NURAAU4 ;HIRMFO/MD-DRIVER FOR ACUITY COUNTS...(count) ;2/27/98 14:21
;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
HSKEEP2 ; SET VARIABLES AND CHECK FOR DISRUPTED PROCESS
S U="^",OUTSW=0 F X=1:1:4 S OUTSW(X)=0
; CHECK STATUS OF DATE NODE -- NUROUTSW='1' (stop job), '0' (run job)
S DATENODE=$G(^DIC(213.9,1,"DATE"))
I +$G(DATENODE)>DT S NUROUTSW=1 Q
I +$G(DATENODE)=DT,$P(DATENODE,U,2)=1 S OUTSW=1 ;day shift completion
I +$G(DATENODE)=DT,$P(DATENODE,U,6)=1 S OUTSW(1)=1 ;evening shift completion
I +$G(DATENODE)=DT,$P(DATENODE,U,10)=1 S OUTSW(2)=1 ;night shift completion
I +$G(DATENODE)=DT,$P(DATENODE,U,9)=1 S OUTSW(3)=1 ;separation/activation job completion
I +DATENODE=DT,OUTSW,OUTSW(1),OUTSW(2),OUTSW(3) S OUTSW(4)=1 Q ; quit if processing is up-to-date
I 'OUTSW S DFN(0)=$S($P(DATENODE,U,4)>0:$P(DATENODE,U,4)-1,1:0),NWARD(0)=$S($P(DATENODE,U,3)>0:$P(DATENODE,U,3)-1,1:0) ;get last day shift patient and ward processed
E S (NWARD(0),DFN(0))=0
I 'OUTSW(1) S DFN(1)=$S($P(DATENODE,U,8)>0:$P(DATENODE,U,8)-1,1:0),NWARD(1)=$S($P(DATENODE,U,7)>0:$P(DATENODE,U,7)-1,1:0) ; get last evening shift patient and ward processed
E S (NWARD(1),DFN(1))=0
I 'OUTSW(2) S DFN(2)=$S($P(DATENODE,U,12)>0:$P(DATENODE,U,12)-1,1:0),NWARD(2)=$S($P(DATENODE,U,11)>0:$P(DATENODE,U,11)-1,1:0) ;get last night shift patient and ward processed
E S (NWARD(2),DFN(2))=0
S $P(^DIC(213.9,1,"DATE"),U,2,12)=0_U_NWARD(0)_U_DFN(0)_U_U_0_U_NWARD(1)_U_DFN(1)_U_0_U_0_U_NWARD(2)_U_DFN(2)
Q
NURAAU4 ;HIRMFO/MD-DRIVER FOR ACUITY COUNTS...(count) ;2/27/98 14:21
+1 ;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
HSKEEP2 ; SET VARIABLES AND CHECK FOR DISRUPTED PROCESS
+1 SET U="^"
SET OUTSW=0
FOR X=1:1:4
SET OUTSW(X)=0
+2 ; CHECK STATUS OF DATE NODE -- NUROUTSW='1' (stop job), '0' (run job)
+3 SET DATENODE=$GET(^DIC(213.9,1,"DATE"))
+4 IF +$GET(DATENODE)>DT
SET NUROUTSW=1
QUIT
+5 ;day shift completion
IF +$GET(DATENODE)=DT
IF $PIECE(DATENODE,U,2)=1
SET OUTSW=1
+6 ;evening shift completion
IF +$GET(DATENODE)=DT
IF $PIECE(DATENODE,U,6)=1
SET OUTSW(1)=1
+7 ;night shift completion
IF +$GET(DATENODE)=DT
IF $PIECE(DATENODE,U,10)=1
SET OUTSW(2)=1
+8 ;separation/activation job completion
IF +$GET(DATENODE)=DT
IF $PIECE(DATENODE,U,9)=1
SET OUTSW(3)=1
+9 ; quit if processing is up-to-date
IF +DATENODE=DT
IF OUTSW
IF OUTSW(1)
IF OUTSW(2)
IF OUTSW(3)
SET OUTSW(4)=1
QUIT
+10 ;get last day shift patient and ward processed
IF 'OUTSW
SET DFN(0)=$SELECT($PIECE(DATENODE,U,4)>0:$PIECE(DATENODE,U,4)-1,1:0)
SET NWARD(0)=$SELECT($PIECE(DATENODE,U,3)>0:$PIECE(DATENODE,U,3)-1,1:0)
+11 IF '$TEST
SET (NWARD(0),DFN(0))=0
+12 ; get last evening shift patient and ward processed
IF 'OUTSW(1)
SET DFN(1)=$SELECT($PIECE(DATENODE,U,8)>0:$PIECE(DATENODE,U,8)-1,1:0)
SET NWARD(1)=$SELECT($PIECE(DATENODE,U,7)>0:$PIECE(DATENODE,U,7)-1,1:0)
+13 IF '$TEST
SET (NWARD(1),DFN(1))=0
+14 ;get last night shift patient and ward processed
IF 'OUTSW(2)
SET DFN(2)=$SELECT($PIECE(DATENODE,U,12)>0:$PIECE(DATENODE,U,12)-1,1:0)
SET NWARD(2)=$SELECT($PIECE(DATENODE,U,11)>0:$PIECE(DATENODE,U,11)-1,1:0)
+15 IF '$TEST
SET (NWARD(2),DFN(2))=0
+16 SET $PIECE(^DIC(213.9,1,"DATE"),U,2,12)=0_U_NWARD(0)_U_DFN(0)_U_U_0_U_NWARD(1)_U_DFN(1)_U_0_U_0_U_NWARD(2)_U_DFN(2)
+17 QUIT