source: FOIAVistA/trunk/r/DSS_EXTRACTS-ECX/ECXANUR.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1ECXANUR ;ALB/JAP - NUR Extract Audit Report ;Oct 15, 1997
2 ;;3.0;DSS EXTRACTS;**8**;Dec 22, 1997
3 ;
4EN ;entry point for NUR extract audit report
5 N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR
6 S ECXERR=0
7 ;ecxaud=0 for 'extract' audit
8 S ECXHEAD="NUR",ECXAUD=0
9 W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
10 ;select extract
11 D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
12 Q:ECXERR
13 ;determine if facility is multidivisional
14 S DIC="^DG(43,",DA=1,DR="11;",DIQ="ECX",DIQ(0)="I" D EN^DIQ1
15 I +ECX(43,1,11,"I")=0 S ECXALL=1
16 I +ECX(43,1,11,"I")=1 D
17 .W !!
18 .S DIR(0)="Y",DIR("A")="Do you want the "_ECXHEAD_" extract audit report for all divisions"
19 .S DIR("B")="NO" D ^DIR K DIR
20 .I $G(DIRUT) S ECXERR=1 Q
21 .;if y=0 i.e., 'no', then ecxall=0 i.e., 'selected'
22 .S ECXALL=Y
23 I ECXERR=1 D Q
24 .W !!,?5,"Try again later... exiting.",!
25 .D AUDIT^ECXKILL
26 ;select divisions/sites; all divisions if ecxall=1
27 S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
28 D NUR^ECXDVSN1(.ECXDIV,ECXALL,.ECXERR)
29 I ECXERR=1 D Q
30 .W !!,?5,"Try again later... exiting.",!
31 .D AUDIT^ECXKILL
32 ;determine output device and queue if requested
33 W !
34 S ECXPGM="PROCESS^ECXANUR",ECXDESC="NUR Extract Audit Report"
35 S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXALL")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")=""
36 W !
37 D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
38 I ECXSAVE("POP")=1 D Q
39 .W !!,?5,"Try again later... exiting.",!
40 .D AUDIT^ECXKILL
41 I ECXSAVE("ZTSK")=0 D
42 .K ECXSAVE,ECXPGM,ECXDESC
43 .D PROCESS^ECXANUR
44 I IO'=IO(0) D ^%ZISC
45 D HOME^%ZIS
46 D AUDIT^ECXKILL
47 Q
48 ;
49PROCESS ;process data in file #727.805
50 N X,Y,W,DATA,DATE,DIV,IEN,LOC,PAT,BD,BDS,QQFLG,CNT
51 K ^TMP($J,"ECXAUD")
52 S (CNT,QQFLG)=0
53 S ECXEXT=ECXARRAY("EXTRACT"),ECXDEF=ECXARRAY("DEF")
54 S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
55 ;get run date in external format
56 D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S ECXRUN=Y
57 ;get records in date range and ward set
58 S IEN="" F S IEN=$O(^ECX(727.805,"AC",ECXEXT,IEN)) Q:IEN="" D
59 .S DATA=^ECX(727.805,IEN,0),DATE=$P(DATA,U,9),LOC=$P(DATA,U,13)
60 .;convert free text date to fm internal format date
61 .S $E(DATE,1,2)=$E(DATE,1,2)-17
62 .Q:$L(DATE)<7 Q:(DATE<ECXSTART) Q:(DATE>ECXEND)
63 .;if ward is among those selected, then tally nursing data
64 .I $D(ECXDIV(LOC)) D
65 ..S DIV="",DIV=$O(ECXDIV(LOC,DIV))
66 ..S PAT=$P(DATA,U,10),BD=$P(DATA,U,14)
67 ..I '$D(^TMP($J,"ECXAUD",DIV,LOC,BD,PAT)) S ^TMP($J,"ECXAUD",DIV,LOC,BD,PAT)=0
68 ..S ^(PAT)=^TMP($J,"ECXAUD",DIV,LOC,BD,PAT)+1,CNT=CNT+1
69 ..I $D(ZTQUEUED),(CNT>499),'(CNT#500),$$S^%ZTLOAD S QQFLG=1,ZTSTOP=1 K ZTREQ
70 ;after all extract records processed, get bedsection names for printing
71 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
72 S IEN=0 F S IEN=$O(^NURSF(213.3,IEN)) Q:+IEN=0 S BDS(IEN)=$P(^NURSF(213.3,IEN,0),U,1)
73 ;print the report
74 D PRINT
75 D AUDIT^ECXKILL
76 Q
77 ;
78PRINT ;print the nursing classification data by division and location order
79 N JJ,SS,LN,NM,BDNM,NLNM,DIV,DIVNM,LOC,PG,QFLG,BTOT,GTOT,STOT,DIR,DIRUT,DTOUT,DUOUT
80 U IO
81 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
82 S (QFLG,PG)=0,$P(LN,"-",80)="",DIV=""
83 F S DIV=$O(ECXDIV("D",DIV)) Q:DIV="" D Q:QFLG
84 .S DIVNM=$P(ECXDIV("D",DIV),U,2)_" ("_$P(ECXDIV("D",DIV),U,3)_")" D HEADER
85 .I '$D(^TMP($J,"ECXAUD",DIV)) D Q
86 ..W !!,?3,"No data available for this division.",!!
87 .F JJ=1:1:5 S GTOT(JJ)=0,GTOT("T")=0
88 .I $D(^TMP($J,"ECXAUD",DIV)) S LOC="" F S LOC=$O(^TMP($J,"ECXAUD",DIV,LOC)) Q:LOC="" D Q:QFLG
89 ..F JJ=1:1:5 S STOT(JJ)=0,STOT("T")=0
90 ..S NLNM=$P(ECXDIV(LOC,DIV),U,2)_" ("_LOC_")",BD=""
91 ..D:($Y+3>IOSL) HEADER Q:QFLG W !,NLNM
92 ..F S BD=$O(^TMP($J,"ECXAUD",DIV,LOC,BD)) Q:BD="" D Q:QFLG
93 ...F PAT=1:1:5 S TOT(PAT)=+$G(^TMP($J,"ECXAUD",DIV,LOC,BD,PAT))
94 ...S BDNM=BDS(BD),BDNM=$E(BDNM,1,22)_" ("_BD_")",BTOT=0 F JJ=1:1:5 S BTOT=BTOT+TOT(JJ)
95 ...;write the bedsection totals
96 ...D:($Y+3>IOSL) HEADER Q:QFLG
97 ...W !,?3,BDNM,?33,$$RJ^XLFSTR(TOT(1),5," "),?41,$$RJ^XLFSTR(TOT(2),5," "),?50,$$RJ^XLFSTR(TOT(3),5," "),?57,$$RJ^XLFSTR(TOT(4),5," "),?64,$$RJ^XLFSTR(TOT(5),5," "),?74,$$RJ^XLFSTR(BTOT,5," ")
98 ...;increment grand total and subtotal
99 ...F JJ=1:1:5 S GTOT(JJ)=GTOT(JJ)+TOT(JJ),STOT(JJ)=STOT(JJ)+TOT(JJ)
100 ...S GTOT("T")=GTOT("T")+BTOT,STOT("T")=STOT("T")+BTOT
101 ..;write the location subtotals
102 ..D:($Y+3>IOSL) HEADER Q:QFLG W !,?33,$E(LN,1,46)
103 ..D:($Y+3>IOSL) HEADER Q:QFLG W !,"Sub-totals for Location ("_LOC_"):"
104 ..W ?33,$$RJ^XLFSTR(STOT(1),5," "),?41,$$RJ^XLFSTR(STOT(2),5," "),?50,$$RJ^XLFSTR(STOT(3),5," "),?57,$$RJ^XLFSTR(STOT(4),5," "),?64,$$RJ^XLFSTR(STOT(5),5," "),?74,$$RJ^XLFSTR(STOT("T"),5," ")
105 ..D:($Y+3>IOSL) HEADER Q:QFLG W !!
106 .;write the division grand totals
107 .D:($Y+3>IOSL) HEADER Q:QFLG W !!,"Grand Totals for "_DIVNM_":"
108 .W ?33,$$RJ^XLFSTR(GTOT(1),5," "),?41,$$RJ^XLFSTR(GTOT(2),5," "),?50,$$RJ^XLFSTR(GTOT(3),5," "),?57,$$RJ^XLFSTR(GTOT(4),5," "),?64,$$RJ^XLFSTR(GTOT(5),5," "),?74,$$RJ^XLFSTR(GTOT("T"),5," ")
109 ;print the audit descriptive narrative
110 I $E(IOST)'="C" D
111 .W @IOF S PG=PG+1
112 .W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
113 .W !,"DSS Extract Log #: "_ECXEXT
114 .W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
115 .W !,"Report Run Date/Time: "_ECXRUN,?68,"Page: ",PG
116 .W !!,LN,!!
117 .S DIC="^ECX(727.1,",DA=ECXARRAY("DEF"),DR="1" D EN^DIQ
118 I $E(IOST)="C",'QFLG D
119 .S SS=22-$Y F JJ=1:1:SS W !
120 .S DIR(0)="E" W ! D ^DIR K DIR
121 Q
122 ;
123HEADER ;header and page control
124 N JJ,SS
125 I $E(IOST)="C" D
126 .S SS=22-$Y F JJ=1:1:SS W !
127 .I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y QFLG=1
128 Q:QFLG
129 W:$Y!($E(IOST)="C") @IOF S PG=PG+1
130 W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
131 W !,"DSS Extract Log #: "_ECXARRAY("EXTRACT")
132 W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
133 W !,"Report Run Date/Time: "_ECXRUN
134 W !,"Medical Center Division: "_$P(ECXDIV("D",DIV),U,2)_" ("_$P(ECXDIV("D",DIV),U,3)_")",?68,"Page: "_PG
135 W !!,"Nursing Location",?36,"Patients per Acuity Level (Category)"
136 W !,?3,"Nursing Bedsection",?37,"I",?44,"II",?52,"III",?60,"IV",?68,"V",?74,"Total"
137 W !,LN,!
138 Q
Note: See TracBrowser for help on using the repository browser.