Changeset 1454 for Scheduling
- Timestamp:
- Jun 21, 2012, 7:24:56 PM (12 years ago)
- Location:
- Scheduling/trunk/m
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX07.m
r1452 r1454 1 BSDX07 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/2 0/12 3:28pm1 BSDX07 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/21/12 3:54pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 7 7 ; v1.3 July 13 2010 - Add support i18n - Dates input as FM dates, not US. 8 8 ; v1.42 Oct 22 2010 - Transaction now restartable by providing arguments 9 ; thanks to Rick Marshall and Zach Gonzalez at Oroville.10 9 ; v1.42 Oct 30 2010 - Extensive refactoring. 11 10 ; v1.5 Mar 15 2011 - End time does not have to have time anymore. … … 32 31 Q 33 32 ; 34 UT ; Unit Tests - Assumes you have Patients with DFNs 1,2 and 335 ; Set-up - Create Clinics36 N RESNAM S RESNAM="UTCLINIC"37 N HLRESIENS ; holds output of UTCR^BSDX35 - HL IEN^Resource IEN38 D39 . N $ET S $ET="D ^%ZTER B"40 . S HLRESIENS=$$UTCR^BSDX35(RESNAM)41 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so42 ;43 N HLIEN,RESIEN44 S HLIEN=$P(HLRESIENS,U)45 S RESIEN=$P(HLRESIENS,U,2)46 ;47 ; Get start and end times48 N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time49 N APPTTIME S APPTTIME=$P(TIMES,U)50 N ENDTIME S ENDTIME=$P(TIMES,U,2)51 ;52 N ZZZ,DFN53 ; Test for normality:54 S DFN=355 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)56 ; Does Appt exist?57 N APPID S APPID=+$P(^BSDXTMP($J,1),U)58 I 'APPID W "Error Making Appt-1" QUIT59 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-2"60 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-3"61 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-4"62 ;63 ; Do it again for a different patient64 S DFN=265 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)66 N APPID S APPID=+$P(^BSDXTMP($J,1),U)67 I 'APPID W "Error Making Appt-5" QUIT68 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-6"69 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-7"70 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-8"71 ;72 ; Again for a different patient (4)73 S DFN=474 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)75 N APPID S APPID=+$P(^BSDXTMP($J,1),U)76 I 'APPID W "Error Making Appt-9" QUIT77 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-10"78 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-11"79 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-12"80 ;81 ; Delete appointment set for Patient 4 (made above)82 N BSDX,DFN83 S DFN=484 S BSDX("PAT")=DFN85 S BSDX("CLN")=HLIEN86 S BSDX("ADT")=APPTTIME87 D ROLLBACK(APPID,.BSDX)88 I +$G(^BSDXAPPT(APPID,0)) W "Error in deleting appointment-1",!89 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-2",!90 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-3",!91 ;92 ; Again for a different patient (5)93 S DFN=594 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)95 N APPID S APPID=+$P(^BSDXTMP($J,1),U)96 I 'APPID W "Error Making Appt-13" QUIT97 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-14"98 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-15"99 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-16"100 ; Now cancel that appointment101 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")102 ; Now make it again103 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)104 N APPID S APPID=+$P(^BSDXTMP($J,1),U)105 I 'APPID W "Error Making Appt-17" QUIT106 I +^BSDXAPPT(APPID,0)'=APPTTIME W "Error Making Appt-18"107 I '$D(^DPT(DFN,"S",APPTTIME)) W "Error Making Appt-19"108 I '$$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error Making Appt-20"109 ;110 ; Delete appointment set for Patient 1 (not made)... needs to not crash111 D112 . N $ET S $ET="D ^%ZTER S $EC="""" W ""Failure to del non-existent appt"",!"113 . N BSDX114 . S BSDX("PAT")=1115 . S BSDX("CLN")=HLIEN116 . S BSDX("ADT")=APPTTIME117 . D ROLLBACK(APPID,.BSDX)118 ;119 ; Test for bad start date120 D APPADD(.ZZZ,2100123,3100123.3,2,RESNAM,30,"Sam's Note",1)121 I +$P(^BSDXTMP($J,1),U,2)'=-2 W "Error in -2",!122 ; Test for bad end date123 D APPADD(.ZZZ,3100123,2100123.3,2,RESNAM,30,"Sam's Note",1)124 I +$P(^BSDXTMP($J,1),U,2)'=-3 W "Error in -3",!125 ; Test for end date without time - obsolete126 ; D APPADD(.ZZZ,3100123.1,3100123,2,RESNAM,30,"Sam's Note",1)127 ; I +$P(^BSDXTMP($J,1),U,2)'=-4 W "Error in -4",!128 ; Test for mumps error129 S BSDXDIE=1130 D APPADD(.ZZZ,APPTTIME,ENDTIME,1,RESNAM,30,"Sam's Note",1)131 I +$P(^BSDXTMP($J,1),U,2)'=-100 W "Error in -100: M Error",!132 K BSDXDIE133 ; Test for TRESTART -- retired in v 1.7134 ; S BSDXRESTART=1135 ; D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)136 ; I +$P(^BSDXTMP($J,1),U,2)'=0&(+$P(^BSDXTMP($J,1),U,2)'=-10) W "Error in TRESTART",!137 ; K BSDXRESTART138 ; Test for non-numeric patient139 D APPADD(.ZZZ,APPTTIME,ENDTIME,"CAT,DOG",RESNAM,30,"Sam's Note",1)140 I +$P(^BSDXTMP($J,1),U,2)'=-5 W "Error in -5",!141 ; Test for a non-existent patient142 D APPADD(.ZZZ,APPTTIME,ENDTIME,8989898989,RESNAM,30,"Sam's Note",1)143 I +$P(^BSDXTMP($J,1),U,2)'=-6 W "Error in -6",!144 ; Test for a non-existent resource name145 D APPADD(.ZZZ,APPTTIME,ENDTIME,3,"lkajsflkjsadf",30,"Sam's Note",1)146 I +$P(^BSDXTMP($J,1),U,2)'=-7 W "Error in -7",!147 ; Test for corrupted resource148 ; Can't test for -8 since it requires DB corruption149 ; Test for inability to add appointment to BSDX Appointment (-9)150 ; Also requires something wrong in the DB151 ; Test for inability to add appointment to 2,44152 ; Test by creating a duplicate appointment153 ; Get start and end times154 N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time155 N APPTTIME S APPTTIME=$P(TIMES,U)156 N ENDTIME S ENDTIME=$P(TIMES,U,2)157 D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)158 D APPADD(.ZZZ,APPTTIME,ENDTIME,3,RESNAM,30,"Sam's Note",1)159 I +$P(^BSDXTMP($J,1),U,2)'=-10 W "Error in -10",!160 ;161 ; Test that rollback occurs properly in various places162 N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time163 N APPTTIME S APPTTIME=$P(TIMES,U)164 N ENDTIME S ENDTIME=$P(TIMES,U,2)165 S DFN=4166 N BSDXSIMERR1 S BSDXSIMERR1=1167 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)168 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))169 I +APPID W "Error in deleting appointment-4",!170 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-5",!171 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-6",!172 ;173 K BSDXSIMERR1174 N BSDXSIMERR2 S BSDXSIMERR2=1175 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)176 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))177 I +APPID W "Error in deleting appointment-7",!178 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-8",!179 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-9",!180 ;181 K BSDXSIMERR2182 N BSDXSIMERR4 S BSDXSIMERR4=1183 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)184 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))185 I +APPID W "Error in deleting appointment-16",!186 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-17",!187 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-18",!188 ;189 K BSDXSIMERR4190 N BSDXSIMERR5 S BSDXSIMERR5=1191 D APPADD(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)192 N APPID S APPID=$O(^BSDXAPPT("B",APPTTIME,""))193 I +APPID W "Error in deleting appointment-19",!194 I $D(^DPT(DFN,"S",APPTTIME)) W "Error in deleting appointment-20",!195 I $$SCIEN^BSDXAPI(DFN,HLIEN,APPTTIME) W "Error in deleting appointment-21",!196 QUIT197 ;198 33 APPADD(BSDXY,BSDXSTART,BSDXEND,BSDXPATID,BSDXRES,BSDXLEN,BSDXNOTE,BSDXATID,BSDXRADEXAM) ;EP 199 34 ; … … 299 134 N BSDXC ; Array to send to MAKE and MAKECK APIs 300 135 ; Only if we have a valid Hosp Location 301 I +BSDXSCD,$D(^SC(BSDXSCD,0)) D 136 I +BSDXSCD,$D(^SC(BSDXSCD,0)) D I +BSDXERR D ERR(BSDXI,"-10~BSDX07 Error: MAKECK^BSDXAPI returned error code: "_BSDXERR) Q ; no need for roll back 302 137 . S BSDXC("PAT")=BSDXPATID 303 138 . S BSDXC("CLN")=BSDXSCD … … 311 146 . S BSDXC("USR")=DUZ 312 147 . S BSDXERR=$$MAKECK^BSDXAPI(.BSDXC) 313 I +BSDXERR D ERR(BSDXI,"-10~BSDX07 Error: MAKECK^BSDXAPI returned error code: "_BSDXERR) Q ; no need for roll back314 148 ; 315 149 ; Done with all checks, let's make appointment in BSDX APPOINTMENT -
Scheduling/trunk/m/BSDX08.m
r1452 r1454 1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/2 0/12 3:52pm1 BSDX08 ; VW/UJO/SMH - WINDOWS SCHEDULING RPCS ; 6/21/12 4:49pm 2 2 ;;1.6;BSDX;;Aug 31, 2011;Build 18 3 3 ; … … 38 38 Q 39 39 ; 40 UT ; Unit Tests41 N RESNAM S RESNAM="UTCLINIC"42 N HLRESIENS ; holds output of UTCR^BSDX35 - HL IEN^Resource IEN43 D44 . N $ET S $ET="D ^%ZTER B"45 . S HLRESIENS=$$UTCR^BSDX35(RESNAM)46 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so47 ;48 N HLIEN,RESIEN49 S HLIEN=$P(HLRESIENS,U)50 S RESIEN=$P(HLRESIENS,U,2)51 ;52 ; Get start and end times53 N TIMES S TIMES=$$TIMES^BSDX35 ; appt time^end time54 N APPTTIME S APPTTIME=$P(TIMES,U)55 N ENDTIME S ENDTIME=$P(TIMES,U,2)56 ;57 ; Test 1: Make normal appointment and cancel it. See if every thing works58 N ZZZ,DFN59 S DFN=360 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)61 S APPID=+$P(^BSDXTMP($J,1),U)62 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")63 I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"64 I $O(^SC(2,"S",APPTTIME,1,0))]"" W "Error in Cancellation-2"65 I $P(^DPT(4,"S",APPTTIME,0),U,2)'="PC" W "Error in Cancellation-3"66 I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4"67 ;68 ; Test 2: Check for -169 ; Make appt70 D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1)71 ; Lock the node in another job72 S APPID=+$P(^BSDXTMP($J,1),U)73 ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 1074 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")75 ;76 ; Test 3: Check for -10077 S bsdxdie=178 D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1)79 S APPID=+$P(^BSDXTMP($J,1),U)80 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")81 I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!82 K bsdxdie83 ;84 ; Test 4: Restartable transaction85 S bsdxrestart=186 D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1)87 S APPID=+$P(^BSDXTMP($J,1),U)88 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")89 I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",!90 ;91 ; Test 5: for invalid Appointment ID (-2 and -3)92 D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")93 I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!94 D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")95 I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!96 UT2 ; More unit Tests97 ;98 ; Test 6: for Cancelling walkin and checked-in appointments99 S BSDXSTART=$E($$NOW^XLFDT,1,12),BSDXEND=BSDXSTART+.0001100 D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt101 S APPID=+$P(^BSDXTMP($J,1),U)102 I APPID=0 W "Error in test 6",!103 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in104 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt105 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!106 ;107 ; Test 7: for cancelling walkin and checked-in appointments108 S BSDXSTART=$E($$NOW^XLFDT,1,12)+.0001,BSDXEND=BSDXSTART+.0001109 D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt110 S APPID=+$P(^BSDXTMP($J,1),U)111 I APPID=0 W "Error in test 6",!112 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin113 S BSDXRES=$O(^BSDXRES("B","Dr Office",""))114 S BSDXCLN=$P(^BSDXRES(BSDXRES,0),U,4)115 S BSDXRESULT=$$RMCI^BSDXAPI(4,BSDXCLN,BSDXSTART) ; remove checkin116 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt117 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!118 QUIT119 40 APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP 120 41 ;Called by RPC: BSDX CANCEL APPOINTMENT … … 141 62 ; Counter 142 63 N BSDXI S BSDXI=0 64 ; 143 65 ; Header Node 144 66 S ^BSDXTMP($J,BSDXI)="T00100ERRORID"_$C(30) … … 158 80 ; 159 81 ;;;test for error inside transaction. See if %ZTER works 160 I $G( bsdxdie) S X=1/082 I $G(BSDXDIE) S X=1/0 161 83 ;;;test 162 84 ;;;test for TRESTART 163 I $G( bsdxrestart) K bsdxrestart TRESTART85 I $G(BSDXRESTART) K BSDXRESTART tRESTART 164 86 ;;;test 165 87 ; … … 187 109 N BSDXERR S BSDXERR=0 188 110 ; Only file in 2/44 if there is an associated hospital location 189 I BSDXLOC D QUIT:BSDXERR 111 I BSDXLOC D QUIT:BSDXERR 190 112 . I '$D(^SC(BSDXLOC,0)) S BSDXERR=1 D ERR(BSDXI,"-6~BSDX08: Invalid Hosp Location stored in Database") QUIT 191 113 . ; Get the IEN of the appointment in the "S" node of ^SC … … 215 137 ;See SDCNP0 216 138 N SD,S ; Start Date 217 S (SD,S)=BSDXSTART 139 S (SD,S)=BSDXSTART 218 140 N I ; Clinic IEN in 44 219 141 S I=BSDXSCD … … 244 166 ; Y#1 -> Minutes; *SI -> * Slots per hour; \.6 trunc min to hour 245 167 ; Y\1 -> Hours since start of day; * SI: * slots 246 S ST=Y#1*SI\.6+(Y\1*SI) 168 S ST=Y#1*SI\.6+(Y\1*SI) 247 169 N SS ; how many slots are supposed to be taken by appointment 248 170 S SS=SL*HSI/60 ; (nb: try SL: 30 min; HSI: 4 slots) … … 251 173 . ; loop through pattern. Tired of documenting. 252 174 . F I=ST+ST:SDDIF D Q:Y="" Q:SS'>0 253 . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y="" 175 . . S Y=$E(STR,$F(STR,$E(S,I+1))) Q:Y="" 254 176 . . S S=$E(S,1,I)_Y_$E(S,I+2,999) 255 . . S SS=SS-1 177 . . S SS=SS-1 256 178 . . Q:SS'>0 257 179 S ^SC(BSDXSCD,"ST",SD\1,1)=S ; new pattern; global set -
Scheduling/trunk/m/BSDX35.m
r1449 r1454 1 BSDX35 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/ 18/12 2:27pm1 BSDX35 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 6/21/12 3:57pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 74 74 S ^BSDXTMP($J,BSDXI)=$C(31) 75 75 Q 76 UTCR(RESNAM) ; $$ - Create Unit Test Clinic and Resource Pair ; Private77 ; Input: Resource Name By Value78 ; Output: -1^Error or HLIEN^RESIEN for Success (file 44 IEN^file 9002018.1 IEN)79 ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY80 N HLIEN S HLIEN=$$UTCR44(RESNAM)81 I +HLIEN=-1 QUIT HLIEN82 ;83 N RESIEN S RESIEN=$$UTCRRES(RESNAM,HLIEN)84 I +RESIEN=-1 QUIT RESIEN85 E QUIT HLIEN_U_RESIEN86 ;87 UTCR44(HLNAME) ; $$ - Create Unit Test Clinic in File 44; Private ; TESTING ONLY CODE88 ; Output: -1^Error or IEN for Success89 ; Input: Hosp Location Name by Value90 ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY91 ;92 I $D(^SC("B",HLNAME)) Q $O(^(HLNAME,""))93 ;94 N SAM95 S SAM(44,"?+1,",.01)=HLNAME ; Name96 S SAM(44,"?+1,",2)="C" ; Type = Clinic97 S SAM(44,"?+1,",2.1)=1 ; Type Extension (not used)98 S SAM(44,"?+1,",3.5)=$O(^DG(40.8,0)) ; Division (not yet used)99 S SAM(44,"?+1,",8)=295 ; Stop Code Number (not used)100 S SAM(44,"?+1,",9)="M" ; Service (not used)101 S SAM(44,"?+1,",1912)=15 ; Length of Appt (not used)102 S SAM(44,"?+1,",1917)=4 ; Display increments per hour (not used)103 S SAM(44,"?+1,",1918)=8 ; Overbooks/day max (not used)104 S SAM(44,"?+1,",2000.5)=0 ; Require Action Profiles: Yes (not used)105 S SAM(44,"?+1,",2001)=999 ; Allowable consecutive no-shows (not used)106 S SAM(44,"?+1,",2002)=999 ; Max # days for Future Booking (not used)107 S SAM(44,"?+1,",2005)=365 ; Max # days for Auto Rebook (not used)108 S SAM(44,"?+1,",2502)="N" ; Non-Count Clinic (not used)109 S SAM(44,"?+1,",2504)="Y" ; Clinic meets at this Facility? (not used)110 S SAM(44,"?+1,",2507)=9 ; Appointment Type (not used)111 ;112 N BSDXERR,BSDXIEN113 D UPDATE^DIE("",$NA(SAM),$NA(BSDXIEN),$NA(BSDXERR))114 Q $S($D(BSDXERR):-1_U_BSDXERR("DIERR",1,"TEXT",1),1:BSDXIEN(1))115 ;116 UTCRRES(NAME,HLIEN) ; $$ - Create Unit Test Resource in 9002018.1 (BSDX RESOURCE); Private117 ; Input: Hospital Location IEN118 ; Output: -1^Error or IEN for Success119 ; DO NOT USE IN A PRODUCTION ENVIRONTMENT. INTENDED FOR TESTING ONLY120 I $D(^BSDXRES("B",NAME)) Q $O(^(NAME,""))121 D RSRC^BSDX16(.RES,"|"_NAME_"||"_HLIEN)122 N RTN S RTN=@$Q(^BSDXTMP($J,0)) ; return array next value123 Q $S(RTN=0:-1_U_RTN,1:+RTN) ; 0 means an error has occurred; 1 means IEN returned124 ;125 TIMES() ; $$ - Create a next available appointment time^ending time; Private126 N NOW S NOW=$$NOW^XLFDT() ; Now time127 N LAST S LAST=$O(^BSDXAPPT("B"," "),-1) ; highest time in file128 N TIME2USE S TIME2USE=$S(NOW>LAST:NOW,1:LAST) ; Which time to use?129 S TIME2USE=$E(TIME2USE,1,12) ; Strip away seconds130 N APPTIME S APPTIME=$$FMADD^XLFDT(TIME2USE,0,0,15,0) ; Add 15 min131 N ENDTIME S ENDTIME=$$FMADD^XLFDT(APPTIME,0,0,15,0) ; Add 15 more min132 Q APPTIME_U_ENDTIME ; quit with apptime^endtime
Note:
See TracChangeset
for help on using the changeset viewer.