GMRYED1 ;HIRMFO/YH-ENTER/EDIT PATIENT INTAKE/OUTPUT ;1/17/97
;;4.0;Intake/Output;;Apr 25, 1997
EN1 ;ENTER/EDIT OUTPUT
OUTPUT ;
LIST S GNN=0 F GNI=0:0 S GNI=$O(^GMRD(126.58,"C",GNI)) Q:GNI'>0 S GNI(1)=$O(^GMRD(126.58,"C",GNI,0)) Q:GNI(1)'>0 S GNN=GNN+1,GNN(GNN)=$P(^GMRD(126.58,GNI(1),0),"^")_"^"_GNI(1) W !,?3,GNN,?10,$P(GNN(GNN),"^")
I GNN'>0 W !,"NO OUTPUT FILE!!!",! G Q1
K GTYP S GNI=0 W !,"Select from 1 to ",GNN," (enter 1,3-5 etc.) or ""^"" to quit: URINE// " R GNI:DTIME S:'$T!(GNI["^") GMROUT=1 G:GMROUT Q1 S:GNI="" GNI=1 I GNI["?" W !!,"Select the number(s) you want to enter/edit data",! G LIST
D VALIDAT G:'$D(GTYP)!(GMROUT(1)) LIST
S GP=0,GNANS="OUT" D NOW^%DTC S X1=%,X2=-2 D C^%DTC S GMREND=9999999-X
F S GP=$O(GTYP(GP)) Q:GP'>0 Q:'$D(GNN(GP)) S GTYP=$P(GNN(GP),"^",2),GLABEL=$P(GNN(GP),"^") W !,"Enter output: ",GLABEL,! S GTP=GTYP D LIST^GMRYUT3 D KILLV^GMRYUT0 K GN,GNUR Q:GMROUT
Q1 K DD,DR,DIE,DD,DLAYGO,DIC,GP,GMRDEL,GMREND,GMRDC,GLABEL,GTYPE,GTP,GNN,GNI,GTYP,GNANS,GN,GNUR,X,Y,GMRVOL,GNEW,%
YN1 I 'GMROUT W !,"Do you want to enter another output" S %=1 D YN^DICN G:%=0 YN1 I %=1 G LIST
Q:$D(GOPT) Q:$D(GNUROP) D Q^GMRYED2,KILLV^GMRYUT0 Q
;
EN2 ;ENTER/EDIT INTAKE
INPUT S GNN=0,GSITE="" F GNI="PO","IV ACCESS" D SETARY
F GNI=0:0 S GNI=$O(^GMRD(126.56,"C",GNI)) Q:GNI'>0 S GNI(1)=$O(^GMRD(126.56,"C",GNI,0)) Q:GNI(1)'>0 I $P(^GMRD(126.56,GNI(1),0),"^")'["PO" S GNN=GNN+1,GNN(GNN)=$P(^(0),"^")_"^"_GNI(1)
S GMRYITM=GNN,GNI=0 F S GNI=$O(^GMRD(126.56,"C",GNI)) Q:GNI'>0 S GNI(1)=$O(^GMRD(126.56,"C",GNI,0)) Q:GNI(1)'>0 S GNN=GNN+1,GNN(GNN)=$P(^GMRD(126.56,GNI(1),0),"^")_"^"_GNI(1)
LIST2 W !,?43,"Detailed input from "_(GMRYITM+1)_" to "_GNN F GNI=1:1:GMRYITM W !,?3,GNI,?10,$P(GNN(GNI),"^") W:$D(GNN(GMRYITM+GNI)) ?43,(GMRYITM+GNI),?50,$P(GNN(GMRYITM+GNI),"^")
QUES2 S GNI=0 W !,"Select from 1 to ",GNN," (enter 1,3-5 etc.) or ""^"" to quit: " R GNI:DTIME S:'$T!(GNI["^") GMROUT=1 G:GMROUT Q2 I GNI=""!(GNI["?") W !!,"Select the number(s) you want to enter/edit data",! G LIST2
D VALIDAT G:'$D(GTYP)!(GMROUT(1)) LIST2
D NOW^%DTC S X1=%,X2=-2 D C^%DTC S GMREND=9999999-X S GNI=0 F S GNI=$O(GTYP(GNI)) Q:GNI'>0 Q:'$D(GNN(GNI)) S GLABEL=$P(GNN(GNI),"^") W !,"Enter intake: ",GLABEL,! D INTAKE,KILLV^GMRYUT0 K GN,GNUR Q:GMROUT
Q2 K DIE,DLAYGO,DD,DR,DIC,%,GRATE,GVOL,GTXT,GSOL,GMRST,GCATH,GMRYITM,GDCIV,GMRZ,GX,GDR,GOPT,GMRDEL,GDATA,GDCDT,GGDA,GLEFT,GIN,GMRDA,GTOTAL,GHLOC,GMRVDT,GMREND,GMRDC,GLABEL,GTYPE,GTP,GNN,GNI,GTYP,GNANS,GN,GNUR,X,Y,GSITE
K GREC,GSTAR,GLEFT,GMRVOL,GTUBE,GDRESS,GSDC,GSITE
YN I DFN>0&'GMROUT W !,"Do you want to enter OUTPUT" S %=1 D YN^DICN W:%=0 !!,"Do you want to go on to enter/edit output for this patient?",!! G:%=0 YN I %=1 S GMROUT=0,GOPT="IN" W ! D LIST K GOPT
D Q^GMRYED2,KILLV^GMRYUT0 Q ;Q:$D(GNUROP) G:'GMROUT EN2 K POP Q
;
INTAKE I '($P(GNN(GNI),"^")["IV ACCESS") G NOGNIV
IV S GSOL="",DA=DFN D IVACCSS^GMRYED5 Q:GMROUT!(GN'>0)!(GSOL="")
S Y=$P(GMRDATA(+X),"^") X ^DD("DD") W !!,"Enter IV INTAKE for ",GSOL_" "_GMRVTYP_" ",GSITE_" "_GVOL_" mls "_GRATE,!,?10,GTXT_" @"_$P(Y,":",1,2)
S GNANS="IV",GTP=GMRVTYP D SELIV^GMRYUT0 I GN>1 W !!,"Enter INTAKE for another IV" S %=2 D YN^DICN G:%=1 IV Q
Q
NOGNIV ;ENTER/EDIT NON-IV INTAKE
S GTYP=$P(GNN(GNI),"^"),GNANS="IN",GTP=$P(GNN(GNI),"^",2) D LIST^GMRYUT3 Q
;
SETARY S GNN=GNN+1,GNN(GNN)=GNI_"^"_$S(GNI["PO":$O(^GMRD(126.56,"B",GNI,0)),1:"")
Q
VALIDAT ;
S GMROUT(1)=0 F GNUR(1)=1:1 S GNUR(2)=$P(GNI,",",GNUR(1)) Q:GNUR(2)="" D VAL1
Q
VAL1 ;
I GNUR(2)["-" D VAL2 Q
S:'$D(GNN(+GNUR(2))) GMROUT(1)=1 Q:GMROUT(1) S GTYP(GNUR(2))="" Q
VAL2 ;
S GNUR(3)=$P(GNUR(2),"-") I GNUR(3)<1!(GNUR(3)>GNN)!'$D(GNN(+GNUR(3))) S GMROUT(1)=1 Q
S GNUR(4)=$P(GNUR(2),"-",2) S:'$D(GNN(+GNUR(4))) GMROUT(1)=1 Q:GMROUT(1) F GNUR(5)=GNUR(3):1:GNUR(4) S:'$D(GNN(GNUR(5))) GMROUT(1)=1 Q:GMROUT(1) S GTYP(GNUR(5))=""
Q
EN3 ;START NEW IV
D STARTIV^GMRYED2
Q3 D KILLV^GMRYUT0 K GDCIV,GN,GDR,GCATH,GHLOC,POP,X,Y,GMRDEL,GDC,GMRQUAL,GX,GLABEL,GMRZ,GSDC,GTUBE,GSITE,GDRESS,GTXT,GMRDC Q
;
STARTIV ;START IV IF NO IV RUNGNING
S GX="",GMRVDT=0,GMRDEL="" W !,?5,"Do you want to start a(n) "_GLABEL S %=2 D YN^DICN S:%<0 GMROUT=1 Q:GMROUT
I %=1 D NEWIV^GMRYED2 S DA=DFN,GMRVTYP=$P(GNN(GNI),"^",2) D IVTYP^GMRYUT1 Q
I %=0 W !,?5,"You have to start a line of "_GLABEL_" before you record intake.",! G STARTIV
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRYED1 4375 printed Nov 22, 2024@17:05:25 Page 2
GMRYED1 ;HIRMFO/YH-ENTER/EDIT PATIENT INTAKE/OUTPUT ;1/17/97
+1 ;;4.0;Intake/Output;;Apr 25, 1997
EN1 ;ENTER/EDIT OUTPUT
OUTPUT ;
LIST SET GNN=0
FOR GNI=0:0
SET GNI=$ORDER(^GMRD(126.58,"C",GNI))
if GNI'>0
QUIT
SET GNI(1)=$ORDER(^GMRD(126.58,"C",GNI,0))
if GNI(1)'>0
QUIT
SET GNN=GNN+1
SET GNN(GNN)=$PIECE(^GMRD(126.58,GNI(1),0),"^")_"^"_GNI(1)
WRITE !,?3,GNN,?10,$PIECE(GNN(GNN),"^")
+1 IF GNN'>0
WRITE !,"NO OUTPUT FILE!!!",!
GOTO Q1
+2 KILL GTYP
SET GNI=0
WRITE !,"Select from 1 to ",GNN," (enter 1,3-5 etc.) or ""^"" to quit: URINE// "
READ GNI:DTIME
if '$TEST!(GNI["^")
SET GMROUT=1
if GMROUT
GOTO Q1
if GNI=""
SET GNI=1
IF GNI["?"
WRITE !!,"Select the number(s) you want to enter/edit data",!
GOTO LIST
+3 DO VALIDAT
if '$DATA(GTYP)!(GMROUT(1))
GOTO LIST
+4 SET GP=0
SET GNANS="OUT"
DO NOW^%DTC
SET X1=%
SET X2=-2
DO C^%DTC
SET GMREND=9999999-X
+5 FOR
SET GP=$ORDER(GTYP(GP))
if GP'>0
QUIT
if '$DATA(GNN(GP))
QUIT
SET GTYP=$PIECE(GNN(GP),"^",2)
SET GLABEL=$PIECE(GNN(GP),"^")
WRITE !,"Enter output: ",GLABEL,!
SET GTP=GTYP
DO LIST^GMRYUT3
DO KILLV^GMRYUT0
KILL GN,GNUR
if GMROUT
QUIT
Q1 KILL DD,DR,DIE,DD,DLAYGO,DIC,GP,GMRDEL,GMREND,GMRDC,GLABEL,GTYPE,GTP,GNN,GNI,GTYP,GNANS,GN,GNUR,X,Y,GMRVOL,GNEW,%
YN1 IF 'GMROUT
WRITE !,"Do you want to enter another output"
SET %=1
DO YN^DICN
if %=0
GOTO YN1
IF %=1
GOTO LIST
+1 if $DATA(GOPT)
QUIT
if $DATA(GNUROP)
QUIT
DO Q^GMRYED2
DO KILLV^GMRYUT0
QUIT
+2 ;
EN2 ;ENTER/EDIT INTAKE
INPUT SET GNN=0
SET GSITE=""
FOR GNI="PO","IV ACCESS"
DO SETARY
+1 FOR GNI=0:0
SET GNI=$ORDER(^GMRD(126.56,"C",GNI))
if GNI'>0
QUIT
SET GNI(1)=$ORDER(^GMRD(126.56,"C",GNI,0))
if GNI(1)'>0
QUIT
IF $PIECE(^GMRD(126.56,GNI(1),0),"^")'["PO"
SET GNN=GNN+1
SET GNN(GNN)=$PIECE(^(0),"^")_"^"_GNI(1)
+2 SET GMRYITM=GNN
SET GNI=0
FOR
SET GNI=$ORDER(^GMRD(126.56,"C",GNI))
if GNI'>0
QUIT
SET GNI(1)=$ORDER(^GMRD(126.56,"C",GNI,0))
if GNI(1)'>0
QUIT
SET GNN=GNN+1
SET GNN(GNN)=$PIECE(^GMRD(126.56,GNI(1),0),"^")_"^"_GNI(1)
LIST2 WRITE !,?43,"Detailed input from "_(GMRYITM+1)_" to "_GNN
FOR GNI=1:1:GMRYITM
WRITE !,?3,GNI,?10,$PIECE(GNN(GNI),"^")
if $DATA(GNN(GMRYITM+GNI))
WRITE ?43,(GMRYITM+GNI),?50,$PIECE(GNN(GMRYITM+GNI),"^")
QUES2 SET GNI=0
WRITE !,"Select from 1 to ",GNN," (enter 1,3-5 etc.) or ""^"" to quit: "
READ GNI:DTIME
if '$TEST!(GNI["^")
SET GMROUT=1
if GMROUT
GOTO Q2
IF GNI=""!(GNI["?")
WRITE !!,"Select the number(s) you want to enter/edit data",!
GOTO LIST2
+1 DO VALIDAT
if '$DATA(GTYP)!(GMROUT(1))
GOTO LIST2
+2 DO NOW^%DTC
SET X1=%
SET X2=-2
DO C^%DTC
SET GMREND=9999999-X
SET GNI=0
FOR
SET GNI=$ORDER(GTYP(GNI))
if GNI'>0
QUIT
if '$DATA(GNN(GNI))
QUIT
SET GLABEL=$PIECE(GNN(GNI),"^")
WRITE !,"Enter intake: ",GLABEL,!
DO INTAKE
DO KILLV^GMRYUT0
KILL GN,GNUR
if GMROUT
QUIT
Q2 KILL DIE,DLAYGO,DD,DR,DIC,%,GRATE,GVOL,GTXT,GSOL,GMRST,GCATH,GMRYITM,GDCIV,GMRZ,GX,GDR,GOPT,GMRDEL,GDATA,GDCDT,GGDA,GLEFT,GIN,GMRDA,GTOTAL,GHLOC,GMRVDT,GMREND,GMRDC,GLABEL,GTYPE,GTP,GNN,GNI,GTYP,GNANS,GN,GNUR,X,Y,GSITE
+1 KILL GREC,GSTAR,GLEFT,GMRVOL,GTUBE,GDRESS,GSDC,GSITE
YN IF DFN>0&'GMROUT
WRITE !,"Do you want to enter OUTPUT"
SET %=1
DO YN^DICN
if %=0
WRITE !!,"Do you want to go on to enter/edit output for this patient?",!!
if %=0
GOTO YN
IF %=1
SET GMROUT=0
SET GOPT="IN"
WRITE !
DO LIST
KILL GOPT
+1 ;Q:$D(GNUROP) G:'GMROUT EN2 K POP Q
DO Q^GMRYED2
DO KILLV^GMRYUT0
QUIT
+2 ;
INTAKE IF '($PIECE(GNN(GNI),"^")["IV ACCESS")
GOTO NOGNIV
IV SET GSOL=""
SET DA=DFN
DO IVACCSS^GMRYED5
if GMROUT!(GN'>0)!(GSOL="")
QUIT
+1 SET Y=$PIECE(GMRDATA(+X),"^")
XECUTE ^DD("DD")
WRITE !!,"Enter IV INTAKE for ",GSOL_" "_GMRVTYP_" ",GSITE_" "_GVOL_" mls "_GRATE,!,?10,GTXT_" @"_$PIECE(Y,":",1,2)
+2 SET GNANS="IV"
SET GTP=GMRVTYP
DO SELIV^GMRYUT0
IF GN>1
WRITE !!,"Enter INTAKE for another IV"
SET %=2
DO YN^DICN
if %=1
GOTO IV
QUIT
+3 QUIT
NOGNIV ;ENTER/EDIT NON-IV INTAKE
+1 SET GTYP=$PIECE(GNN(GNI),"^")
SET GNANS="IN"
SET GTP=$PIECE(GNN(GNI),"^",2)
DO LIST^GMRYUT3
QUIT
+2 ;
SETARY SET GNN=GNN+1
SET GNN(GNN)=GNI_"^"_$SELECT(GNI["PO":$ORDER(^GMRD(126.56,"B",GNI,0)),1:"")
+1 QUIT
VALIDAT ;
+1 SET GMROUT(1)=0
FOR GNUR(1)=1:1
SET GNUR(2)=$PIECE(GNI,",",GNUR(1))
if GNUR(2)=""
QUIT
DO VAL1
+2 QUIT
VAL1 ;
+1 IF GNUR(2)["-"
DO VAL2
QUIT
+2 if '$DATA(GNN(+GNUR(2)))
SET GMROUT(1)=1
if GMROUT(1)
QUIT
SET GTYP(GNUR(2))=""
QUIT
VAL2 ;
+1 SET GNUR(3)=$PIECE(GNUR(2),"-")
IF GNUR(3)<1!(GNUR(3)>GNN)!'$DATA(GNN(+GNUR(3)))
SET GMROUT(1)=1
QUIT
+2 SET GNUR(4)=$PIECE(GNUR(2),"-",2)
if '$DATA(GNN(+GNUR(4)))
SET GMROUT(1)=1
if GMROUT(1)
QUIT
FOR GNUR(5)=GNUR(3):1:GNUR(4)
if '$DATA(GNN(GNUR(5)))
SET GMROUT(1)=1
if GMROUT(1)
QUIT
SET GTYP(GNUR(5))=""
+3 QUIT
EN3 ;START NEW IV
+1 DO STARTIV^GMRYED2
Q3 DO KILLV^GMRYUT0
KILL GDCIV,GN,GDR,GCATH,GHLOC,POP,X,Y,GMRDEL,GDC,GMRQUAL,GX,GLABEL,GMRZ,GSDC,GTUBE,GSITE,GDRESS,GTXT,GMRDC
QUIT
+1 ;
STARTIV ;START IV IF NO IV RUNGNING
+1 SET GX=""
SET GMRVDT=0
SET GMRDEL=""
WRITE !,?5,"Do you want to start a(n) "_GLABEL
SET %=2
DO YN^DICN
if %<0
SET GMROUT=1
if GMROUT
QUIT
+2 IF %=1
DO NEWIV^GMRYED2
SET DA=DFN
SET GMRVTYP=$PIECE(GNN(GNI),"^",2)
DO IVTYP^GMRYUT1
QUIT
+3 IF %=0
WRITE !,?5,"You have to start a line of "_GLABEL_" before you record intake.",!
GOTO STARTIV
+4 QUIT