GMRYSE3 ;HIRMFO/YH-ITEMIZED PATIENT I/O REPORT BY SHIFT PART 4 ;5/13/96
;;4.0;Intake/Output;;Apr 25, 1997
WIVINF ;
S GDA=0 F S GDA=$O(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP,GSUB,GDA)) Q:GDA'>0!GMROUT S GDATA=$G(^TMP($J,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP,GSUB,GDA)),GAMT=+$P(GDATA,"^") D
.I GIVTYP="Z" D WCARE Q
.I GAMT>3000 D START Q
.I GDA=2 S (GTYP,GIN)=$P(GDATA,"^",2),GIN=$S(GIN="B":2,GIN="A"!(GIN="P")!(GIN="L"):1,GIN="H"!(GIN="I"):3,1:0) Q:GIN=0 D ADD^GMRYSE2,WIV Q
.I GDA=3 D
..S GPORT=$G(^GMR(126,DFN,"IV",GSUB,3))
..D:($Y+10)>IOSL HEADER2^GMRYSE1 Q:GMROUT D WHR Q:GMROUT W ?14
..S GTXT(1)=$P(GDATA,"^",5)_" "_$P(GDATA,"^",4)_$S(GPORT'="":" ("_GPORT_")",1:"")_" infusion rate adjusted: "_$S(+$P(GDATA,"^")>0:$P(GDATA,"^"),1:"UNKNOWN")_" mls/hr"_$S($P(GDATA,"^",6)'="":" - "_$P(GDATA,"^",6),1:"")
..I $L(GTXT(1))>0 D WLINE
..S GNURSE=+$P(GDATA,"^",2) D WNURS
Q
START ;
D:($Y+10)>IOSL HEADER2^GMRYSE1 Q:GMROUT S GCATH=$P(GDATA,"^",6),GTYP=$P(GDATA,"^",4),GSITE=$P(GDATA,"^",2),GSOL=$P(GDATA,"^",3),GVOL=$P(GDATA,"^",5),GNURSE=+$P(GDATA,"^",7) W " " D WHR
S GPORT=$P($G(^GMR(126,DFN,"IV",GSUB,3)),"^") D WTYPE
S GTXT(1)=GTXT(1)_$S(GTYP'="L":" "_GVOL_" mls ",1:"")_$S($P(GDATA,"^",11)["FLUSH":"flushed",GCATH'="":"started",1:"added")_" Site: "_GSITE S:GCATH'="" GTXT(1)=GTXT(1)_" IV cath: "_GCATH
S GTXT(1)=GTXT(1)_$S(GPORT'="":" ("_GPORT_")",1:"")_$S(+$P(GDATA,"^",12)>0:" Rate: "_+$P(GDATA,"^",12)_" ml/hr",1:"")
I $L(GTXT(1))>0 D WLINE
D WNURS Q:$P(GDATA,"^",9)="" S GSAVE=GHR,GHR=$P(GDATA,"^",9),GNURSE=+$P(GDATA,"^",10),GREASON=$S($P(GDATA,"^",11)'="":$P(GDATA,"^",11),1:"")
I GTYP="L" S GREASON=$S($P(GDATA,"^",11)="INFUSED"!($P(GDATA,"^",11)="FLUSHED"):"",1:GREASON)
I GSOL'="*" D
. D:($Y+10)>IOSL HEADER2^GMRYSE1 W ?20,"Discontinued on "_$E(GHR,4,5)_"/"_$E(GHR,6,7)_"/"_$E(GHR,2,3)_" @ " D WDC W:GREASON'=""&(IOM'>80) !,?20,"Reason: "_GREASON W:GREASON'=""&(IOM>80) " Reason: "_GREASON D WNURS S GHR=GSAVE K GSAVE
Q
WIV ;PRINT IV INTAKE
S GNURSE=+$P(GDATA,"^",4),GSITE=$P(GDATA,"^",3),GSOL=$P(GDATA,"^",5)
I GTYP'="L" D
.D:($Y+10)>IOSL HEADER2^GMRYSE1 Q:GMROUT D WHR Q:GMROUT D WTYPE S GTXT(1)=GTXT(1)_" Intake Vol: "_$S($P(GDATA,"^",6)["*":"unknown",1:GAMT_" mls")_" Remaining amount: "_$P(GDATA,"^",6)_" mls "
.I $L(GTXT(1))>0 D WLINE
.D WNURS
Q
WTYPE ;PRINT IV TYPE
S GTXT(1)=GSOL_" "_$S(GTYP="A":"admix",GTYP="B":"blood",GTYP="P":"piggy",GTYP="H":"hyper",GTYP="I":"intra",1:"")
Q
WHR ;
I GHOLD=$E(GHR,1,12) Q
S GHR(1)=$E($P(GHR,".",2),1,4),GLEN=$L(GHR(1)),GTIME=$S(GLEN=1:GHR(1)_"000",GLEN=2:GHR(1)_"00",GLEN=3:GHR(1)_"0",1:GHR(1))
W ?4,$E(GTIME,1,2),":",$E(GTIME,3,4)_" "
S GHOLD=$E(GHR,1,12) Q
WNURS G:$S(GNURSE=0:1,'$D(^VA(200,GNURSE,0)):1,$P(^VA(200,GNURSE,0),"^")="":1,1:0) Q S GCOL=$S(IOM>80:120,1:70) W ?GCOL,$E($P($P(^VA(200,GNURSE,0),"^"),",",2)),$E($P(^(0),"^"))
S GPOS="" I GNURSE>0,$D(^NURSF(211.8,"C",GNURSE)) S GLOC=$O(^NURSF(211.8,"C",GNURSE,0)) S:$D(^NURSF(211.8,GLOC,0)) GPOS=$P(^(0),"^",2)
W "/"_$S(GPOS="R":"RN",GPOS="L":"LPN",GPOS="N":"NA",GPOS="C":"CL",1:"OTH")
Q W ! Q
WCARE ;
Q:$P(GDATA,"^",2)=""&($P(GDATA,"^",3)="")&($P(GDATA,"^",4)="") D WHR S GTXT(1)=$P(GDATA,"^",8)_": " S GSAVE=$L(GTXT(1)),GMRY=$P(GDATA,"^",2),GTXT(1)=GTXT(1)_$S(GMRY'="":GMRY,1:"")
S GMRY=$S($P(GDATA,"^",4)="Y":$P(GDATA,"^",4),1:""),GTXT(1)=GTXT(1)_$S(GMRY'=""&($L(GTXT(1))>GSAVE):", ",1:"")_$S(GMRY="Y":"dressing changed",1:"")
S GMRY=$P(GDATA,"^",6),GTXT(1)=GTXT(1)_$S($L(GTXT(1))>GSAVE&(GMRY'=""):", ",1:"")_$S(GMRY="Y":"site discontinued",1:"")
I $L(GTXT(1))>0 D WLINE
I $P(GDATA,"^",3)["Y" D
. S GSITE=$P(GDATA,"^",8),GIEN=+$P(GDATA,"^",7),GPORT=$S($D(^GMR(126,DFN,"IV",GIEN,3)):^(3),1:""),GSITE(GSITE)="" D FINDCA^GMRYCATH(.GSITE)
. S GTXT(1)=" "_GSITE(GSITE)_$S(GPORT'="":" - "_GPORT,1:"")_" tubing changed" D WLINE
Q2 K GMR100,GMR101,GMR102,GTXT,GMRLEN
S GNURSE=+$P(GDATA,"^",5) D WNURS
Q
WDC ;
S GHR(1)=$E($P(GHR,".",2),1,4),GLEN=$L(GHR(1)),GTIME=$S(GLEN=1:GHR(1)_"000",GLEN=2:GHR(1)_"00",GLEN=3:GHR(1)_"0",1:GHR(1)) W $E(GTIME,1,2)_":"_$E(GTIME,3,4) Q
WLINE ;PRINT DESCRIPTION
N X S DIWR=$S(IOM>80:100,1:50),DIWF="",DIWL=0,X=GTXT(1) K ^UTILITY($J) D ^DIWP
S GMRI=0 F S GMRI=$O(^UTILITY($J,"W",0,GMRI)) Q:GMRI'>0 D:($Y+10)>IOSL HEADER2^GMRYSE1 Q:GMROUT W !,?14,^UTILITY($J,"W",0,GMRI,0)
K ^UTILITY($J),GMRI Q
GMRYSE3 ;HIRMFO/YH-ITEMIZED PATIENT I/O REPORT BY SHIFT PART 4 ;5/13/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
WIVINF ;
+1 SET GDA=0
FOR
SET GDA=$ORDER(^TMP($JOB,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP,GSUB,GDA))
IF GDA'>0!GMROUT
QUIT
SET GDATA=$GET(^TMP($JOB,"GMRY",GDATE,GSFT,GIO,GHR,GIVDT,GIVTYP,GSUB,GDA))
SET GAMT=+$PIECE(GDATA,"^")
Begin DoDot:1
+2 IF GIVTYP="Z"
DO WCARE
QUIT
+3 IF GAMT>3000
DO START
QUIT
+4 IF GDA=2
SET (GTYP,GIN)=$PIECE(GDATA,"^",2)
SET GIN=$SELECT(GIN="B":2,GIN="A"!(GIN="P")!(GIN="L"):1,GIN="H"!(GIN="I"):3,1:0)
IF GIN=0
QUIT
DO ADD^GMRYSE2
DO WIV
QUIT
+5 IF GDA=3
Begin DoDot:2
+6 SET GPORT=$GET(^GMR(126,DFN,"IV",GSUB,3))
+7 IF ($Y+10)>IOSL
DO HEADER2^GMRYSE1
IF GMROUT
QUIT
DO WHR
IF GMROUT
QUIT
WRITE ?14
+8 SET GTXT(1)=$PIECE(GDATA,"^",5)_" "_$PIECE(GDATA,"^",4)_$SELECT(GPORT'="":" ("_GPORT_")",1:"")_" infusion rate adjusted: "_$SELECT(+$PIECE(GDATA,"^")>0:$PIECE(GDATA,"^"),1:"UNKNOWN")_" mls/hr"_$SELECT($PIECE(GDATA,"^",6)'="":" -
"_...
... $PIECE(GDATA,"^",6),1:"")
+9 IF $LENGTH(GTXT(1))>0
DO WLINE
+10 SET GNURSE=+$PIECE(GDATA,"^",2)
DO WNURS
End DoDot:2
End DoDot:1
+11 QUIT
START ;
+1 IF ($Y+10)>IOSL
DO HEADER2^GMRYSE1
IF GMROUT
QUIT
SET GCATH=$PIECE(GDATA,"^",6)
SET GTYP=$PIECE(GDATA,"^",4)
SET GSITE=$PIECE(GDATA,"^",2)
SET GSOL=$PIECE(GDATA,"^",3)
SET GVOL=$PIECE(GDATA,"^",5)
SET GNURSE=+$PIECE(GDATA,"^",7)
WRITE " "
DO WHR
+2 SET GPORT=$PIECE($GET(^GMR(126,DFN,"IV",GSUB,3)),"^")
DO WTYPE
+3 SET GTXT(1)=GTXT(1)_$SELECT(GTYP'="L":" "_GVOL_" mls ",1:"")_$SELECT($PIECE(GDATA,"^",11)["FLUSH":"flushed",GCATH'="":"started",1:"added")_" Site: "_GSITE
IF GCATH'=""
SET GTXT(1)=GTXT(1)_" IV cath: "_GCATH
+4 SET GTXT(1)=GTXT(1)_$SELECT(GPORT'="":" ("_GPORT_")",1:"")_$SELECT(+$PIECE(GDATA,"^",12)>0:" Rate: "_+$PIECE(GDATA,"^",12)_" ml/hr",1:"")
+5 IF $LENGTH(GTXT(1))>0
DO WLINE
+6 DO WNURS
IF $PIECE(GDATA,"^",9)=""
QUIT
SET GSAVE=GHR
SET GHR=$PIECE(GDATA,"^",9)
SET GNURSE=+$PIECE(GDATA,"^",10)
SET GREASON=$SELECT($PIECE(GDATA,"^",11)'="":$PIECE(GDATA,"^",11),1:"")
+7 IF GTYP="L"
SET GREASON=$SELECT($PIECE(GDATA,"^",11)="INFUSED"!($PIECE(GDATA,"^",11)="FLUSHED"):"",1:GREASON)
+8 IF GSOL'="*"
Begin DoDot:1
+9 IF ($Y+10)>IOSL
DO HEADER2^GMRYSE1
WRITE ?20,"Discontinued on "_$EXTRACT(GHR,4,5)_"/"_$EXTRACT(GHR,6,7)_"/"_$EXTRACT(GHR,2,3)_" @ "
DO WDC
IF GREASON'=""&(IOM'>80)
WRITE !,?20,"Reason: "_GREASON
IF GREASON'=""&(IOM>80)
WRITE " Reason: "_GREASON
DO WNURS
SET GHR=GSAVE
KILL GSAVE
End DoDot:1
+10 QUIT
WIV ;PRINT IV INTAKE
+1 SET GNURSE=+$PIECE(GDATA,"^",4)
SET GSITE=$PIECE(GDATA,"^",3)
SET GSOL=$PIECE(GDATA,"^",5)
+2 IF GTYP'="L"
Begin DoDot:1
+3 IF ($Y+10)>IOSL
DO HEADER2^GMRYSE1
IF GMROUT
QUIT
DO WHR
IF GMROUT
QUIT
DO WTYPE
SET GTXT(1)=GTXT(1)_" Intake Vol: "_$SELECT($PIECE(GDATA,"^",6)["*":"unknown",1:GAMT_" mls")_" Remaining amount: "_$PIECE(GDATA,"^",6)_" mls "
+4 IF $LENGTH(GTXT(1))>0
DO WLINE
+5 DO WNURS
End DoDot:1
+6 QUIT
WTYPE ;PRINT IV TYPE
+1 SET GTXT(1)=GSOL_" "_$SELECT(GTYP="A":"admix",GTYP="B":"blood",GTYP="P":"piggy",GTYP="H":"hyper",GTYP="I":"intra",1:"")
+2 QUIT
WHR ;
+1 IF GHOLD=$EXTRACT(GHR,1,12)
QUIT
+2 SET GHR(1)=$EXTRACT($PIECE(GHR,".",2),1,4)
SET GLEN=$LENGTH(GHR(1))
SET GTIME=$SELECT(GLEN=1:GHR(1)_"000",GLEN=2:GHR(1)_"00",GLEN=3:GHR(1)_"0",1:GHR(1))
+3 WRITE ?4,$EXTRACT(GTIME,1,2),":",$EXTRACT(GTIME,3,4)_" "
+4 SET GHOLD=$EXTRACT(GHR,1,12)
QUIT
WNURS IF $SELECT(GNURSE=0
GOTO Q
SET GCOL=$SELECT(IOM>80:120,1:70)
WRITE ?GCOL,$EXTRACT($PIECE($PIECE(^VA(200,GNURSE,0),"^"),",",2)),$EXTRACT($PIECE(^(0),"^"))
+1 SET GPOS=""
IF GNURSE>0
IF $DATA(^NURSF(211.8,"C",GNURSE))
SET GLOC=$ORDER(^NURSF(211.8,"C",GNURSE,0))
IF $DATA(^NURSF(211.8,GLOC,0))
SET GPOS=$PIECE(^(0),"^",2)
+2 WRITE "/"_$SELECT(GPOS="R":"RN",GPOS="L":"LPN",GPOS="N":"NA",GPOS="C":"CL",1:"OTH")
Q WRITE !
QUIT
WCARE ;
+1 IF $PIECE(GDATA,"^",2)=""&($PIECE(GDATA,"^",3)="")&($PIECE(GDATA,"^",4)="")
QUIT
DO WHR
SET GTXT(1)=$PIECE(GDATA,"^",8)_": "
SET GSAVE=$LENGTH(GTXT(1))
SET GMRY=$PIECE(GDATA,"^",2)
SET GTXT(1)=GTXT(1)_$SELECT(GMRY'="":GMRY,1:"")
+2 SET GMRY=$SELECT($PIECE(GDATA,"^",4)="Y":$PIECE(GDATA,"^",4),1:"")
SET GTXT(1)=GTXT(1)_$SELECT(GMRY'=""&($LENGTH(GTXT(1))>GSAVE):", ",1:"")_$SELECT(GMRY="Y":"dressing changed",1:"")
+3 SET GMRY=$PIECE(GDATA,"^",6)
SET GTXT(1)=GTXT(1)_$SELECT($LENGTH(GTXT(1))>GSAVE&(GMRY'=""):", ",1:"")_$SELECT(GMRY="Y":"site discontinued",1:"")
+4 IF $LENGTH(GTXT(1))>0
DO WLINE
+5 IF $PIECE(GDATA,"^",3)["Y"
Begin DoDot:1
+6 SET GSITE=$PIECE(GDATA,"^",8)
SET GIEN=+$PIECE(GDATA,"^",7)
SET GPORT=$SELECT($DATA(^GMR(126,DFN,"IV",GIEN,3)):^(3),1:"")
SET GSITE(GSITE)=""
DO FINDCA^GMRYCATH(.GSITE)
+7 SET GTXT(1)=" "_GSITE(GSITE)_$SELECT(GPORT'="":" - "_GPORT,1:"")_" tubing changed"
DO WLINE
End DoDot:1
Q2 KILL GMR100,GMR101,GMR102,GTXT,GMRLEN
+1 SET GNURSE=+$PIECE(GDATA,"^",5)
DO WNURS
+2 QUIT
WDC ;
+1 SET GHR(1)=$EXTRACT($PIECE(GHR,".",2),1,4)
SET GLEN=$LENGTH(GHR(1))
SET GTIME=$SELECT(GLEN=1:GHR(1)_"000",GLEN=2:GHR(1)_"00",GLEN=3:GHR(1)_"0",1:GHR(1))
WRITE $EXTRACT(GTIME,1,2)_":"_$EXTRACT(GTIME,3,4)
QUIT
WLINE ;PRINT DESCRIPTION
+1 NEW X
SET DIWR=$SELECT(IOM>80:100,1:50)
SET DIWF=""
SET DIWL=0
SET X=GTXT(1)
KILL ^UTILITY($JOB)
DO ^DIWP
+2 SET GMRI=0
FOR
SET GMRI=$ORDER(^UTILITY($JOB,"W",0,GMRI))
IF GMRI'>0
QUIT
IF ($Y+10)>IOSL
DO HEADER2^GMRYSE1
IF GMROUT
QUIT
WRITE !,?14,^UTILITY($JOB,"W",0,GMRI,0)
+3 KILL ^UTILITY($JOB),GMRI
QUIT