source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCRPI01.m@ 619

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

initial load of WorldVistAEHR

File size: 5.9 KB
Line 
1SCRPI01 ;ALB/SCK - IEMM REPORT OF INCOMPLETE ENCOUNTERS ; 2/2/97
2 ;;5.3;Scheduling;**66,338**;AUG 13, 1993
3 ;
4EN ; Main entry point for report of incomplete encounters report
5 ; Variables
6 ; SDTXT - String array for initial message display
7 ; SDDT - date Range, Begin^End
8 ; SDSEL1,2 - Selection methods Line Tag
9 ; SDOK - Flag, 1 - Ok to continu, 0 - Quit
10 ;
11 N VAUTD,VAUTC,VAUDS,VAUTSTR,VAUTNI,SDTXT,SDDT,ZTSAVE,VAUTN,VAUER,SDSEL1,SDSEL2,SDOK,NDX,VAUTVB
12 ;
13 W !,$C(7)
14 F NDX=1:1 S SDTXT=$P($T(MSG+NDX),";;",2) Q:SDTXT="$$END" D
15 . W !,SDTXT
16 W !!
17 S DIR(0)="E" D ^DIR K DIR Q:'$G(Y)
18 ;
19 I $$DIV^SCRPIUT1<0 G ENQ
20 D MSG2
21 S SDSEL1=$$SELCT("","First") G:SDSEL1']"" ENQ
22 S SDSEL2=$$SELCT(SDSEL1,"Next") G:SDSEL2']"" ENQ
23 I '$$ASKDT^SCENI01(.SDDT) G ENQ
24 ;
25 D @SDSEL1 Q:$G(SDOK)<0
26 D @SDSEL2 Q:$G(SDOK)<0
27 ;
28 F X="SDDT","VAUTC","VAUTD","VAUDS","VAUDS(","VAUTC(","VAUTD(","SDSEL1","SDSEL2","VAUTN","VAUTN(","VAUER","VAUER(" D
29 . S ZTSAVE(X)=""
30 S IOP="Q"
31 W !!,"This report requires 132 columns and could take some time.",!,"Remember to QUEUE the report.",!
32 D EN^XUTMDEVQ("RPT^SCRPI01","IEMM Error Listing",.ZTSAVE)
33 D HOME^%ZIS
34ENQ Q
35 ;
36RPT ; Build report, then call print
37 K ^TMP("SCRPI ERR",$J)
38 D BLD
39 D PRINT^SCRPI01A
40 Q
41 ;
42EXIT ;
43 K ^TMP("SCRPI ERR",$J)
44 Q
45 ;
46SELCT(S1,SCT) ; Set selection criteria
47 ; Input
48 ; S1 - Previous selection method
49 ; SCT - first or second selection method
50 ;
51 ; Returns
52 ; CLN - Clinic
53 ; ERR - Error Code
54 ; PAT - Patient
55 ; DSS - Stop Code
56 ;
57 ; Variables
58 ; SCTEXT - Set up display list
59 ;
60 N X,CNT,SCTEXT
61 S X="SM^"
62 F CNT=1:1 S SCTEXT=$P($T(OPTIONS+CNT),";;",2) Q:SCTEXT="$$END" D
63 . Q:S1[$P(SCTEXT,":")
64 . S X=X_SCTEXT
65 ;
66 S DIR(0)=X,DIR("A")="Set "_SCT_" Selection Criteria"
67 S DIR("?")="Pick a selection criteria from those listed below."
68 S DIR("??")="^D HLP^SCRPI01"
69 D ^DIR K DIR
70 Q $S(Y["C":"CLN",Y["P":"PAT",Y["E":"ERR",Y["D":"DSS",1:"")
71 ;
72CLN ; Clinic selection o/m/a
73 W !!,"Clinic Selection"
74 S VAUTNI=2
75 D CLINIC^VAUTOMA
76 W !
77 S SDOK=Y
78 Q
79 ;
80PAT ; Patient selection o/m/a
81 W !!,"Patient Selection"
82 S VAUTNI=2
83 D PATIENT^VAUTOMA
84 W !
85 S SDOK=Y
86 Q
87 ;
88ERR ; Error selection o/m/a
89 W !!,"Transmission Error Selection"
90 S DIC="^SD(409.76,",VAUTSTR="Error",VAUTVB="VAUER",VAUTNI=2
91 D FIRST^VAUTOMA
92 W !
93 S SDOK=Y
94 Q
95 ;
96DSS ; Clinic Stop code selection o/m/a
97 W !!,"Clinic Stop Code Selection"
98 S DIC="^DIC(40.7,",VAUTSTR="Stop Code",VAUTVB="VAUDS",VAUTNI=2
99 D FIRST^VAUTOMA
100 W !
101 S SDOK=1
102 Q
103 ;
104BLD ; Search for incomplete encounters and build TMP global
105 ; Variables
106 ; SDEND - End date of date range
107 ; SDOE - Encounter IEN
108 ; SDOEDT - Encounter date
109 ; SDCNT - Entry count
110 ;
111 N SDEND,SDOE,SDOEDT,SDCNT
112 ;
113 S SDOEDT=$P(SDDT,U)-.1,SDEND=$P(SDDT,U,2)+.9,SDCNT=0
114 F S SDOEDT=$O(^SD(409.75,"AEDT",SDOEDT)) Q:'SDOEDT!(SDOEDT>SDEND) D
115 . S SDXMT=0 F S SDXMT=$O(^SD(409.75,"AEDT",SDOEDT,SDXMT)) Q:'SDXMT D
116 .. S SDXER=0 F S SDXER=$O(^SD(409.75,"AEDT",SDOEDT,SDXMT,SDXER)) Q:'SDXER D BLD1(SDXER,SDXMT)
117 Q
118 ;
119BLD1(SDE,SDX) ; If error passes checks, add to sorted TMP global
120 ; Input
121 ; SDE - Pointer to #409.75
122 ; SDX - Pointer to #409.73
123 ;
124 ; Variables
125 ; SCEN - Temporary array for encounter information
126 ; SDDEL - Deleted Encounter Marker "*"
127 ; SDRSLT - -1:error, 1:Deleted Encounter, 0:Not deleted
128 ; SDIV - Division IEN
129 ; SDCDE - Stop code
130 ;
131 ; Output
132 ; ^TMP("SCRPI ERR",$J,Division Name,Clinic Name,Patient Name,Encounter Date,Error code IEN,0)=DFN^#409.73 Pointer^Deleted Flag
133 ;
134 N SCEN,SDDEL,SDRSLT,SDIV,SDCDE
135 ;
136 I '$D(ZTQUEUED) S SDCNT=SDCNT+1 W:(SDCNT#10)=0 "."
137 ;
138 S SDRSLT=$$OPENC^SCUTIE1(SDXMT,"SCEN")
139 Q:SDRSLT<0
140 S:SDRSLT SDDEL="*"
141 ;
142 I SDRSLT D
143 . S SDIV=$P(^SD(409.74,SCEN("DELIEN"),1),U,11)
144 . S SDCDE=$P(^SD(409.74,SCEN("DELIEN"),1),U,3)
145 E D
146 . S SDIV=$P(^SCE(SCEN("SDOIEN"),0),U,11)
147 . S SDCDE=$P(^SCE(SCEN("SDOIEN"),0),U,3)
148 ;
149 I $S(VAUTD:0,$D(VAUTD(SDIV)):0,1:1) Q
150 ;
151 I SDSEL1="CLN",$S(VAUTC:0,$D(VAUTC(SCEN("CLINIC"))):0,1:1) Q
152 I SDSEL1="PAT",$S(VAUTN:0,$D(VAUTN(SCEN("DFN"))):0,1:1) Q
153 I SDSEL1="ERR" Q:'$D(^SD(409.75,SDE,0)) I $S(VAUER:0,$D(VAUER($P(^SD(409.75,SDE,0),U,2))):0,1:1) Q ; SD*5.3*338
154 I SDSEL1="DSS",$S(VAUDS:0,$D(VAUDS(SDCDE)):0,1:1) Q
155 ;
156 I SDSEL2="CLN",$S(VAUTC:0,$D(VAUTC(SCEN("CLINIC"))):0,1:1) Q
157 I SDSEL2="PAT",$S(VAUTN:0,$D(VAUTN(SCEN("DFN"))):0,1:1) Q
158 I SDSEL2="ERR" Q:'$D(^SD(409.75,SDE,0)) I $S(VAUER:0,$D(VAUER($P(^SD(409.75,SDE,0),U,2))):0,1:1) Q ; SD*5.3*338
159 I SDSEL2="DSS",$S(VAUDS:0,$D(VAUDS(SDCDE)):0,1:1) Q
160 ;
161 S ^TMP("SCRPI ERR",$J,$P(^DG(40.8,SDIV,0),U),$P(^SC(SCEN("CLINIC"),0),U),$P(^DPT(SCEN("DFN"),0),U),SCEN("ENCOUNTER"),SDE,0)=SCEN("DFN")_U_SDX_U_$G(SDDEL)
162 Q
163 ;
164SELMTHD(SEL) ; Returns 'external' version of selection method
165 Q $S(SEL="CLN":"Clinic",SEL="PAT":"Patient",SEL="ERR":"Error Code",SEL="DSS":"Clinic Stop Code")
166 ;
167HLP ; '??' help for the selection criteria.
168 ;
169 W !?2,"You may select any two of the following selection criteria, one at a time, for"
170 W !?2,"your report. You will be asked for one/many/all selections for each criteria"
171 W !?2,"selected."
172 W !
173 W !?2,"Selection criteria are not sort criteria. The sort criteria are Division,"
174 W !?2,"Clinic, Patient, and Encounter. Selection criteria limit what will be"
175 W !?2,"printed in the report."
176 Q
177 ;
178MSG2 ;
179 W !!!
180 W "The following are selection criteria which are used to specify a group of or"
181 W !,"particular clinic, patient, error code or clinic stop code to be printed."
182 W !,"You are asked to pick two, one at a time. Type '??' for more details."
183 Q
184 ;
185MSG ;
186 ;; This report requires 132 columns to print and will default to
187 ;; QUEUING required. If you print this report to your terminal,
188 ;; answer 'NO' to the 'Do you still want your output queued' prompt.
189 ;;$$END
190 ;
191OPTIONS ; Selection methods
192 ;;C:Clinic;
193 ;;P:Patient;
194 ;;E:Error Code;
195 ;;D:Clinic Stop Code;
196 ;;$$END
197 ;
Note: See TracBrowser for help on using the repository browser.