Changeset 1462 for Scheduling/trunk
- Timestamp:
- Jun 27, 2012, 7:45:33 PM (12 years ago)
- Location:
- Scheduling/trunk/m
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX31.m
r1461 r1462 1 BSDX31 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/2 6/12 4:35pm1 BSDX31 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/27/12 4:57pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 10 10 ; - Made BSDXNOS extrinsic. 11 11 ; - Moved Unit Tests to BSDXUT1 12 ; - BSDXNOS deletes no-show rather than file 0 for 13 ; undoing a no show 12 14 ; 13 15 ; Error Reference: … … 85 87 N BSDXRESNOD S BSDXRESNOD=^BSDXRES(BSDXRES,0) 86 88 N BSDXLOC S BSDXLOC=$P(BSDXRESNOD,U,4) ;HOSPITAL LOCATION 87 I '$D(^SC(BSDXLOC,0)) S BSDXLOC="" ; Unlink it if it doesn't exist 88 ; I can go and then delete it from BSDXLOC like Mailman code which tries 89 ; to be too helpful... but I will postpone that until this is need it. 90 ; 91 ; Edit BSDX APPOINTMENT entry 92 N BSDXMSG S BSDXMSG=$$BSDXNOS(BSDXAPTID,BSDXNS) ;Edit BSDX APPOINTMENT entry NOSHOW field 89 I BSDXLOC,'$D(^SC(BSDXLOC,0)) S BSDXLOC="" ; Unlink it if it doesn't exist 90 ; I can go and then delete it from ^BSDXRES like Mailman code which tries 91 ; to be too helpful... but I will postpone that until this is a need. 92 ; 93 ; Check if it's okay to no-show patient. 94 N BSDXERR S BSDXERR=0 ; Error variable 95 I BSDXLOC S BSDXERR=$$NOSHOWCK^BSDXAPI1(BSDXPATID,BSDXLOC,BSDXSTART,BSDXNS) 96 I BSDXERR D ERR(-5,"BSDX31: "_$P(BSDXERR,U,2)) QUIT 97 ; 98 ; Simulated Error 99 I $G(BSDXSIMERR1) D ERR(-4,"BSDX31: Simulated Error") QUIT 100 ; Edit BSDX APPOINTMENT entry No-show field 101 ; Failure Analysis: If we fail here, no rollback needed, as this is the 1st 102 ; call 103 N BSDXMSG S BSDXMSG=$$BSDXNOS(BSDXAPTID,BSDXNS) 93 104 I BSDXMSG D ERR(-4,"BSDX31: "_$P(BSDXMSG,U,2)) QUIT 94 105 ; 95 106 ; Edit File 2 "S" node entry 96 N BSDXERR ; Error variable 107 ; Failure Analysis: If we fail here, we need to rollback the BSDX 108 ; Apptointment Entry 109 N BSDXERR S BSDXERR=0 ; Error variable 97 110 ; If HL exist, (resource is linked to PIMS), file no show in File 2 98 111 I BSDXLOC S BSDXERR=$$NOSHOW^BSDXAPI1(BSDXPATID,BSDXLOC,BSDXSTART,BSDXNS) 99 I BSDXERR D ERR(-5,"BSDX31: "_$P(BSDXERR,U,2)) QUIT 100 ; 112 I BSDXERR D QUIT 113 . D ERR(-5,"BSDX31: "_$P(BSDXERR,U,2)) 114 . N % S %=$$BSDXNOS(BSDXAPTID,'BSDXNS) ; no error checking for filer 115 ; 116 ; Return data in ADO.net table 101 117 S BSDXI=BSDXI+1 102 118 S ^BSDXTMP($J,BSDXI)="1^"_$C(30) ; 1 means everything okay … … 106 122 ; 107 123 BSDXNOS(BSDXAPTID,BSDXNS) ; $$ Private; File/unfile noshow in ^BSDXAPPT 124 ; in v1.7 I delete the no-show value rather than file zero 108 125 N BSDXFDA,BSDXIENS,BSDXMSG 126 N BSDXVALUE ; What to file: 1 or delete it. 127 I BSDXNS S BSDXVALUE=1 128 E S BSDXVALUE="@" 109 129 S BSDXIENS=BSDXAPTID_"," 110 S BSDXFDA(9002018.4,BSDXIENS,.1)=BSDX NS ;NOSHOW130 S BSDXFDA(9002018.4,BSDXIENS,.1)=BSDXVALUE ;NOSHOW 1 or 0 111 131 D FILE^DIE("","BSDXFDA","BSDXMSG") 112 132 QUIT:$D(BSDXMSG) -1_U_BSDXMSG("DIERR",1,"TEXT",1) … … 157 177 ; 158 178 ERR(BSDXERID,ERRTXT) ;Error processing 179 ; If last line is $C(31), we are done. No more errors to send to client. 180 I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT 159 181 S BSDXI=BSDXI+1 160 182 S ERRTXT=$TR(ERRTXT,"^","~") … … 166 188 ETRAP ;EP Error trap entry 167 189 N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap 168 I $G(BSDXAPTID),$D(BSDXNS) N % S %=$$BSDXNOS(BSDXAPTID,'BSDXNS) ; Reverse No-Show status (whatever it was)169 190 D ^%ZTER 170 191 S $EC="" ; Clear Error 192 I $G(BSDXAPTID),$D(BSDXNS) N % S %=$$BSDXNOS(BSDXAPTID,'BSDXNS) ; Reverse No-Show status (whatever it was) 171 193 ; Send to client 172 194 I '$D(BSDXI) N BSDXI S BSDXI=0 173 195 D ERR(-100,"BSDX31 Error: "_$G(%ZTERZE)) 174 Q UIT196 Q:$Q 100_U_"Mumps Error" Q 175 197 ; 176 198 IMHERE(BSDXRES) ;EP -
Scheduling/trunk/m/BSDXAPI1.m
r1461 r1462 1 BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/2 6/12 4:32pm1 BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/27/12 4:45pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 7 7 ; CLINIC = SC IEN 8 8 ; DATE = FM Date/Time of Appointment 9 ; NSFLAG = truthy value to add no-show, or falsy to remove 10 ; -1^error for failure, 0 for success9 ; NSFLAG = truthy value to add no-show, or falsy to remove (use 1 or 0 pls!) 10 ; 1^error for failure, 0 for success 11 11 ; Code follows EN1^SDN 12 ; 13 ; Check for failure conditions first before doing this. No globals set here 12 14 N NOSHOWCK S NOSHOWCK=$$NOSHOWCK(PAT,CLINIC,DATE,NSFLAG) 13 15 I NOSHOWCK Q NOSHOWCK 14 16 ; 17 ; Set up Protocol Driver 15 18 N SDNSHDL,SDDA S SDNSHDL=$$HANDLE^SDAMEVT(1) S SDDA=$$SCIEN^BSDXAPI(PAT,CLINIC,DATE) 16 19 N SDATA 17 D BEFORE^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,SDNSHDL) 20 D BEFORE^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,SDNSHDL) ; Only ^TMP set here. 21 ; 22 ; Simulated Errors 23 Q:$D(BSDXSIMERR2) 1_U_"Simulated Error" 24 ; 25 ; Edit the ^DPT( "S" node entry - Noshow or undo noshow 26 ; Failure analysis: if we fail here, we presume no change happened in 27 ; ^DPT(DA,"S", and so we just have to roll back ^BSDXAPPT 18 28 N BSDXIENS S BSDXIENS=DATE_","_PAT_"," 19 29 N BSDXFDA … … 29 39 D FILE^DIE("","BSDXFDA","BSDXMSG") 30 40 Q:$D(BSDXMSG) 1_U_"Fileman edit to DPT error: Patient="_PAT_" Appt="_DATE_" Error="_BSDXMSG("DIERR",1,"TEXT",1) 41 ; 42 ; This M error trigger tests if ^BSDXAPPT rolls back. 43 ; I won't try to roll back ^DPT(,"S" 44 ; The M error is caused here, so if I try to rollback, I can cause another 45 ; error. Infinite Errors then. 46 I $D(BSDXSIMERR3) N X S X=1/0 47 ; 48 ; Run the event driver 31 49 D NOSHOW^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,0,SDNSHDL) 32 50 Q 0 51 ; 33 52 NOSHOWCK(PAT,CLINIC,DATE,NSFLAG) ; $$ PEP; No-show Check 34 ; pars are the same as above 53 ; TODO: Not all appointments can be no showed. 54 ; Check the code in SDAMN 55 ; S SDSTB=$$STATUS^SDAM1(DFN,SDT,SDCL,$G(^DPT(DFN,"S",SDT,0))) ; before status 56 ; Q:'$$CHK ; Checks $D(^SD(409.63,"ANS",1,+SDSTB)) 35 57 QUIT 0 -
Scheduling/trunk/m/BSDXUT.m
r1461 r1462 1 BSDXUT ; VEN/SMH - Unit Tests for Scheduling GUI ; 6/2 6/12 11:06am1 BSDXUT ; VEN/SMH - Unit Tests for Scheduling GUI ; 6/27/12 4:18pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 207 207 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1) 208 208 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1) 209 I +$P(^BSDXTMP($J,1),U,2)'=-10 W "Error in -10 in Unlinked Section ",!209 I +$P(^BSDXTMP($J,1),U,2)'=-10 W "Error in -10 in Unlinked Section (existing bug)",! 210 210 ; 211 211 ; Test that ROLLBACK^BSDX07 occurs properly in various places -
Scheduling/trunk/m/BSDXUT1.m
r1461 r1462 1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/2 6/12 4:36pm1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/27/12 4:59pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; … … 227 227 ; Test 2: Undo NOSHOW 228 228 D NOSHOW^BSDX31(.ZZZ,APPID,0) 229 I $P(^BSDXAPPT(APPID,0),U,10)'=" 0" W "ERROR T2",!229 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T2",! 230 230 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T2",! 231 231 ; Test 3: -1 … … 243 243 I $P(^BSDXTMP($J,1),U)'=-100 W "ERROR T6",! 244 244 K BSDXDIE 245 ; Test 7: Restartable transaction 246 N BSDXRESTART S BSDXRESTART=1 247 D NOSHOW^BSDX31(.ZZZ,APPID,1) 248 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T7",! 245 ; 246 ; Test 9 247 ; Error Simulations 248 ; Get start and end times 249 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time 250 N APPTTIME S APPTTIME=$P(TIMES,U) 251 N ENDTIME S ENDTIME=$P(TIMES,U,2) 252 ; 253 ; This tests if we fail without filing anything 254 N ZZZ,DFN 255 S DFN=3 256 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 257 N APPID S APPID=+$P(^BSDXTMP($J,1),U) 258 N BSDXSIMERR1 S BSDXSIMERR1=1 259 D NOSHOW^BSDX31(.ZZZ,APPID,1) 260 I $P(^BSDXTMP($J,1),U)'=-4 W "ERROR T9.1",! 261 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.2",! 262 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.3",! 263 K BSDXSIMERR1 264 ; 265 ; This tests if we fail inside BSDXAPI and have to rollback ^BSDXAPPT 266 N BSDXSIMERR2 S BSDXSIMERR2=1 267 D NOSHOW^BSDX31(.ZZZ,APPID,1) 268 I $P(^BSDXTMP($J,1),U)'=-5 W "ERROR T9.4",! 269 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.5",! 270 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.6",! 271 K BSDXSIMERR2 272 ; 273 ; This test a mumps error in BSDXAPI 274 N BSDXSIMERR3 S BSDXSIMERR3=1 275 D NOSHOW^BSDX31(.ZZZ,APPID,1) 276 I +$P(^BSDXTMP($J,1),U)'=-100 W "ERROR T9.7",! 277 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.8",! 278 K BSDXSIMERR3 279 ; 280 ; Test 7: Restartable transaction ; Retired 281 ; 282 ; Test 8: UTs for an unlinked resource (not linked to PIMS) 283 N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic 284 N RESIEN 285 D 286 . N $ET S $ET="D ^%ZTER B" 287 . S RESIEN=$$UTCRRES^BSDXUT(RESNAM) 288 . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so 289 ; 290 ; Get start and end times 291 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time 292 N APPTTIME S APPTTIME=$P(TIMES,U) 293 N ENDTIME S ENDTIME=$P(TIMES,U,2) 294 ; 295 ; Make appt 296 N ZZZ,DFN 297 S DFN=3 298 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1) 299 N APPID S APPID=+$P(^BSDXTMP($J,1),U) 300 ; Test 1: Sanity Check 301 D NOSHOW^BSDX31(.ZZZ,APPID,1) 302 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.1",! 303 ; Test 2: Undo NOSHOW 304 D NOSHOW^BSDX31(.ZZZ,APPID,0) 305 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T8.2",! 306 ; Test 3: Put it back on... 307 D NOSHOW^BSDX31(.ZZZ,APPID,1) 308 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.3",! 309 ; 310 ; 249 311 QUIT
Note:
See TracChangeset
for help on using the changeset viewer.