GMRYUT10 ;HIRMFO/YH-IV RESTART ;6/11/93
;;4.0;Intake/Output;;Apr 25, 1997
OTHRSOL ;ENTER OTHER NAME OF SOLUTION
W !!,"Please SPECIFY the name of the solution",!,?2,"(maximum 75 characters): " S X="" R X:DTIME I '$T!(X["^") S GMROUT=1 Q
I X=""!(X["?")!($L(X)>75) W !,"Enter the name of this IV solution or ^ to quit",! G OTHRSOL
YN W !,X_" " S %=1 D YN^DICN W:%=0 !!,"Enter Y(es) or N(o) to confirm your entry is correct or not.",! G:%=0 YN I %=1 S $P(Y(0),"^")=X Q
S:%<0 GMROUT=1 Q:GMROUT G OTHRSOL
EDTSOL ;
W !,"Enter additional vitamins/electrolytes using a ; to separate additives",! S $P(Y(0),"^")=$$RW^GMRYDIR($P(Y(0),"^"),75) Q:GMROUT
YN2 W !,$P(Y(0),"^")_" " S %=1 D YN^DICN W:%=0 !!,"Enter Y(es) or N(o) to confirm your entry is correct or not.",! G:%=0 YN2 Q:%=1
S:%<0 GMROUT=1 Q:GMROUT G EDTSOL
RESTART ;RESTART IV
K GMRXX S GMRXX=0,GDR=1 D NOW^%DTC S GNOW=%,X1=%,X2=-1 D C^%DTC S GDT(1)=X,GDT=9999999-X D SEARCH Q:GMROUT
I GMRXX=0 D
.W !!,"An IV can't be restarted for one or more of the following reasons:",!,?5,"1. The specific item has been running over 24 hrs.",!,?5,"2. The solution has been discontinued for over 8 hrs.",!,?5,"3. The remaining solution is under 5 mls."
.W !,?5,"4. The reason for discontinuation is 'INFUSED'.",!! S GMROUT=1
Q:GMROUT D WRITE
K GTIME Q
SEARCH ;SEARCH THE IV STARTED WITHIN 24 HRS DC'D WITHIN 8 HRS
I '$D(^GMR(126,DFN,"IV","C")) W !!,"There are no IVs in the database for this patient!",! S GMROUT=1 Q
S GIVDT=0 F S GIVDT=$O(^GMR(126,DFN,"IV","C",GIVDT)) Q:GIVDT'>0 Q:GIVDT>GDT D SCREEN
Q
SCREEN S GDA=0 F S GDA=$O(^GMR(126,DFN,"IV","C",GIVDT,GDA)) Q:GDA'>0 D SAVE
Q
SAVE S GDATA=^GMR(126,DFN,"IV",GDA,0),GDC=+$P(GDATA,"^",9) Q:(GNOW-GDC)>8!(GDC'>0) Q:$P($G(^GMR(126,DFN,"IV",GDA,1)),"^")>0
S GDA(1)=0,GDA(1)=$S('$D(^GMR(126,DFN,"IV",GDA,"IN",0)):0,1:+$P(^(0),"^",3)),GVOL=$S(GDA(1)'>0:0,'$D(^GMR(126,DFN,"IV",GDA,"IN",GDA(1),0)):0,1:$P(^(0),"^",2)) I '(GVOL["*"!(GVOL>4)) Q
S GREASON=$P(GDATA,"^",11) Q:GREASON["INFUSED"!(GREASON["Infused")!(GREASON["infused") S GMRXX=GMRXX+1,GMRXX(GMRXX)=$P(GDATA,"^",1,5)_"^"_$P(GDATA,"^",12)_"^"_GDC_"^"_GREASON_"^"_GVOL_"^"_GDA Q
WRITE Q:GMROUT W !!,"Select one of the following IV(s) to restart",! F I=1:1:GMRXX W !,I_". " D WRT
W !!,"Please enter your choice: " S I="" R I:DTIME I '$T!(I["^")!(I="") S GMROUT=1 Q
I I=""!(I["?")!(I'?.N) W @IOF,!!,"Enter the number of the IV solution you want to restart",! G WRITE
S I=+I
YN1 D SET
I GMRXX>0 S GDR=2 W @IOF G WRITE
K GCATH,GDC,GHLOC,GMRXX,GMRYY,II,I,GNOW,GREASON,GSDC,GVOL,GX Q
WRT W $P(GMRXX(I),"^",3)_" ("_$P(GMRXX(I),"^",4)_") "_$P(GMRXX(I),"^",5)_" ml "_$S($P(GMRXX(I),"^",6)'="":$P(GMRXX(I),"^",6)_" ml/hr ",1:"") S Y=$P(GMRXX(I),"^") X ^DD("DD") W !,?4,"started on "_$P(Y,":",1,2)
S (GTIME,Y)=$P(GMRXX(I),"^",7) X ^DD("DD") W !,?4,"DC'd on "_$P(Y,":",1,2)_" "_$P(GMRXX(I),"^",9)_" ml left",!,?4,"DC reason: "_$P(GMRXX(I),"^",8) Q
SET S GDATA=GMRXX(+I),GHLOC=GMRHLOC,GMRZ=$P(GDATA,"^",3),(GMRZ(1),GMRVTYP)=$P(GDATA,"^",4),GMRZ(2)=$P(GDATA,"^",9),GMRZ(3)=$P(GDATA,"^",6),GSAVE(1)=+$P(GDATA,"^",10) K GMRXX(+I) S GMRXX=GMRXX-1
D:GMRXX>0 RESET S:GMRZ(2)'>0 GMRZ(2)="" S GSAVE=GMRZ(2) S:GSAVE="" GSAVE=+$P(GDATA,"^",5)
ASK S GMRX="" D ASK1^GMRYUT6 Q:GMROUT G:GMRX="N" ASK
ASK2 I GDR=1 D DT^GMRYUT3 S:GX="" GMROUT=1 Q:GMROUT W:GX<GTIME !!,"Start date/time comes before the DC'd date/time.",! G:GX<GTIME ASK2 D
. S GMROUT(1)=0,GMROUT(1)=$$ADM^GMRYUT12(.GMROUT,DFN,GX) Q:GMROUT
. S (GSITE,GCATH,GCATH(1))="" D SITECATH^GMRYSTCA
. Q
Q:GMROUT S GSAVE=GMRVTYP K DD S X=+GX,DLAYGO=126.03,DA(1)=DFN,DIC="^GMR(126,"_DA(1)_",""IV"",",DIC(0)="ML" D WAIT^GMRYUT0 Q:GMROUT D FILE^DICN L -^GMR(126,DFN) K DIC,DLAYGO,DD
I Y'>0 S GMROUT=1 Q
S DA=+Y,GMRVTYP=GSAVE
S DIE="^GMR(126,"_DA(1)_",""IV"",",DR="2///^S X=GMRZ;3///^S X=GMRZ(1);4///^S X=GMRZ(2);11///^S X=GMRZ(3);6///^S X=""`""_DUZ;7///^S X=""`""_GHLOC;"_$S(GDR=1:"1///^S X=GSITE;5///^S X=GCATH;17///^S X=GCATH(1)",GDR=2:"1///^S X=GSITE",1:"")
D WAIT^GMRYUT0 I GMROUT K DIE,DR Q
D ^DIE L -^GMR(126,DFN) K DIE,DR I $P(^GMR(126,DA(1),"IV",DA,0),"^",2)=""!($P(^(0),"^",3)="")!($P(^(0),"^",5)="") W !!,"Undefined value in the record.",!! D DELIV^GMRYED2 S GMROUT=1 Q
S $P(^GMR(126,DFN,"IV",GSAVE(1),1),"^")=GX,$P(^(1),"^",2)=DA,GLINE=DA D RESTART^GMRYED2 Q
RESET ;
K GMRYY S (GMRYY,II)=0 F S II=$O(GMRXX(II)) Q:II'>0 S GMRYY=GMRYY+1,GMRYY(GMRYY)=GMRXX(II)
K GMRXX S GMRXX=0 F II=1:1:GMRYY S GMRXX(II)=GMRYY(II),GMRXX=GMRXX+1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRYUT10 4512 printed Dec 13, 2024@01:55:44 Page 2
GMRYUT10 ;HIRMFO/YH-IV RESTART ;6/11/93
+1 ;;4.0;Intake/Output;;Apr 25, 1997
OTHRSOL ;ENTER OTHER NAME OF SOLUTION
+1 WRITE !!,"Please SPECIFY the name of the solution",!,?2,"(maximum 75 characters): "
SET X=""
READ X:DTIME
IF '$TEST!(X["^")
SET GMROUT=1
QUIT
+2 IF X=""!(X["?")!($LENGTH(X)>75)
WRITE !,"Enter the name of this IV solution or ^ to quit",!
GOTO OTHRSOL
YN WRITE !,X_" "
SET %=1
DO YN^DICN
if %=0
WRITE !!,"Enter Y(es) or N(o) to confirm your entry is correct or not.",!
if %=0
GOTO YN
IF %=1
SET $PIECE(Y(0),"^")=X
QUIT
+1 if %<0
SET GMROUT=1
if GMROUT
QUIT
GOTO OTHRSOL
EDTSOL ;
+1 WRITE !,"Enter additional vitamins/electrolytes using a ; to separate additives",!
SET $PIECE(Y(0),"^")=$$RW^GMRYDIR($PIECE(Y(0),"^"),75)
if GMROUT
QUIT
YN2 WRITE !,$PIECE(Y(0),"^")_" "
SET %=1
DO YN^DICN
if %=0
WRITE !!,"Enter Y(es) or N(o) to confirm your entry is correct or not.",!
if %=0
GOTO YN2
if %=1
QUIT
+1 if %<0
SET GMROUT=1
if GMROUT
QUIT
GOTO EDTSOL
RESTART ;RESTART IV
+1 KILL GMRXX
SET GMRXX=0
SET GDR=1
DO NOW^%DTC
SET GNOW=%
SET X1=%
SET X2=-1
DO C^%DTC
SET GDT(1)=X
SET GDT=9999999-X
DO SEARCH
if GMROUT
QUIT
+2 IF GMRXX=0
Begin DoDot:1
+3 WRITE !!,"An IV can't be restarted for one or more of the following reasons:",!,?5,"1. The specific item has been running over 24 hrs.",!,?5,"2. The solution has been discontinued for over 8 hrs.",!,?5,"3. The remaining solution is unde
r 5 mls."
+4 WRITE !,?5,"4. The reason for discontinuation is 'INFUSED'.",!!
SET GMROUT=1
End DoDot:1
+5 if GMROUT
QUIT
DO WRITE
+6 KILL GTIME
QUIT
SEARCH ;SEARCH THE IV STARTED WITHIN 24 HRS DC'D WITHIN 8 HRS
+1 IF '$DATA(^GMR(126,DFN,"IV","C"))
WRITE !!,"There are no IVs in the database for this patient!",!
SET GMROUT=1
QUIT
+2 SET GIVDT=0
FOR
SET GIVDT=$ORDER(^GMR(126,DFN,"IV","C",GIVDT))
if GIVDT'>0
QUIT
if GIVDT>GDT
QUIT
DO SCREEN
+3 QUIT
SCREEN SET GDA=0
FOR
SET GDA=$ORDER(^GMR(126,DFN,"IV","C",GIVDT,GDA))
if GDA'>0
QUIT
DO SAVE
+1 QUIT
SAVE SET GDATA=^GMR(126,DFN,"IV",GDA,0)
SET GDC=+$PIECE(GDATA,"^",9)
if (GNOW-GDC)>8!(GDC'>0)
QUIT
if $PIECE($GET(^GMR(126,DFN,"IV",GDA,1)),"^")>0
QUIT
+1 SET GDA(1)=0
SET GDA(1)=$SELECT('$DATA(^GMR(126,DFN,"IV",GDA,"IN",0)):0,1:+$PIECE(^(0),"^",3))
SET GVOL=$SELECT(GDA(1)'>0:0,'$DATA(^GMR(126,DFN,"IV",GDA,"IN",GDA(1),0)):0,1:$PIECE(^(0),"^",2))
IF '(GVOL["*"!(GVOL>4))
QUIT
+2 SET GREASON=$PIECE(GDATA,"^",11)
if GREASON["INFUSED"!(GREASON["Infused")!(GREASON["infused")
QUIT
SET GMRXX=GMRXX+1
SET GMRXX(GMRXX)=$PIECE(GDATA,"^",1,5)_"^"_$PIECE(GDATA,"^",12)_"^"_GDC_"^"_GREASON_"^"_GVOL_"^"_GDA
QUIT
WRITE if GMROUT
QUIT
WRITE !!,"Select one of the following IV(s) to restart",!
FOR I=1:1:GMRXX
WRITE !,I_". "
DO WRT
+1 WRITE !!,"Please enter your choice: "
SET I=""
READ I:DTIME
IF '$TEST!(I["^")!(I="")
SET GMROUT=1
QUIT
+2 IF I=""!(I["?")!(I'?.N)
WRITE @IOF,!!,"Enter the number of the IV solution you want to restart",!
GOTO WRITE
+3 SET I=+I
YN1 DO SET
+1 IF GMRXX>0
SET GDR=2
WRITE @IOF
GOTO WRITE
+2 KILL GCATH,GDC,GHLOC,GMRXX,GMRYY,II,I,GNOW,GREASON,GSDC,GVOL,GX
QUIT
WRT WRITE $PIECE(GMRXX(I),"^",3)_" ("_$PIECE(GMRXX(I),"^",4)_") "_$PIECE(GMRXX(I),"^",5)_" ml "_$SELECT($PIECE(GMRXX(I),"^",6)'="":$PIECE(GMRXX(I),"^",6)_" ml/hr ",1:"")
SET Y=$PIECE(GMRXX(I),"^")
XECUTE ^DD("DD")
WRITE !,?4,"started on "_$PIECE(Y,":",1,2)
+1 SET (GTIME,Y)=$PIECE(GMRXX(I),"^",7)
XECUTE ^DD("DD")
WRITE !,?4,"DC'd on "_$PIECE(Y,":",1,2)_" "_$PIECE(GMRXX(I),"^",9)_" ml left",!,?4,"DC reason: "_$PIECE(GMRXX(I),"^",8)
QUIT
SET SET GDATA=GMRXX(+I)
SET GHLOC=GMRHLOC
SET GMRZ=$PIECE(GDATA,"^",3)
SET (GMRZ(1),GMRVTYP)=$PIECE(GDATA,"^",4)
SET GMRZ(2)=$PIECE(GDATA,"^",9)
SET GMRZ(3)=$PIECE(GDATA,"^",6)
SET GSAVE(1)=+$PIECE(GDATA,"^",10)
KILL GMRXX(+I)
SET GMRXX=GMRXX-1
+1 if GMRXX>0
DO RESET
if GMRZ(2)'>0
SET GMRZ(2)=""
SET GSAVE=GMRZ(2)
if GSAVE=""
SET GSAVE=+$PIECE(GDATA,"^",5)
ASK SET GMRX=""
DO ASK1^GMRYUT6
if GMROUT
QUIT
if GMRX="N"
GOTO ASK
ASK2 IF GDR=1
DO DT^GMRYUT3
if GX=""
SET GMROUT=1
if GMROUT
QUIT
if GX<GTIME
WRITE !!,"Start date/time comes before the DC'd date/time.",!
if GX<GTIME
GOTO ASK2
Begin DoDot:1
+1 SET GMROUT(1)=0
SET GMROUT(1)=$$ADM^GMRYUT12(.GMROUT,DFN,GX)
if GMROUT
QUIT
+2 SET (GSITE,GCATH,GCATH(1))=""
DO SITECATH^GMRYSTCA
+3 QUIT
End DoDot:1
+4 if GMROUT
QUIT
SET GSAVE=GMRVTYP
KILL DD
SET X=+GX
SET DLAYGO=126.03
SET DA(1)=DFN
SET DIC="^GMR(126,"_DA(1)_",""IV"","
SET DIC(0)="ML"
DO WAIT^GMRYUT0
if GMROUT
QUIT
DO FILE^DICN
LOCK -^GMR(126,DFN)
KILL DIC,DLAYGO,DD
+5 IF Y'>0
SET GMROUT=1
QUIT
+6 SET DA=+Y
SET GMRVTYP=GSAVE
+7 SET DIE="^GMR(126,"_DA(1)_",""IV"","
SET DR="2///^S X=GMRZ;3///^S X=GMRZ(1);4///^S X=GMRZ(2);11///^S X=GMRZ(3);6///^S X=""`""_DUZ;7///^S X=""`""_GHLOC;"_$SELECT(GDR=1:"1///^S X=GSITE;5///^S X=GCATH;17///^S X=GCATH(1)",GDR=2:"1///^S X=GSITE",1:"")
+8 DO WAIT^GMRYUT0
IF GMROUT
KILL DIE,DR
QUIT
+9 DO ^DIE
LOCK -^GMR(126,DFN)
KILL DIE,DR
IF $PIECE(^GMR(126,DA(1),"IV",DA,0),"^",2)=""!($PIECE(^(0),"^",3)="")!($PIECE(^(0),"^",5)="")
WRITE !!,"Undefined value in the record.",!!
DO DELIV^GMRYED2
SET GMROUT=1
QUIT
+10 SET $PIECE(^GMR(126,DFN,"IV",GSAVE(1),1),"^")=GX
SET $PIECE(^(1),"^",2)=DA
SET GLINE=DA
DO RESTART^GMRYED2
QUIT
RESET ;
+1 KILL GMRYY
SET (GMRYY,II)=0
FOR
SET II=$ORDER(GMRXX(II))
if II'>0
QUIT
SET GMRYY=GMRYY+1
SET GMRYY(GMRYY)=GMRXX(II)
+2 KILL GMRXX
SET GMRXX=0
FOR II=1:1:GMRYY
SET GMRXX(II)=GMRYY(II)
SET GMRXX=GMRXX+1