GMRYFLW2 ;HIRMFO/YH-IV FLOW SHEET UTILITY ;8/9/96
;;4.0;Intake/Output;;Apr 25, 1997
W !,GMRNAM W:SSN'="" ?17,SSN W:GMRBTH'="" ?32,GMRBTH W:GMRAGE'="" ?42,"(",GMRAGE," YRS)" W:GMRSEX'="" ?53,GMRSEX W ?93,"MEDICAL RECORD"
W !,"UNIT: " W:GMRWARD(1)'="" ?7,GMRWARD(1) W ?33,"RM/BED: " W:GMRBED'="" ?41,GMRBED W ?91,"FLOW SHEET-VERTICAL",!
D INP^VADPT S GMRVHLOC=$P($G(^DIC(42,+$G(VAIN(4)),44)),"^")
W "DIVISION: "_$S(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:""),?93,"IV FLOW SHEET",!
Q
BLANK F X=1:1 W ! Q:IOSL<($Y+$S($E(IOST)="P":4,1:5))
Q
D:GQT FOOTER^GMRYFLW2
I GQT,'GQ,$E(IOST)="C" W "Press return to continue or ^ to quit " R X:DTIME I '$T!(X["^") S GMROUT=1 Q
W:'($E(IOST)'="C"&'GPC) @IOF
S GQT=1,GPC=GPC+1 W !,?122,"Page: "_GPC,!,?36,"RATE AMT. AMT.",?86,"TUBE",?91,"DRSG",!
W "DATE |TIME |SOLUTIONS/BLOOD",?35,"|ML'S|LEFT|ABSRB|SITE",?68,"|CATHETER",?85,"|CHNG|CHNG|D/C'D|REASON D/C |SITE CONDITION",!,GDASH,!
Q
WRTDT ;
I GSDAY'=GDATE!(GST'=GSITE) S GDATA(1)=$E(GDATE,4,5)_"/"_$E(GDATE,6,7)_"/"_$E(GDATE,2,3)_"|"_$E($P(GTIME,".",2)_"0000",1,2)_":"_$E($P(GTIME,".",2)_"0000",3,4)_$E(GDATA(1),15,132) Q
S GDATA(1)=" |"_$S(GHOLD'=$G(GDT):$E($P(GTIME,".",2)_"0000",1,2)_":"_$E($P(GTIME,".",2)_"0000",3,4),1:" ")_$E(GDATA(1),15,132) Q
Q
LINE2 ;PRINT 2ND LINE FOR IV
I $L(GSOL,";")>1 N X D Q
.F X=2:1:$L(GSOL,";") Q:$P(GSOL,";",X)=""!GMROUT S GDATA(1)=$E(GLINE,1,15)_$E($P(GSOL,";",X)_GBLNK,1,20)_$E(GLINE,36,69)_$S(X=2:$E(GPORT_GBLNK,1,15),1:$E(GBLNK,1,15))_$E(GLINE,85,132) D WRTLINE
.Q:GMROUT S GDATA(1)=$E(GLINE,1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_$E(GLINE,36,132) D WRTLINE
.Q
S GDATA(1)=$E(GLINE,1,15)_$S(GNURSE'="":$E("("_GNURSE_")"_GBLNK,1,20),1:$E(GBLNK,1,20))_$E(GLINE,36,69)_$S(GPORT="":$E(GBLNK,1,15),1:$E(GPORT_GBLNK,1,15))_$E(GLINE,85,132) D WRTLINE
Q
FLUSH ;
S GDATA(1)=$E(GDATA(1),1,46)_$E(GBLNK,1,5)_"|"_$E($P(GDATA,"^",2)_GBLNK,1,16)_"|"_$E($P(GDATA,"^",6)_GBLNK,1,16)_$E(GLINE,86,102)_$E($S($P(GDATA,"^",11)'["INFUSED":$P(GDATA,"^",11),1:"")_GBLNK,1,13)_$E(GLINE,116,132)
D WRTLINE
Q
GMRUT S GIN(1)=0
S GDT=0 F S GDT=$O(^GMR(126,DFN,"IV",GIN,"IN","B",GDT)) Q:GDT'>0 S GDA=0 F S GDA=$O(^GMR(126,DFN,"IV",GIN,"IN","B",GDT,GDA)) Q:GDA'>0 S ^TMP($J,"GMR",GIN,GDT,1)=^GMR(126,DFN,"IV",GIN,"IN",GDA,0),GIN(1)=GIN(1)+1
Q
GMRTITR S GDT=0 F S GDT=$O(^GMR(126,DFN,"IV",GIN,"TITR","B",GDT)) Q:GDT'>0 S GDA=0 F S GDA=$O(^GMR(126,DFN,"IV",GIN,"TITR","B",GDT,GDA)) Q:GDA'>0 S ^TMP($J,"GMR",GIN,GDT,998)=^GMR(126,DFN,"IV",GIN,"TITR",GDA,0)
Q
WRTLINE I GST'=GSITE&(GST'="") D:($Y+$S($E(IOST)="P":6,1:11))>IOSL HEADER1^GMRYFLW2 Q:GMROUT
D:($Y+$S($E(IOST)="P":6,1:11))>IOSL HEADER1^GMRYFLW2 Q:GMROUT W GDATA(1),! S GDATA(1)=GLINE,GSDAY=GDATE,GSTM=GTIME,GST=GSITE
Q
WRT S GDATA=^TMP($J,"GMRY",GSITE,GDTIME,999),GDATE=$P(GDTIME,"."),GTIME=GDTIME S:'$D(GHOLD) GHOLD=GTIME S:'$D(GDT) GDT=0 D WRTDT^GMRYFLW2
S:GST'=GSITE GDATA(1)=$E(GDATA(1),1,52)_$E(GSITE_GBLNK,1,16)_$E(GDATA(1),69,132) 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(GDATA(1),96,132)
S GDATA(1)=$E(GDATA(1),1,96)_$S($P(GDATA,"^",6)["Y":"yes |site d/c'd ",1:" | ")_$E(GDATA(1),116,132) S:$P(GDATA,"^",2)'="" GDATA(1)=$E(GDATA(1),1,116)_$E($P(GDATA,"^",2),1,13)
D WRTLINE Q
CGIVER(GDFN) ;CARE GIVER
N X S X=$$GET1^DIQ(200,GDFN_",","NAME")
I X'="" S X=$P(X,",")_","_$E($P(X,",",2)) S:$L(X)>18 X=$E(X,1,18)
Q X
SCOND ;
F G=2:1:GLEN Q:GMROUT D
.S GDATA(1)=$E(GLINE,1,102)_$E($G(^UTILITY($J,"W",0,G,0))_GBLNK,1,13)_"|"_$E($P($G(GSCOND),",",G)_GBLNK,2,16)
.D WRTLINE^GMRYFLW2
K G,GSCOND,GLEN,GREASON,^UTILITY($J,"W") Q
DC ;
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(GDATA(1),96,132)
S GSCOND=$P($G(GDATA),"^",2)
S GDATA(1)=$E(GDATA(1),1,116)_$S(GSCOND="":"NO REDNESS/PA",1:$E($P(GSCOND,",")_GBLNK,1,13))
Q
GMRYFLW2 ;HIRMFO/YH-IV FLOW SHEET UTILITY ;8/9/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
+1 WRITE !,GMRNAM
IF SSN'=""
WRITE ?17,SSN
IF GMRBTH'=""
WRITE ?32,GMRBTH
IF GMRAGE'=""
WRITE ?42,"(",GMRAGE," YRS)"
IF GMRSEX'=""
WRITE ?53,GMRSEX
WRITE ?93,"MEDICAL RECORD"
+2 WRITE !,"UNIT: "
IF GMRWARD(1)'=""
WRITE ?7,GMRWARD(1)
WRITE ?33,"RM/BED: "
IF GMRBED'=""
WRITE ?41,GMRBED
WRITE ?91,"FLOW SHEET-VERTICAL",!
+3 DO INP^VADPT
SET GMRVHLOC=$PIECE($GET(^DIC(42,+$GET(VAIN(4)),44)),"^")
+4 WRITE "DIVISION: "_$SELECT(GMRVHLOC>0:$$GET1^DIQ(4,+$$GET1^DIQ(44,+GMRVHLOC,3,"I"),.01,"I"),1:""),?93,"IV FLOW SHEET",!
+5 QUIT
BLANK FOR X=1:1
WRITE !
IF IOSL<($Y+$SELECT($EXTRACT(IOST)="P"
QUIT
+1 QUIT
+1 IF GQT
DO FOOTER^GMRYFLW2
+2 IF GQT
IF 'GQ
IF $EXTRACT(IOST)="C"
WRITE "Press return to continue or ^ to quit "
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
QUIT
+3 IF '($EXTRACT(IOST)'="C"&'GPC)
WRITE @IOF
+4 SET GQT=1
SET GPC=GPC+1
WRITE !,?122,"Page: "_GPC,!,?36,"RATE AMT. AMT.",?86,"TUBE",?91,"DRSG",!
+5 WRITE "DATE |TIME |SOLUTIONS/BLOOD",?35,"|ML'S|LEFT|ABSRB|SITE",?68,"|CATHETER",?85,"|CHNG|CHNG|D/C'D|REASON D/C |SITE CONDITION",!,GDASH,!
+6 QUIT
WRTDT ;
+1 IF GSDAY'=GDATE!(GST'=GSITE)
SET GDATA(1)=$EXTRACT(GDATE,4,5)_"/"_$EXTRACT(GDATE,6,7)_"/"_$EXTRACT(GDATE,2,3)_"|"_$EXTRACT($PIECE(GTIME,".",2)_"0000",1,2)_":"_$EXTRACT($PIECE(GTIME,".",2)_"0000",3,4)_$EXTRACT(GDATA(1),15,132)
QUIT
+2 SET GDATA(1)=" |"_$SELECT(GHOLD'=$GET(GDT):$EXTRACT($PIECE(GTIME,".",2)_"0000",1,2)_":"_$EXTRACT($PIECE(GTIME,".",2)_"0000",3,4),1:" ")_$EXTRACT(GDATA(1),15,132)
QUIT
+3 QUIT
LINE2 ;PRINT 2ND LINE FOR IV
+1 IF $LENGTH(GSOL,";")>1
NEW X
Begin DoDot:1
+2 FOR X=2:1:$LENGTH(GSOL,";")
IF $PIECE(GSOL,";",X)=""!GMROUT
QUIT
SET GDATA(1)=$EXTRACT(GLINE,1,15)_$EXTRACT($PIECE(GSOL,";",X)_GBLNK,1,20)_$EXTRACT(GLINE,36,69)_$SELECT(X=2:$EXTRACT(GPORT_GBLNK,1,15),1:$EXTRACT(GBLNK,1,15))_$EXTRACT(GLINE,85,132)
DO WRTLINE
+3 IF GMROUT
QUIT
SET GDATA(1)=$EXTRACT(GLINE,1,15)_$SELECT(GNURSE'="":$EXTRACT("("_GNURSE_")"_GBLNK,1,20),1:$EXTRACT(GBLNK,1,20))_$EXTRACT(GLINE,36,132)
DO WRTLINE
+4 QUIT
End DoDot:1
QUIT
+5 SET GDATA(1)=$EXTRACT(GLINE,1,15)_$SELECT(GNURSE'="":$EXTRACT("("_GNURSE_")"_GBLNK,1,20),1:$EXTRACT(GBLNK,1,20))_$EXTRACT(GLINE,36,69)_$SELECT(GPORT="":$EXTRACT(GBLNK,1,15),1:$EXTRACT(GPORT_GBLNK,1,15))_$EXTRACT(GLINE,85,132)
DO WRTLINE
+6 QUIT
FLUSH ;
+1 SET GDATA(1)=$EXTRACT(GDATA(1),1,46)_$EXTRACT(GBLNK,1,5)_"|"_$EXTRACT($PIECE(GDATA,"^",2)_GBLNK,1,16)_"|"_$EXTRACT($PIECE(GDATA,"^",6)_GBLNK,1,16)_...
... $EXTRACT(GLINE,86,102)_$EXTRACT($SELECT($PIECE(GDATA,"^",11)'["INFUSED":$PIECE(GDATA,"^",11),1:"")_GBLNK,1,13)_$EXTRACT(GLINE,116,132)
+2 DO WRTLINE
+3 QUIT
GMRUT SET GIN(1)=0
+1 SET GDT=0
FOR
SET GDT=$ORDER(^GMR(126,DFN,"IV",GIN,"IN","B",GDT))
IF GDT'>0
QUIT
SET GDA=0
FOR
SET GDA=$ORDER(^GMR(126,DFN,"IV",GIN,"IN","B",GDT,GDA))
IF GDA'>0
QUIT
SET ^TMP($JOB,"GMR",GIN,GDT,1)=^GMR(126,DFN,"IV",GIN,"IN",GDA,0)
SET GIN(1)=GIN(1)+1
+2 QUIT
GMRTITR SET GDT=0
FOR
SET GDT=$ORDER(^GMR(126,DFN,"IV",GIN,"TITR","B",GDT))
IF GDT'>0
QUIT
SET GDA=0
FOR
SET GDA=$ORDER(^GMR(126,DFN,"IV",GIN,"TITR","B",GDT,GDA))
IF GDA'>0
QUIT
SET ^TMP($JOB,"GMR",GIN,GDT,998)=^GMR(126,DFN,"IV",GIN,"TITR",GDA,0)
+1 QUIT
WRTLINE IF GST'=GSITE&(GST'="")
IF ($Y+$SELECT($EXTRACT(IOST)="P"
DO HEADER1^GMRYFLW2
IF GMROUT
QUIT
+1 IF ($Y+$SELECT($EXTRACT(IOST)="P"
DO HEADER1^GMRYFLW2
IF GMROUT
QUIT
WRITE GDATA(1),!
SET GDATA(1)=GLINE
SET GSDAY=GDATE
SET GSTM=GTIME
SET GST=GSITE
+2 QUIT
WRT SET GDATA=^TMP($JOB,"GMRY",GSITE,GDTIME,999)
SET GDATE=$PIECE(GDTIME,".")
SET GTIME=GDTIME
IF '$DATA(GHOLD)
SET GHOLD=GTIME
IF '$DATA(GDT)
SET GDT=0
DO WRTDT^GMRYFLW2
+1 IF GST'=GSITE
SET GDATA(1)=$EXTRACT(GDATA(1),1,52)_$EXTRACT(GSITE_GBLNK,1,16)_$EXTRACT(GDATA(1),69,132)
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(GDATA(1),96,132)
+2 SET GDATA(1)=$EXTRACT(GDATA(1),1,96)_$SELECT($PIECE(GDATA,"^",6)["Y":"yes |site d/c'd ",1:" | ")_$EXTRACT(GDATA(1),116,132)
IF $PIECE(GDATA,"^",2)'=""
SET GDATA(1)=$EXTRACT(GDATA(1),1,116)_$EXTRACT($PIECE(GDATA,"^",2),1,13)
+3 DO WRTLINE
QUIT
CGIVER(GDFN) ;CARE GIVER
+1 NEW X
SET X=$$GET1^DIQ(200,GDFN_",","NAME")
+2 IF X'=""
SET X=$PIECE(X,",")_","_$EXTRACT($PIECE(X,",",2))
IF $LENGTH(X)>18
SET X=$EXTRACT(X,1,18)
+3 QUIT X
SCOND ;
+1 FOR G=2:1:GLEN
IF GMROUT
QUIT
Begin DoDot:1
+2 SET GDATA(1)=$EXTRACT(GLINE,1,102)_$EXTRACT($GET(^UTILITY($JOB,"W",0,G,0))_GBLNK,1,13)_"|"_$EXTRACT($PIECE($GET(GSCOND),",",G)_GBLNK,2,16)
+3 DO WRTLINE^GMRYFLW2
End DoDot:1
+4 KILL G,GSCOND,GLEN,GREASON,^UTILITY($JOB,"W")
QUIT
DC ;
+1 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(GDATA(1),96,132)
+2 SET GSCOND=$PIECE($GET(GDATA),"^",2)
+3 SET GDATA(1)=$EXTRACT(GDATA(1),1,116)_$SELECT(GSCOND="":"NO REDNESS/PA",1:$EXTRACT($PIECE(GSCOND,",")_GBLNK,1,13))
+4 QUIT