Changeset 1461 for Scheduling/trunk/m/BSDX08.m
- Timestamp:
- Jun 26, 2012, 8:01:30 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX08.m
r1460 r1461 1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/2 5/12 6:17pm1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/26/12 10:49am 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; … … 6 6 ; Change History 7 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. 8 ; - Transaction work. As of v 1.7, all work here has been superceded 9 ; - Refactoring of AVUPDT - never tested though. 16 10 ; - Refactored all of APPDEL. 17 11 ; … … 19 13 ; - Added ability to remove checked in appointments. Added a couple 20 14 ; of units tests for that under UT2. 21 ; - Minor reformatting because of how KIDS adds tabs. 15 ; 16 ; 3120625 VEN/SMH v1.7 17 ; - Transactions removed. Code refactored to work w/o txns. 22 18 ; 23 19 ; Error Reference: … … 31 27 ; -8^BSDX08: Unable to find associated PIMS appointment for this patient 32 28 ; -9^BSDX08: BSDXAPI returned an error: (error) 29 ; -10^BSDX08: $$BSDXCAN failed (Fileman filing error) 33 30 ; -100~BSDX08 Error: (Mumps Error) 34 31 ; … … 76 73 ; 77 74 ;;;test for error inside transaction. See if %ZTER works 78 I $G(BSDXDIE )S X=1/075 I $G(BSDXDIE1) N X S X=1/0 79 76 ; 80 77 ; Check appointment ID and whether it exists … … 90 87 ; Check the resource ID and whether it exists 91 88 N BSDXSC1 S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID 92 ; If the resou ce id doesn't exist...89 ; If the resource id doesn't exist... 93 90 I BSDXSC1="" D ERR(BSDXI,"-4~BSDX08: Cancelled appointment does not have a Resouce ID") QUIT 94 91 I '$D(^BSDXRES(BSDXSC1,0)) D ERR(BSDXI,"-5~BSDX08: Resouce ID does not exist in BSDX RESOURCE") QUIT 95 92 ; 96 ; BSDXAPPT First; todo: check for error 97 D BSDXCAN(BSDXAPTID) ; Add a cancellation date in BSDX APPOINTMENT 98 ; 99 ; Process PIMS issues second: 100 ; cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability 93 ; 94 ; Check if PIMS will let us cancel the appointment using $$CANCELCK^BSDXAPI 101 95 ; Get zero node of resouce 102 96 N BSDXNOD S BSDXNOD=^BSDXRES(BSDXSC1,0) 103 97 ; Get Hosp location 104 98 N BSDXLOC S BSDXLOC=$P(BSDXNOD,U,4) 105 ; Error indicator for Hosp Location filing for getting out of routine99 ; Error indicator 106 100 N BSDXERR S BSDXERR=0 107 ; For BSDXC108 N BSDXC 109 ; Only file in 2/44 if there is an associated hospital location110 I BSDXLOC D QUIT:BSDXERR101 ; 102 N BSDXC ; Array to pass to BSDXAPI 103 ; 104 I BSDXLOC D 111 105 . S BSDXC("PAT")=BSDXPATID 112 106 . S BSDXC("CLN")=BSDXLOC … … 120 114 . ; 121 115 . S BSDXERR=$$CANCELCK^BSDXAPI(.BSDXC) ; 0 or 1^error message 122 . I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)) QUIT 116 ; If error, quit. No need to rollback as no changes took place. 117 I BSDXERR D ERR(BSDXI,"-9~BSDX08: BSDXAPI reports that "_$P(BSDXERR,U,2)) QUIT 118 ; 119 I $G(BSDXDIE2) N X S X=1/0 120 ; 121 ; Now cancel the appointment for real 122 ; BSDXAPPT First; no need for rollback if error occured. 123 N BSDXERR S BSDXERR=$$BSDXCAN(BSDXAPTID) ; Add a cancellation date in BSDX APPOINTMENT 124 I BSDXERR D ERR(BSDXI,"$$BSDXCAN failed (Fileman filing error): "_$P(BSDXERR,U,2)) QUIT 125 ; 126 ; Then PIMS: 127 ; cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability 128 ; If error happens, must rollback ^BSDXAPPT 129 I BSDXLOC D QUIT:BSDXERR 130 . N BSDXLEN S BSDXLEN=$$APPLEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) ; appt length 131 . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) ; Cancel through BSDXAPI 132 . ; Rollback BSDXAPPT if error occurs 133 . ; TODO: If an M error occurs in BSDXAPI, ETRAP gets called, ^BSDXTMP is 134 . ; populated, then the output of $$CANCEL is the output of ETRAP. 135 . ; Then, we see that BSDXERR is true, and we do another write, 136 . ; which deletes the information we had in ^BSDXTMP. What to do??? 137 . I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)),ROLLBACK(BSDXAPTID) QUIT 123 138 . ; 124 . N BSDXLEN S BSDXLEN=$$APPLEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) 125 . ; 126 . ; Cancel through BSDXAPI 127 . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) 128 . I BSDXERR=1 D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXZ,U,2)) QUIT 129 . ; Update Legacy PIMS clinic Availability 139 . ; Update Legacy PIMS clinic Availability ; no failure expected here. 130 140 . D AVUPDT(BSDXLOC,BSDXSTART,BSDXLEN) 131 141 ; … … 138 148 Q 139 149 ; 140 ROLLBACK(BSDXAPTID)141 150 AVUPDT(BSDXSCD,BSDXSTART,BSDXLEN) ;Update Legacy PIMS Clinic availability 142 151 ;See SDCNP0 … … 185 194 Q 186 195 ; 187 BSDXCAN(BSDXAPTID) ; 188 ; Cancel BSDX APPOINTMENT entry189 N %DT,X,BSDXDATE,Y,BSDXIENS,BSDXFDA,BSDXMSG190 S %DT="XT",X="NOW" D ^%DT ; X ^DD("DD")191 S BSDXDATE= Y196 BSDXCAN(BSDXAPTID) ; $$; Private; Cancel BSDX APPOINTMENT entry 197 ; Input: Appt IEN in ^BSDXAPPT 198 ; Output: 0 for success and 1^Msg for failure 199 N BSDXDATE,BSDXIENS,BSDXFDA,BSDXMSG 200 S BSDXDATE=$$NOW^XLFDT() 192 201 S BSDXIENS=BSDXAPTID_"," 193 202 S BSDXFDA(9002018.4,BSDXIENS,.12)=BSDXDATE 194 K BSDXMSG195 203 D FILE^DIE("","BSDXFDA","BSDXMSG") 196 Q 204 I $D(BSDXMSG) Q 1_U_BSDXMSG("DIERR",1,"TEXT",1) 205 QUIT 0 206 ; 207 ROLLBACK(BSDXAPTID) ; Proc; Private; Rollback cancellation 208 ; Input same as $$BSDXCAN 209 N BSDXIENS S BSDXIENS=BSDXAPTID_"," 210 N BSDXFDA S BSDXFDA(9002018.4,BSDXIENS,.12)="@" 211 N BSDXMSG 212 D FILE^DIE("","BSDXFDA","BSDXMSG") 213 ;I $D(BSDXMSG) ; Not sure what to do. We are already handling an error. 214 QUIT 197 215 ; 198 216 CANEVT(BSDXPAT,BSDXSTART,BSDXSC) ;EP Called by BSDX CANCEL APPOINTMENT event … … 248 266 D ^%ZTER 249 267 S $EC="" ; Clear Error 268 ; Roll back BSDXAPPT; 269 ; TODO: What if a Mumps error happens in fileman in BSDXAPI? The Scheduling files can potentially be out of sync 270 D:$G(BSDXAPTID) ROLLBACK(BSDXAPTID) 250 271 ; Log error message and send to client 251 272 I '$D(BSDXI) N BSDXI S BSDXI=0 252 273 D ERR(BSDXI,"-100~BSDX08 Error: "_$G(%ZTERZE)) 253 Q UIT274 Q:$Q 1_U_"-100~Mumps Error" Q 254 275 ; 255 276 ;;;NB: This is code that is unused in both original and port.
Note:
See TracChangeset
for help on using the changeset viewer.