GMRYUT0 ;HIRMFO/YH - PATIENT I/O UTILITIES - PATIENT SEARCH AND IV DISPLAY ;2/12/91
;;4.0;Intake/Output;**3,6**;Apr 25, 1997
PATDAT ;SELECT PATIENT
S DIC(0)="AEQMZ",DIC="^DPT(" D ^DIC K DIC S DFN=+Y I DFN'>0 S GMROUT=1 Q
PT D 1^VADPT S GMRWARD(1)=$S($D(GMRVWLO):GMRVWLO,1:$P(VAIN(4),"^",2)),GMRWARD=$P(VAIN(4),"^"),GMRVADM=$P(VAIN(7),"^",2),GMRAGE=$P(VADM(4),"^"),SSN=$P(VADM(2),"^",2),GMRDIAG=$P(VAIN(9),"^"),GMRBED=$P($P(VAIN(5),"^"),"-",1,2)
S GMRSEX=$P(VADM(5),"^",2),GMRBTH=$P(VADM(3),"^",2),GMRNAM=$P(VADM(1),"^"),GMRHLOC=+$P(VAIN(4),"^") D KVAR^VADPT K VA I $D(^DIC(42,+GMRHLOC,44)) S GMRHLOC=+$P(^(44),"^") Q:GMRHLOC>0
Q
HOSP S DIC("A")="Select Hospital Location: ",DIC=44,DIC(0)="AEMQ",DIC("S")="I $P(^(0),U,3)'=""Z""" D ^DIC K DIC I Y'>0 S GMROUT=1 Q
S GMRHLOC=+Y Q
LISTIV ;LIST CURRENT IV LINES
K GMRDATA S GMRVN=0,GN=0 F II=0:0 S GMRVN=$O(^GMR(126,DA,"IV","C",GMRVN)) Q:GMRVN'>0 D SAVEIV
S GN(1)=GN I GN=0 W !!,"There is no IV running for this patient.",! G Q
Q K GTITR,GDATA,GMRVTYP,GMRVS Q
SAVEIV ;SAVE IV LINES IN ARRAY FOR SELECTION
S GIV=0 F II=0:0 S GIV=$O(^GMR(126,DA,"IV","C",GMRVN,GIV)) Q:GIV'>0 I GMRDC=2!(GMRDC=0&($P($G(^GMR(126,DA,"IV",GIV,0)),"^",9)="")) S GDATA=^(0),GMRVTYP=$P(GDATA,"^",4),GMRVS=$P(GDATA,"^",2) I GMRVTYP'="",GMRVS'="" S GN=GN+1 D SET
Q
SET S GMRDATA(GN)=9999999-GMRVN_"^"_GIV_"^"_GMRVTYP_"^"_GMRVS_"^"_$P(GDATA,"^",9)_"^"_$P(GDATA,"^",3)_"^"_$P(GDATA,"^",5)_"^"_$S($P(GDATA,"^",6)'="":"Started",1:$S($P(GDATA,"^",3)["LOCK":"Converted",1:"Added"))
S GTITR=$P(GDATA,"^",12) I $D(^GMR(126,DA,"IV",GIV,"TITR","C")) D
.S I=$O(^GMR(126,DA,"IV",GIV,"TITR","C",0)) I I>0 S I(1)=$O(^GMR(126,DA,"IV",GIV,"TITR","C",I,0)) S GTITR=$S($D(^GMR(126,DA,"IV",GIV,"TITR",I(1),0)):$P(^(0),"^",2),1:GTITR)
K I S GMRDATA(GN)=GMRDATA(GN)_"^"_$S(GTITR>0:GTITR_" ml/hr",1:"")
S GSITE=GMRVS,GSITE(GSITE)="" D FINDCA^GMRYCATH(.GSITE) S GMRDATA(GN)=GMRDATA(GN)_"^"_GSITE(GSITE)_"^"_$G(^GMR(126,DFN,"IV",GIV,3))
Q
SETDT I '(GMRDT>GMREND) S GDA=$O(^GMR(126,DA(1),"IV",DA,"IN","B",GMRDT,0)) S GN=GN+1,GMRDATA(GN)=GMRDT_"^"_GDA_"^"_GIN(GDA)
Q
WAIT ;
L +^GMR(126,DFN):0 I '$T W !!,"This patient's I/O records are being updated by someone else",!,"please try this patient later",!! S GMROUT=1 Q
Q
KILLV K GMRNO,GMRVNM,II,GMRVN,GMRDATA,GDTEND,GMRVP,GMRVS,GMRVSTP,GMRVSTR,GMRVL,GMRVTYP,GADDI,GBOTT,GSOL,GSTREN,GIV,GIVDT,GWRITE,GFLAG
;; GMRY*4*6 - RJS ADDED GFLAG TO KILLV
Q
SELIV ;LIST IV FOR THE SELECTED IV LINE
D IVINTK^GMRYUT8 I $D(GTOTAL) W !,?5,"Total amount absorbed: "_$S(GSTAR'="":GSTAR,1:($P(^GMR(126,DA(1),"IV",DA,0),"^",5)-GTOTAL)_" mls"),!!
K GMRDATA S (GDCIV,GN)=0,GX="",GMRDEL="",GMRDC=1 I $D(^GMR(126,DA(1),"IV",DA,"IN",0)) S GMRDT=0 F S GMRDT=$O(^GMR(126,DA(1),"IV",DA,"IN","B",GMRDT)) Q:GMRDT'>0 D SETDT
S GN(1)=GN I '$D(GMRDATA) W !,?5,$C(7),"No intake records for this IV line within the last 48 hours" G DT
I $D(GMRDATA) D SELECT^GMRYUT3 I $E(GX)="^" S DA=DFN G QIV
D WARN I "Nn"[GX&(GX'="") S GX="" G DT
I GX>0 S DA(2)=DA(1),DA(1)=DA,DA=+$P(GX,"^",2) G:DA'>0 QIV S GHLOC=$P($G(^GMR(126,DFN,"IV",DA(1),"IN",DA,0)),"^",5) D IV^GMRYUT8 S DA=DFN G QIV
DT S X="",GHLOC=GMRHLOC S %DT("A")="Please enter a new DATE/TIME: ",%DT="AETXRS",%DT(0)="-NOW" D ^%DT K %DT S (GX,X)=Y I Y<1 S X="" S DA=DFN G QIV
DC I '$D(^GMR(126,DA(1),"IV",DA,"IN",0)) S ^(0)="^126.313IDA^0^0"
K DD S GSAVE=GMRVTYP,DLAYGO=126.313,X=GX,DA(2)=DA(1),DA(1)=DA,DIC="^GMR(126,"_DA(2)_",""IV"","_DA(1)_",""IN"",",DIC(0)="ML" D WAIT^GMRYUT0 D:'GMROUT FILE^DICN L:'GMROUT -^GMR(126,DFN)
K DR,DIC,DLAYGO,DD S DA=+$G(Y),GMRVTYP=GSAVE I $G(Y)'>0 S GMROUT=1,DA=DA(1),DA(1)=DA(2) G QIV
D IV^GMRYUT8
QIV W ! K GMRX,GHLOC,GX,GY,X,GMRDEL,GMRVOL,GMRDATA,GDATE,GMRDT,DIC,Y Q
WARN W !!,"If you modify your original remaining entry, (i.e. Amount Left),",!,"please check any other entries for possible inaccuracies",! Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRYUT0 3877 printed Nov 22, 2024@17:05:50 Page 2
GMRYUT0 ;HIRMFO/YH - PATIENT I/O UTILITIES - PATIENT SEARCH AND IV DISPLAY ;2/12/91
+1 ;;4.0;Intake/Output;**3,6**;Apr 25, 1997
PATDAT ;SELECT PATIENT
+1 SET DIC(0)="AEQMZ"
SET DIC="^DPT("
DO ^DIC
KILL DIC
SET DFN=+Y
IF DFN'>0
SET GMROUT=1
QUIT
PT DO 1^VADPT
SET GMRWARD(1)=$SELECT($DATA(GMRVWLO):GMRVWLO,1:$PIECE(VAIN(4),"^",2))
SET GMRWARD=$PIECE(VAIN(4),"^")
SET GMRVADM=$PIECE(VAIN(7),"^",2)
SET GMRAGE=$PIECE(VADM(4),"^")
SET SSN=$PIECE(VADM(2),"^",2)
SET GMRDIAG=$PIECE(VAIN(9),"^")
SET GMRBED=$PIECE($PIECE(VAIN(5),"^"),"-",1,2)
+1 SET GMRSEX=$PIECE(VADM(5),"^",2)
SET GMRBTH=$PIECE(VADM(3),"^",2)
SET GMRNAM=$PIECE(VADM(1),"^")
SET GMRHLOC=+$PIECE(VAIN(4),"^")
DO KVAR^VADPT
KILL VA
IF $DATA(^DIC(42,+GMRHLOC,44))
SET GMRHLOC=+$PIECE(^(44),"^")
if GMRHLOC>0
QUIT
+2 QUIT
HOSP SET DIC("A")="Select Hospital Location: "
SET DIC=44
SET DIC(0)="AEMQ"
SET DIC("S")="I $P(^(0),U,3)'=""Z"""
DO ^DIC
KILL DIC
IF Y'>0
SET GMROUT=1
QUIT
+1 SET GMRHLOC=+Y
QUIT
LISTIV ;LIST CURRENT IV LINES
+1 KILL GMRDATA
SET GMRVN=0
SET GN=0
FOR II=0:0
SET GMRVN=$ORDER(^GMR(126,DA,"IV","C",GMRVN))
if GMRVN'>0
QUIT
DO SAVEIV
+2 SET GN(1)=GN
IF GN=0
WRITE !!,"There is no IV running for this patient.",!
GOTO Q
Q KILL GTITR,GDATA,GMRVTYP,GMRVS
QUIT
SAVEIV ;SAVE IV LINES IN ARRAY FOR SELECTION
+1 SET GIV=0
FOR II=0:0
SET GIV=$ORDER(^GMR(126,DA,"IV","C",GMRVN,GIV))
if GIV'>0
QUIT
IF GMRDC=2!(GMRDC=0&($PIECE($GET(^GMR(126,DA,"IV",GIV,0)),"^",9)=""))
SET GDATA=^(0)
SET GMRVTYP=$PIECE(GDATA,"^",4)
SET GMRVS=$PIECE(GDATA,"^",2)
IF GMRVTYP'=""
IF GMRVS'=""
SET GN=GN+1
DO SET
+2 QUIT
SET SET GMRDATA(GN)=9999999-GMRVN_"^"_GIV_"^"_GMRVTYP_"^"_GMRVS_"^"_$PIECE(GDATA,"^",9)_"^"_$PIECE(GDATA,"^",3)_"^"_$PIECE(GDATA,"^",5)_"^"_$SELECT($PIECE(GDATA,"^",6)'="":"Started",1:$SELECT($PIECE(GDATA,"^",3)["LOCK":"Converted",1:"Added"))
+1 SET GTITR=$PIECE(GDATA,"^",12)
IF $DATA(^GMR(126,DA,"IV",GIV,"TITR","C"))
Begin DoDot:1
+2 SET I=$ORDER(^GMR(126,DA,"IV",GIV,"TITR","C",0))
IF I>0
SET I(1)=$ORDER(^GMR(126,DA,"IV",GIV,"TITR","C",I,0))
SET GTITR=$SELECT($DATA(^GMR(126,DA,"IV",GIV,"TITR",I(1),0)):$PIECE(^(0),"^",2),1:GTITR)
End DoDot:1
+3 KILL I
SET GMRDATA(GN)=GMRDATA(GN)_"^"_$SELECT(GTITR>0:GTITR_" ml/hr",1:"")
+4 SET GSITE=GMRVS
SET GSITE(GSITE)=""
DO FINDCA^GMRYCATH(.GSITE)
SET GMRDATA(GN)=GMRDATA(GN)_"^"_GSITE(GSITE)_"^"_$GET(^GMR(126,DFN,"IV",GIV,3))
+5 QUIT
SETDT IF '(GMRDT>GMREND)
SET GDA=$ORDER(^GMR(126,DA(1),"IV",DA,"IN","B",GMRDT,0))
SET GN=GN+1
SET GMRDATA(GN)=GMRDT_"^"_GDA_"^"_GIN(GDA)
+1 QUIT
WAIT ;
+1 LOCK +^GMR(126,DFN):0
IF '$TEST
WRITE !!,"This patient's I/O records are being updated by someone else",!,"please try this patient later",!!
SET GMROUT=1
QUIT
+2 QUIT
KILLV KILL GMRNO,GMRVNM,II,GMRVN,GMRDATA,GDTEND,GMRVP,GMRVS,GMRVSTP,GMRVSTR,GMRVL,GMRVTYP,GADDI,GBOTT,GSOL,GSTREN,GIV,GIVDT,GWRITE,GFLAG
+1 ;; GMRY*4*6 - RJS ADDED GFLAG TO KILLV
+2 QUIT
SELIV ;LIST IV FOR THE SELECTED IV LINE
+1 DO IVINTK^GMRYUT8
IF $DATA(GTOTAL)
WRITE !,?5,"Total amount absorbed: "_$SELECT(GSTAR'="":GSTAR,1:($PIECE(^GMR(126,DA(1),"IV",DA,0),"^",5)-GTOTAL)_" mls"),!!
+2 KILL GMRDATA
SET (GDCIV,GN)=0
SET GX=""
SET GMRDEL=""
SET GMRDC=1
IF $DATA(^GMR(126,DA(1),"IV",DA,"IN",0))
SET GMRDT=0
FOR
SET GMRDT=$ORDER(^GMR(126,DA(1),"IV",DA,"IN","B",GMRDT))
if GMRDT'>0
QUIT
DO SETDT
+3 SET GN(1)=GN
IF '$DATA(GMRDATA)
WRITE !,?5,$CHAR(7),"No intake records for this IV line within the last 48 hours"
GOTO DT
+4 IF $DATA(GMRDATA)
DO SELECT^GMRYUT3
IF $EXTRACT(GX)="^"
SET DA=DFN
GOTO QIV
+5 DO WARN
IF "Nn"[GX&(GX'="")
SET GX=""
GOTO DT
+6 IF GX>0
SET DA(2)=DA(1)
SET DA(1)=DA
SET DA=+$PIECE(GX,"^",2)
if DA'>0
GOTO QIV
SET GHLOC=$PIECE($GET(^GMR(126,DFN,"IV",DA(1),"IN",DA,0)),"^",5)
DO IV^GMRYUT8
SET DA=DFN
GOTO QIV
DT SET X=""
SET GHLOC=GMRHLOC
SET %DT("A")="Please enter a new DATE/TIME: "
SET %DT="AETXRS"
SET %DT(0)="-NOW"
DO ^%DT
KILL %DT
SET (GX,X)=Y
IF Y<1
SET X=""
SET DA=DFN
GOTO QIV
DC IF '$DATA(^GMR(126,DA(1),"IV",DA,"IN",0))
SET ^(0)="^126.313IDA^0^0"
+1 KILL DD
SET GSAVE=GMRVTYP
SET DLAYGO=126.313
SET X=GX
SET DA(2)=DA(1)
SET DA(1)=DA
SET DIC="^GMR(126,"_DA(2)_",""IV"","_DA(1)_",""IN"","
SET DIC(0)="ML"
DO WAIT^GMRYUT0
if 'GMROUT
DO FILE^DICN
if 'GMROUT
LOCK -^GMR(126,DFN)
+2 KILL DR,DIC,DLAYGO,DD
SET DA=+$GET(Y)
SET GMRVTYP=GSAVE
IF $GET(Y)'>0
SET GMROUT=1
SET DA=DA(1)
SET DA(1)=DA(2)
GOTO QIV
+3 DO IV^GMRYUT8
QIV WRITE !
KILL GMRX,GHLOC,GX,GY,X,GMRDEL,GMRVOL,GMRDATA,GDATE,GMRDT,DIC,Y
QUIT
WARN WRITE !!,"If you modify your original remaining entry, (i.e. Amount Left),",!,"please check any other entries for possible inaccuracies",!
QUIT