GMRYUT3 ;HIRMFO/YH-PATIENT I/O UTILITIES - DIC CALL ;11/6/96
;;4.0;Intake/Output;;Apr 25, 1997
LIST ;LIST I/O RECORDS FOR THE SELECTED TYPE IN THE DATABASE
K GMRDATA S DA=DFN,GMRDC=1,GN=0,GX="",GMRDEL="" I $D(^GMR(126,DA,GNANS,"TYP")) S GMRDT=0 F S GMRDT=$O(^GMR(126,DA,GNANS,"TYP",GMRDT)) Q:GMRDT'>0 I '(GMRDT>GMREND) D SETDA
S GN(1)=GN I '$D(GMRDATA) W !,?5,$C(7),"No records in the database within the last 48 hours" G NEW
I $D(GMRDATA) D SELECT S:GX["^^" GMROUT=1 I GMROUT!($E(GX)="^") S DA=DFN G Q
I "Nn"[GX&(GX'="") S GX="" G NEW
I GX>0 S DA(1)=DA,DA=+$P(GX,"^",2) G:DA'>0 Q S GHLOC=$S(GNANS="IN":+$P($G(^GMR(126,DFN,"IN",DA,0)),"^",4),GNANS="OUT":+$P($G(^GMR(126,DFN,"OUT",DA,0)),"^",7),1:"") S:GHLOC'>0 GHLOC=GMRHLOC D @GNANS S DA=DA(1) G Q
NEW D DT G:GX=""!GMROUT Q
S GMROUT(1)=0,GMROUT(1)=$$ADM^GMRYUT12(.GMROUT,DFN,GX) Q:GMROUT
S GMROUT(1)=0,GHLOC=GMRHLOC,X=GX I '$D(^GMR(126,DA,GNANS,0)) S ^(0)=$S(GNANS="OUT":"^126.02IDA^0^0",GNANS="IN":"^126.01IDA^0^0",1:"")
K DD S DLAYGO=$S(GNANS="OUT":126.02,GNANS="IN":126.01,1:""),GDATE=X,DA(1)=DA,DIC="^GMR(126,"_DA(1)_","""_GNANS_""",",DIC(0)="ML" D WAIT^GMRYUT0 D:'GMROUT FILE^DICN L:'GMROUT -^GMR(126,DFN)
K DIC,DLAYGO,DD S X=GDATE S DA=+$G(Y) I GMROUT!($G(Y)'>0) S GMROUT=1,DA=DA(1) G Q
D @GNANS S DA=DA(1)
Q W ! K GMRX,GMRY,GHLOC,GMRDC,GMRYTYP,GEDIT,GY,D0,D1,GX,GN,X,Y,GMRDEL,GMRVOL,GMRDATA,GDATE,GMRDT,DIC,Y Q
DT S (GX,X)="" S %DT("A")="Please enter a new DATE/TIME: ",%DT="AETXRS",%DT(0)="-NOW" S:+$G(GMRVIDT)>0 %DT("B")=GMRVIDT D ^%DT K %DT S:Y>0 (GX,X)=+Y
Q
SELECT S GN(2)=1 W !
RESEL S GX="",GN(3)=0 F GN=GN(2):1:GN(1) Q:("Nn"[GX&(GX'=""))!(GX["^")!(GX'="")!(GX["?")!GMROUT S:'GN(3) GN(3)=GN D WRITE^GMRYUT11:GMRDC=1,WRITE^GMRYUT1:GMRDC=0!(GMRDC=2) I '(GN#3)!(GN=GN(1)) D QUEST^GMRYUT1 W !! S GN(3)=0
G:GX["?" RESEL Q:GMROUT!(GX["^")!("Nn"[GX) G:'(GX=""!(GX>0)) SELECT S:GX>0 GMRDEL=$P(GX,+GX,2),GX=+GX I GX>0,$D(GMRDATA(+GX)) S:GX["@" GX=+$P(GX,"@"),GMRDEL="@" S GX=GMRDATA(+GX) Q
G:GX=9999 SELECT I GX>0,'$D(GMRDATA(+GX)) G SELECT
Q
OUT ;
S GX(1)=+GX I GMRDEL="@" S %=1 W !!,"Are you sure you want to delete this record" D YN^DICN S:%<0 GMROUT=1 W:%=0 !!,"Enter N(o) if you do not want to delete this record or '^' to quit.",! G:%=0 OUT D:%=1 KILLRC^GMRYINTK K % Q
S Y=+GX X ^DD("DD") W !!,"Enter "_GLABEL_" dated "_$P(Y,":",1,2) W !,?5,"Unit ml is not required",!
S GMRZ=$P(^GMR(126,DA(1),"OUT",DA,0),"^",3) D:((GLABEL["URINE")!(GLABEL["DRAIN"))&(GMRZ="") DRAIN^GMRYUT7 I GMROUT!GMROUT(1) D S GMROUT(1)=0 Q
. I $P((GX),"^",2)="" D KILLRC^GMRYINTK
W !,"Enter numeric value for measured output in cc/ml or ",!,"enter S(mall), M(edium) or L(arge) for estimated output.",!
S DIE="^GMR(126,"_DA(1)_","""_GNANS_""",",DR="1///^S X=GLABEL;3;5///^S X=""`""_DUZ;6///^S X=""`""_GHLOC;"_$S(GLABEL["DRAIN"!(GLABEL["URINE"):"2///^S X=$S(GMRZ'="""":""`""_GMRZ,1:"""");",1:"")
I GLABEL["OTHER" S DR=DR_"4"
D WAIT^GMRYUT0 I GMROUT K DIE,DR Q
D ^DIE L -^GMR(126,DFN) K DIE,DR,GMRZ I $P(^GMR(126,DA(1),GNANS,DA,0),"^",4)="" D KILLRC^GMRYINTK Q
I GLABEL["DRAIN" W !,"Enter another DRAINAGE" S %=2 D YN^DICN Q:%'=1 D MOREDRN^GMRYUT8 S:'GMROUT X=+GX G:'GMROUT OUT S GMROUT=0 Q
Q
IN ;EDIT OR DELETE INPUT RECORD
D INTAKE^GMRYINTK
Q
SETDA S GDATE=9999999-GMRDT,GDA=0 F S GDA=$O(^GMR(126,DA,GNANS,"TYP",GMRDT,GTP,GDA)) Q:GDA'>0 S GN=GN+1,GMRDATA(GN)=GDATE_"^"_GDA
Q
GMRYUT3 ;HIRMFO/YH-PATIENT I/O UTILITIES - DIC CALL ;11/6/96
+1 ;;4.0;Intake/Output;;Apr 25, 1997
LIST ;LIST I/O RECORDS FOR THE SELECTED TYPE IN THE DATABASE
+1 KILL GMRDATA
SET DA=DFN
SET GMRDC=1
SET GN=0
SET GX=""
SET GMRDEL=""
IF $DATA(^GMR(126,DA,GNANS,"TYP"))
SET GMRDT=0
FOR
SET GMRDT=$ORDER(^GMR(126,DA,GNANS,"TYP",GMRDT))
IF GMRDT'>0
QUIT
IF '(GMRDT>GMREND)
DO SETDA
+2 SET GN(1)=GN
IF '$DATA(GMRDATA)
WRITE !,?5,$CHAR(7),"No records in the database within the last 48 hours"
GOTO NEW
+3 IF $DATA(GMRDATA)
DO SELECT
IF GX["^^"
SET GMROUT=1
IF GMROUT!($EXTRACT(GX)="^")
SET DA=DFN
GOTO Q
+4 IF "Nn"[GX&(GX'="")
SET GX=""
GOTO NEW
+5 IF GX>0
SET DA(1)=DA
SET DA=+$PIECE(GX,"^",2)
IF DA'>0
GOTO Q
SET GHLOC=$SELECT(GNANS="IN":+$PIECE($GET(^GMR(126,DFN,"IN",DA,0)),"^",4),GNANS="OUT":+$PIECE($GET(^GMR(126,DFN,"OUT",DA,0)),"^",7),1:"")
IF GHLOC'>0
SET GHLOC=GMRHLOC
DO @GNANS
SET DA=DA(1)
GOTO Q
NEW DO DT
IF GX=""!GMROUT
GOTO Q
+1 SET GMROUT(1)=0
SET GMROUT(1)=$$ADM^GMRYUT12(.GMROUT,DFN,GX)
IF GMROUT
QUIT
+2 SET GMROUT(1)=0
SET GHLOC=GMRHLOC
SET X=GX
IF '$DATA(^GMR(126,DA,GNANS,0))
SET ^(0)=$SELECT(GNANS="OUT":"^126.02IDA^0^0",GNANS="IN":"^126.01IDA^0^0",1:"")
+3 KILL DD
SET DLAYGO=$SELECT(GNANS="OUT":126.02,GNANS="IN":126.01,1:"")
SET GDATE=X
SET DA(1)=DA
SET DIC="^GMR(126,"_DA(1)_","""_GNANS_""","
SET DIC(0)="ML"
DO WAIT^GMRYUT0
IF 'GMROUT
DO FILE^DICN
IF 'GMROUT
LOCK -^GMR(126,DFN)
+4 KILL DIC,DLAYGO,DD
SET X=GDATE
SET DA=+$GET(Y)
IF GMROUT!($GET(Y)'>0)
SET GMROUT=1
SET DA=DA(1)
GOTO Q
+5 DO @GNANS
SET DA=DA(1)
Q WRITE !
KILL GMRX,GMRY,GHLOC,GMRDC,GMRYTYP,GEDIT,GY,D0,D1,GX,GN,X,Y,GMRDEL,GMRVOL,GMRDATA,GDATE,GMRDT,DIC,Y
QUIT
DT SET (GX,X)=""
SET %DT("A")="Please enter a new DATE/TIME: "
SET %DT="AETXRS"
SET %DT(0)="-NOW"
IF +$GET(GMRVIDT)>0
SET %DT("B")=GMRVIDT
DO ^%DT
KILL %DT
IF Y>0
SET (GX,X)=+Y
+1 QUIT
SELECT SET GN(2)=1
WRITE !
RESEL SET GX=""
SET GN(3)=0
FOR GN=GN(2):1:GN(1)
IF ("Nn"[GX&(GX'=""))!(GX["^")!(GX'="")!(GX["?")!GMROUT
QUIT
IF 'GN(3)
SET GN(3)=GN
IF GMRDC=1
DO WRITE^GMRYUT11
IF GMRDC=0!(GMRDC=2)
DO WRITE^GMRYUT1
IF '(GN#3)!(GN=GN(1))
DO QUEST^GMRYUT1
WRITE !!
SET GN(3)=0
+1 IF GX["?"
GOTO RESEL
IF GMROUT!(GX["^")!("Nn"[GX)
QUIT
IF '(GX=""!(GX>0))
GOTO SELECT
IF GX>0
SET GMRDEL=$PIECE(GX,+GX,2)
SET GX=+GX
IF GX>0
IF $DATA(GMRDATA(+GX))
IF GX["@"
SET GX=+$PIECE(GX,"@")
SET GMRDEL="@"
SET GX=GMRDATA(+GX)
QUIT
+2 IF GX=9999
GOTO SELECT
IF GX>0
IF '$DATA(GMRDATA(+GX))
GOTO SELECT
+3 QUIT
OUT ;
+1 SET GX(1)=+GX
IF GMRDEL="@"
SET %=1
WRITE !!,"Are you sure you want to delete this record"
DO YN^DICN
IF %<0
SET GMROUT=1
IF %=0
WRITE !!,"Enter N(o) if you do not want to delete this record or '^' to quit.",!
IF %=0
GOTO OUT
IF %=1
DO KILLRC^GMRYINTK
KILL %
QUIT
+2 SET Y=+GX
XECUTE ^DD("DD")
WRITE !!,"Enter "_GLABEL_" dated "_$PIECE(Y,":",1,2)
WRITE !,?5,"Unit ml is not required",!
+3 SET GMRZ=$PIECE(^GMR(126,DA(1),"OUT",DA,0),"^",3)
IF ((GLABEL["URINE")!(GLABEL["DRAIN"))&(GMRZ="")
DO DRAIN^GMRYUT7
IF GMROUT!GMROUT(1)
Begin DoDot:1
+4 IF $PIECE((GX),"^",2)=""
DO KILLRC^GMRYINTK
End DoDot:1
SET GMROUT(1)=0
QUIT
+5 WRITE !,"Enter numeric value for measured output in cc/ml or ",!,"enter S(mall), M(edium) or L(arge) for estimated output.",!
+6 SET DIE="^GMR(126,"_DA(1)_","""_GNANS_""","
SET DR="1///^S X=GLABEL;3;5///^S X=""`""_DUZ;6///^S X=""`""_GHLOC;"_$SELECT(GLABEL["DRAIN"!(GLABEL["URINE"):"2///^S X=$S(GMRZ'="""":""`""_GMRZ,1:"""");",1:"")
+7 IF GLABEL["OTHER"
SET DR=DR_"4"
+8 DO WAIT^GMRYUT0
IF GMROUT
KILL DIE,DR
QUIT
+9 DO ^DIE
LOCK -^GMR(126,DFN)
KILL DIE,DR,GMRZ
IF $PIECE(^GMR(126,DA(1),GNANS,DA,0),"^",4)=""
DO KILLRC^GMRYINTK
QUIT
+10 IF GLABEL["DRAIN"
WRITE !,"Enter another DRAINAGE"
SET %=2
DO YN^DICN
IF %'=1
QUIT
DO MOREDRN^GMRYUT8
IF 'GMROUT
SET X=+GX
IF 'GMROUT
GOTO OUT
SET GMROUT=0
QUIT
+11 QUIT
IN ;EDIT OR DELETE INPUT RECORD
+1 DO INTAKE^GMRYINTK
+2 QUIT
SETDA SET GDATE=9999999-GMRDT
SET GDA=0
FOR
SET GDA=$ORDER(^GMR(126,DA,GNANS,"TYP",GMRDT,GTP,GDA))
IF GDA'>0
QUIT
SET GN=GN+1
SET GMRDATA(GN)=GDATE_"^"_GDA
+1 QUIT