source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCDXRT02.m@ 1710

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

initial load of WorldVistAEHR

File size: 8.8 KB
RevLine 
[613]1SCDXRT02 ;ALB/JRP - RETRANSMIT REJECTS FROM NPCDB;15-OCT-1996
2 ;;5.3;Scheduling;**68**;AUG 13, 1993
3 ;
4EN ;Entry point for List Manager display
5 D EN^VALM("SCDX RETRAN REJECTS FROM NPCDB")
6 Q
7 ;
8HEADER ;Entry point for building header List Manager header
9 ;Input : Variables as set by List Manager interface
10 ;Output : Header for List Manager screen
11 ;
12 ;Declare variables
13 N TMP,SPOT
14 ;Build header
15 S TMP="Patients whose encounter data has been rejected by the National"
16 S SPOT=40-($L(TMP)\2)
17 S VALMHDR(1)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
18 S TMP="Patient Care Database and not currently marked for retransmission"
19 S SPOT=40-($L(TMP)\2)
20 S VALMHDR(2)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
21 S TMP="(Entries marked by '*' will be flagged for retransmission on exit)"
22 S SPOT=40-($L(TMP)\2)
23 S VALMHDR(3)=$$INSERT^SCDXUTL1(TMP,"",SPOT)
24 Q
25 ;
26INIT ;Entry point for building List Manager display & indexes
27 ;Input : Variables as set by List Manager interface
28 ;Output : List Manager display
29 ; VALMAR(Line,0) = Line to display
30 ; Indexes
31 ; VALMAR("ENTRIES") = Total number of entries
32 ; VALMAR("LINES") = Total number of lines
33 ; VALMAR("ENTRY2DFN",Entry) = DFN of entry
34 ; VALMAR("DFN",DFN,XmitPtr) = Patient's name
35 ; XmitPtr => Pointer to TRANSMITTED OUTPATIENT
36 ; ENCOUNTER file (#409.73)
37 ; VALMAR("NAME",Name) = DFN ^ Total encounters rejected
38 ;
39 ;Declare variables
40 N SPOT,COL4ENT,LINE4ENT,TOTENTRY,DATA,ENTRY,DFN,NAME,NAMEID,VA,BS,VAERR
41 ;Initialize global locations being used
42 K @VALMAR
43 ;Get array of all rejections not currently marked for [re]transmission
44 W !!
45 W !,"Building list of patients who have encounters that were rejected by"
46 W !,"the National Patient Care Database and are not currently marked for"
47 W !,"retransmission. This list only includes demographic and other non-"
48 W !,"encounter related errors."
49 S TOTENTRY=+$$GETREJ^SCDXUTL4(VALMAR,3,20)
50 I (TOTENTRY<1) D Q
51 .;No rejections on file - print message and quit
52 .W !!,"No demographic rejections requiring retransmission are currently on file.",!
53 .K @VALMAR
54 .H 2
55 .S VALMQUIT=1
56 ;Determine total number of lines that will be in display
57 ; (this is also the last entry number of column 1)
58 S VALMCNT=TOTENTRY\2
59 S:(TOTENTRY#2) VALMCNT=VALMCNT+1
60 ;Remember total number of entries and lines
61 S @VALMAR@("ENTRIES")=TOTENTRY
62 S @VALMAR@("LINES")=VALMCNT
63 ;Build display
64 W !!,"Building display screen "
65 S ENTRY=1
66 ; string of blank characters
67 S BS="",$P(BS," ",25)=""
68 ; Loop through name index of rejection array
69 S NAME=""
70 F S NAME=$O(@VALMAR@("NAME",NAME)) Q:(NAME="") D
71 .;Write a dot for every 10 entries
72 .W:('(ENTRY#10)) "."
73 .;Get DFN
74 .S DFN=+$G(@VALMAR@("NAME",NAME))
75 .D PID^VADPT6
76 .;Determine which column & line to put entry in
77 .S COL4ENT=(ENTRY>VALMCNT)+1
78 .S LINE4ENT=ENTRY
79 .S:(ENTRY>VALMCNT) LINE4ENT=ENTRY-VALMCNT
80 .;Get data currently stored in display
81 .S DATA=$G(@VALMAR@(LINE4ENT,0))
82 .;Insert entry number
83 .S SPOT=5-$L(ENTRY)
84 .S:(COL4ENT=2) SPOT=43-$L(ENTRY)
85 .S DATA=$$INSERT^SCDXUTL1(ENTRY,DATA,SPOT)
86 .;Insert patient name truncated to 20 characters, then BID
87 .S SPOT=6
88 .S:(COL4ENT=2) SPOT=44
89 .S NAMEID=$E(NAME_BS,1,20)_$S(VA("BID")]"":" ("_VA("BID")_")",1:"")
90 .S DATA=$$INSERT^SCDXUTL1(NAMEID,DATA,SPOT)
91 .;Put data back into display
92 .S @VALMAR@(LINE4ENT,0)=DATA
93 .;Store data into indexes
94 .S @VALMAR@("ENTRY2DFN",ENTRY)=DFN
95 .S @VALMAR@("DFN2ENTRY",DFN)=ENTRY
96 .;Increment entry number
97 .S ENTRY=ENTRY+1
98 ;Done
99 S VALMBG=1
100 Q
101 ;
102MARK(RESET) ;Entry point to prompt user for entry numbers to mark/unmark
103 ; for retransmission
104 ;
105 ;Input : RESET - Flag denoting which process to execute
106 ; 0 = Mark entry for retransmission (default)
107 ; 1 = Unmark entry for retransmission
108 ; Variables as set by List Manager interface
109 ;Output : None
110 ; The following index is set when marking an entry
111 ; VALMAR("MARKED",Entry) = ""
112 ; This index is deleted when unmarking an entry
113 ; The List Manager display is updated accordingly
114 ;Note : Marking/unmarking is done only in the context of the List
115 ; Manager display
116 ;
117 ;Check input
118 S RESET=+$G(RESET)
119 ;Declare variables
120 N ENTRY,SELECT,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
121 ;Switch to full screen
122 D FULL^VALM1
123 ;Prompt user for selection(s)
124 S X=+$O(@VALMAR@("ENTRY2DFN",""))
125 S Y=+$O(@VALMAR@("ENTRY2DFN",""),-1)
126 S DIR(0)="LAO^"_X_":"_Y_":0"
127 S DIR("A")="Select "_VALM("ENTITY")_"(s) ("_X_"-"_Y_"): "
128 S DIR("?",1)=" Select the patient(s) whose rejected encounters you want "_$S(RESET:"un",1:"")_"marked"
129 S DIR("?")=" for retransmission to the National Patient Care Database"
130 D ^DIR
131 I $D(DIRUT) S VALMBCK="R" Q
132 ;Move selections from Y into SELECT - parse main output of DIR
133 ; into individual entries in SELECT() array
134 M SELECT=Y
135 F X=1:1 S Y=$P(SELECT(0),",",X) Q:('Y) S SELECT(Y)=""
136 K SELECT(0)
137 ;Loop through selected entries
138 S ENTRY=0
139 F S ENTRY=+$O(SELECT(ENTRY)) Q:('ENTRY) D
140 .;Mark/unmark entry for retransmission
141 .D MARKIDX(ENTRY,RESET)
142 ;Done
143 S VALMBCK="R"
144 Q
145 ;
146MARKPT(RESET) ; Entry point to prompt user for patients to mark/unmark
147 ; for retransmission
148 ;
149 ; (see description of input/output for MARK call)
150 ;
151 S RESET=+$G(RESET)
152 ;Declare variables
153 N ENTRY,DA,DIC,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,VAUTN
154 ;Switch to full screen
155 D FULL^VALM1
156 ;Prompt user for selection(s) via VAUTOMA
157 S VAUTNI=2
158 S DIC("S")="I $D(@VALMAR@(""DFN2ENTRY"",+Y))"
159 D PATIENT^VAUTOMA
160 I Y<0 S VALMBCK="R" Q
161 I VAUTN=1 D MARKALL(RESET)
162 ;Loop through selected entries
163 S DFN=0
164 F S DFN=+$O(VAUTN(DFN)) Q:('DFN) D
165 .S ENTRY=$G(@VALMAR@("DFN2ENTRY",DFN)) Q:'ENTRY
166 .;Mark/unmark entry for retransmission
167 .D MARKIDX(ENTRY,RESET)
168 ;Done
169 S VALMBCK="R"
170 Q
171 ;
172MARKALL(RESET) ;Entry point to mark all entries for retransmission
173 ;
174 ;Input : RESET - Flag denoting which process to execute
175 ; 0 = Mark entry for retransmission (default)
176 ; 1 = Unmark entry for retransmission
177 ; Variables as set by List Manager interface
178 ;Output : None
179 ; The following index is set when marking an entry
180 ; VALMAR("MARKED",Entry) = ""
181 ; This index is deleted when unmarking an entry
182 ; The List Manager display is updated accordingly
183 ;Note : Marking/unmarking is done only in the context of the List
184 ; Manager display
185 ;
186 ;Check input
187 S RESET=+$G(RESET)
188 ;Declare variables
189 N ENTRY
190 ;Loop through all entries in entry & DFN index
191 S ENTRY=""
192 F S ENTRY=+$O(@VALMAR@("ENTRY2DFN",ENTRY)) Q:('ENTRY) D
193 .;Mark/unmark for retransmission
194 .D MARKIDX(ENTRY,RESET)
195 ;Done
196 S VALMBCK="R"
197 Q
198 ;
199MARKIDX(ENTRY,RESET) ;Entry point to mark/unmark an entry for retransmission
200 ;
201 ;Input : ENTRY - Entry number in display to mark/unmark
202 ; RESET - Flag denoting which process to execute
203 ; 0 = Mark entry for retransmission (default)
204 ; 1 = Unmark entry for retransmission
205 ; Variables as set by List Manager interface
206 ;Output : None
207 ; The following index is set when marking an entry
208 ; VALMAR("MARKED",Entry) = ""
209 ; This index is deleted when unmarking an entry
210 ; The List Manager display is updated accordingly
211 ;Note : Marking/unmarking is done only in the context of the List
212 ; Manager display
213 ;
214 ;Check input
215 S ENTRY=+$G(ENTRY)
216 Q:(ENTRY<1)
217 Q:('$D(@VALMAR@("ENTRY2DFN",ENTRY)))
218 S RESET=+$G(RESET)
219 ;Declare variables
220 N TMP,COL4ENT,LINE4ENT,DATA,SPOT
221 ;Set index
222 S:('RESET) @VALMAR@("MARKED",ENTRY)=""
223 ;Delete index
224 K:(RESET) @VALMAR@("MARKED",ENTRY)
225 ;Update display
226 ; Determine which column & line to put entry in
227 S TMP=+$G(@VALMAR@("LINES"))
228 S COL4ENT=(ENTRY>TMP)+1
229 S LINE4ENT=ENTRY
230 S:(ENTRY>TMP) LINE4ENT=ENTRY-TMP
231 ;Get data currently stored in display
232 S DATA=$G(@VALMAR@(LINE4ENT,0))
233 ;Put/remove retransmission mark
234 S SPOT=1
235 S:(COL4ENT=2) SPOT=39
236 S TMP="*"
237 S:(RESET) TMP=" "
238 S DATA=$$INSERT^SCDXUTL1(TMP,DATA,SPOT)
239 ;Put data back into display
240 S @VALMAR@(LINE4ENT,0)=DATA
241 ;Done
242 Q
243 ;
244CLEANUP ;Entry point for cleaning up
245 ;
246 ;Input : Variables as set by List Manager interface
247 ;Output : None
248 ;
249 ;Declare variables
250 N ENTRY,DFN,XMITPTR
251 ;Switch to full screen
252 D FULL^VALM1
253 W !
254 W !,"Rejected encounters for the selected patient(s) will now be"
255 W !,"marked for retransmission "
256 ;Loop through index of marked entries
257 S ENTRY=""
258 F S ENTRY=+$O(@VALMAR@("MARKED",ENTRY)) Q:('ENTRY) D
259 .;Get DFN for entry
260 .S DFN=+$G(@VALMAR@("ENTRY2DFN",ENTRY))
261 .Q:('DFN)
262 .;Loop through index of all entries in TRANSMITTED OUTPATIENT
263 .; ENCOUNTER file (#409.73) for DFN
264 .S XMITPTR=""
265 .F S XMITPTR=+$O(@VALMAR@("DFN",DFN,XMITPTR)) Q:('XMITPTR) D
266 ..;Mark entry for retransmission
267 ..D STREEVNT^SCDXFU01(XMITPTR,0)
268 ..;Turn on transmission flag
269 ..D XMITFLAG^SCDXFU01(XMITPTR)
270 ..W "."
271 ;Done - clean up global location used and quit
272 K @VALMAR
273 Q
Note: See TracBrowser for help on using the repository browser.