Final checkin. Completed ability to be able to remove appointments that have been checked in. Also, fixed not being able to make an appointment at midnight issue.
This commit is contained in:
parent
95362c15d8
commit
2800143ac1
45
m/BSDX08.m
45
m/BSDX08.m
|
@ -1,4 +1,4 @@
|
|||
BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm
|
||||
BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 1/25/11 12:39pm
|
||||
;;1.42;BSDX;;Dec 07, 2010
|
||||
;
|
||||
; Original by HMW. New Written by Sam Habiel. Licensed under LGPL.
|
||||
|
@ -15,6 +15,11 @@ BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm
|
|||
; --> worked in the first place. Waiting for bug report to know.
|
||||
; - Refactored all of APPDEL.
|
||||
;
|
||||
; 3111125 UJO/SMH v1.5
|
||||
; - Added ability to remove checked in appointments. Added a couple
|
||||
; of units tests for that under UT2.
|
||||
; - Minor reformatting because of how KIDS adds tabs.
|
||||
;
|
||||
; Error Reference:
|
||||
; -1~BSDX08: Appt record is locked. Please contact technical support.
|
||||
; -2~BSDX08: Invalid Appointment ID
|
||||
|
@ -71,35 +76,29 @@ UT ; Unit Tests
|
|||
I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
|
||||
D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
|
||||
I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
|
||||
UT2 ; More unit Tests
|
||||
;
|
||||
; Test 6: for Cancelling walkin and checked-in appointments (should fail).
|
||||
; Test 6: for Cancelling walkin and checked-in appointments
|
||||
S BSDXSTART=$E($$NOW^XLFDT,1,12),BSDXEND=BSDXSTART+.0001
|
||||
D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1)
|
||||
D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt
|
||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||
B
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT)
|
||||
B
|
||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note")
|
||||
B
|
||||
I APPID=0 W "Error in test 6",!
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
|
||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
|
||||
I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
|
||||
;
|
||||
; Test 7: for cancelling walkin and checked-in appointments (this should pass)
|
||||
; Test 7: for cancelling walkin and checked-in appointments
|
||||
S BSDXSTART=$E($$NOW^XLFDT,1,12)+.0001,BSDXEND=BSDXSTART+.0001
|
||||
D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1)
|
||||
D APPADD^BSDX07(.ZZZ,BSDXSTART,BSDXEND,4,"Dr Office",10,"Sam's Note",1) ; Add appt
|
||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||
B
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT)
|
||||
I APPID=0 W "Error in test 6",!
|
||||
D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
|
||||
S BSDXRES=$O(^BSDXRES("B","Dr Office",""))
|
||||
S BSDXCLN=$P(^BSDXRES(BSDXRES,0),U,4)
|
||||
B
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI(4,BSDXCLN,BSDXSTART)
|
||||
B
|
||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note")
|
||||
;
|
||||
|
||||
S BSDXRESULT=$$RMCI^BSDXAPI(4,BSDXCLN,BSDXSTART) ; 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
|
||||
; Lock the node in another job for testing.
|
||||
UTL(APPID) L +^BSDXAPPT(APPID) HANG 10 QUIT
|
||||
;
|
||||
APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
||||
;Called by RPC: BSDX CANCEL APPOINTMENT
|
||||
;Cancels existing appointment in BSDX APPOINTMENT and 44/2 subfiles
|
||||
|
@ -109,7 +108,7 @@ APPDEL(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
|||
; - BSDXCR is pointer to CANCELLATION REASON File (409.2)
|
||||
; - BSDXNOT is user note
|
||||
;
|
||||
; Returns error code in recordset field ERRORID. Zero is success.
|
||||
; Returns error code in recordset field ERRORID. Empty string is success.
|
||||
; Returns Global Array. Must use this type in RPC.
|
||||
;
|
||||
; Return Array: set Return and clear array
|
||||
|
@ -341,4 +340,4 @@ ETRAP ;EP Error trap entry
|
|||
; . F S BSDX1=$O(^BSDXRES(BSDXSC1,20,BSDX1)) Q:'+BSDX1 Q:BSDXZ=0 D
|
||||
; . . Q:'$D(^BSDXRES(BSDXSC1,20,BSDX1,0))
|
||||
; . . S BSDXLOC=$P(^BSDXRES(BSDXSC1,20,BSDX1,0),U)
|
||||
. ; . . S BSDXSCIEN=$$SCIEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) I +BSDXSCIEN S BSDXZ=0 Q
|
||||
; . . S BSDXSCIEN=$$SCIEN^BSDXAPI(BSDXPATID,BSDXLOC,BSDXSTART) I +BSDXSCIEN S BSDXZ=0 Q
|
||||
|
|
45
m/BSDXAPI.m
45
m/BSDXAPI.m
|
@ -1,22 +1,32 @@
|
|||
BSDXAPI ; IHS/ANMC/LJF - SCHEDULING APIs ; 12/6/10 5:50pm
|
||||
BSDXAPI ; IHS/ANMC/LJF - SCHEDULING APIs ; 1/25/11 1:00pm
|
||||
;;1.42;BSDX;;Dec 07, 2010;Build 7
|
||||
;Orignal routine is BSDAPI by IHS/LJF, HMW, and MAW
|
||||
;local mods (many) by WV/SMH
|
||||
;Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
|
||||
; Change History:
|
||||
; 2010-11-5:
|
||||
; 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:
|
||||
; 2010-11-12: (1.42)
|
||||
; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as well.
|
||||
; 2010-12-5
|
||||
; 2010-12-5 (1.42)
|
||||
; Added an entry point to update the patient note in file 44.
|
||||
; 2010-12-6
|
||||
; 2010-12-6 (1.42)
|
||||
; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
|
||||
; 2010-12-8
|
||||
; 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.
|
||||
;
|
||||
;
|
||||
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
|
||||
|
@ -53,7 +63,7 @@ MAKE(BSDR) ;PEP; call to store appt made
|
|||
I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
|
||||
I ($G(BSDR("TYP"))<3)!($G(BSDR("TYP"))>4) Q 1_U_"Appt Type error: "_$G(BSDR("TYP"))
|
||||
I $G(BSDR("ADT")) S BSDR("ADT")=+$E(BSDR("ADT"),1,12) ;remove seconds
|
||||
I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
;
|
||||
;I ($G(BSDR("LEN"))<5)!($G(BSDR("LEN"))>240) Q 1_U_"Appt Length error: "_$G(BSDR("LEN")) ; v 1.42 - no check on length is done anymore. see top comments for details.
|
||||
I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Made Appt Error: "_$G(BSDR("USR"))
|
||||
|
@ -149,9 +159,9 @@ CHECKIN(BSDR) ;EP; call to add checkin info to appt; IHS/ITSC/LJF 12/23/2004 PAT
|
|||
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
|
||||
I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
I $G(BSDR("CDT")) S BSDR("CDT")=+$E(BSDR("CDT"),1,12) ;remove seconds
|
||||
I $G(BSDR("CDT"))'?7N1".".4N Q 1_U_"Checkin Date/Time error: "_$G(BSDR("CDT"))
|
||||
I $G(BSDR("CDT"))'?7N.1".".4N Q 1_U_"Checkin Date/Time error: "_$G(BSDR("CDT"))
|
||||
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
|
||||
|
@ -218,9 +228,9 @@ CANCEL(BSDR) ;PEP; called to cancel appt
|
|||
I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
|
||||
I ($G(BSDR("TYP"))'="C"),($G(BSDR("TYP"))'="PC") Q 1_U_"Cancel Status error: "_$G(BSDR("TYP"))
|
||||
I $G(BSDR("ADT")) S BSDR("ADT")=+$E(BSDR("ADT"),1,12) ;remove seconds
|
||||
I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
|
||||
I $G(BSDR("CDT")) S BSDR("CDT")=+$E(BSDR("CDT"),1,12) ;remove seconds
|
||||
I $G(BSDR("CDT"))'?7N1".".4N Q 1_U_"Cancel Date/Time error: "_$G(BSDR("CDT"))
|
||||
I $G(BSDR("CDT"))'?7N.1".".4N Q 1_U_"Cancel Date/Time error: "_$G(BSDR("CDT"))
|
||||
I '$D(^VA(200,+$G(BSDR("USR")),0)) Q 1_U_"User Who Canceled Appt Error: "_$G(BSDR("USR"))
|
||||
I '$D(^SD(409.2,+$G(BSDR("CR")))) Q 1_U_"Cancel Reason error: "_$G(BSDR("CR"))
|
||||
;
|
||||
|
@ -228,7 +238,13 @@ CANCEL(BSDR) ;PEP; called to cancel appt
|
|||
S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
I 'IEN Q 1_U_"Error trying to find appointment for cancel: Patient="_BSDR("PAT")_" Clinic="_BSDR("CLN")_" Appt="_BSDR("ADT")
|
||||
;
|
||||
I $$CI(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"),IEN) Q 1_U_"Patient already checked in; cannot cancel until checkin deleted: Patient="_BSDR("PAT")_" Clinic="_BSDR("CLN")_" Appt="_BSDR("ADT")
|
||||
; BSDX 1.5 3110125
|
||||
; UJO/SMH - Add ability to remove check-in if the patient is checked in
|
||||
; I $$CI(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"),IEN) Q 1_U_"Patient already checked in; cannot cancel until checkin deleted: Patient="_BSDR("PAT")_" Clinic="_BSDR("CLN")_" Appt="_BSDR("ADT")
|
||||
; Remove check-in if the patient is checked in.
|
||||
N BSDXRESULT S BSDXRESULT=0 ; Result; should be zero if success; -1 + message if failure
|
||||
I $$CI(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"),IEN) SET BSDXRESULT=$$RMCI(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
|
||||
I BSDXRESULT Q BSDXRESULT
|
||||
;
|
||||
; remember before status
|
||||
NEW SDATA,DFN,SDT,SDCL,SDDA,SDCPHDL
|
||||
|
@ -275,12 +291,15 @@ RMCI(PAT,CLINIC,DATE) ;PEP; -- Remove Check-in; $$
|
|||
; 0 if okay
|
||||
; -1 if failure
|
||||
;
|
||||
; remember before status
|
||||
; 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
|
||||
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)
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue