GMRYFLW1 ;HIRMFO/YH-INTRAVENOUS INFUSION FLOW SHEET CONT. ;8/9/96
;;4.0;Intake/Output;;Apr 25, 1997
REPORT I "Pp"[GMREDB D HEADER1^GMRYFLW2 G:GMROUT Q1 I '$D(^TMP($J)) W !!,"NO DATA FOR THIS REPORT",!!!!!!!! G Q2
I "SsWw"[GMREDB D HEADER1^GMRYFLW2 I '$D(^TMP($J)) W !!,?5,"NO DATA FOR THIS REPORT",!!!!!!!! G Q2
S GST="",GDATA(1)=GLINE I $D(^TMP($J,"GMRY")) S (GSTM,GSDAY)=0,GSITE="" F S GSITE=$O(^TMP($J,"GMRY",GSITE)) Q:GSITE=""!GMROUT S GDTIME=0 F S GDTIME=$O(^TMP($J,"GMRY",GSITE,GDTIME)) Q:GDTIME'>0!GMROUT D LINE Q:GMROUT
I 'GMROUT,$D(^TMP($J,"GMR")) D
.S GNOIV=1,GIN=0 F S GIN=$O(^TMP($J,"GMR",GIN)) Q:GIN'>0 D NXT
W:'GMROUT GDATA(1),!
Q I 'GMROUT&(IOSL'<($Y+$S($E(IOST)="P":6,1:11))) F X=1:1 W GLINE,! Q:IOSL<($Y+$S($E(IOST)="P":6,1:11))
Q2 I 'GMROUT D FOOTER^GMRYFLW2 I $E(IOST)="C" W "Press return to continue or ^ to quit " S X="" R X:DTIME S:'$T!(X["^") GMROUT=1
Q1 K ^TMP($J),GPORT,GHOLD,GREASON,GSCOND,GNOIV Q
LINE ;
S GIN=0 F S GIN=$O(^TMP($J,"GMRY",GSITE,GDTIME,GIN)) Q:GIN'>0!GMROUT D IVLINE:GIN<999,WRT^GMRYFLW2:GIN=999 Q:GMROUT
Q
IVLINE ;
S (GDATA(2),GDATA)=^TMP($J,"GMRY",GSITE,GDTIME,GIN) S GTOTAL=+$P(GDATA,"^",5),GDATE=$P(GDTIME,"."),(GHOLD,GTIME)=GDTIME,GDC=$S($P(GDATA,"^",9)'="":$P(GDATA,"^",9,11),1:"") D I Q:GMROUT D LINE2^GMRYFLW2 Q:GMROUT
G:$P(GDATA,"^",4)="L" NXT
I $D(^GMR(126,DFN,"IV",GIN,"IN",0)) D GMRUT^GMRYFLW2
I $D(^GMR(126,DFN,"IV",GIN,"TITR",0)) D GMRTITR^GMRYFLW2
I '$D(^TMP($J,"GMR",GIN)) Q
NXT S (GIN(2),GDT)=0 F S GDT=$O(^TMP($J,"GMR",GIN,GDT)) Q:GDT'>0!GMROUT S GDA=0 F S GDA=$O(^TMP($J,"GMR",GIN,GDT,GDA)) Q:GDA'>0!GMROUT D IN:GDA<998,IC:GDA=999,TR:GDA=998
K ^TMP($J,"GMR",GIN) W GLINE,! Q
I ;IV RECORD
S GSOL=$P(GDATA,"^",3),GPORT=$P(GDATA,"^",13),GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",7))
D WRTDT^GMRYFLW2 S GDATA(1)=$E(GDATA(1),1,15)_$E($P(GSOL,";")_GBLNK,1,20)_$E(GDATA(1),36,132)
S GDATA(1)=$E(GDATA(1),1,36)_$S($P(GDATA,"^",12)'="":$E($P(GDATA,"^",12)_" ",1,4),1:" ")_$E(GDATA(1),41,132)
I $P(GDATA,"^",4)="L" D FLUSH^GMRYFLW2 Q
S GDATA(1)=$E(GDATA(1),1,41)_$E($P(GDATA,"^",5)_" ",1,4)_$E(GDATA(1),46,132),GDATA(1)=$E(GDATA(1),1,46)_"0 |"_$E($P(GDATA,"^",2)_GBLNK,1,16)_"|"
S GCATH=$E($P(GDATA,"^",6)_GBLNK,1,16) S GDATA(1)=GDATA(1)_GCATH_$E(GLINE,86,132)
I '$D(^TMP($J,"GMRY",GSITE,GDTIME,999))&('$D(^TMP($J,"GMR",GIN,GDTIME,999))) D WRTLINE^GMRYFLW2 Q
I $D(^TMP($J,"GMRY",GSITE,GDTIME,999)) S GDATA=^(999) D TUBE Q:GMROUT K ^TMP($J,"GMRY",GSITE,GDTIME,999) Q
I $D(^TMP($J,"GMR",GIN,GDTIME,999)) S GDATA=^(999) D TUBE Q:GMROUT K ^TMP($J,"GMR",GIN,GDTIME,999) S GDATA=GDATA(2) Q
Q
IC ;SITECARE
S GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT
S GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",5)) S GNURSE=$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20)),GDATA(1)=$E(GDATA(1),1,15)_GNURSE_$E(GDATA(1),36,132)
D TUBE
Q
TUBE S GDATA(1)=$E(GDATA(1),1,86)_$S($P(GDATA,"^",3)["Y":"yes ",1:"no ")_"|"_$S($P(GDATA,"^",4)["Y":"yes ",1:"no ")_$E(GLINE,96,132)
S GSCOND=$P($G(GDATA),"^",2),GLEN=$L(GSCOND,",")
S GDATA(1)=$E(GDATA(1),1,116)_$S(GLEN>0:$E($P(GSCOND,",")_GBLNK,1,13),1:"NO REDNESS/PA")
I $D(GNOIV) D
.S GSITE=$P($G(^GMR(126,DFN,"IV",GIN,0)),"^",2),GPORT=$G(^GMR(126,DFN,"IV",GIN,3))
.S GDATA(1)=$E(GDATA(1),1,52)_$E(GSITE_GBLNK,1,16)_"|"_$E(GPORT_GBLNK,1,15)_$E(GDATA(1),85,132)
.Q
D WRTLINE^GMRYFLW2
I $G(GLEN)>1 D F G=2:1:GLEN S GDATA(1)=$E(GLINE,1,116)_$E($P(GSCOND,",",G)_GBLNK,2,13) D WRTLINE^GMRYFLW2
Q
TR ;INFUSION RATE
S GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",3)),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT
S GDATA(1)=$E(GDATA(1),1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_"|"_$E($S(+$P(GDATA,"^",2)>0:$P(GDATA,"^",2)_" ",1:"* "),1,4)_$E(GLINE,41,132)
D WRTLINE^GMRYFLW2 Q
IN ;
S GIN(2)=GIN(2)+1,GDATA=^TMP($J,"GMR",GIN,GDT,GDA),GDATE=$P(GDT,"."),GTIME=GDT D WRTDT^GMRYFLW2 Q:GMROUT
S GNURSE=$$CGIVER^GMRYFLW2($P(GDATA,"^",4)) S GDATA(1)=$E(GDATA(1),1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_$E(GDATA(1),36,132)
S GABSORB=$S($P(GDATA,"^",2)["*":"*",1:GTOTAL-$P(GDATA,"^",2)),GDATA(1)=$E(GDATA(1),1,41)_$E($P(GDATA,"^",2)_GBLNK,1,4)_"|"_$E(GABSORB_GBLNK,1,5)_$E(GDATA(1),52,132)
S GREASON="",GREASON(1)=0
I GIN(1)=GIN(2)&(GDC'="") D K ^TMP($J,"GMRY",GSITE,+$P(GDC,"^"),999)
.S GREASON=$P($G(GDC),"^",3) I GREASON'="" K ^UTILITY($J,"W") S X=GREASON,DIWF="",DIWL=0,DIWR=13 D ^DIWP S GREASON(1)=+$G(^UTILITY($J,"W",0))
.S GDATA(1)=$E(GDATA(1),1,96)_"yes |"_$E($G(^UTILITY($J,"W",0,1,0))_GBLNK,1,13)_$E(GDATA(1),116,132)
.I $D(^TMP($J,"GMRY",GSITE,+$P(GDC,"^"),999)) S GDATA=^(999) D DC^GMRYFLW2
D WRTLINE^GMRYFLW2
S GLEN(1)=$L($G(GSCOND),","),GLEN=$S(GREASON(1)>GLEN(1)!(GREASON(1)=GLEN(1)):GREASON(1),GLEN(1)>GREASON(1):GLEN(1),1:0)
I GLEN>1 D SCOND^GMRYFLW2
Q
GMRYFLW1 ;HIRMFO/YH-INTRAVENOUS INFUSION FLOW SHEET CONT. ;8/9/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
REPORT IF "Pp"[GMREDB
DO HEADER1^GMRYFLW2
IF GMROUT
GOTO Q1
IF '$DATA(^TMP($JOB))
WRITE !!,"NO DATA FOR THIS REPORT",!!!!!!!!
GOTO Q2
+1 IF "SsWw"[GMREDB
DO HEADER1^GMRYFLW2
IF '$DATA(^TMP($JOB))
WRITE !!,?5,"NO DATA FOR THIS REPORT",!!!!!!!!
GOTO Q2
+2 SET GST=""
SET GDATA(1)=GLINE
IF $DATA(^TMP($JOB,"GMRY"))
SET (GSTM,GSDAY)=0
SET GSITE=""
FOR
SET GSITE=$ORDER(^TMP($JOB,"GMRY",GSITE))
IF GSITE=""!GMROUT
QUIT
SET GDTIME=0
FOR
SET GDTIME=$ORDER(^TMP($JOB,"GMRY",GSITE,GDTIME))
IF GDTIME'>0!GMROUT
QUIT
DO LINE
IF GMROUT
QUIT
+3 IF 'GMROUT
IF $DATA(^TMP($JOB,"GMR"))
Begin DoDot:1
+4 SET GNOIV=1
SET GIN=0
FOR
SET GIN=$ORDER(^TMP($JOB,"GMR",GIN))
IF GIN'>0
QUIT
DO NXT
End DoDot:1
+5 IF 'GMROUT
WRITE GDATA(1),!
Q IF 'GMROUT&(IOSL'<($Y+$SELECT($EXTRACT(IOST)="P":6,1:11)))
FOR X=1:1
WRITE GLINE,!
IF IOSL<($Y+$SELECT($EXTRACT(IOST)="P"
QUIT
Q2 IF 'GMROUT
DO FOOTER^GMRYFLW2
IF $EXTRACT(IOST)="C"
WRITE "Press return to continue or ^ to quit "
SET X=""
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
Q1 KILL ^TMP($JOB),GPORT,GHOLD,GREASON,GSCOND,GNOIV
QUIT
LINE ;
+1 SET GIN=0
FOR
SET GIN=$ORDER(^TMP($JOB,"GMRY",GSITE,GDTIME,GIN))
IF GIN'>0!GMROUT
QUIT
IF GIN<999
DO IVLINE
IF GIN=999
DO WRT^GMRYFLW2
IF GMROUT
QUIT
+2 QUIT
IVLINE ;
+1 SET (GDATA(2),GDATA)=^TMP($JOB,"GMRY",GSITE,GDTIME,GIN)
SET GTOTAL=+$PIECE(GDATA,"^",5)
SET GDATE=$PIECE(GDTIME,".")
SET (GHOLD,GTIME)=GDTIME
SET GDC=$SELECT($PIECE(GDATA,"^",9)'="":$PIECE(GDATA,"^",9,11),1:"")
DO I
IF GMROUT
QUIT
DO LINE2^GMRYFLW2
IF GMROUT
QUIT
+2 IF $PIECE(GDATA,"^",4)="L"
GOTO NXT
+3 IF $DATA(^GMR(126,DFN,"IV",GIN,"IN",0))
DO GMRUT^GMRYFLW2
+4 IF $DATA(^GMR(126,DFN,"IV",GIN,"TITR",0))
DO GMRTITR^GMRYFLW2
+5 IF '$DATA(^TMP($JOB,"GMR",GIN))
QUIT
NXT SET (GIN(2),GDT)=0
FOR
SET GDT=$ORDER(^TMP($JOB,"GMR",GIN,GDT))
IF GDT'>0!GMROUT
QUIT
SET GDA=0
FOR
SET GDA=$ORDER(^TMP($JOB,"GMR",GIN,GDT,GDA))
IF GDA'>0!GMROUT
QUIT
IF GDA<998
DO IN
IF GDA=999
DO IC
IF GDA=998
DO TR
+1 KILL ^TMP($JOB,"GMR",GIN)
WRITE GLINE,!
QUIT
I ;IV RECORD
+1 SET GSOL=$PIECE(GDATA,"^",3)
SET GPORT=$PIECE(GDATA,"^",13)
SET GNURSE=$$CGIVER^GMRYFLW2($PIECE(GDATA,"^",7))
+2 DO WRTDT^GMRYFLW2
SET GDATA(1)=$EXTRACT(GDATA(1),1,15)_$EXTRACT($PIECE(GSOL,";")_GBLNK,1,20)_$EXTRACT(GDATA(1),36,132)
+3 SET GDATA(1)=$EXTRACT(GDATA(1),1,36)_$SELECT($PIECE(GDATA,"^",12)'="":$EXTRACT($PIECE(GDATA,"^",12)_" ",1,4),1:" ")_$EXTRACT(GDATA(1),41,132)
+4 IF $PIECE(GDATA,"^",4)="L"
DO FLUSH^GMRYFLW2
QUIT
+5 SET GDATA(1)=$EXTRACT(GDATA(1),1,41)_$EXTRACT($PIECE(GDATA,"^",5)_" ",1,4)_$EXTRACT(GDATA(1),46,132)
SET GDATA(1)=$EXTRACT(GDATA(1),1,46)_"0 |"_$EXTRACT($PIECE(GDATA,"^",2)_GBLNK,1,16)_"|"
+6 SET GCATH=$EXTRACT($PIECE(GDATA,"^",6)_GBLNK,1,16)
SET GDATA(1)=GDATA(1)_GCATH_$EXTRACT(GLINE,86,132)
+7 IF '$DATA(^TMP($JOB,"GMRY",GSITE,GDTIME,999))&('$DATA(^TMP($JOB,"GMR",GIN,GDTIME,999)))
DO WRTLINE^GMRYFLW2
QUIT
+8 IF $DATA(^TMP($JOB,"GMRY",GSITE,GDTIME,999))
SET GDATA=^(999)
DO TUBE
IF GMROUT
QUIT
KILL ^TMP($JOB,"GMRY",GSITE,GDTIME,999)
QUIT
+9 IF $DATA(^TMP($JOB,"GMR",GIN,GDTIME,999))
SET GDATA=^(999)
DO TUBE
IF GMROUT
QUIT
KILL ^TMP($JOB,"GMR",GIN,GDTIME,999)
SET GDATA=GDATA(2)
QUIT
+10 QUIT
IC ;SITECARE
+1 SET GDATA=^TMP($JOB,"GMR",GIN,GDT,GDA)
SET GDATE=$PIECE(GDT,".")
SET GTIME=GDT
DO WRTDT^GMRYFLW2
IF GMROUT
QUIT
+2 SET GNURSE=$$CGIVER^GMRYFLW2($PIECE(GDATA,"^",5))
SET GNURSE=$SELECT(GNURSE'="":$EXTRACT("("_GNURSE_")"_GBLNK,1,20),1:$EXTRACT(GBLNK,1,20))
SET GDATA(1)=$EXTRACT(GDATA(1),1,15)_GNURSE_$EXTRACT(GDATA(1),36,132)
+3 DO TUBE
+4 QUIT
TUBE SET GDATA(1)=$EXTRACT(GDATA(1),1,86)_$SELECT($PIECE(GDATA,"^",3)["Y":"yes ",1:"no ")_"|"_$SELECT($PIECE(GDATA,"^",4)["Y":"yes ",1:"no ")_$EXTRACT(GLINE,96,132)
+1 SET GSCOND=$PIECE($GET(GDATA),"^",2)
SET GLEN=$LENGTH(GSCOND,",")
+2 SET GDATA(1)=$EXTRACT(GDATA(1),1,116)_$SELECT(GLEN>0:$EXTRACT($PIECE(GSCOND,",")_GBLNK,1,13),1:"NO REDNESS/PA")
+3 IF $DATA(GNOIV)
Begin DoDot:1
+4 SET GSITE=$PIECE($GET(^GMR(126,DFN,"IV",GIN,0)),"^",2)
SET GPORT=$GET(^GMR(126,DFN,"IV",GIN,3))
+5 SET GDATA(1)=$EXTRACT(GDATA(1),1,52)_$EXTRACT(GSITE_GBLNK,1,16)_"|"_$EXTRACT(GPORT_GBLNK,1,15)_$EXTRACT(GDATA(1),85,132)
+6 QUIT
End DoDot:1
+7 DO WRTLINE^GMRYFLW2
+8 IF $GET(GLEN)>1
Begin DoDot:1
End DoDot:1
FOR G=2:1:GLEN
SET GDATA(1)=$EXTRACT(GLINE,1,116)_$EXTRACT($PIECE(GSCOND,",",G)_GBLNK,2,13)
DO WRTLINE^GMRYFLW2
+9 QUIT
TR ;INFUSION RATE
+1 SET GDATA=^TMP($JOB,"GMR",GIN,GDT,GDA)
SET GNURSE=$$CGIVER^GMRYFLW2($PIECE(GDATA,"^",3))
SET GDATE=$PIECE(GDT,".")
SET GTIME=GDT
DO WRTDT^GMRYFLW2
IF GMROUT
QUIT
+2 SET GDATA(1)=$EXTRACT(GDATA(1),1,15)_$SELECT(GNURSE'="":$EXTRACT("("_GNURSE_")"_GBLNK,1,20),1:$EXTRACT(GBLNK,1,20))_"|"_$EXTRACT($SELECT(+$PIECE(GDATA,"^",2)>0:$PIECE(GDATA,"^",2)_" ",1:"* "),1,4)_$EXTRACT(GLINE,41,132)
+3 DO WRTLINE^GMRYFLW2
QUIT
IN ;
+1 SET GIN(2)=GIN(2)+1
SET GDATA=^TMP($JOB,"GMR",GIN,GDT,GDA)
SET GDATE=$PIECE(GDT,".")
SET GTIME=GDT
DO WRTDT^GMRYFLW2
IF GMROUT
QUIT
+2 SET GNURSE=$$CGIVER^GMRYFLW2($PIECE(GDATA,"^",4))
SET GDATA(1)=$EXTRACT(GDATA(1),1,15)_$SELECT(GNURSE'="":$EXTRACT("("_GNURSE_")"_GBLNK,1,20),1:$EXTRACT(GBLNK,1,20))_$EXTRACT(GDATA(1),36,132)
+3 SET GABSORB=$SELECT($PIECE(GDATA,"^",2)["*":"*",1:GTOTAL-$PIECE(GDATA,"^",2))
SET GDATA(1)=$EXTRACT(GDATA(1),1,41)_$EXTRACT($PIECE(GDATA,"^",2)_GBLNK,1,4)_"|"_$EXTRACT(GABSORB_GBLNK,1,5)_$EXTRACT(GDATA(1),52,132)
+4 SET GREASON=""
SET GREASON(1)=0
+5 IF GIN(1)=GIN(2)&(GDC'="")
Begin DoDot:1
+6 SET GREASON=$PIECE($GET(GDC),"^",3)
IF GREASON'=""
KILL ^UTILITY($JOB,"W")
SET X=GREASON
SET DIWF=""
SET DIWL=0
SET DIWR=13
DO ^DIWP
SET GREASON(1)=+$GET(^UTILITY($JOB,"W",0))
+7 SET GDATA(1)=$EXTRACT(GDATA(1),1,96)_"yes |"_$EXTRACT($GET(^UTILITY($JOB,"W",0,1,0))_GBLNK,1,13)_$EXTRACT(GDATA(1),116,132)
+8 IF $DATA(^TMP($JOB,"GMRY",GSITE,+$PIECE(GDC,"^"),999))
SET GDATA=^(999)
DO DC^GMRYFLW2
End DoDot:1
KILL ^TMP($JOB,"GMRY",GSITE,+$PIECE(GDC,"^"),999)
+9 DO WRTLINE^GMRYFLW2
+10 SET GLEN(1)=$LENGTH($GET(GSCOND),",")
SET GLEN=$SELECT(GREASON(1)>GLEN(1)!(GREASON(1)=GLEN(1)):GREASON(1),GLEN(1)>GREASON(1):GLEN(1),1:0)
+11 IF GLEN>1
DO SCOND^GMRYFLW2
+12 QUIT