Updates to M routines to support deletion of check-in
This commit is contained in:
parent
700ea47212
commit
951f83c1d3
137
m/BSDX08.m
137
m/BSDX08.m
|
@ -1,31 +1,31 @@
|
||||||
BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm
|
BSDX08 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 12:35pm
|
||||||
;;1.42;BSDX;;Dec 07, 2010
|
;;1.42;BSDX;;Dec 07, 2010
|
||||||
;
|
;
|
||||||
; Original by HMW. New Written by Sam Habiel. Licensed under LGPL.
|
; Original by HMW. New Written by Sam Habiel. Licensed under LGPL.
|
||||||
;
|
;
|
||||||
; Change History
|
; Change History
|
||||||
; 3101022 UJO/SMH v1.42
|
; 3101022 UJO/SMH v1.42
|
||||||
; - Transaction now restartable. Thanks to
|
; - Transaction now restartable. Thanks to
|
||||||
; --> Zach Gonzalez and Rick Marshall for fix.
|
; --> Zach Gonzalez and Rick Marshall for fix.
|
||||||
; - Extra TROLLBACK in Lock Statement when lock fails.
|
; - Extra TROLLBACK in Lock Statement when lock fails.
|
||||||
; --> Removed--Rollback is already in ERR tag.
|
; --> Removed--Rollback is already in ERR tag.
|
||||||
; - Added new statements to old SD code in AVUPDT to obviate
|
; - Added new statements to old SD code in AVUPDT to obviate
|
||||||
; --> need to restore variables in transaction
|
; --> need to restore variables in transaction
|
||||||
; - Refactored this chunk of code. Don't really know whether it
|
; - Refactored this chunk of code. Don't really know whether it
|
||||||
; --> worked in the first place. Waiting for bug report to know.
|
; --> worked in the first place. Waiting for bug report to know.
|
||||||
; - Refactored all of APPDEL.
|
; - Refactored all of APPDEL.
|
||||||
;
|
;
|
||||||
; Error Reference:
|
; Error Reference:
|
||||||
; -1~BSDX08: Appt record is locked. Please contact technical support.
|
; -1~BSDX08: Appt record is locked. Please contact technical support.
|
||||||
; -2~BSDX08: Invalid Appointment ID
|
; -2~BSDX08: Invalid Appointment ID
|
||||||
; -3~BSDX08: Invalid Appointment ID
|
; -3~BSDX08: Invalid Appointment ID
|
||||||
; -4~BSDX08: Cancelled appointment does not have a Resouce ID
|
; -4~BSDX08: Cancelled appointment does not have a Resouce ID
|
||||||
; -5~BSDX08: Resouce ID does not exist in BSDX RESOURCE
|
; -5~BSDX08: Resouce ID does not exist in BSDX RESOURCE
|
||||||
; -6~BSDX08: Invalid Hosp Location stored in Database
|
; -6~BSDX08: Invalid Hosp Location stored in Database
|
||||||
; -7~BSDX08: Patient does not have an appointment in PIMS Clinic
|
; -7~BSDX08: Patient does not have an appointment in PIMS Clinic
|
||||||
; -8^BSDX08: Unable to find associated PIMS appointment for this patient
|
; -8^BSDX08: Unable to find associated PIMS appointment for this patient
|
||||||
; -9^BSDX08: BSDXAPI returned an error: (error)
|
; -9^BSDX08: BSDXAPI returned an error: (error)
|
||||||
; -100~BSDX08 Error: (Mumps Error)
|
; -100~BSDX08 Error: (Mumps Error)
|
||||||
;
|
;
|
||||||
APPDELD(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
APPDELD(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
||||||
;Entry point for debugging
|
;Entry point for debugging
|
||||||
|
@ -33,45 +33,54 @@ APPDELD(BSDXY,BSDXAPTID,BSDXTYP,BSDXCR,BSDXNOT) ;EP
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
UT ; Unit Tests
|
UT ; Unit Tests
|
||||||
; Test 1: Make normal appointment and cancel it. See if every thing works
|
; Test 1: Make normal appointment and cancel it. See if every thing works
|
||||||
N ZZZ
|
N ZZZ
|
||||||
D APPADD^BSDX07(.ZZZ,3110123.2,3110123.3,4,"Dr Office",10,"Sam's Note",1)
|
D APPADD^BSDX07(.ZZZ,3110123.2,3110123.3,4,"Dr Office",10,"Sam's Note",1)
|
||||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
||||||
I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
|
I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
|
||||||
I $O(^SC(2,"S",3110123.2,1,0))]"" W "Error in Cancellation-2"
|
I $O(^SC(2,"S",3110123.2,1,0))]"" W "Error in Cancellation-2"
|
||||||
I $P(^DPT(4,"S",3110123.2,0),U,2)'="PC" W "Error in Cancellation-3"
|
I $P(^DPT(4,"S",3110123.2,0),U,2)'="PC" W "Error in Cancellation-3"
|
||||||
I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4"
|
I ^DPT(4,"S",3110123.2,"R")'="Sam's Cancel Note" W "Error in Cancellation-4"
|
||||||
;
|
;
|
||||||
; Test 2: Check for -1
|
; Test 2: Check for -1
|
||||||
; Make appt
|
; Make appt
|
||||||
D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1)
|
D APPADD^BSDX07(.ZZZ,3110125.2,3110125.3,4,"Dr Office",10,"Sam's Note",1)
|
||||||
; Lock the node in another job
|
; Lock the node in another job
|
||||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
|
; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
|
||||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
|
||||||
;
|
;
|
||||||
; Test 3: Check for -100
|
; Test 3: Check for -100
|
||||||
S bsdxdie=1
|
S bsdxdie=1
|
||||||
D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1)
|
D APPADD^BSDX07(.ZZZ,3110126.2,3110126.3,4,"Dr Office",10,"Sam's Note",1)
|
||||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
||||||
I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
|
I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
|
||||||
K bsdxdie
|
K bsdxdie
|
||||||
;
|
;
|
||||||
; Test 4: Restartable transaction
|
; Test 4: Restartable transaction
|
||||||
S bsdxrestart=1
|
S bsdxrestart=1
|
||||||
D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1)
|
D APPADD^BSDX07(.ZZZ,3110128.2,3110128.3,4,"Dr Office",10,"Sam's Note",1)
|
||||||
S APPID=+$P(^BSDXTMP($J,1),U)
|
S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
|
||||||
I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",!
|
I $P(^DPT(4,"S",3110128.2,0),U,2)'="PC" W "Error in Restartable Transaction",!
|
||||||
;
|
;
|
||||||
; Test 5: for invalid Appointment ID (-2 and -3)
|
; Test 5: for invalid Appointment ID (-2 and -3)
|
||||||
D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
|
D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
|
||||||
I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
|
I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
|
||||||
D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
|
D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
|
||||||
I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
|
I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
|
||||||
QUIT
|
;
|
||||||
|
; 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)
|
||||||
|
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")
|
||||||
|
QUIT
|
||||||
; Lock the node in another job for testing.
|
; Lock the node in another job for testing.
|
||||||
UTL(APPID) L +^BSDXAPPT(APPID) HANG 10 QUIT
|
UTL(APPID) L +^BSDXAPPT(APPID) HANG 10 QUIT
|
||||||
;
|
;
|
||||||
|
|
58
m/BSDXAPI.m
58
m/BSDXAPI.m
|
@ -4,19 +4,19 @@ BSDXAPI ; IHS/ANMC/LJF - SCHEDULING APIs ; 12/6/10 5:50pm
|
||||||
;local mods (many) by WV/SMH
|
;local mods (many) by WV/SMH
|
||||||
;Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
|
;Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
|
||||||
; Change History:
|
; Change History:
|
||||||
; 2010-11-5:
|
; 2010-11-5:
|
||||||
; - Fixed errors having to do uncanceling patient appointments if it was a patient cancelled appointment.
|
; - 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.
|
; - 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:
|
||||||
; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as well.
|
; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as well.
|
||||||
; 2010-12-5
|
; 2010-12-5
|
||||||
; Added an entry point to update the patient note in file 44.
|
; Added an entry point to update the patient note in file 44.
|
||||||
; 2010-12-6
|
; 2010-12-6
|
||||||
; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
|
; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
|
||||||
; 2010-12-8
|
; 2010-12-8
|
||||||
; Removed restriction on max appt length. Even though this restriction
|
; Removed restriction on max appt length. Even though this restriction
|
||||||
; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
|
; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
|
||||||
; will ignore it here too.
|
; will ignore it here too.
|
||||||
;
|
;
|
||||||
MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO) ; Simplified PEP w/ parameters for $$MAKE - making appointment
|
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
|
; Call like this for DFN 23435 having an appointment at Hospital Location 33
|
||||||
|
@ -266,6 +266,42 @@ 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)
|
S X=$P($G(^SC(CLINIC,"S",DATE,1,X,"C")),U)
|
||||||
Q $S(X:1,1:0)
|
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
|
||||||
|
;
|
||||||
|
; remember before status
|
||||||
|
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
|
||||||
|
;
|
||||||
|
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_","
|
||||||
|
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)
|
||||||
|
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
|
SCIEN(PAT,CLINIC,DATE) ;PEP; returns ien for appt in ^SC
|
||||||
NEW X,IEN
|
NEW X,IEN
|
||||||
S X=0 F S X=$O(^SC(CLINIC,"S",DATE,1,X)) Q:'X Q:$G(IEN) D
|
S X=0 F S X=$O(^SC(CLINIC,"S",DATE,1,X)) Q:'X Q:$G(IEN) D
|
||||||
|
|
Loading…
Reference in New Issue