NURACEW1 ;HIRMFO/RM-CHECK FOR PATIENTS NOT CLASSIFIED BY WARD...cont. ;MAY 1985
;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ; ENTRY FROM NURACEW0, ASK TO CLASSIFY THOSE NOT CLASSIFIED TODAY
G:('$D(NURSTABL(1))) QUIT2
D SORTTABL S NURQUIT=0 F TCNT=1:1 D:$D(NURSTABL(TCNT))&'NURQUIT CHKCONT1 Q:'$D(NURSTABL(TCNT))!NURQUIT
G QUIT2
CHKCONT1 ;
W !!,$P(NURSTABL(TCNT),"^",2),?$X+10,ROOMTABL(TCNT)," OK" S %=1 D YN^DICN
I %=-1 S NURQUIT=1 Q
I %=1 S TABLSW=0 D EN1^NURACE0 Q
I %=2 D CHKCONT2 Q
W !,"ANSWER YES OR NO" G CHKCONT1
CHKCONT2 ;
W !!,"Do you wish to stop looping through names" S %=1 D YN^DICN
I %=-1!(%=1) S NURQUIT=1 Q
Q:%=2
W !,"ANSWER YES OR NO" G CHKCONT2
QUIT2 ; KILL REST OF VARIABLES USED IN ROUTINE
I $D(NURSTABL(1))&'PRTSW W !!,?16,"**** ROUTINE FINISHED ****",!!
K %,NS1,NURSA,NURSTABL,NURSTRAN,NURSX,TABLSW,TCNT
Q
SORTTABL ; THIS PUTS THE ARRAYS IN ORDER BY ROOM-BED (IF EXIST) OR NAME
K ^TMP($J) S NURSDTSW=0 S:$D(DATETABL) NURSDTSW=1
F NURSZ=1:1:NURSCNT D SETSORT
S NURSX=0,NURSZ="" F NURSA=0:0 S NURSZ=$O(^TMP($J,NURSZ)) Q:NURSZ="" S NURSY="" F NURSA=0:0 S NURSY=$O(^TMP($J,NURSZ,NURSY)) Q:NURSY="" F DFN=0:0 S DFN=$O(^TMP($J,NURSZ,NURSY,DFN)) Q:DFN'>0 S NURSX=NURSX+1 D RESETARR
Q K ^TMP($J) Q
RESETARR ;
S ROOMTABL(NURSX)=$S(NURSZ'=" EMPTY":NURSZ,1:"")
S NURSTABL(NURSX)=DFN_"^"_NURSY
S:NURSDTSW DATETABL(NURSX)=^TMP($J,NURSZ,NURSY,+NURSTABL(NURSX))
Q
SETSORT ;
Q:'$D(NURSTABL(NURSZ))!($P(NURSTABL(NURSZ),"^",2)="") S NURSWHO=$P(NURSTABL(NURSZ),"^",2)
S ^TMP($J,$S(ROOMTABL(NURSZ)'="":ROOMTABL(NURSZ),1:" EMPTY"),NURSWHO,+NURSTABL(NURSZ))=$S('NURSDTSW:"",1:DATETABL(NURSZ))
Q
NURACEW1 ;HIRMFO/RM-CHECK FOR PATIENTS NOT CLASSIFIED BY WARD...cont. ;MAY 1985
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ; ENTRY FROM NURACEW0, ASK TO CLASSIFY THOSE NOT CLASSIFIED TODAY
+1 IF ('$DATA(NURSTABL(1)))
GOTO QUIT2
+2 DO SORTTABL
SET NURQUIT=0
FOR TCNT=1:1
IF $DATA(NURSTABL(TCNT))&'NURQUIT
DO CHKCONT1
IF '$DATA(NURSTABL(TCNT))!NURQUIT
QUIT
+3 GOTO QUIT2
CHKCONT1 ;
+1 WRITE !!,$PIECE(NURSTABL(TCNT),"^",2),?$X+10,ROOMTABL(TCNT)," OK"
SET %=1
DO YN^DICN
+2 IF %=-1
SET NURQUIT=1
QUIT
+3 IF %=1
SET TABLSW=0
DO EN1^NURACE0
QUIT
+4 IF %=2
DO CHKCONT2
QUIT
+5 WRITE !,"ANSWER YES OR NO"
GOTO CHKCONT1
CHKCONT2 ;
+1 WRITE !!,"Do you wish to stop looping through names"
SET %=1
DO YN^DICN
+2 IF %=-1!(%=1)
SET NURQUIT=1
QUIT
+3 IF %=2
QUIT
+4 WRITE !,"ANSWER YES OR NO"
GOTO CHKCONT2
QUIT2 ; KILL REST OF VARIABLES USED IN ROUTINE
+1 IF $DATA(NURSTABL(1))&'PRTSW
WRITE !!,?16,"**** ROUTINE FINISHED ****",!!
+2 KILL %,NS1,NURSA,NURSTABL,NURSTRAN,NURSX,TABLSW,TCNT
+3 QUIT
SORTTABL ; THIS PUTS THE ARRAYS IN ORDER BY ROOM-BED (IF EXIST) OR NAME
+1 KILL ^TMP($JOB)
SET NURSDTSW=0
IF $DATA(DATETABL)
SET NURSDTSW=1
+2 FOR NURSZ=1:1:NURSCNT
DO SETSORT
+3 SET NURSX=0
SET NURSZ=""
FOR NURSA=0:0
SET NURSZ=$ORDER(^TMP($JOB,NURSZ))
IF NURSZ=""
QUIT
SET NURSY=""
FOR NURSA=0:0
SET NURSY=$ORDER(^TMP($JOB,NURSZ,NURSY))
IF NURSY=""
QUIT
FOR DFN=0:0
SET DFN=$ORDER(^TMP($JOB,NURSZ,NURSY,DFN))
IF DFN'>0
QUIT
SET NURSX=NURSX+1
DO RESETARR
Q KILL ^TMP($JOB)
QUIT
RESETARR ;
+1 SET ROOMTABL(NURSX)=$SELECT(NURSZ'=" EMPTY":NURSZ,1:"")
+2 SET NURSTABL(NURSX)=DFN_"^"_NURSY
+3 IF NURSDTSW
SET DATETABL(NURSX)=^TMP($JOB,NURSZ,NURSY,+NURSTABL(NURSX))
+4 QUIT
SETSORT ;
+1 IF '$DATA(NURSTABL(NURSZ))!($PIECE(NURSTABL(NURSZ),"^",2)="")
QUIT
SET NURSWHO=$PIECE(NURSTABL(NURSZ),"^",2)
+2 SET ^TMP($JOB,$SELECT(ROOMTABL(NURSZ)'="":ROOMTABL(NURSZ),1:" EMPTY"),NURSWHO,+NURSTABL(NURSZ))=$SELECT('NURSDTSW:"",1:DATETABL(NURSZ))
+3 QUIT