NURCYED0 ;HIRMFO/YH,FT-PATIENT INTAKE/OUTPUT ENTER/EDIT ;9/16/96 14:31
;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ;CALL TO EDIT PATIENT OUTPUT
S X="GMRYED1" X ^%ZOSF("TEST") Q:'$T S (GNUROP,NUROP)=1 D EDIT,Q Q
EN2 ;CALL TO EDIT INTAKE
S X="GMRYED1" X ^%ZOSF("TEST") Q:'$T S (GNUROP,NUROP)=2 D EDIT,Q Q
EN3 ;IV AND IV MAINTENANCE
S X="GMRYED1" X ^%ZOSF("TEST") Q:'$T S (GNUROP,NUROP)=3 D EDIT,Q Q
EDIT ;
S (NURQUIT,NURQUIT(1))=0 D WARDPAT^NURCVUT0 Q:NURQUIT!(NUREDB["S"&'$D(NRMBD)) D SETUTIL I '$D(^TMP($J)) W:"Ss"[NUREDB !,"*** NO PATIENTS REGISTERED IN THESE ROOMS",! Q
S NURRM="" F S NURRM=$O(^TMP($J,NURRM)) Q:NURRM=""!NURQUIT S NBED="" F S NBED=$O(^TMP($J,NURRM,NBED)) Q:NBED=""!NURQUIT S NURNAM="" F S NURNAM=$O(^TMP($J,NURRM,NBED,NURNAM)) Q:NURNAM=""!NURQUIT D EDTPT
Q
EDTPT ;
S DFN=0 F S DFN=$O(^TMP($J,NURRM,NBED,NURNAM,DFN)) Q:DFN'>0!NURQUIT D CHECK Q:DA'>0 D:"Pp"'[NUREDB ASKOK Q:NURQUIT D EDIT2
Q
EDIT2 I 'NURQUIT(1) S GMROUT=0 D 1^VADPT S GMRHLOC=0 I $D(^DIC(42,+$P(VAIN(4),"^"),44)) S GMRHLOC=+$P(^(44),"^")
I 'NURQUIT(1) W:GMRHLOC'>0 !,"HOSPITAL LOCATION NOT AVAILABLE",! D:GMRHLOC>0 OUTPUT^GMRYED1:GNUROP=1,INPUT^GMRYED1:GNUROP=2,LIST^GMRYED3:GNUROP=3 S (GMROUT,NURQUIT)=0 S:"Pp"[NUREDB NURQUIT=1
Q
ASKOK ; LOOPING THROUGH NAMES
S NURQUIT(1)=0 W !,NURNAM,?$X+10,$S(NURRM=" BLANK":" ",1:NURRM)_"-"_$S(NBED=" BLANK":" ",1:NBED_" ") S %=1 D YN^DICN I %=1!(%=-1) S:%=-1 NURQUIT=1 Q
I '% W $C(7),!,?4,"ANSWER 'YES' or 'NO'" G ASKOK
ASL W !,"Do you wish to stop looping through names?" S %=1 D YN^DICN W ! I %=1!(%=-1) S NURQUIT=1 Q
I '% W $C(7),!,?4,"ANSWER 'YES' or 'NO'" G ASL
S NURQUIT(1)=1
Q
SETUTIL ; SET ARRAY OF PATIENTS
K ^TMP($J) I "Pp"[NUREDB S NURWARD=$S($D(^NURSF(214,DFN,0)):$P(^(0),"^",3),1:"") D WRDST
I "SsUu"[NUREDB F DFN=0:0 S DFN=$O(^NURSF(214,"AF","A",NURWARD,DFN)) Q:DFN'>0 D WRDST
Q
WRDST ; SET UTILITY FOR PATIENTS ON WARD
W:$E(IOST)="C" "." D 1^VADPT
Q:"Ss"[NUREDB&($S(VAIN(5)="":1,1:'$D(NRMBD($P($P(VAIN(5),"^"),"-",1,2)))))!(VADM(1)="")
S ^TMP($J,$S($P($P(VAIN(5),"^"),"-")'="":$P($P(VAIN(5),"^"),"-"),1:" BLANK"),$S($P($P(VAIN(5),"^"),"-",2)'="":$P($P(VAIN(5),"^"),"-",2),1:" BLANK"),VADM(1),DFN)=""
Q
DATE ; CALL TO SET AND GMRVIDT (WHEN THE VITALS WERE TAKEN)
; ALSO RETURNS NURQUIT=1 IF TIMEOUT OR UPARROW OUT.
S X="^",%DT("A")="ENTER DATE (TIME Required) VITALS WERE TAKEN: ",%DT="XAPETR",%DT(0)="-NOW" D ^%DT K %DT
I Y<0!(X="^") S NURQUIT=1 Q
S GMRVIDT=Y
Q
Q ;
D KVAR^VADPT K NURP,NURX,NRMBD,NURI,NURLEN,NURRMST,GMRQUAL,GMRHLOC,DA,GNUROP,ND1,NDA,NORM,NPWARD,NURQUIT,NUREDB,NURSX,NURSY,NURWARD,NURWLO,NWLOC,POP,VA,DFN,GMROUT,NURHLO,NURRM,GDA,NURNAM,NBED,NUROP,NUROUT,X,Y
Q
CHECK I '$D(^GMR(126,0)) S ^GMR(126,0)="PATIENT I/O FILE^126P^0^0"
S X=DFN,DIC(0)="Z",DIC="^GMR(126,",D="B" D MIX^DIC1 S:Y>0 DA=+$P(Y,"^") G:Y>0 NEXT K DD S (DINUM,X)=DFN,DIC(0)="L",DLAYGO=126 D FILE^DICN S DA=+$P(Y,"^")
NEXT K DIC,DDLAYGO,DO,DD Q
NURCYED0 ;HIRMFO/YH,FT-PATIENT INTAKE/OUTPUT ENTER/EDIT ;9/16/96 14:31
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ;CALL TO EDIT PATIENT OUTPUT
+1 SET X="GMRYED1"
XECUTE ^%ZOSF("TEST")
IF '$TEST
QUIT
SET (GNUROP,NUROP)=1
DO EDIT
DO Q
QUIT
EN2 ;CALL TO EDIT INTAKE
+1 SET X="GMRYED1"
XECUTE ^%ZOSF("TEST")
IF '$TEST
QUIT
SET (GNUROP,NUROP)=2
DO EDIT
DO Q
QUIT
EN3 ;IV AND IV MAINTENANCE
+1 SET X="GMRYED1"
XECUTE ^%ZOSF("TEST")
IF '$TEST
QUIT
SET (GNUROP,NUROP)=3
DO EDIT
DO Q
QUIT
EDIT ;
+1 SET (NURQUIT,NURQUIT(1))=0
DO WARDPAT^NURCVUT0
IF NURQUIT!(NUREDB["S"&'$DATA(NRMBD))
QUIT
DO SETUTIL
IF '$DATA(^TMP($JOB))
IF "Ss"[NUREDB
WRITE !,"*** NO PATIENTS REGISTERED IN THESE ROOMS",!
QUIT
+2 SET NURRM=""
FOR
SET NURRM=$ORDER(^TMP($JOB,NURRM))
IF NURRM=""!NURQUIT
QUIT
SET NBED=""
FOR
SET NBED=$ORDER(^TMP($JOB,NURRM,NBED))
IF NBED=""!NURQUIT
QUIT
SET NURNAM=""
FOR
SET NURNAM=$ORDER(^TMP($JOB,NURRM,NBED,NURNAM))
IF NURNAM=""!NURQUIT
QUIT
DO EDTPT
+3 QUIT
EDTPT ;
+1 SET DFN=0
FOR
SET DFN=$ORDER(^TMP($JOB,NURRM,NBED,NURNAM,DFN))
IF DFN'>0!NURQUIT
QUIT
DO CHECK
IF DA'>0
QUIT
IF "Pp"'[NUREDB
DO ASKOK
IF NURQUIT
QUIT
DO EDIT2
+2 QUIT
EDIT2 IF 'NURQUIT(1)
SET GMROUT=0
DO 1^VADPT
SET GMRHLOC=0
IF $DATA(^DIC(42,+$PIECE(VAIN(4),"^"),44))
SET GMRHLOC=+$PIECE(^(44),"^")
+1 IF 'NURQUIT(1)
IF GMRHLOC'>0
WRITE !,"HOSPITAL LOCATION NOT AVAILABLE",!
IF GMRHLOC>0
IF GNUROP=1
DO OUTPUT^GMRYED1
IF GNUROP=2
DO INPUT^GMRYED1
IF GNUROP=3
DO LIST^GMRYED3
SET (GMROUT,NURQUIT)=0
IF "Pp"[NUREDB
SET NURQUIT=1
+2 QUIT
ASKOK ; LOOPING THROUGH NAMES
+1 SET NURQUIT(1)=0
WRITE !,NURNAM,?$X+10,$SELECT(NURRM=" BLANK":" ",1:NURRM)_"-"_$SELECT(NBED=" BLANK":" ",1:NBED_" ")
SET %=1
DO YN^DICN
IF %=1!(%=-1)
IF %=-1
SET NURQUIT=1
QUIT
+2 IF '%
WRITE $CHAR(7),!,?4,"ANSWER 'YES' or 'NO'"
GOTO ASKOK
ASL WRITE !,"Do you wish to stop looping through names?"
SET %=1
DO YN^DICN
WRITE !
IF %=1!(%=-1)
SET NURQUIT=1
QUIT
+1 IF '%
WRITE $CHAR(7),!,?4,"ANSWER 'YES' or 'NO'"
GOTO ASL
+2 SET NURQUIT(1)=1
+3 QUIT
SETUTIL ; SET ARRAY OF PATIENTS
+1 KILL ^TMP($JOB)
IF "Pp"[NUREDB
SET NURWARD=$SELECT($DATA(^NURSF(214,DFN,0)):$PIECE(^(0),"^",3),1:"")
DO WRDST
+2 IF "SsUu"[NUREDB
FOR DFN=0:0
SET DFN=$ORDER(^NURSF(214,"AF","A",NURWARD,DFN))
IF DFN'>0
QUIT
DO WRDST
+3 QUIT
WRDST ; SET UTILITY FOR PATIENTS ON WARD
+1 IF $EXTRACT(IOST)="C"
WRITE "."
DO 1^VADPT
+2 IF "Ss"[NUREDB&($SELECT(VAIN(5)=""
QUIT
+3 SET ^TMP($JOB,$SELECT($PIECE($PIECE(VAIN(5),"^"),"-")'="":$PIECE($PIECE(VAIN(5),"^"),"-"),1:" BLANK"),$SELECT($PIECE($PIECE(VAIN(5),"^"),"-",2)'="":$PIECE($PIECE(VAIN(5),"^"),"-",2),1:" BLANK"),VADM(1),DFN)=""
+4 QUIT
DATE ; CALL TO SET AND GMRVIDT (WHEN THE VITALS WERE TAKEN)
+1 ; ALSO RETURNS NURQUIT=1 IF TIMEOUT OR UPARROW OUT.
+2 SET X="^"
SET %DT("A")="ENTER DATE (TIME Required) VITALS WERE TAKEN: "
SET %DT="XAPETR"
SET %DT(0)="-NOW"
DO ^%DT
KILL %DT
+3 IF Y<0!(X="^")
SET NURQUIT=1
QUIT
+4 SET GMRVIDT=Y
+5 QUIT
Q ;
+1 DO KVAR^VADPT
KILL NURP,NURX,NRMBD,NURI,NURLEN,NURRMST,GMRQUAL,GMRHLOC,DA,GNUROP,ND1,NDA,NORM,NPWARD,NURQUIT,NUREDB,NURSX,NURSY,NURWARD,NURWLO,NWLOC,POP,VA,DFN,GMROUT,NURHLO,NURRM,GDA,NURNAM,NBED,NUROP,NUROUT,X,Y
+2 QUIT
CHECK IF '$DATA(^GMR(126,0))
SET ^GMR(126,0)="PATIENT I/O FILE^126P^0^0"
+1 SET X=DFN
SET DIC(0)="Z"
SET DIC="^GMR(126,"
SET D="B"
DO MIX^DIC1
IF Y>0
SET DA=+$PIECE(Y,"^")
IF Y>0
GOTO NEXT
KILL DD
SET (DINUM,X)=DFN
SET DIC(0)="L"
SET DLAYGO=126
DO FILE^DICN
SET DA=+$PIECE(Y,"^")
NEXT KILL DIC,DDLAYGO,DO,DD
QUIT