Refactoring BSDX25 continued...
This commit is contained in:
parent
86db419104
commit
fba588405f
75
m/BSDX25.m
75
m/BSDX25.m
|
@ -1,4 +1,4 @@
|
|||
BSDX25 ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 6/29/12 12:04pm
|
||||
BSDX25 ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 7/3/12 12:27pm
|
||||
;;1.7T1;BSDX;;Aug 31, 2011;Build 18
|
||||
; Licensed under LGPL
|
||||
;
|
||||
|
@ -33,6 +33,13 @@ CHECKIN(BSDXY,BSDXAPPTID,BSDXCDT) ;Private EP Check in appointment
|
|||
; - 0 if all okay
|
||||
; - Another number or text if not
|
||||
;
|
||||
; Error reference:
|
||||
; -1 -> Invalid Appointment ID
|
||||
; -2 -> Invalid Check-in Date
|
||||
; -3 -> Cannot check-in due to Fileman Filer failure
|
||||
; -10 -> BSDXAPI error
|
||||
; -100 -> Mumps Error
|
||||
;
|
||||
; Turn off SDAM Appointment Events BSDX Protocol Processing
|
||||
N BSDXNOEV
|
||||
S BSDXNOEV=1 ;Don't execute protocol
|
||||
|
@ -43,6 +50,9 @@ CHECKIN(BSDXY,BSDXAPPTID,BSDXCDT) ;Private EP Check in appointment
|
|||
; $ET
|
||||
N $ET S $ET="G ERROR^BSDX25"
|
||||
;
|
||||
; Test for error trap for Unit Tests
|
||||
I $G(BSDXDIE) N X S X=1/0
|
||||
;
|
||||
N BSDXI S BSDXI=0
|
||||
;
|
||||
S BSDXY=$NAME(^BSDXTMP($J))
|
||||
|
@ -50,39 +60,42 @@ CHECKIN(BSDXY,BSDXAPPTID,BSDXCDT) ;Private EP Check in appointment
|
|||
;
|
||||
S ^BSDXTMP($J,0)="T00020ERRORID"_$C(30)
|
||||
;
|
||||
I '+BSDXAPPTID D ERR("Invalid Appointment ID") QUIT
|
||||
I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("Invalid Appointment ID") QUIT
|
||||
;
|
||||
; Lock the node for synchronizing access to appointment
|
||||
LOCK +^BSDXAPPT(BSDXAPPTID):1
|
||||
ELSE DO ERR("-7~Lock not acquired") QUIT
|
||||
I '+BSDXAPPTID D ERR("-1~Invalid Appointment ID") QUIT
|
||||
I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-1~Invalid Appointment ID") QUIT
|
||||
;
|
||||
; Remove Date formatting v.1.5. Client will send date as FM Date.
|
||||
;S:BSDXCDT["@0000" BSDXCDT=$P(BSDXCDT,"@")
|
||||
;S %DT="T",X=BSDXCDT D ^%DT S BSDXCDT=Y
|
||||
S BSDXCDT=+BSDXCDT ; Strip off zeros if C# sends them
|
||||
I BSDXCDT=-1 D ERR(70) Q
|
||||
I BSDXCDT'>2000000 D ERR("-2~Invalid Check-in Date") QUIT
|
||||
I BSDXCDT>$$NOW^XLFDT S BSDXCDT=$$NOW^XLFDT
|
||||
;
|
||||
;Checkin BSDX APPOINTMENT entry
|
||||
N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT)
|
||||
I BSDXERR D ERR("BSDX08: Fileman Filer failed to check-in appt") QUIT
|
||||
;
|
||||
N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0)
|
||||
N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5)
|
||||
N BSDXSTART S BSDXSTART=$P(BSDXNOD,U)
|
||||
; Some data
|
||||
N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0) ; Appointment Node
|
||||
N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
|
||||
N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Appointment Start Time
|
||||
;
|
||||
; Get Hospital Location IEN from BSDXAPPT to BSDXRES (RESOUCE:HOSPITAL LOCATION)
|
||||
N BSDXSC1 S BSDXSC1=$$GET1^DIQ(9002018.4,BSDXAPPTID_",",".07:.04","I")
|
||||
I BSDXSC1,'$D(^SC(BSDXSC1,0)) S BSDXSC1="" ; Null it off if it doesn't exist
|
||||
;
|
||||
; Check if we can check-in using BSDXAPI
|
||||
N BSDXERR S BSDXERR=0
|
||||
I BSDXSC1 S BSDXERR=$$CHECKIC1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
|
||||
I BSDXERR D ERR(-10_"~"_$P(BSDXERR,U,2)) QUIT
|
||||
;
|
||||
; Checkin BSDX APPOINTMENT entry
|
||||
; Failure Analysis: If we fail here, no changes were made.
|
||||
N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT)
|
||||
I BSDXERR D ERR("-3~Fileman Filer failed to check-in appt") QUIT
|
||||
;
|
||||
; File check-in using BSDXAPI
|
||||
; Failure Analysis: If we fail here, we need to roll back first check-in.
|
||||
N BSDXERR S BSDXERR=0
|
||||
I BSDXSC1 S BSDXERR=$$CHECKIN1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
|
||||
I BSDXERR D ERR($P(BSDXZ,U,2)) QUIT
|
||||
;
|
||||
; Unlock
|
||||
LOCK -^BSDXAPPT(BSDXAPPTID)
|
||||
I BSDXERR D QUIT
|
||||
. N % S %=$$BSDXCHK(BSDXAPPTID,"@") ; No Error checking to prevent loop.
|
||||
. D ERR(-10_"~"_$P(BSDXERR,U,2)) ; Send error message to client
|
||||
;
|
||||
S BSDXI=BSDXI+1
|
||||
S ^BSDXTMP($J,BSDXI)="0"_$C(30)
|
||||
|
@ -98,6 +111,8 @@ BSDXCHK(BSDXAPPTID,BSDXCDT) ; $$ Private Entry Point. File or delete check-in to
|
|||
; Output: 1^Error for error
|
||||
; 0 for success
|
||||
;
|
||||
Q:$G(BSDXSIMERR1) 1_U_"Simulated Error 1"
|
||||
;
|
||||
N BSDXIENS,BSDXMSG,BSDXFDA ; Filer variables
|
||||
S BSDXIENS=BSDXAPPTID_","
|
||||
S BSDXFDA(9002018.4,BSDXIENS,.03)=BSDXCDT
|
||||
|
@ -144,10 +159,6 @@ RMCI(BSDXY,BSDXAPPTID) ; EP - Remove Check-in from BSDX APPT and 2/44
|
|||
I '+$G(BSDXAPPTID) D ERR("-1~Invalid Appointment ID") QUIT
|
||||
I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-2~Invalid Appointment ID") QUIT
|
||||
;
|
||||
; Lock the node for synchronizing access to appointment
|
||||
LOCK +^BSDXAPPT(BSDXAPPTID):1
|
||||
ELSE DO ERR("-7~Lock not acquired") QUIT
|
||||
;
|
||||
; Remove checkin from BSDX APPOINTMENT entry
|
||||
N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,"@")
|
||||
I BSDXERR D ERR("-6~Cannot file data in $$BSDXCHK") QUIT
|
||||
|
@ -166,12 +177,9 @@ RMCI(BSDXY,BSDXAPPTID) ; EP - Remove Check-in from BSDX APPT and 2/44
|
|||
S BSDXSC1=$P(BSDXNOD,U,4) ;HOSPITAL LOCATION
|
||||
;
|
||||
N BSDXZ ; Scratch variable to hold error message
|
||||
I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
|
||||
I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI1(BSDXPATID,BSDXSC1,BSDXSTART)
|
||||
I +$G(BSDXZ) D ERR("-5~"_$P(BSDXZ,U,2)) QUIT
|
||||
;
|
||||
; Unlock
|
||||
LOCK -^BSDXAPPT(BSDXAPPTID)
|
||||
;
|
||||
; Return ADO recordset
|
||||
S BSDXI=BSDXI+1
|
||||
S ^BSDXTMP($J,BSDXI)="0"_$C(30)
|
||||
|
@ -224,13 +232,20 @@ CHKEVT3(BSDXRES) ;
|
|||
ERROR ;
|
||||
S $ETRAP="D ^%ZTER HALT" ; Emergency Error Trap for the wise
|
||||
D ^%ZTER
|
||||
S $EC="" ; Clear Error
|
||||
; VEN/SMH: NB: I make a conscious decision not to roll back anything
|
||||
; here in the error trap. Once the error is fixed, users can
|
||||
; undo or redo the check-in.
|
||||
; Individual portions of this routine may choose to do rolling back
|
||||
; of their own (e.g. a failed call to BSDXAPI causes rollback to occur
|
||||
; in CHECKIN)
|
||||
;
|
||||
; Log error message and send to client
|
||||
D ERR("-100~Mumps Error")
|
||||
Q
|
||||
Q:$Q "-100^Mumps Error" Q
|
||||
;
|
||||
ERR(BSDXERR) ;Error processing
|
||||
I $G(BSDXAPPTID) LOCK -^BSDXAPPT(BSDXAPPTID)
|
||||
; If last line is $C(31), we are done. No more errors to send to client.
|
||||
I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT
|
||||
S BSDXERR=$G(BSDXERR)
|
||||
S BSDXERR=$P(BSDXERR,"~")_"~"_$TEXT(+0)_":"_$P(BSDXERR,"~",2) ; Append Routine Name
|
||||
S BSDXI=$G(BSDXI)+1
|
||||
|
|
170
m/BSDXAPI.m
170
m/BSDXAPI.m
|
@ -1,46 +1,11 @@
|
|||
BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/29/12 12:19pm
|
||||
BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 7/3/12 12:30pm
|
||||
;;1.7T1;BSDX;;Aug 31, 2011;Build 18
|
||||
; Licensed under LGPL
|
||||
;
|
||||
;Orignal routine is BSDAPI by IHS/LJF, HMW, and MAW
|
||||
; Orignal routine is BSDAPI by IHS/LJF, HMW, and MAW
|
||||
; mods (many) by WV/SMH
|
||||
;Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
|
||||
; Change History:
|
||||
; 2010-11-5: (1.42)
|
||||
; - Fixed errors having to do uncanceling patient appointments if it was
|
||||
; a patient cancelled appointment.
|
||||
; - Use new style Fileman API for storing appointments in file 44 in
|
||||
; $$MAKE due to problems with legacy API.
|
||||
; 2010-11-12: (1.42)
|
||||
; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as
|
||||
; well.
|
||||
; 2010-12-5 (1.42)
|
||||
; Added an entry point to update the patient note in file 44.
|
||||
; 2010-12-6 (1.42)
|
||||
; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
|
||||
; 2010-12-8 (1.42)
|
||||
; Removed restriction on max appt length. Even though this restriction
|
||||
; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
|
||||
; will ignore it here too.
|
||||
; 2011-01-25 (v.1.5)
|
||||
; Added entry point $$RMCI to remove checked in appointments.
|
||||
; In $$CANCEL, if the appointment is checked in, delete check-in rather than
|
||||
; spitting an error message to the user saying 'Delete the check-in'
|
||||
; Changed all lines that look like this:
|
||||
; I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
; to:
|
||||
; I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
; to allow for date at midnight which does not have a dot at the end.
|
||||
; 2011-01-26 (v.1.5)
|
||||
; More user friendly message if patient already has appointment in $$MAKE:
|
||||
; Spits out pt name and user friendly date.
|
||||
; 2012-06-18 (v 1.7)
|
||||
; Removing transacions. Means that code SHOULD NOT fail. Took all checks
|
||||
; out for making an appointment to MAKECK. We call this first to make sure
|
||||
; that the appointment is okay to make before committing to make it. We
|
||||
; still have the provision to delete the data though if we fail when we
|
||||
; actually make the appointment.
|
||||
; CANCELCK exists for the same purpose.
|
||||
; Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
|
||||
; Change history is located in BSDXAPI1 (to save space).
|
||||
;
|
||||
MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO) ; Simplified PEP w/ parameters for $$MAKE - making appointment
|
||||
; Call like this for DFN 23435 having an appointment at Hospital Location 33
|
||||
|
@ -229,6 +194,70 @@ CHECKIN(BSDR) ;EP; call to add checkin info to appt; IHS/ITSC/LJF 12/23/2004 PAT
|
|||
; = 0 means everything worked
|
||||
; = 1^message means error with reason message
|
||||
;
|
||||
I $G(BSDXDIE2) N X S X=1/0
|
||||
;
|
||||
N BSDXERR S BSDXERR=$$CHECKICK(.BSDR)
|
||||
I BSDXERR Q BSDXERR
|
||||
;
|
||||
; find ien for appt in file 44
|
||||
NEW IEN,DIE,DA,DR
|
||||
S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
;
|
||||
; remember before status
|
||||
; Failure analysis: Only ^TMP global is set here.
|
||||
NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
|
||||
S DFN=BSDR("PAT"),SDT=BSDR("ADT"),SDCL=BSDR("CLN"),SDMODE=2,SDDA=IEN
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; set checkin; Old Code -- keep for ref VEN/SMH 3 Jul 2012
|
||||
; S DIE="^SC("_BSDR("CLN")_",""S"","_BSDR("ADT")_",1,"
|
||||
; S DA(2)=BSDR("CLN"),DA(1)=BSDR("ADT"),DA=IEN
|
||||
; S DR="309///"_BSDR("CDT")_";302///`"_BSDR("USR")_";305///"_$$NOW^XLFDT
|
||||
; D ^DIE
|
||||
;
|
||||
I $D(BSDXSIMERR3) Q 1_U_"Simulated Error"
|
||||
;
|
||||
; Failure analysis: If this fails, no other changes were made in this routine
|
||||
N BSDXIENS S BSDXIENS=IEN_","_BSDR("ADT")_","_BSDR("CLN")_","
|
||||
N BSDXFDA
|
||||
S BSDXFDA(44.003,BSDXIENS,309)=BSDR("CDT")
|
||||
S BSDXFDA(44.003,BSDXIENS,302)=BSDR("USR")
|
||||
S BSDXFDA(44.003,BSDXIENS,305)=$$NOW^XLFDT()
|
||||
N BSDXERR
|
||||
D UPDATE^DIE("","BSDXFDA","BSDXERR")
|
||||
;
|
||||
I $D(BSDXERR) Q 1_U_"Error checking in appointment to file 44. Error: "_BSDXERR("DIERR",1,"TEXT",1)
|
||||
;
|
||||
; set after status
|
||||
S SDDA=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; Point of no Return
|
||||
; call event driver
|
||||
D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
|
||||
Q 0
|
||||
;
|
||||
CHECKIC1(DFN,CLIN,APDATE) ; Simplified PEP w/ parameters for $$CHECKICK -
|
||||
; Check-in Check
|
||||
; Call like this for DFN 23435 checking in now at Hospital Location 33
|
||||
; for appt at Dec 20, 2009 @ 10:11:59
|
||||
; S RESULT=$$CHECKIC1^BSDXAPI(23435,33,3091220.221159)
|
||||
N BSDR
|
||||
S BSDR("PAT")=DFN ;DFN
|
||||
S BSDR("CLN")=CLIN ;Hosp Loc IEN
|
||||
S BSDR("ADT")=APDATE ;Appt Date
|
||||
S BSDR("CDT")=$$NOW^XLFDT ;Check-in date defaults to now
|
||||
S BSDR("USR")=DUZ ;Check-in user defaults to current
|
||||
Q $$CHECKICK(.BSDR)
|
||||
;
|
||||
CHECKICK(BSDR) ; $$ PEP; - Is it okay to check-in patient?
|
||||
; Input: Same as $$CHECKIN
|
||||
; Output: 0 if okay or 1^message if error
|
||||
;
|
||||
I $G(BSDXSIMERR2) Q 1_U_"Simulated Error"
|
||||
;
|
||||
I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT"))
|
||||
I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
|
||||
I $G(BSDR("ADT")) S BSDR("ADT")=+$E(BSDR("ADT"),1,12) ;remove seconds
|
||||
|
@ -238,29 +267,8 @@ CHECKIN(BSDR) ;EP; call to add checkin info to appt; IHS/ITSC/LJF 12/23/2004 PAT
|
|||
I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR"))
|
||||
;
|
||||
; find ien for appt in file 44
|
||||
NEW IEN,DIE,DA,DR
|
||||
S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
N IEN S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
I 'IEN Q 1_U_"Error trying to find appointment for checkin: Patient="_BSDR("PAT")_" Clinic="_BSDR("CLN")_" Appt="_BSDR("ADT")
|
||||
;
|
||||
; remember before status
|
||||
NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
|
||||
S DFN=BSDR("PAT"),SDT=BSDR("ADT"),SDCL=BSDR("CLN"),SDMODE=2,SDDA=IEN
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; set checkin
|
||||
S DIE="^SC("_BSDR("CLN")_",""S"","_BSDR("ADT")_",1,"
|
||||
S DA(2)=BSDR("CLN"),DA(1)=BSDR("ADT"),DA=IEN
|
||||
S DR="309///"_BSDR("CDT")_";302///`"_BSDR("USR")_";305///"_$$NOW^XLFDT
|
||||
D ^DIE
|
||||
;
|
||||
; set after status
|
||||
S SDDA=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; call event driver
|
||||
D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
|
||||
Q 0
|
||||
;
|
||||
CANCEL1(DFN,CLIN,TYP,APDATE,REASON,INFO) ; PEP w/ parameters for $$CANCEL - cancelling appointment
|
||||
|
@ -377,46 +385,6 @@ CI(PAT,CLINIC,DATE,SDIEN) ;PEP; -- returns 1 if appt already checked-in
|
|||
S X=$P($G(^SC(CLINIC,"S",DATE,1,X,"C")),U)
|
||||
Q $S(X:1,1:0)
|
||||
;
|
||||
RMCI(PAT,CLINIC,DATE) ;PEP; -- Remove Check-in; $$
|
||||
; PAT = DFN
|
||||
; CLINIC = SC IEN
|
||||
; DATE = FM Date/Time of Appointment
|
||||
;
|
||||
; Returns:
|
||||
; 0 if okay
|
||||
; -1 if failure
|
||||
;
|
||||
; Call like this: $$RMCI(233,33,3110102.1130)
|
||||
;
|
||||
; Move my variables into the ones used by SDAPIs (just a convenience)
|
||||
NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
|
||||
S DFN=PAT,SDT=DATE,SDCL=CLINIC,SDMODE=2,SDDA=$$SCIEN(DFN,SDCL,SDT)
|
||||
;
|
||||
I SDDA<1 QUIT 0 ; Appt cancelled; cancelled appts rm'ed from file 44
|
||||
;
|
||||
; remember before status
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; remove check-in using filer.
|
||||
N BSDXIENS S BSDXIENS=SDDA_","_DATE_","_CLINIC_","
|
||||
N BSDXFDA
|
||||
S BSDXFDA(44.003,BSDXIENS,309)="@" ; CHECKED-IN
|
||||
S BSDXFDA(44.003,BSDXIENS,302)="@" ; CHECK IN USER
|
||||
S BSDXFDA(44.003,BSDXIENS,305)="@" ; CHECK IN ENTERED
|
||||
N BSDXERR
|
||||
D FILE^DIE("","BSDXFDA","BSDXERR")
|
||||
I $D(BSDXERR) QUIT "-1~Can't file for Pat "_PAT_" in Clinic "_CLINIC_" at "_DATE_". Fileman reported an error: "_BSDXERR("DIERR",1,"TEXT",1)
|
||||
;
|
||||
; set after status
|
||||
; S SDDA=$$SCIEN(DFN,SDCL,SDT) ;smh -why is this here? SDDA won't change.
|
||||
S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
|
||||
D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
|
||||
;
|
||||
; call event driver
|
||||
D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
|
||||
QUIT 0
|
||||
;
|
||||
SCIEN(PAT,CLINIC,DATE) ;PEP; returns ien for appt in ^SC
|
||||
NEW X,IEN
|
||||
S X=0 F S X=$O(^SC(CLINIC,"S",DATE,1,X)) Q:'X Q:$G(IEN) D
|
||||
|
|
70
m/BSDXAPI1.m
70
m/BSDXAPI1.m
|
@ -1,7 +1,50 @@
|
|||
BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/29/12 11:52am
|
||||
BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 7/3/12 12:37pm
|
||||
;;1.7T1;BSDX;;Aug 31, 2011;Build 18
|
||||
; Licensed under LGPL
|
||||
;
|
||||
; Change History (BSDXAPI and BSDXAPI1)
|
||||
; Pre 1.42:
|
||||
; - Simplified entry points (MAKE1, CANCEL1, CHECKIN1)
|
||||
; 2010-11-5: (1.42)
|
||||
; - Fixed errors having to do uncanceling patient appointments if it was
|
||||
; a patient cancelled appointment.
|
||||
; - Use new style Fileman API for storing appointments in file 44 in
|
||||
; $$MAKE due to problems with legacy API.
|
||||
; 2010-11-12: (1.42)
|
||||
; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as
|
||||
; well.
|
||||
; 2010-12-5 (1.42)
|
||||
; Added an entry point to update the patient note in file 44.
|
||||
; 2010-12-6 (1.42)
|
||||
; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
|
||||
; 2010-12-8 (1.42)
|
||||
; Removed restriction on max appt length. Even though this restriction
|
||||
; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
|
||||
; will ignore it here too.
|
||||
; 2011-01-25 (v.1.5)
|
||||
; Added entry point $$RMCI to remove checked in appointments.
|
||||
; In $$CANCEL, if the appointment is checked in, delete check-in rather than
|
||||
; spitting an error message to the user saying 'Delete the check-in'
|
||||
; Changed all lines that look like this:
|
||||
; I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
; to:
|
||||
; I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
; to allow for date at midnight which does not have a dot at the end.
|
||||
; 2011-01-26 (v.1.5)
|
||||
; More user friendly message if patient already has appointment in $$MAKE:
|
||||
; Spits out pt name and user friendly date.
|
||||
; 2012-06-18 (v 1.7)
|
||||
; Removing transacions. Means that code SHOULD NOT fail. Took all checks
|
||||
; out for making an appointment to MAKECK. We call this first to make sure
|
||||
; that the appointment is okay to make before committing to make it. We
|
||||
; still have the provision to delete the data though if we fail when we
|
||||
; actually make the appointment.
|
||||
; CANCELCK exists for the same purpose.
|
||||
; CHECKINK ditto
|
||||
; New API: $$NOWSHOW^BSDXAPI1 for no-showing patients
|
||||
; Moved RMCI from BSDXAPI to BSDXAPI1 because BSDXAPI1 is getting larger
|
||||
; than 20000 characters.
|
||||
;
|
||||
NOSHOW(PAT,CLINIC,DATE,NSFLAG) ; $$ PEP; No-show Patient at appt date (new in v1.7)
|
||||
; PAT = DFN
|
||||
; CLINIC = SC IEN
|
||||
|
@ -40,8 +83,8 @@ NOSHOW(PAT,CLINIC,DATE,NSFLAG) ; $$ PEP; No-show Patient at appt date (new in v1
|
|||
Q:$D(BSDXMSG) 1_U_"Fileman edit to DPT error: Patient="_PAT_" Appt="_DATE_" Error="_BSDXMSG("DIERR",1,"TEXT",1)
|
||||
;
|
||||
; This M error trigger tests if ^BSDXAPPT rolls back.
|
||||
; I won't try to roll back ^DPT(,"S"
|
||||
; The M error is caused here, so if I try to rollback, I can cause another
|
||||
; I won't try to roll back ^DPT(,"S" because
|
||||
; the M error is caused here, so if I try to rollback, I can cause another
|
||||
; error. Infinite Errors then.
|
||||
I $D(BSDXSIMERR3) N X S X=1/0
|
||||
;
|
||||
|
@ -67,6 +110,10 @@ RMCI(PAT,CLINIC,DATE) ;PEP; -- Remove Check-in; $$
|
|||
;
|
||||
; Call like this: $$RMCI(233,33,3110102.1130)
|
||||
;
|
||||
; Check to see if we can remove the check-in
|
||||
N BSDXERR S BSDXERR=$$RMCICK(PAT,CLINIC,DATE)
|
||||
I BSDXERR Q BSDXERR
|
||||
;
|
||||
; Move my variables into the ones used by SDAPIs (just a convenience)
|
||||
NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
|
||||
S DFN=PAT,SDT=DATE,SDCL=CLINIC,SDMODE=2,SDDA=$$SCIEN^BSDXAPI(DFN,SDCL,SDT)
|
||||
|
@ -96,6 +143,23 @@ RMCI(PAT,CLINIC,DATE) ;PEP; -- Remove Check-in; $$
|
|||
D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
|
||||
QUIT 0
|
||||
;
|
||||
RMCICK(PAT,CLINIC,DATE) ;PEP; Can you remove a check-in for this patient?
|
||||
; PAT - DFN by value
|
||||
; CLINIC - ^SC ien by value
|
||||
; DATE - Appointment Date
|
||||
; Output: 0 if okay or 1 if error
|
||||
;
|
||||
; Get appointment IEN in ^SC(DA(2),"S",DA(1),1,
|
||||
N SCIEN S SCIEN=$$SCIEN^BSDXAPI(PAT,CLINIC,DATE)
|
||||
;
|
||||
; If not there, it has been cancelled.
|
||||
I 'SCIEN QUIT 0
|
||||
;
|
||||
; Check if checked out
|
||||
I $$CO^BSDXAPI(PAT,CLINIC,DATE,SCIEN) Q 1_U_"Appointment Already Checked Out"
|
||||
;
|
||||
QUIT 0
|
||||
;
|
||||
UPDATENT(PAT,CLINIC,DATE,NOTE) ; PEP; Update Note in ^SC for patient's appointment @ DATE
|
||||
; PAT = DFN
|
||||
; CLINIC = SC IEN
|
||||
|
|
10
m/BSDXUT1.m
10
m/BSDXUT1.m
|
@ -1,4 +1,4 @@
|
|||
BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/29/12 12:32pm
|
||||
BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/3/12 12:28pm
|
||||
;;1.7T1;BSDX;;Aug 31, 2011;Build 18
|
||||
;
|
||||
;
|
||||
|
@ -93,7 +93,7 @@ UT08 ; Unit Tests for BSDX08; Must have patients 1,2,3,4,5 defined in system
|
|||
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||
I APPID=0 W "Error in test 6",!
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI1(DFN,HLIEN,APPTTIME) ; remove checkin
|
||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
|
||||
I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
|
||||
;
|
||||
|
@ -139,7 +139,7 @@ UT08 ; Unit Tests for BSDX08; Must have patients 1,2,3,4,5 defined in system
|
|||
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||
I APPID=0 W "Error in test 6",!
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI1(DFN,HLIEN,APPTTIME) ; remove checkin
|
||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
|
||||
I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
|
||||
QUIT
|
||||
|
@ -190,7 +190,7 @@ UT29 ; Unit Test for BSDX29
|
|||
D BSDXCP^BSDX29(.ZZZ,RESIEN,HLIEN,FIRSTDATE,LASTDATE)
|
||||
I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
|
||||
;
|
||||
W "Waiting for 5 seconds for it to finish",! HANG 5
|
||||
W "Waiting for 5 seconds for taskman to finish",! HANG 5
|
||||
N DFN,APPTTIME S (DFN,APPTTIME)=""
|
||||
F S DFN=$O(BSDXAPPT(DFN)) Q:'DFN D
|
||||
. F S APPTTIME=$O(BSDXAPPT(DFN,APPTTIME)) Q:'APPTTIME D
|
||||
|
@ -223,7 +223,7 @@ UT29 ; Unit Test for BSDX29
|
|||
D BSDXCP^BSDX29(.ZZZ,RESIEN,HLIEN,FIRSTDATE,LASTDATE)
|
||||
I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
|
||||
;
|
||||
W "Waiting for 5 seconds for it to finish",! HANG 5
|
||||
W "Waiting for 5 seconds for taskman to finish",! HANG 5
|
||||
W:^BSDXTMP("BSDXCOPY",+^BSDXTMP($J,1))'[" 0 records" "Copy failed",!
|
||||
QUIT
|
||||
;
|
||||
|
|
51
m/BSDXUT2.m
51
m/BSDXUT2.m
|
@ -1,4 +1,4 @@
|
|||
BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/29/12 12:23pm
|
||||
BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/3/12 12:03pm
|
||||
;;1.7T1;BSDX;;Aug 31, 2011;Build 18
|
||||
;
|
||||
EN ; Run all unit tests in this routine
|
||||
|
@ -48,11 +48,58 @@ UT25 ; Unit Tests for BSDX25
|
|||
D RMCI^BSDX25(.ZZZ,234987234398)
|
||||
IF +^BSDXTMP($J,1)'=-2 WRITE "ERROR IN Etest 2",!
|
||||
; Tests for 3 to 5 difficult to produce
|
||||
; Error tests follow: Mumps error test; Transaction restartability
|
||||
; Error tests follow: Mumps error test;
|
||||
; Error in RMCI
|
||||
N BSDXDIE S BSDXDIE=1
|
||||
D RMCI^BSDX25(.ZZZ,APPTID)
|
||||
IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 3",!
|
||||
K BSDXDIE
|
||||
; M Error in CHECKIN
|
||||
N BSDXDIE S BSDXDIE=1
|
||||
D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
|
||||
IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 8",!
|
||||
K BSDXDIE
|
||||
; M Error in $$CHECKIN^BSDXAPI
|
||||
N BSDXDIE2 S BSDXDIE2=1
|
||||
D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
|
||||
IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 9",!
|
||||
K BSDXDIE2
|
||||
;
|
||||
; Get start and end times
|
||||
N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
|
||||
N APPTTIME S APPTTIME=$P(TIMES,U)
|
||||
N ENDTIME S ENDTIME=$P(TIMES,U,2)
|
||||
;
|
||||
N ZZZ,DFN
|
||||
S DFN=5
|
||||
N ZZZ
|
||||
D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
|
||||
N APPTID S APPTID=+^BSDXTMP($J,1)
|
||||
N HL S HL=$$GET1^DIQ(9002018.4,APPTID,".07:.04","I")
|
||||
;
|
||||
; Simulated Error in $$BSDXCHK^BSDX25
|
||||
N BSDXSIMERR1 S BSDXSIMERR1=1
|
||||
D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
|
||||
IF +^BSDXTMP($J,1)'=-3 WRITE "ERROR in Etest 10",!
|
||||
IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 111",!
|
||||
IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 112",!
|
||||
K BSDXSIMERR1
|
||||
;
|
||||
; Simulated Error in $$CHECKICK^BSDXAPI
|
||||
N BSDXSIMERR2 S BSDXSIMERR2=1
|
||||
D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
|
||||
IF +^BSDXTMP($J,1)'=-10 WRITE "ERROR in Etest 11",!
|
||||
IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 113",!
|
||||
IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 114",!
|
||||
K BSDXSIMERR2
|
||||
;
|
||||
; Simulated Error in $$CHECKIN^BSDXAPI
|
||||
N BSDXSIMERR3 S BSDXSIMERR3=1
|
||||
D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
|
||||
IF +^BSDXTMP($J,1)'=-10 WRITE "ERROR in Etest 11",!
|
||||
IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 115",!
|
||||
IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 116",!
|
||||
K BSDXSIMERR3
|
||||
;
|
||||
; Unlinked Clinic Tests
|
||||
N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
|
||||
|
|
Loading…
Reference in New Issue