GMRYUT6 ;HIRMFO/YH-IV SOLUTION SELECT FROM PHARMACY/NURS FILES ;5/13/96
;;4.0;Intake/Output;;Apr 25, 1997
PSSOL ;LIST PATIENT IV SOLUTION FROM PHARMACY ORDER
K GMRY S (GMRZ,GMRZ(1),GMRZ(2),GMRZ(3))="",(GMRX,GMRY)=0 D GETIV^GMRYPSIV(DFN,GMRVTYP,.GMRY) I GMRY'>0 W !,"No pharmacy active IV order for this patient",! G NURSOL
SEL ;Select from the following pharmacy active IV order(s)
W !,"pharmacy active IV order for the patient:",! F GMRX=1:1:GMRY W !,GMRX_"."_$P(GMRY(GMRX),"^")_" "_$P(GMRY(GMRX),"^",2)_" "_$P(GMRY(+GMRX),"^",4),!
W !,"Select a number between 1 and "_GMRY_": " S GMRX=0 R GMRX:DTIME I '$T!(GMRX["^") S GMROUT=1 G Q
G:GMRX="" NURSOL G:GMRX<1!(GMRX>GMRY) SEL
S GMRZ=$P(GMRY(+GMRX),"^"),GMRZ(2)=+$P(GMRY(+GMRX),"^",2),GMRZ(1)=$P(GMRY(+GMRX),"^",3),GMRZ(3)=+$P(GMRY(+GMRX),"^",4) D ASK1 G:GMRX=""!("Yy"[GMRX) Q G SEL
NURSOL ;SELECT FROM NUR SOLUTION FILE
D NURSOL^GMRYUT7 G:GMROUT Q
S GMRZ=$P(Y(0),"^"),GMRZ(1)=$P(Y(0),"^",2),GMRZ(2)=+$P(Y(0),"^",3),GMRZ(3)="" D ASK1 G:GMRX=""!("Yy"[GMRX)!GMROUT Q S (GMRZ,GMRZ(1),GMRZ(2),GMRZ(3))="" G NURSOL
Q K X,Y,GMRX,GMRY,GMRDA,GMRD S:GMRZ=""!(GMRZ(1)="")!(GMRZ(2)="") GMROUT=1 Q
ASK1 S X="" W !,"Amount of solution in mls in the container: "_$S(GMRZ(2)="":"",1:GMRZ(2)_"// ") R X:DTIME S:'$T!(X["^") GMROUT=1 Q:GMROUT
I (X'=""&(X'>0))!(X["?") W !!,"Enter total amount of solution in mls in the container.",! S X="" G ASK1
I '(X?1.4N!(X?1.4N1"."1N))&(X'="") W !,"ERROR ENTRY",! G ASK1
I GOPT'="RESTART"&((X>9999!(X<.1))&(X'="")) W !!,"Amount of solution has to be a number between .1 and 9999.",!! G ASK1
I GOPT="RESTART"&(X>$G(GSAVE)) W !!,"The number must be equal to or less than the remaining amount.",!! G ASK1
I X[".",$L($P(X,".",2))>1 W !!,"Only 1 decimal digit allowed",! G ASK1
S:X>0 GMRZ(2)=+X I GMRZ(2)=0 G ASK1
ASK3 W !,"Enter a number for infusion rate (Example: 125 = 125 ml/hr): "_$S(GMRZ(3)>0:GMRZ(3)_"// ",1:" ") S X="" R X:DTIME S:'$T!(X["^") GMROUT=1 Q:GMROUT
G:X="" ASK4 I X'=""&(X'?1.3N!(X<0)!(X>999)) W !,"Enter a number between 1 and 999 or enter <RET> to bypass this entry",! G ASK3
I X>0 S GMRZ(3)=X G ASK4
I X["?" W !,"Enter the rate at which the infusion is to take place.",!,"For example: a number 125 entered means the infusion rate is 125 mls/hr",! S X="" G ASK3
ASK4 W !,GMRZ_" "_$S(GMRZ(1)="A":"admixture",GMRZ(1)="P":"piggyback",GMRZ(1)="B":"blood/blood product",GMRZ(1)="H":"hyperal",GMRZ(1)="I":"intralipids",1:"")_" "_GMRZ(2)_" mls "_$S(GMRZ(3)'="":GMRZ(3),1:"UNKNOWN")_" ml/hr"
W " Is it correct " S %=1 D YN^DICN S GMRX=$S(%=1:"Y",%=2:"N",1:"") S:%<0 GMROUT=1 Q:GMRX="Y"!(GMRX="N")!GMROUT
W !!,"If data is correct, please enter 'Y', else enter 'N' if incorrect.",! G ASK4
Q
ADDHNG S DR="S:GMRVTYP[""P"" Y=""@1"";1///^S X=GMRZ;@1;2//^S X=""N"";S:GMRVTYP[""P"" Y=""@2"";3//^S X=""N"";@2;4///^S X=""`""_DUZ;I GADD=""Y"" S Y=""@3"";5//^S X=""D"";@3;" Q
SITEDES ;SELECT IV SITE DESCRIPTION, CALLED BY DATA ENTRY ROUTINES
K GMRY,GSEL S GMRZ="",GMRTRNS=2 K GMRX D DISPLAY^GMRYUT5 R GMRX:DTIME I '$T!(GMRX["^") S GMROUT=1,GMRZ="" G QL
I GMRX="" S GMRZ=$P(^GMRD(126.72,1,0),"^") G ASK2
S I=$L(GMRX,",") F X=1:1:I S Y=$P(GMRX,",",X) I ((Y'?.N1"-".N)&(Y'?.N))!((Y["-")&($P(Y,"-",2)<$P(Y,"-",1))!($P(Y,"-",1)=0)!($P(Y,"-",2)=0)) S GMRX="?"
I GMRX["?" W !!,"Select an item or a combination of items such as ",!,"1,3-5 to describe the IV site you observe",! G SITEDES
D VALIDAT^GMRYUT9 G:'$D(GSEL) SITEDES S GMRX=0 F S GMRX=$O(GSEL(GMRX)) Q:GMRX'>0!('$D(GMRY(+GMRX))) S GMRZ=GMRZ_$S($L(GMRZ)>0:", ",1:"")_$P(GMRY(GMRX),"^",2)
I $L(GMRZ)>50 W !,"The string length is longer than 50 characters!" G SITEDES
ASK2 G:$L(GMRZ)'>0 SITEDES S X=""
QL K %,GMRX,GMRY,GMRN,GMRTRNS,GSEL Q
GMRYUT6 ;HIRMFO/YH-IV SOLUTION SELECT FROM PHARMACY/NURS FILES ;5/13/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
PSSOL ;LIST PATIENT IV SOLUTION FROM PHARMACY ORDER
+1 KILL GMRY
SET (GMRZ,GMRZ(1),GMRZ(2),GMRZ(3))=""
SET (GMRX,GMRY)=0
DO GETIV^GMRYPSIV(DFN,GMRVTYP,.GMRY)
IF GMRY'>0
WRITE !,"No pharmacy active IV order for this patient",!
GOTO NURSOL
SEL ;Select from the following pharmacy active IV order(s)
+1 WRITE !,"pharmacy active IV order for the patient:",!
FOR GMRX=1:1:GMRY
WRITE !,GMRX_"."_$PIECE(GMRY(GMRX),"^")_" "_$PIECE(GMRY(GMRX),"^",2)_" "_$PIECE(GMRY(+GMRX),"^",4),!
+2 WRITE !,"Select a number between 1 and "_GMRY_": "
SET GMRX=0
READ GMRX:DTIME
IF '$TEST!(GMRX["^")
SET GMROUT=1
GOTO Q
+3 IF GMRX=""
GOTO NURSOL
IF GMRX<1!(GMRX>GMRY)
GOTO SEL
+4 SET GMRZ=$PIECE(GMRY(+GMRX),"^")
SET GMRZ(2)=+$PIECE(GMRY(+GMRX),"^",2)
SET GMRZ(1)=$PIECE(GMRY(+GMRX),"^",3)
SET GMRZ(3)=+$PIECE(GMRY(+GMRX),"^",4)
DO ASK1
IF GMRX=""!("Yy"[GMRX)
GOTO Q
GOTO SEL
NURSOL ;SELECT FROM NUR SOLUTION FILE
+1 DO NURSOL^GMRYUT7
IF GMROUT
GOTO Q
+2 SET GMRZ=$PIECE(Y(0),"^")
SET GMRZ(1)=$PIECE(Y(0),"^",2)
SET GMRZ(2)=+$PIECE(Y(0),"^",3)
SET GMRZ(3)=""
DO ASK1
IF GMRX=""!("Yy"[GMRX)!GMROUT
GOTO Q
SET (GMRZ,GMRZ(1),GMRZ(2),GMRZ(3))=""
GOTO NURSOL
Q KILL X,Y,GMRX,GMRY,GMRDA,GMRD
IF GMRZ=""!(GMRZ(1)="")!(GMRZ(2)="")
SET GMROUT=1
QUIT
ASK1 SET X=""
WRITE !,"Amount of solution in mls in the container: "_$SELECT(GMRZ(2)="":"",1:GMRZ(2)_"// ")
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
IF GMROUT
QUIT
+1 IF (X'=""&(X'>0))!(X["?")
WRITE !!,"Enter total amount of solution in mls in the container.",!
SET X=""
GOTO ASK1
+2 IF '(X?1.4N!(X?1.4N1"."1N))&(X'="")
WRITE !,"ERROR ENTRY",!
GOTO ASK1
+3 IF GOPT'="RESTART"&((X>9999!(X<.1))&(X'=""))
WRITE !!,"Amount of solution has to be a number between .1 and 9999.",!!
GOTO ASK1
+4 IF GOPT="RESTART"&(X>$GET(GSAVE))
WRITE !!,"The number must be equal to or less than the remaining amount.",!!
GOTO ASK1
+5 IF X["."
IF $LENGTH($PIECE(X,".",2))>1
WRITE !!,"Only 1 decimal digit allowed",!
GOTO ASK1
+6 IF X>0
SET GMRZ(2)=+X
IF GMRZ(2)=0
GOTO ASK1
ASK3 WRITE !,"Enter a number for infusion rate (Example: 125 = 125 ml/hr): "_$SELECT(GMRZ(3)>0:GMRZ(3)_"// ",1:" ")
SET X=""
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
IF GMROUT
QUIT
+1 IF X=""
GOTO ASK4
IF X'=""&(X'?1.3N!(X<0)!(X>999))
WRITE !,"Enter a number between 1 and 999 or enter <RET> to bypass this entry",!
GOTO ASK3
+2 IF X>0
SET GMRZ(3)=X
GOTO ASK4
+3 IF X["?"
WRITE !,"Enter the rate at which the infusion is to take place.",!,"For example: a number 125 entered means the infusion rate is 125 mls/hr",!
SET X=""
GOTO ASK3
ASK4 WRITE !,GMRZ_" "_$SELECT(GMRZ(1)="A":"admixture",GMRZ(1)="P":"piggyback",GMRZ(1)="B":"blood/blood product",GMRZ(1)="H":"hyperal",GMRZ(1)="I":"intralipids",1:"")_" "_GMRZ(2)_" mls "_$SELECT(GMRZ(3)'="":GMRZ(3),1:"UNKNOWN")_" ml/hr"
+1 WRITE " Is it correct "
SET %=1
DO YN^DICN
SET GMRX=$SELECT(%=1:"Y",%=2:"N",1:"")
IF %<0
SET GMROUT=1
IF GMRX="Y"!(GMRX="N")!GMROUT
QUIT
+2 WRITE !!,"If data is correct, please enter 'Y', else enter 'N' if incorrect.",!
GOTO ASK4
+3 QUIT
ADDHNG SET DR="S:GMRVTYP[""P"" Y=""@1"";1///^S X=GMRZ;@1;2//^S X=""N"";S:GMRVTYP[""P"" Y=""@2"";3//^S X=""N"";@2;4///^S X=""`""_DUZ;I GADD=""Y"" S Y=""@3"";5//^S X=""D"";@3;"
QUIT
SITEDES ;SELECT IV SITE DESCRIPTION, CALLED BY DATA ENTRY ROUTINES
+1 KILL GMRY,GSEL
SET GMRZ=""
SET GMRTRNS=2
KILL GMRX
DO DISPLAY^GMRYUT5
READ GMRX:DTIME
IF '$TEST!(GMRX["^")
SET GMROUT=1
SET GMRZ=""
GOTO QL
+2 IF GMRX=""
SET GMRZ=$PIECE(^GMRD(126.72,1,0),"^")
GOTO ASK2
+3 SET I=$LENGTH(GMRX,",")
FOR X=1:1:I
SET Y=$PIECE(GMRX,",",X)
IF ((Y'?.N1"-".N)&(Y'?.N))!((Y["-")&($PIECE(Y,"-",2)<$PIECE(Y,"-",1))!($PIECE(Y,"-",1)=0)!($PIECE(Y,"-",2)=0))
SET GMRX="?"
+4 IF GMRX["?"
WRITE !!,"Select an item or a combination of items such as ",!,"1,3-5 to describe the IV site you observe",!
GOTO SITEDES
+5 DO VALIDAT^GMRYUT9
IF '$DATA(GSEL)
GOTO SITEDES
SET GMRX=0
FOR
SET GMRX=$ORDER(GSEL(GMRX))
IF GMRX'>0!('$DATA(GMRY(+GMRX)))
QUIT
SET GMRZ=GMRZ_$SELECT($LENGTH(GMRZ)>0:", ",1:"")_$PIECE(GMRY(GMRX),"^",2)
+6 IF $LENGTH(GMRZ)>50
WRITE !,"The string length is longer than 50 characters!"
GOTO SITEDES
ASK2 IF $LENGTH(GMRZ)'>0
GOTO SITEDES
SET X=""
QL KILL %,GMRX,GMRY,GMRN,GMRTRNS,GSEL
QUIT