1 | BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm
|
---|
2 | ;;1.42;BSDX;;Dec 07, 2010
|
---|
3 | ;
|
---|
4 | ; Original by HMW. New Written by Sam Habiel. Licensed under LGPL.
|
---|
5 | ;
|
---|
6 | ; Change History
|
---|
7 | ; 3101022 UJO/SMH v1.42
|
---|
8 | ; - Transaction now restartable. Thanks to
|
---|
9 | ; --> Zach Gonzalez and Rick Marshall for fix.
|
---|
10 | ; - Extra TROLLBACK in Lock Statement when lock fails.
|
---|
11 | ; --> Removed--Rollback is already in ERR tag.
|
---|
12 | ; - Added new statements to old SD code in AVUPDT to obviate
|
---|
13 | ; --> need to restore variables in transaction
|
---|
14 | ; - Refactored this chunk of code. Don't really know whether it
|
---|
15 | ; --> worked in the first place. Waiting for bug report to know.
|
---|
16 | ; - Refactored all of APPDEL.
|
---|
17 | ;
|
---|
18 | ; Error Reference:
|
---|
19 | ; -1~BSDX08: Appt record is locked. Please contact technical support.
|
---|
20 | ; -2~BSDX08: Invalid Appointment ID
|
---|
21 | ; -3~BSDX08: Invalid Appointment ID
|
---|
22 | ; -4~BSDX08: Cancelled appointment does not have a Resouce ID
|
---|
23 | ; -5~BSDX08: Resouce ID does not exist in BSDX RESOURCE
|
---|
24 | ; -6~BSDX08: Invalid Hosp Location stored in Database
|
---|
25 | ; -7~BSDX08: Patient does not have an appointment in PIMS Clinic
|
---|
26 | ; -8^BSDX08: Unable to find associated PIMS appointment for this patient
|
---|
27 | ; -9^BSDX08: BSDXAPI returned an error: (error)
|
---|
28 | ; -100~BSDX08 Error: (Mumps Error)
|
---|
29 | ;
|
---|
30 | APPDELD(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
---|
31 | ;Entry point for debugging
|
---|
32 | D DEBUG^%Serenji("APPDEL^BSDX08(.BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT)")
|
---|
33 | Q
|
---|
34 | ;
|
---|
35 | UT ; Unit Tests
|
---|
36 | ; Test 1: Make normal appointment and cancel it. See if every thing works
|
---|
37 | N ZZZ
|
---|
38 | D APPADD^BSDX07(.ZZZ,3110123.2,3110123.3,4,"Dr Office",10,"Sam's Note",1)
|
---|
39 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
40 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
---|
41 | I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
|
---|
42 | I $O(^SC(2,"S",3110123.2,1,0))]"" W "Error in Cancellation-2"
|
---|
43 | I $P(^DPT(4,"S",3110123.2,0),U,2)'="PC" W "Error in Cancellation-3"
|
---|
44 | I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4"
|
---|
45 | ;
|
---|
46 | ; Test 2: Check for -1
|
---|
47 | ; Make appt
|
---|
48 | D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1)
|
---|
49 | ; Lock the node in another job
|
---|
50 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
51 | ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
|
---|
52 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
---|
53 | ;
|
---|
54 | ; Test 3: Check for -100
|
---|
55 | S bsdxdie=1
|
---|
56 | D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1)
|
---|
57 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
58 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
---|
59 | I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
|
---|
60 | K bsdxdie
|
---|
61 | ;
|
---|
62 | ; Test 4: Restartable transaction
|
---|
63 | S bsdxrestart=1
|
---|
64 | D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1)
|
---|
65 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
66 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
---|
67 | I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",!
|
---|
68 | ;
|
---|
69 | ; Test 5: for invalid Appointment ID (-2 and -3)
|
---|
70 | D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
|
---|
71 | I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
|
---|
72 | D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
|
---|
73 | I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
|
---|
74 | ;
|
---|
75 | ; Test 6: for Cancelling walkin and checked-in appointments (should fail).
|
---|
76 | S BSDXSTART=$E($$NOW^XLFDT,1,12),BSDXEND=BSDXSTART+.0001
|
---|
77 | D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1)
|
---|
78 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
79 | B
|
---|
80 | D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT)
|
---|
81 | B
|
---|
82 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note")
|
---|
83 | B
|
---|
84 | ;
|
---|
85 | ; Test 7: for cancelling walkin and checked-in appointments (this should pass)
|
---|
86 | S BSDXSTART=$E($$NOW^XLFDT,1,12)+.0001,BSDXEND=BSDXSTART+.0001
|
---|
87 | D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1)
|
---|
88 | S APPID=+$P(^BSDXTMP($J,1),U)
|
---|
89 | B
|
---|
90 | D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT)
|
---|
91 | S BSDXRES=$O(^BSDXRES("B","Dr Office",""))
|
---|
92 | S BSDXCLN=$P(^BSDXRES(BSDXRES,0),U,4)
|
---|
93 | B
|
---|
94 | S BSDXRESULT=$$RMCI^BSDXAPI(4,BSDXCLN,BSDXSTART)
|
---|
95 | B
|
---|
96 | D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note")
|
---|
97 | ;
|
---|
98 |
|
---|
99 | QUIT
|
---|
100 | ; Lock the node in another job for testing.
|
---|
101 | UTL(APPID) L +^BSDXAPPT(APPID) HANG 10 QUIT
|
---|
102 | ;
|
---|
103 | APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
---|
104 | ;Called by RPC: BSDX CANCEL APPOINTMENT
|
---|
105 | ;Cancels existing appointment in BSDX APPOINTMENT and 44/2 subfiles
|
---|
106 | ;Input Parameters:
|
---|
107 | ; - BSDXAPTID is entry number in BSDX APPOINTMENT file
|
---|
108 | ; - BSDXTYP is C for clinic-cancelled and PC for patient cancelled
|
---|
109 | ; - BSDXCR is pointer to CANCELLATION REASON File (409.2)
|
---|
110 | ; - BSDXNOT is user note
|
---|
111 | ;
|
---|
112 | ; Returns error code in recordset field ERRORID. Zero is success.
|
---|
113 | ; Returns Global Array. Must use this type in RPC.
|
---|
114 | ;
|
---|
115 | ; Return Array: set Return and clear array
|
---|
116 | S BSDXY=$NA(^BSDXTMP($J))
|
---|
117 | K ^BSDXTMP($J)
|
---|
118 | ;
|
---|
119 | ; Set min DUZ vars if they don't exist
|
---|
120 | D ^XBKVAR
|
---|
121 | ;
|
---|
122 | ; $ET
|
---|
123 | N $ET S $ET="G ETRAP^BSDX08"
|
---|
124 | ;
|
---|
125 | ; Counter
|
---|
126 | N BSDXI S BSDXI=0
|
---|
127 | ; Header Node
|
---|
128 | S ^BSDXTMP($J,BSDXI)="T00100ERRORID"_$C(30)
|
---|
129 | ;
|
---|
130 | ; Lock BSDX node, only to synchronize access to the globals.
|
---|
131 | ; It's not expected that the error will ever happen as no filing
|
---|
132 | ; is supposed to take 5 seconds.
|
---|
133 | L +^BSDXAPPT(BSDXAPTID):5 I '$T D ERR(BSDXI,"-1~BSDX08: Appt record is locked. Please contact technical support.") Q
|
---|
134 | ;
|
---|
135 | ;Restartable Transaction; restore paramters when starting.
|
---|
136 | ; (Params restored are what's passed here + BSDXI)
|
---|
137 | TSTART (BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT,BSDXI):T="BSDX CANCEL APPOINTEMENT^BSDX08"
|
---|
138 | ;
|
---|
139 | ; Turn off SDAM APPT PROTOCOL BSDX Entries
|
---|
140 | N BSDXNOEV
|
---|
141 | S BSDXNOEV=1 ;Don't execute BSDX CANCEL APPOINTMENT protocol
|
---|
142 | ;
|
---|
143 | ;;;test for error inside transaction. See if %ZTER works
|
---|
144 | I $G(bsdxdie) S X=1/0
|
---|
145 | ;;;test
|
---|
146 | ;;;test for TRESTART
|
---|
147 | I $G(bsdxrestart) K bsdxrestart TRESTART
|
---|
148 | ;;;test
|
---|
149 | ;
|
---|
150 | ; Check appointment ID and whether it exists
|
---|
151 | I '+BSDXAPTID D ERR(BSDXI,"-2~BSDX08: Invalid Appointment ID") Q
|
---|
152 | I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"-3~BSDX08: Invalid Appointment ID") Q
|
---|
153 | ;
|
---|
154 | ; Start Processing:
|
---|
155 | ; First, add cancellation date to appt entry in BSDX APPOINTMENT
|
---|
156 | N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPTID,0) ; BSDX Appt Node
|
---|
157 | N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; Patient ID
|
---|
158 | N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Start Time
|
---|
159 | D BSDXCAN(BSDXAPTID) ; Add a cancellation date in BSDX APPOINTMENT
|
---|
160 | ;
|
---|
161 | ; Second, cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability
|
---|
162 | N BSDXSC1 S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID
|
---|
163 | ; If the resouce id doesn't exist...
|
---|
164 | I BSDXSC1="" D ERR(BSDXI,"-4~BSDX08: Cancelled appointment does not have a Resouce ID") QUIT
|
---|
165 | I '$D(^BSDXRES(BSDXSC1,0)) D ERR(BSDXI,"-5~BSDX08: Resouce ID does not exist in BSDX RESOURCE") QUIT
|
---|
166 | ; Get zero node of resouce
|
---|
167 | S BSDXNOD=^BSDXRES(BSDXSC1,0)
|
---|
168 | ; Get Hosp location
|
---|
169 | N BSDXLOC S BSDXLOC=$P(BSDXNOD,U,4)
|
---|
170 | ; Error indicator for Hosp Location filing for getting out of routine
|
---|
171 | N BSDXERR S BSDXERR=0
|
---|
172 | ; Only file in 2/44 if there is an associated hospital location
|
---|
173 | I BSDXLOC D QUIT:BSDXERR
|
---|
174 | . I '$D(^SC(BSDXLOC,0)) S BSDXERR=1 D ERR(BSDXI,"-6~BSDX08: Invalid Hosp Location stored in Database") QUIT
|
---|
175 | . ; Get the IEN of the appointment in the "S" node of ^SC
|
---|
176 | . N BSDXSCIEN
|
---|
177 | . S BSDXSCIEN=$$SCIEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART)
|
---|
178 | . I BSDXSCIEN="" S BSDXERR=1 D ERR(BSDXI,"-7~BSDX08: Patient does not have an appointment in PIMS Clinic") QUIT
|
---|
179 | . ; Get the appointment node
|
---|
180 | . S BSDXNOD=$G(^SC(BSDXLOC,"S",BSDXSTART,1,BSDXSCIEN,0))
|
---|
181 | . I BSDXNOD="" S BSDXERR=1 D ERR(BSDXI,"-8^BSDX08: Unable to find associated PIMS appointment for this patient") QUIT
|
---|
182 | . N BSDXLEN S BSDXLEN=$P(BSDXNOD,U,2)
|
---|
183 | . ; Cancel through BSDXAPI
|
---|
184 | . N BSDXZ
|
---|
185 | . D APCAN(.BSDXZ,BSDXLOC,BSDXPATID,BSDXSTART)
|
---|
186 | . I +BSDXZ>0 S BSDXERR=1 D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXZ,U,2)) QUIT
|
---|
187 | . ; Update Legacy PIMS clinic Availability
|
---|
188 | . D AVUPDT(BSDXLOC,BSDXSTART,BSDXLEN)
|
---|
189 | ;
|
---|
190 | TCOMMIT
|
---|
191 | L -^BSDXAPPT(BSDXAPTID)
|
---|
192 | S BSDXI=BSDXI+1
|
---|
193 | S ^BSDXTMP($J,BSDXI)=""_$C(30)
|
---|
194 | S BSDXI=BSDXI+1
|
---|
195 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
196 | Q
|
---|
197 | ;
|
---|
198 | AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN) ;Update Legacy PIMS Clinic availability
|
---|
199 | ;See SDCNP0
|
---|
200 | N SD,S ; Start Date
|
---|
201 | S (SD,S)=BSDXSTART
|
---|
202 | N I ; Clinic IEN in 44
|
---|
203 | S I=BSDXSCD
|
---|
204 | ; if day has no schedule in legacy PIMS, forget about this update.
|
---|
205 | Q:'$D(^SC(I,"ST",SD\1,1))
|
---|
206 | N SL ; Clinic characteristics node (length of appt, when appts start etc)
|
---|
207 | S SL=^SC(I,"SL")
|
---|
208 | N X ; Hour Clinic Display Begins
|
---|
209 | S X=$P(SL,U,3)
|
---|
210 | N STARTDAY ; When does the day start?
|
---|
211 | S STARTDAY=$S($L(X):X,1:8) ; If defined, use it; otherwise, 8am
|
---|
212 | N SB ; ?? Who knows? Day Start - 1 divided by 100.
|
---|
213 | S SB=STARTDAY-1/100
|
---|
214 | S X=$P(SL,U,6) ; Now X is Display increments per hour
|
---|
215 | N HSI ; Slots per hour, try 1
|
---|
216 | S HSI=$S(X:X,1:4) ; if defined, use it; otherwise, 4
|
---|
217 | N SI ; Slots per hour, try 2
|
---|
218 | S SI=$S(X="":4,X<3:4,X:X,1:4) ; If slots "", or less than 3, then 4
|
---|
219 | N STR ; ??
|
---|
220 | S STR="#@!$* XXWVUTSRQPONMLKJIHGFEDCBA0123456789jklmnopqrstuvwxyz"
|
---|
221 | N SDDIF ; Slots per hour diff??
|
---|
222 | S SDDIF=$S(HSI<3:8/HSI,1:2)
|
---|
223 | S SL=BSDXLEN ; Dammit, reusing variable; SL now Appt Length from GUI
|
---|
224 | S S=^SC(I,"ST",SD\1,1) ; reusing var again; S now Day Pattern from PIMS
|
---|
225 | N Y ; Hours since start of Date
|
---|
226 | S Y=SD#1-SB*100 ;SD#1=FM Time portion; -SB minus start of day; conv to hrs
|
---|
227 | N ST ; ??
|
---|
228 | ; Y#1 -> Minutes; *SI -> * Slots per hour; \.6 trunc min to hour
|
---|
229 | ; Y\1 -> Hours since start of day; * SI: * slots
|
---|
230 | S ST=Y#1*SI\.6+(Y\1*SI)
|
---|
231 | N SS ; how many slots are supposed to be taken by appointment
|
---|
232 | S SS=SL*HSI/60 ; (nb: try SL: 30 min; HSI: 4 slots)
|
---|
233 | N I
|
---|
234 | I Y'<1 D ; If Hours since start of Date is greater than 1
|
---|
235 | . ; loop through pattern. Tired of documenting.
|
---|
236 | . F I=ST+ST:SDDIF D Q:Y="" Q:SS'>0
|
---|
237 | . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y=""
|
---|
238 | . . S S=$E(S,1,I)_Y_$E(S,I+2,999)
|
---|
239 | . . S SS=SS-1
|
---|
240 | . . Q:SS'>0
|
---|
241 | S ^SC(BSDXSCD,"ST",SD\1,1)=S ; new pattern; global set
|
---|
242 | Q
|
---|
243 | ;
|
---|
244 | APCAN(BSDXZ,BSDXLOC,BSDXDFN,BSDXSD) ;
|
---|
245 | ;Cancel appointment for patient BSDXDFN in clinic BSDXSC1
|
---|
246 | ;at time BSDXSD
|
---|
247 | N BSDXC,%H
|
---|
248 | S BSDXC("PAT")=BSDXPATID
|
---|
249 | S BSDXC("CLN")=BSDXLOC
|
---|
250 | S BSDXC("TYP")=BSDXTYP
|
---|
251 | S BSDXC("ADT")=BSDXSD
|
---|
252 | S %H=$H D YMD^%DTC
|
---|
253 | S BSDXC("CDT")=X+%
|
---|
254 | S BSDXC("NOT")=BSDXNOT
|
---|
255 | S:'+$G(BSDXCR) BSDXCR=11 ;Other
|
---|
256 | S BSDXC("CR")=BSDXCR
|
---|
257 | S BSDXC("USR")=DUZ
|
---|
258 | ;
|
---|
259 | S BSDXZ=$$CANCEL^BSDXAPI(.BSDXC)
|
---|
260 | Q
|
---|
261 | ;
|
---|
262 | BSDXCAN(BSDXAPTID) ;
|
---|
263 | ;Cancel BSDX APPOINTMENT entry
|
---|
264 | N %DT,X,BSDXDATE,Y,BSDXIENS,BSDXFDA,BSDXMSG
|
---|
265 | S %DT="XT",X="NOW" D ^%DT ; X ^DD("DD")
|
---|
266 | S BSDXDATE=Y
|
---|
267 | S BSDXIENS=BSDXAPTID_","
|
---|
268 | S BSDXFDA(9002018.4,BSDXIENS,.12)=BSDXDATE
|
---|
269 | K BSDXMSG
|
---|
270 | D FILE^DIE("","BSDXFDA","BSDXMSG")
|
---|
271 | Q
|
---|
272 | ;
|
---|
273 | CANEVT(BSDXPAT,BSDXSTART,BSDXSC) ;EP Called by BSDX CANCEL APPOINTMENT event
|
---|
274 | ;when appointments cancelled via PIMS interface.
|
---|
275 | ;Propagates cancellation to BSDXAPPT and raises refresh event to running GUI clients
|
---|
276 | N BSDXFOUND,BSDXRES
|
---|
277 | Q:+$G(BSDXNOEV)
|
---|
278 | Q:'+$G(BSDXSC)
|
---|
279 | S BSDXFOUND=0
|
---|
280 | I $D(^BSDXRES("ALOC",BSDXSC)) S BSDXRES=$O(^BSDXRES("ALOC",BSDXSC,0)) S BSDXFOUND=$$CANEVT1(BSDXRES,BSDXSTART,BSDXPAT)
|
---|
281 | I BSDXFOUND D CANEVT3(BSDXRES) Q
|
---|
282 | I $D(^BXDXRES("ASSOC",BSDXSC)) S BSDXRES=$O(^BSDXRES("ASSOC",BSDXSC,0)) S BSDXFOUND=$$CANEVT1(BSDXRES,BSDXSTART,BSDXPAT)
|
---|
283 | I BSDXFOUND D CANEVT3(BSDXRES)
|
---|
284 | Q
|
---|
285 | ;
|
---|
286 | CANEVT1(BSDXRES,BSDXSTART,BSDXPAT) ;
|
---|
287 | ;Get appointment id in BSDXAPT
|
---|
288 | ;If found, call BSDXCAN(BSDXAPPT) and return 1
|
---|
289 | ;else return 0
|
---|
290 | N BSDXFOUND,BSDXAPPT
|
---|
291 | S BSDXFOUND=0
|
---|
292 | Q:'+BSDXRES BSDXFOUND
|
---|
293 | Q:'$D(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART)) BSDXFOUND
|
---|
294 | S BSDXAPPT=0 F S BSDXAPPT=$O(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART,BSDXAPPT)) Q:'+BSDXAPPT D Q:BSDXFOUND
|
---|
295 | . S BSDXNOD=$G(^BSDXAPPT(BSDXAPPT,0)) Q:BSDXNOD=""
|
---|
296 | . I $P(BSDXNOD,U,5)=BSDXPAT,$P(BSDXNOD,U,12)="" S BSDXFOUND=1 Q
|
---|
297 | I BSDXFOUND,+$G(BSDXAPPT) D BSDXCAN(BSDXAPPT)
|
---|
298 | Q BSDXFOUND
|
---|
299 | ;
|
---|
300 | CANEVT3(BSDXRES) ;
|
---|
301 | ;Call RaiseEvent to notify GUI clients
|
---|
302 | ;
|
---|
303 | N BSDXRESN
|
---|
304 | S BSDXRESN=$G(^BSDXRES(BSDXRES,0))
|
---|
305 | Q:BSDXRESN=""
|
---|
306 | S BSDXRESN=$P(BSDXRESN,"^")
|
---|
307 | ;D EVENT^BSDX23("SCHEDULE-"_BSDXRESN,"","","")
|
---|
308 | D EVENT^BMXMEVN("BSDX SCHEDULE",BSDXRESN)
|
---|
309 | Q
|
---|
310 | ;
|
---|
311 | ERR(BSDXI,BSDXERR) ;Error processing
|
---|
312 | S BSDXI=BSDXI+1
|
---|
313 | S BSDXERR=$TR(BSDXERR,"^","~")
|
---|
314 | I $TL>0 TROLLBACK
|
---|
315 | S ^BSDXTMP($J,BSDXI)=BSDXERR_$C(30)
|
---|
316 | S BSDXI=BSDXI+1
|
---|
317 | S ^BSDXTMP($J,BSDXI)=$C(31)
|
---|
318 | L -^BSDXAPPT(BSDXAPTID)
|
---|
319 | QUIT
|
---|
320 | ;
|
---|
321 | ETRAP ;EP Error trap entry
|
---|
322 | N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap
|
---|
323 | ; Rollback, otherwise ^XTER will be empty from future rollback
|
---|
324 | I $TL>0 TROLLBACK
|
---|
325 | D ^%ZTER
|
---|
326 | S $EC="" ; Clear Error
|
---|
327 | ; Log error message and send to client
|
---|
328 | I '$D(BSDXI) N BSDXI S BSDXI=0
|
---|
329 | D ERR(BSDXI,"-100~BSDX08 Error: "_$G(%ZTERZE))
|
---|
330 | QUIT
|
---|
331 | ;
|
---|
332 | ;;;NB: This is code that is unused in both original and port.
|
---|
333 | ; ; If not appt in the "S" node is found in ^SC then check associated RPMS Clinic Multiple
|
---|
334 | ; I BSDXSCIEN="" D I 'BSDXZ Q ;Q:BSDXZ
|
---|
335 | ; . S BSDXERR="BSDX08: Unable to find associated RPMS appointment for this patient. "
|
---|
336 | ; . S BSDXZ=1
|
---|
337 | ; . ; Check if there are associated RPMS clinics. (not currently used) Does the multiple exist? No, then quit
|
---|
338 | ; . I '$D(^BSDXRES(BSDXSC1,20)) S BSDXZ=0 QUIT
|
---|
339 | ; . ; Loop through the multiple. Get Location and then the ^SC "S" node IEN.
|
---|
340 | ; . N BSDX1 S BSDX1=0
|
---|
341 | ; . F S BSDX1=$O(^BSDXRES(BSDXSC1,20,BSDX1)) Q:'+BSDX1 Q:BSDXZ=0 D
|
---|
342 | ; . . Q:'$D(^BSDXRES(BSDXSC1,20,BSDX1,0))
|
---|
343 | ; . . S BSDXLOC=$P(^BSDXRES(BSDXSC1,20,BSDX1,0),U)
|
---|
344 | . ; . . S BSDXSCIEN=$$SCIEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) I +BSDXSCIEN S BSDXZ=0 Q
|
---|