Changeset 1455 for Scheduling/trunk/m/BSDX08.m
- Timestamp:
- Jun 22, 2012, 7:11:05 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX08.m
r1454 r1455 1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/2 1/12 4:49pm2 ;;1. 6;BSDX;;Aug 31, 2011;Build 181 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/22/12 4:19pm 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; 4 4 ; Original by HMW. New Written by Sam Habiel. Licensed under LGPL. … … 71 71 L +^BSDXAPPT(BSDXAPTID):5 I '$T D ERR(BSDXI,"-1~BSDX08: Appt record is locked. Please contact technical support.") Q 72 72 ; 73 ;Restartable Transaction; restore paramters when starting.74 ; (Params restored are what's passed here + BSDXI)75 TSTART (BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT,BSDXI):T="BSDX CANCEL APPOINTEMENT^BSDX08"76 ;77 73 ; Turn off SDAM APPT PROTOCOL BSDX Entries 78 74 N BSDXNOEV … … 81 77 ;;;test for error inside transaction. See if %ZTER works 82 78 I $G(BSDXDIE) S X=1/0 83 ;;;test84 ;;;test for TRESTART85 I $G(BSDXRESTART) K BSDXRESTART tRESTART86 ;;;test87 79 ; 88 80 ; Check appointment ID and whether it exists 89 81 I '+BSDXAPTID D ERR(BSDXI,"-2~BSDX08: Invalid Appointment ID") Q 90 82 I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(BSDXI,"-3~BSDX08: Invalid Appointment ID") Q 91 ; 83 ; 92 84 ; Start Processing: 93 ; First, add cancellation date to appt entry in BSDX APPOINTMENT85 ; First, get data 94 86 N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPTID,0) ; BSDX Appt Node 95 87 N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; Patient ID 96 88 N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Start Time 97 D BSDXCAN(BSDXAPTID) ; Add a cancellation date in BSDX APPOINTMENT 98 ; 99 ; Second, cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability 89 ; 90 ; Check the resource ID and whether it exists 100 91 N BSDXSC1 S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID 101 92 ; If the resouce id doesn't exist... 102 93 I BSDXSC1="" D ERR(BSDXI,"-4~BSDX08: Cancelled appointment does not have a Resouce ID") QUIT 103 94 I '$D(^BSDXRES(BSDXSC1,0)) D ERR(BSDXI,"-5~BSDX08: Resouce ID does not exist in BSDX RESOURCE") QUIT 95 ; 96 ; Process PIMS issues first: 97 ; cancel appt in "S" nodes in file 2 and 44, then update Legacy PIMS Availability 104 98 ; Get zero node of resouce 105 S BSDXNOD=^BSDXRES(BSDXSC1,0)99 N BSDXNOD S BSDXNOD=^BSDXRES(BSDXSC1,0) 106 100 ; Get Hosp location 107 101 N BSDXLOC S BSDXLOC=$P(BSDXNOD,U,4) 108 102 ; Error indicator for Hosp Location filing for getting out of routine 109 103 N BSDXERR S BSDXERR=0 104 ; For BSDXC 105 N BSDXC 110 106 ; Only file in 2/44 if there is an associated hospital location 111 107 I BSDXLOC D QUIT:BSDXERR 112 . I '$D(^SC(BSDXLOC,0)) S BSDXERR=1 D ERR(BSDXI,"-6~BSDX08: Invalid Hosp Location stored in Database") QUIT 113 . ; Get the IEN of the appointment in the "S" node of ^SC 114 . N BSDXSCIEN 115 . S BSDXSCIEN=$$SCIEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) 116 . I BSDXSCIEN="" S BSDXERR=1 D ERR(BSDXI,"-7~BSDX08: Patient does not have an appointment in PIMS Clinic") QUIT 117 . ; Get the appointment node 118 . S BSDXNOD=$G(^SC(BSDXLOC,"S",BSDXSTART,1,BSDXSCIEN,0)) 119 . I BSDXNOD="" S BSDXERR=1 D ERR(BSDXI,"-8^BSDX08: Unable to find associated PIMS appointment for this patient") QUIT 120 . N BSDXLEN S BSDXLEN=$P(BSDXNOD,U,2) 108 . S BSDXC("PAT")=BSDXPATID 109 . S BSDXC("CLN")=BSDXLOC 110 . S BSDXC("TYP")=BSDXTYP 111 . S BSDXC("ADT")=BSDXSTART 112 . S BSDXC("CDT")=$$NOW^XLFDT() 113 . S BSDXC("NOT")=BSDXNOT 114 . S:'+$G(BSDXCR) BSDXCR=11 ;Other 115 . S BSDXC("CR")=BSDXCR 116 . S BSDXC("USR")=DUZ 117 . ; 118 . S BSDXERR=$$CANCELCK^BSDXAPI(.BSDXC) ; 0 or 1^error message 119 . I BSDXERR D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXERR,U,2)) QUIT 120 . ; 121 . N BSDXLEN S BSDXLEN=$$APPLEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) 122 . ; DEBUG 123 . I 'BSDXLEN S $EC=",U1," 124 . ; DEBUG 121 125 . ; Cancel through BSDXAPI 122 . N BSDXZ 123 . D APCAN(.BSDXZ,BSDXLOC,BSDXPATID,BSDXSTART) 124 . I +BSDXZ>0 S BSDXERR=1 D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXZ,U,2)) QUIT 126 . S BSDXERR=$$CANCEL^BSDXAPI(.BSDXC) 127 . I BSDXERR=1 D ERR(BSDXI,"-9^BSDX08: BSDXAPI returned an error: "_$P(BSDXZ,U,2)) QUIT 125 128 . ; Update Legacy PIMS clinic Availability 126 129 . D AVUPDT(BSDXLOC,BSDXSTART,BSDXLEN) 127 130 ; 128 TCOMMIT 131 D BSDXCAN(BSDXAPTID) ; Add a cancellation date in BSDX APPOINTMENT 132 ; 129 133 L -^BSDXAPPT(BSDXAPTID) 130 134 S BSDXI=BSDXI+1 … … 180 184 Q 181 185 ; 182 APCAN(BSDXZ,BSDXLOC,BSDXDFN,BSDXSD) ;183 ;Cancel appointment for patient BSDXDFN in clinic BSDXSC1184 ;at time BSDXSD185 N BSDXC,%H186 S BSDXC("PAT")=BSDXPATID187 S BSDXC("CLN")=BSDXLOC188 S BSDXC("TYP")=BSDXTYP189 S BSDXC("ADT")=BSDXSD190 S %H=$H D YMD^%DTC191 S BSDXC("CDT")=X+%192 S BSDXC("NOT")=BSDXNOT193 S:'+$G(BSDXCR) BSDXCR=11 ;Other194 S BSDXC("CR")=BSDXCR195 S BSDXC("USR")=DUZ196 ;197 S BSDXZ=$$CANCEL^BSDXAPI(.BSDXC)198 Q199 ;200 186 BSDXCAN(BSDXAPTID) ; 201 187 ;Cancel BSDX APPOINTMENT entry … … 231 217 Q:'$D(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART)) BSDXFOUND 232 218 S BSDXAPPT=0 F S BSDXAPPT=$O(^BSDXAPPT("ARSRC",BSDXRES,BSDXSTART,BSDXAPPT)) Q:'+BSDXAPPT D Q:BSDXFOUND 219 . N BSDXNOD 233 220 . S BSDXNOD=$G(^BSDXAPPT(BSDXAPPT,0)) Q:BSDXNOD="" 234 221 . I $P(BSDXNOD,U,5)=BSDXPAT,$P(BSDXNOD,U,12)="" S BSDXFOUND=1 Q … … 250 237 S BSDXI=BSDXI+1 251 238 S BSDXERR=$TR(BSDXERR,"^","~") 252 I $TL>0 TROLLBACK253 239 S ^BSDXTMP($J,BSDXI)=BSDXERR_$C(30) 254 240 S BSDXI=BSDXI+1 … … 259 245 ETRAP ;EP Error trap entry 260 246 N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap 261 ; Rollback, otherwise ^XTER will be empty from future rollback262 I $TL>0 TROLLBACK263 247 D ^%ZTER 264 248 S $EC="" ; Clear Error
Note:
See TracChangeset
for help on using the changeset viewer.