GMRYPSIV ;HIRMFO/YH-DISPLAY ACTIVE PATIENT IV ORDER ;5/22/96
;;4.0;Intake/Output;;Apr 25, 1997
GETIV(GDFN,GTYP,GY) ;
;INPUT VARIABLES:
;GDFN - DFN. POINTER TO THE PATIENT FILE (#2).
;GTYP -TYPE OF IV - 'A' FOR ADMIXTURE
; 'B' FOR BLOOD/BLOOD PRODUCT
; 'H' FOR HYPERAL
; 'P' FOR PIGGYBACK
;OUTPUT ARRAY
;GY - CONTAINS ACTIVE IV ORDER INFORMATION
N I,J,GSOL,GRATE,GVOL,GADDI S GY=0
;GET IV Sub-File (#55.01) ORDER NUMBER AND STATUS LISTING FOR A SELECTED
;PATIENT.
D LIST^DIC(55.01,","_GDFN_",",".01;100;","","","","","","","") I '$D(^TMP("DILIST",$J)) Q
;GET ORDER NUMBER, START DATE/TIME, TYPE, INFUSION RATE, SOLUTION AND
;ADDITIVES FOR EACH ACTIVE IV ORDER
S I=0 F S I=$O(^TMP("DILIST",$J,"ID",I)) Q:I'>0 D
.I +$G(^TMP("DILIST",$J,"ID",I,.01))>0,$G(^TMP("DILIST",$J,"ID",I,100))["ACTIVE" D
..S I(1)=+^TMP("DILIST",$J,"ID",I,.01),I(2)=I(1)_","_GDFN_","
..K GARY D GETS^DIQ(55.01,I(2),".01;.02;.04;.08;1*;3*;","E","GARY")
..I $E($G(GARY(55.01,I(2),.04,"E")))=GTYP D ;TYPE OF SOLUTION
...S GRATE=$G(GARY(55.01,I(2),.08,"E")) ;INFUSION RATE
...S GVOL=0,(GSOL,J)="" F S J=$O(GARY(55.11,J)) Q:J="" S GSOL=GSOL_$S(GSOL'="":";",1:"")_$G(GARY(55.11,J,.01,"E")),GVOL=GVOL+$G(GARY(55.11,J,1,"E"))
...S (GADDI,J)="" F S J=$O(GARY(55.02,J)) Q:J="" D
....S GADDI=GADDI_$S(GADDI'="":";",1:"")_$G(GARY(55.02,J,.01,"E"))_$S($G(GARY(55.02,J,.02,"E"))'="":" "_$G(GARY(55.02,J,.02,"E")),1:"")
...S GSOL=GSOL_$S(GADDI'="":";"_GADDI,1:"")
...S GY=GY+1,GY(GY)=$S($L(GSOL)>60:$E(GSOL,1,60)_"...",1:GSOL)_"^"_GVOL_"^"_GTYP_"^"_GRATE
K GARY,^TMP("DILIST",$J) Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRYPSIV 1655 printed Dec 13, 2024@01:55:30 Page 2
GMRYPSIV ;HIRMFO/YH-DISPLAY ACTIVE PATIENT IV ORDER ;5/22/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
GETIV(GDFN,GTYP,GY) ;
+1 ;INPUT VARIABLES:
+2 ;GDFN - DFN. POINTER TO THE PATIENT FILE (#2).
+3 ;GTYP -TYPE OF IV - 'A' FOR ADMIXTURE
+4 ; 'B' FOR BLOOD/BLOOD PRODUCT
+5 ; 'H' FOR HYPERAL
+6 ; 'P' FOR PIGGYBACK
+7 ;OUTPUT ARRAY
+8 ;GY - CONTAINS ACTIVE IV ORDER INFORMATION
+9 NEW I,J,GSOL,GRATE,GVOL,GADDI
SET GY=0
+10 ;GET IV Sub-File (#55.01) ORDER NUMBER AND STATUS LISTING FOR A SELECTED
+11 ;PATIENT.
+12 DO LIST^DIC(55.01,","_GDFN_",",".01;100;","","","","","","","")
IF '$DATA(^TMP("DILIST",$JOB))
QUIT
+13 ;GET ORDER NUMBER, START DATE/TIME, TYPE, INFUSION RATE, SOLUTION AND
+14 ;ADDITIVES FOR EACH ACTIVE IV ORDER
+15 SET I=0
FOR
SET I=$ORDER(^TMP("DILIST",$JOB,"ID",I))
if I'>0
QUIT
Begin DoDot:1
+16 IF +$GET(^TMP("DILIST",$JOB,"ID",I,.01))>0
IF $GET(^TMP("DILIST",$JOB,"ID",I,100))["ACTIVE"
Begin DoDot:2
+17 SET I(1)=+^TMP("DILIST",$JOB,"ID",I,.01)
SET I(2)=I(1)_","_GDFN_","
+18 KILL GARY
DO GETS^DIQ(55.01,I(2),".01;.02;.04;.08;1*;3*;","E","GARY")
+19 ;TYPE OF SOLUTION
IF $EXTRACT($GET(GARY(55.01,I(2),.04,"E")))=GTYP
Begin DoDot:3
+20 ;INFUSION RATE
SET GRATE=$GET(GARY(55.01,I(2),.08,"E"))
+21 SET GVOL=0
SET (GSOL,J)=""
FOR
SET J=$ORDER(GARY(55.11,J))
if J=""
QUIT
SET GSOL=GSOL_$SELECT(GSOL'="":";",1:"")_$GET(GARY(55.11,J,.01,"E"))
SET GVOL=GVOL+$GET(GARY(55.11,J,1,"E"))
+22 SET (GADDI,J)=""
FOR
SET J=$ORDER(GARY(55.02,J))
if J=""
QUIT
Begin DoDot:4
+23 SET GADDI=GADDI_$SELECT(GADDI'="":";",1:"")_$GET(GARY(55.02,J,.01,"E"))_$SELECT($GET(GARY(55.02,J,.02,"E"))'="":" "_$GET(GARY(55.02,J,.02,"E")),1:"")
End DoDot:4
+24 SET GSOL=GSOL_$SELECT(GADDI'="":";"_GADDI,1:"")
+25 SET GY=GY+1
SET GY(GY)=$SELECT($LENGTH(GSOL)>60:$EXTRACT(GSOL,1,60)_"...",1:GSOL)_"^"_GVOL_"^"_GTYP_"^"_GRATE
End DoDot:3
End DoDot:2
End DoDot:1
+26 KILL GARY,^TMP("DILIST",$JOB)
QUIT