source: WorldVistAEHR/trunk/r/DSS_EXTRACTS-ECX/ECXADEN.m@ 1556

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

initial load of WorldVistAEHR

File size: 7.1 KB
RevLine 
[613]1ECXADEN ;ALB/JAP - DEN Extract Audit Report ;Oct 10, 1997
2 ;;3.0;DSS EXTRACTS;**8**;Dec 22, 1997
3 ;
4EN ;entry point for DEN extract audit report
5 ;select extract
6 N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR,SITES,ECX
7 ;ecxaud=0 for 'extract' audit
8 S ECXERR=0
9 S ECXHEAD="DEN",ECXAUD=0
10 W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
11 D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
12 Q:ECXERR
13 ;determine if facility is multidivisional
14 K ECX D FILE^DID(225,,"ENTRIES","ECX") S SITES=ECX("ENTRIES") K ECX
15 I SITES=1 S ECXALL=1
16 I SITES>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 W !
28 S ECXSTART=ECXARRAY("START"),ECXEND=ECXARRAY("END")
29 D DEN^ECXDVSN(.ECXDIV,ECXALL,.ECXERR)
30 I ECXERR=1 D Q
31 .W !!,?5,"Try again later... exiting.",!
32 .D AUDIT^ECXKILL
33 ;determine output device and queue if requested
34 S ECXPGM="PROCESS^ECXADEN",ECXDESC="DEN 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^ECXADEN
44 I IO'=IO(0) D ^%ZISC
45 D HOME^%ZIS
46 D AUDIT^ECXKILL
47 Q
48 ;
49PROCESS ;process data in file #727.806
50 N X,Y,JJ,DATE,DIV,IEN,DFN,SXAM,CXAM,EXAM,PT,TMP,TOTPTS,QQFLG,CNT
51 K ^TMP($J,"ECXAUD"),^TMP($J,"ECXPATS"),^TMP($J,"ECXPROC")
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 ;convert ecxdiv array to be subscripted by dental site id #
58 S JJ=0 F S JJ=$O(ECXDIV(JJ)) Q:JJ="" S DIV=$P(ECXDIV(JJ),U,3),DIV(DIV)=JJ
59 ;get records within date range and dental site(s)
60 S IEN="" F S IEN=$O(^ECX(727.806,"AC",ECXEXT,IEN)) Q:IEN="" D Q:QQFLG
61 .S PT=^ECX(727.806,IEN,0)
62 .S DATE=$P(PT,U,9),DIV=$P(PT,U,41)
63 .;convert free text date to fm internal format date
64 .S $E(DATE,1,2)=$E(DATE,1,2)-17
65 .Q:$L(DATE)<7 Q:(DATE<ECXSTART) Q:(DATE>ECXEND)
66 .;if dental division is in selected set, then tally dental data
67 .Q:'$D(DIV(DIV))
68 .S DFN=$P(PT,U,5),(SXAM,CXAM)=0,EXAM=$P(PT,U,11) S:EXAM="S" SXAM=1 S:EXAM="C" CXAM=1
69 .S DATA=SXAM_U_CXAM_U
70 .S DATA=DATA_+$P(PT,U,44)_U_+$P(PT,U,13)_U_+$P(PT,U,14)_U_+$P(PT,U,18)_U_+$P(PT,U,24)_U_+$P(PT,U,25)_U_+$P(PT,U,26)_U_+$P(PT,U,27)_U
71 .S DATA=DATA_+$P(PT,U,15)_U_+$P(PT,U,16)_U_+$P(PT,U,38)_U_+$P(PT,U,39)_U_+$P(PT,U,19)_U_+$P(PT,U,20)_U_+$P(PT,U,21)_U
72 .S DATA=DATA_+$P(PT,U,30)_U_+$P(PT,U,31)_U_+$P(PT,U,32)_U_+$P(PT,U,33)_U_+$P(PT,U,34)_U_+$P(PT,U,35)_U_+$P(PT,U,36)
73 .I '$D(^TMP($J,"ECXAUD",DIV,DFN)) S ^TMP($J,"ECXAUD",DIV,DFN)="0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0^0"
74 .S TMP=^TMP($J,"ECXAUD",DIV,DFN)
75 .F JJ=1:1:24 S $P(TMP,U,JJ)=$P(TMP,U,JJ)+$P(DATA,U,JJ)
76 .S ^TMP($J,"ECXAUD",DIV,DFN)=TMP,CNT=CNT+1
77 .I $D(ZTQUEUED),(CNT>499),'(CNT#500),$$S^%ZTLOAD S QQFLG=1,ZTSTOP=1 K ZTREQ Q
78 ;after all dental extract records processed, then do totals by patient and procedure
79 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
80 S DIV="" F S DIV=$O(DIV(DIV)) Q:DIV="" S TOTPTS(DIV)=0 F JJ=1:1:24 S ^TMP($J,"ECXPROC",DIV,JJ)=0,^TMP($J,"ECXPATS",DIV,JJ)=0
81 S DIV="" F S DIV=$O(^TMP($J,"ECXAUD",DIV)) Q:DIV="" D
82 .S DFN="" F S DFN=$O(^TMP($J,"ECXAUD",DIV,DFN)) Q:DFN="" D
83 ..S TMP=^TMP($J,"ECXAUD",DIV,DFN),TOTPTS(DIV)=TOTPTS(DIV)+1
84 ..F JJ=1:1:24 S ^TMP($J,"ECXPROC",DIV,JJ)=^TMP($J,"ECXPROC",DIV,JJ)+$P(TMP,U,JJ) I +$P(TMP,U,JJ)>0 S ^TMP($J,"ECXPATS",DIV,JJ)=^TMP($J,"ECXPATS",DIV,JJ)+1
85 ;print the report
86 D PRINT
87 D AUDIT^ECXKILL
88 Q
89 ;
90PRINT ;print the DEN audit report by dental site
91 N LN,P,PG,SS,QFLG,GTPROC,GTPAT,TPROC,TPAT,DIEN,TEXT
92 U IO
93 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTREQ Q
94 S (QFLG,PG)=0,$P(LN,"-",80)="",DIV=""
95 F S DIV=$O(^TMP($J,"ECXPROC",DIV)) Q:DIV="" S DIEN=DIV(DIV) D Q:QFLG
96 .S (GTPROC,GTPAT)=0
97 .D HEADER Q:QFLG
98 .I TOTPTS(DIV)=0 D Q
99 ..W !!,?28,"No data for Dental Site "_$P(ECXDIV(DIEN),U,3)_".",!
100 .S GTPAT=TOTPTS(DIV)
101 .F P=1:1:24 D Q:QFLG
102 ..S TEXT=$T(DENT+P),TEXT=$P(TEXT,";;",2),TPROC=^TMP($J,"ECXPROC",DIV,P),TPAT=^TMP($J,"ECXPATS",DIV,P),GTPROC=GTPROC+TPROC
103 ..D:($Y+3>IOSL) HEADER Q:QFLG
104 ..W !,$E($P(TEXT,U,1),1,25),?28,$E($P(TEXT,U,2),1,25),?56,$$RJ^XLFSTR(TPROC,5," "),?70,$$RJ^XLFSTR(TPAT,5," ")
105 .D:($Y+3>IOSL) HEADER Q:QFLG W !!
106 .D:($Y+3>IOSL) HEADER Q:QFLG W !,?56,"-----",?70,"-----"
107 .D:($Y+3>IOSL) HEADER Q:QFLG W !,"Totals for Dental Site "_$P(ECXDIV(DIEN),U,3)_":",?56,$$RJ^XLFSTR(GTPROC,5," "),?70,$$RJ^XLFSTR(GTPAT,5," ")," **"
108 .D:($Y+3>IOSL) HEADER Q:QFLG W !!,"** Total # of unique patients.",!
109 I $E(IOST)'="C" D
110 .W @IOF S PG=PG+1
111 .W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
112 .W !,"DSS Extract Log #: "_ECXEXT
113 .W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
114 .W !,"Report Run Date/Time: "_ECXRUN,?70,"Page: ",PG
115 .W !!,LN,!!
116 .S DIC="^ECX(727.1,",DA=ECXARRAY("DEF"),DR="1" D EN^DIQ
117 .W @IOF
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 #: "_ECXEXT
132 W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
133 W !,"Report Run Date/Time: "_ECXRUN
134 I $P(ECXDIV(DIEN),U,2)="" S $P(ECXDIV(DIEN),U,2)="Unknown"
135 W !,"Dental Site: "_$P(ECXDIV(DIEN),U,3)_" ("_$P(ECXDIV(DIEN),U,2)_")",?70,"Page: "_PG
136 W !!,?56,"# of",?70,"# of"
137 W !,"DSS Procedure",?28,"Dental Procedure",?56,"Procedures",?70,"Patients"
138 W !,LN,!
139 Q
140 ;
141DENT ;;procedure names for report
142 ;;Screening Exam^ SCREENING EXAMINATION
143 ;;Complete Exam^ COMPLETE EXAMINATION
144 ;;Evaluation^ EVALUATION
145 ;;X-Rays Extraoral^ DIAGNOSTIC FILMS-EXTRAORAL
146 ;;X-Rays Intraoral^ DIAGNOSTIC FILMS-INTRAORAL
147 ;;Neoplasm Confirmed Malignant^ MALIGNANT NEOPLASM CONFIRMED
148 ;;Surfaces Restored^ SURFACE RESTORED
149 ;;Root Canal Therapy^ ROOT CANAL FILLED
150 ;;Periodontal Quads (Surgical)^ QUADRANT OF PERIODONTAL SURGERY
151 ;;Periodontal Quads (Root Plane)^ QUADRANT OF ROOT PLANING AND CURETTAGE
152 ;;Prophy Natural Dentition^ PROPHYLAXIS - NATURAL DENTITION
153 ;;Prophy Denture^ PATIENT WITH PROTHESES CLEANED
154 ;;Extractions^ EXTRACTIONS (WEIGHTED)
155 ;;Surgical Extractions^ SURGICAL EXTRACTION
156 ;;Neoplasm Removed^ NEOPLASM REMOVED
157 ;;Biopsy/Smear^ BIOPSY AND/OR CYTOLOGICAL SMEARS
158 ;;Fracture^ MAXILLOFACIAL FRACTURE REDUCTION
159 ;;Individual Crowns^ SINGLE CROWN (PER CROWN)
160 ;;Post & Cores^ POST AND CORE OR OVERDENTURE COPING
161 ;;Fixed Partials (Abut)^ ABUTMENT UNIT FOR FIXED PROSTHESIS
162 ;;Fixed Partials (Pont Only)^ PONTIC UNIT FOR FIXED PROSTHESIS
163 ;;Removable Partials^ REMOVABLE PARTIAL DENTURE INSERTED
164 ;;Complete Dentures^ REMOVABLE COMPLETE DENTURE INSERTED
165 ;;Prosthetic Repair^ PROTHESIS REPAIRED
Note: See TracBrowser for help on using the repository browser.