source: FOIAVistA/trunk/r/NURSING_SERVICE-NUR/NURAAU0.m@ 1535

Last change on this file since 1535 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1NURAAU0 ;HIRMFO/RM,MD-DRIVER FOR ACUITY COUNTS...AMIS 1106a ;2/27/98 14:19
2 ;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
3EN1 ;DONE BY: DAILY BATCH RUN 12:00 AM TO 2:00 AM NURAAU2
4 ;DOES: HSKEEP2^NURAAU4
5 S X=$G(^DIC(213.9,1,"OFF")) Q:X=""!(X=1)
6 ; check if acuity job is currently running
7 I +$P(^DIC(213.9,1,"DATE"),U,13)>0 D:'$D(ZTQUEUED) G QUIT1
8 .W !!,"This option is currently running.",!! H 3
9 .Q
10 I $P(^DIC(213.9,1,"DATE"),U,1)>DT W:'$D(ZTQUEUED) !,"BATCH JOB HAS A FUTURE DATE. CALL IRM" G QUIT1 ;quit if DATE AMIS JOB LAST RUN is in future
11 L +^DIC(213.9,1,"DATE"):0 I '$T,$D(ZTQUEUED) D G QUIT1
12 . S ZTDTH=$$HADD^XLFDT($H,"","",59),ZTDESC="Requeued Nursing Acuity/Separation-Activation Run",ZTIO="",ZTRTN="EN1^NURAAU0" D ^%ZTLOAD
13 . Q
14 ;
15CONT ; start processing acuity totals
16 D ^NURAAU5 ; check if MAS wards have a Nursing Location.
17 S $P(^DIC(213.9,1,"DATE"),U,13)=$S($D(ZTQUEUED):ZTSK,1:1) ;set flag to show acuity job is running
18 S NUROUTSW=0 ; initialize processing switch (0=process/1=stop)
19 F D Q:NUROUTSW
20 .D HSKEEP2^NURAAU4 Q:NUROUTSW ; see when last job was run and set flags
21 .I OUTSW(4) W:'$D(ZTQUEUED) !,"BATCH JOB ALREADY COMPLETED" S NUROUTSW=1 Q
22 .I '$D(^NURSF(211.4,"ABS")) W:'$D(ZTQUEUED) !!,"No Bedsections associated with MAS units cannot process",! S NUROUTSW=1 Q
23 .S RPTDATE=+$G(^DIC(213.9,1,"DATE"))
24 .I +RPTDATE D EN2^NURAAU3 Q:NUROUTSW D ;purge old data and create new nodes
25 ..F BED=0:0 S BED=$O(^NURSF(211.4,"ABS",BED)) Q:BED'>0!(NUROUTSW) S BEDSECT=BED F NCWARD=0:0 S NCWARD=$O(^NURSF(211.4,"ABS",BED,NCWARD)) Q:NCWARD'>0!(NUROUTSW) I $P($G(^NURSF(211.4,NCWARD,1)),U)="A" W:'$D(ZTQUEUED) "." D Q:NUROUTSW
26 ...S NURTYPE=0 F I=1:1:5 S NCLASS(I)=0
27 ...F SHIFT="N","D","E" D FINALLY
28 ...Q
29 ..I 'OUTSW(2) D EN1^NURAMB1 ; process night shift acuity
30 ..I 'OUTSW S NURCENDT=(.15+RPTDATE),NURCUTDT=(.1445+RPTDATE) D ^NURSACEN ; Calculate hospital census at day shift cutoff time (AMIS acuity).
31 ..I 'OUTSW!'(OUTSW(1)) D EN1^NURAAU1 ; process day & evening shift acuity
32 ..I 'OUTSW(3) D EN1^NURAMU3 ; separation/activation update
33 ..S X=+$G(^DIC(213.9,1,"DATE")),$P(^DIC(213.9,1,"DATE"),U)=$$FMADD^XLFDT(X,1) H 5 ;add one day to last process date and wait 5 seconds
34 ..F X=2,6,9,10 S $P(^DIC(213.9,1,"DATE"),U,X)=1
35 ..I +$G(^DIC(213.9,1,"DATE"))=DT S NUROUTSW=1 ; if acuity totals are done through today, then set process flag to 1 (stop)
36 ..Q
37 .Q
38 S $P(^DIC(213.9,1,"DATE"),U,13)="" ;set flag to show acuity job is finished running
39QUIT ; unlock parameter node
40 L -^DIC(213.9,1,"DATE")
41QUIT1 ; kill local variables and close device
42 D KVAR^VADPT,^NURAKILL S:$D(ZTQUEUED) ZTREQ="@" D ^%ZISC
43 Q
44FINALLY ; ADD ACUITY COUNTS TO FILE
45 S X=RPTDATE_SHIFT_NCWARD D EN1^NURAMHU S DA(1)=DA ; EN1^NURAMHU creates/looks up 213.4 entries (AMIS 1106 MANHOURS file)
46 L +^NURSA(213.4,DA(1)):0 G:'$T FINALLY
47 I '$D(^NURSA(213.4,DA(1),1,0)) S ^NURSA(213.4,DA(1),1,0)="^213.41PA^^"
48 S DA=$O(^NURSA(213.4,DA(1),1,"B",+BEDSECT,0)) I +DA>0 G EDIT
49 S X=+BEDSECT,DLAYGO=213.41,DIC="^NURSA(213.4,DA(1),1,",DIC(0)="L" K DD
50 D FILE^DICN K DD,DLAYGO Q:+Y'>0
51 S DA=+Y,^NURSA(213.4,DA(1),1,DA,0)=+BEDSECT_"^0^0^0^0^0",^NURSA(213.4,DA(1),1,"B",+BEDSECT,DA)=""
52EDIT S ZERONOD=$G(^NURSA(213.4,DA(1),1,DA,0)) F X=2:1:6 S $P(^NURSA(213.4,DA(1),1,DA,0),U,X)=($P(ZERONOD,U,X)+NCLASS(X-1))
53 L -^NURSA(213.4,DA(1))
54 Q
Note: See TracBrowser for help on using the repository browser.