Refactoring and txn restart fix to routines 26,29,31
This commit is contained in:
parent
882f7bad40
commit
2f21f07db7
|
@ -1,4 +1,4 @@
|
||||||
BSDX26 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 11/18/10 5:36pm
|
BSDX26 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 3:08am
|
||||||
;;1.42;BSDX;;Sep 29, 2010
|
;;1.42;BSDX;;Sep 29, 2010
|
||||||
; Change History:
|
; Change History:
|
||||||
; 3101023 - UJO/SMH - Addition of restartable transaction; relocation of tx.
|
; 3101023 - UJO/SMH - Addition of restartable transaction; relocation of tx.
|
||||||
|
@ -33,17 +33,19 @@ UT ; Unit Tests
|
||||||
N bsdxdie S bsdxdie=1
|
N bsdxdie S bsdxdie=1
|
||||||
D EDITAPT(.ZZZ,188,NOTE)
|
D EDITAPT(.ZZZ,188,NOTE)
|
||||||
I +^BSDXTMP($J,1)'=-100 W "ERROR IN -100",! B
|
I +^BSDXTMP($J,1)'=-100 W "ERROR IN -100",! B
|
||||||
|
k bsdxdie
|
||||||
; Test 5: Trestart
|
; Test 5: Trestart
|
||||||
N bsdxrestart S bsdxrestart=1
|
N bsdxrestart S bsdxrestart=1
|
||||||
N %H S %H=$H
|
N %H S %H=$H
|
||||||
N NOTE S NOTE="New Note "_%H
|
N NOTE S NOTE="New Note "_%H
|
||||||
D EDITAPT(.ZZZ,188,NOTE)
|
D EDITAPT(.ZZZ,188,NOTE)
|
||||||
I ^BSDXAPPT(188,1,1,0)'=NOTE W "ERROR in TRESTART",! B
|
I ^BSDXAPPT(188,1,1,0)'=NOTE W "ERROR in TRESTART",! B
|
||||||
; Test for Hosp Location Update
|
; Test 6: for Hosp Location Update
|
||||||
N DATE S DATE=$$NOW^XLFDT()
|
N DATE S DATE=$$NOW^XLFDT()
|
||||||
|
S DATE=$E(DATE,1,12) ; Just get minutes b/c of HL file input transform
|
||||||
D APPADD^BSDX07(.ZZZ,DATE,DATE+.001,3,"Dr Office",30,"Old Note",1)
|
D APPADD^BSDX07(.ZZZ,DATE,DATE+.001,3,"Dr Office",30,"Old Note",1)
|
||||||
N APPID S APPID=+$P(^BSDXTMP($J,1),U)
|
N APPID S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
D EDITAPT(.ZZZ,APTID,"New Note")
|
D EDITAPT(.ZZZ,APPID,"New Note")
|
||||||
I ^BSDXAPPT(APTID,1,1,0)'="New Note" W "Error in HL Section",! B
|
I ^BSDXAPPT(APTID,1,1,0)'="New Note" W "Error in HL Section",! B
|
||||||
I $P(^SC(2,"S",DATE,1,1,0),U,4)'="New Note" W "Error in HL Section",! B
|
I $P(^SC(2,"S",DATE,1,1,0),U,4)'="New Note" W "Error in HL Section",! B
|
||||||
QUIT
|
QUIT
|
||||||
|
|
119
m/BSDX29.m
119
m/BSDX29.m
|
@ -1,79 +1,92 @@
|
||||||
BSDX29 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 7/18/10 2:03pm
|
BSDX29 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 6:05am
|
||||||
;;1.41;BSDX;;Sep 29, 2010
|
;;1.42;BSDX;;Sep 29, 2010
|
||||||
;
|
;
|
||||||
; Change Log:
|
; Change Log:
|
||||||
; v1.3 by WV/SMH on 3100713
|
; v1.3 by WV/SMH on 3100713
|
||||||
; - Beginning and Ending dates passed as FM Dates
|
; - Beginning and Ending dates passed as FM Dates
|
||||||
|
; v1.42 by WV/SMH on 3101023
|
||||||
|
; - Transaction moved; now restartable too.
|
||||||
|
; --> Thanks to Zach Gonzalez and Rick Marshall.
|
||||||
|
; - Refactoring of major portions of routine
|
||||||
;
|
;
|
||||||
BSDXCPD(BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND) ;EP
|
BSDXCPD(BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND) ;EP
|
||||||
;Entry point for debugging
|
;Entry point for debugging
|
||||||
;
|
;
|
||||||
;D DEBUG^%Serenji("BSDXCP^BSDX29(.BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND)")
|
D DEBUG^%Serenji("BSDXCP^BSDX29(.BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND)")
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
BSDXCP(BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND) ;EP
|
BSDXCP(BSDXY,BSDXRES,BSDX44,BSDXBEG,BSDXEND) ;EP
|
||||||
;Copy appointments from HOSPITAL LOCATION entry BSDX44 to BSDX RESOURCE entry BSDXRES
|
;Copy appointments from HOSPITAL LOCATION entry BSDX44 to BSDX RESOURCE entry BSDXRES
|
||||||
;Beginning with appointments on day BSDXBEG and ending on BSDXEND, inclusive
|
;Beginning with appointments on day BSDXBEG and ending on BSDXEND, inclusive
|
||||||
|
;Called by RPC: BSDX COPY APPOINTMENTS
|
||||||
;
|
;
|
||||||
;Returns ADO Recordset formatted fields containing count of records copied and error message:
|
; Parameters:
|
||||||
|
; - BSDXY: Global Return
|
||||||
|
; - BSDXRES: BSDX RESOURCE to copy appointments to
|
||||||
|
; - BSDX44: Hospital Location IEN to copy appointments from
|
||||||
|
; - BSDXBEG: Beginning Date in FM Format
|
||||||
|
; - BSDXEND: End Date in FM Format
|
||||||
;
|
;
|
||||||
; July 13 2010: D dates (BEG and END) from US format to FM Dates for i18n
|
;Returns ADO Recordset containing TASK_NUMBER and ERRORID
|
||||||
;
|
;
|
||||||
;
|
; Return Array
|
||||||
S BSDXY="^BSDXTMP("_$J_")"
|
S BSDXY=$NA(^BSDXTMP($J))
|
||||||
N BSDXI,BSDXST,ZTSK
|
K ^BSDXTMP($J)
|
||||||
S BSDXI=0
|
; $ET
|
||||||
S X="ETRAP^BSDX29",@^%ZOSF("TRAP")
|
N $ET S $ET="G ETRAP^BSDX29"
|
||||||
|
; Counter
|
||||||
|
N BSDXI S BSDXI=0
|
||||||
|
; Header Node
|
||||||
S ^BSDXTMP($J,0)="T00010TASK_NUMBER^T00020ERRORID"_$C(30)
|
S ^BSDXTMP($J,0)="T00010TASK_NUMBER^T00020ERRORID"_$C(30)
|
||||||
;
|
;
|
||||||
;Convert beginning and ending dates
|
; Make dates inclusive; add 1 to FM dates
|
||||||
;
|
|
||||||
;TODO:Validate FM Dates coming through
|
|
||||||
;
|
|
||||||
S BSDXBEG=BSDXBEG-1
|
S BSDXBEG=BSDXBEG-1
|
||||||
S BSDXEND=BSDXEND+1
|
S BSDXEND=BSDXEND+1
|
||||||
;
|
;
|
||||||
|
; Taskman variables
|
||||||
|
N ZTSK,ZTRTN,ZTDTH,ZTDESC,ZTSAVE
|
||||||
|
; Task Load
|
||||||
S ZTRTN="ZTM^BSDX29",ZTDTH=$H,ZTDESC="COPY PATIENT APPTS"
|
S ZTRTN="ZTM^BSDX29",ZTDTH=$H,ZTDESC="COPY PATIENT APPTS"
|
||||||
S ZTSAVE("BSDXBEG")="",ZTSAVE("BSDXEND")="",ZTSAVE("BSDX44")="",ZTSAVE("BSDXRES")=""
|
S ZTSAVE("BSDXBEG")="",ZTSAVE("BSDXEND")="",ZTSAVE("BSDX44")="",ZTSAVE("BSDXRES")=""
|
||||||
D ^%ZTLOAD
|
D ^%ZTLOAD
|
||||||
;
|
; Set up return ADO.net dataset
|
||||||
|
N BSDXST S BSDXST=$S($G(ZTSK)>0:"OK",1:"Unable to create task.")
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
S BSDXST=$S($G(ZTSK)>0:"OK",1:"Unable to create task.")
|
|
||||||
S ^BSDXTMP($J,BSDXI)=$G(ZTSK)_"^"_BSDXST_$C(30)_$C(31)
|
S ^BSDXTMP($J,BSDXI)=$G(ZTSK)_"^"_BSDXST_$C(30)_$C(31)
|
||||||
Q
|
QUIT
|
||||||
;
|
|
||||||
ZTMTST ;
|
|
||||||
;
|
|
||||||
S %DT="AE" D ^%DT S BSDXBEG=Y
|
|
||||||
S %DT="AE" D ^%DT S BSDXEND=Y
|
|
||||||
S BSDX44=3,BSDXSRES=1,ZTSK=3380
|
|
||||||
D ZTM
|
|
||||||
Q
|
|
||||||
;
|
;
|
||||||
ZTMD ;EP - Debug entry point
|
ZTMD ;EP - Debug entry point
|
||||||
;D DEBUG^%Serenji("ZTM^BSDX29")
|
;D DEBUG^%Serenji("ZTM^BSDX29")
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
ZTM ;EP
|
ZTM ;EP - Taskman entry point
|
||||||
;Taskman entry point
|
; Variables set up in ZTSAVE above
|
||||||
S X="ZTMERR^BSDX29",@^%ZOSF("TRAP")
|
;
|
||||||
;$O through ^SC(BSDX44,"S",
|
|
||||||
Q:'$D(ZTSK)
|
Q:'$D(ZTSK)
|
||||||
N BSDXCNT,BSDXIEN,BSDXNOD,BSDXNOTE,BSDXCAN,BSDXPAT,BSDXLEN,BSDXMADE,BSDXCLRK,BSDXPAT,BSDXQUIT
|
; $ET
|
||||||
S BSDXCNT=0,BSDXQUIT=0
|
N $ET S $ET="G ZTMERR^BSDX29"
|
||||||
|
; Txn
|
||||||
|
TSTART (BSDXBEG,BSDXEND,BSDX44,BSDXRES):T="BSDX COPY APPOINTMENT^BSDX29"
|
||||||
|
;$O through ^SC(BSDX44,"S",
|
||||||
|
N BSDXCNT S BSDXCNT=0 ; Count of Copied Appointments
|
||||||
|
N BSDXQUIT S BSDXQUIT=0 ; Quit Flag to be retrieved from an external proc
|
||||||
|
; Set Count
|
||||||
S ^BSDXTMP("BSDXCOPY",ZTSK)=BSDXCNT
|
S ^BSDXTMP("BSDXCOPY",ZTSK)=BSDXCNT
|
||||||
TSTART
|
; Loop through dates here.
|
||||||
F S BSDXBEG=$O(^SC(BSDX44,"S",BSDXBEG)) Q:'+BSDXBEG Q:BSDXBEG>BSDXEND Q:BSDXQUIT D
|
F S BSDXBEG=$O(^SC(BSDX44,"S",BSDXBEG)) Q:'+BSDXBEG Q:BSDXBEG>BSDXEND Q:BSDXQUIT D
|
||||||
. S BSDXIEN=0 F S BSDXIEN=$O(^SC(BSDX44,"S",BSDXBEG,1,BSDXIEN)) Q:'+BSDXIEN Q:BSDXQUIT D
|
. ; Loop through Entries in each date in the subsubfile.
|
||||||
. . S BSDXNOD=$G(^SC(BSDX44,"S",BSDXBEG,1,BSDXIEN,0))
|
. ; Quit if we are at the end or if a remote process requests a quit.
|
||||||
. . Q:'+BSDXNOD
|
. N BSDXIEN S BSDXIEN=0
|
||||||
. . S BSDXCAN=$P(BSDXNOD,U,9)
|
. F S BSDXIEN=$O(^SC(BSDX44,"S",BSDXBEG,1,BSDXIEN)) Q:'+BSDXIEN Q:BSDXQUIT D
|
||||||
. . Q:BSDXCAN="C"
|
. . N BSDXNOD S BSDXNOD=$G(^SC(BSDX44,"S",BSDXBEG,1,BSDXIEN,0)) ; Node
|
||||||
. . S BSDXPAT=$P(BSDXNOD,U)
|
. . Q:'+BSDXNOD ; Quit if no node
|
||||||
. . S BSDXLEN=$P(BSDXNOD,U,2) ;duration in minutes
|
. . N BSDXCAN S BSDXCAN=$P(BSDXNOD,U,9) ; Cancel flag
|
||||||
. . S BSDXCLRK=$P(BSDXNOD,U,6) ;appt made by (clerk)
|
. . Q:BSDXCAN="C" ; Quit if appt cancelled
|
||||||
. . S BSDXMADE=$P(BSDXNOD,U,7) ;date appt made
|
. . N BSDXPAT S BSDXPAT=$P(BSDXNOD,U) ; Patient
|
||||||
. . S BSDXNOTE=$P(BSDXNOD,U,4) ;'OTHER' field contains note
|
. . N BSDXLEN S BSDXLEN=$P(BSDXNOD,U,2) ;duration in minutes
|
||||||
|
. . N BSDXCLRK S BSDXCLRK=$P(BSDXNOD,U,6) ;appt made by (clerk)
|
||||||
|
. . N BSDXMADE S BSDXMADE=$P(BSDXNOD,U,7) ;date appt made
|
||||||
|
. . N BSDXNOTE S BSDXNOTE=$P(BSDXNOD,U,4) ;'OTHER' field contains note
|
||||||
. . S BSDXCNT=BSDXCNT+$$XFER(BSDXRES,BSDXBEG,BSDXPAT,BSDXLEN,BSDXCLRK,BSDXMADE,BSDXNOTE)
|
. . S BSDXCNT=BSDXCNT+$$XFER(BSDXRES,BSDXBEG,BSDXPAT,BSDXLEN,BSDXCLRK,BSDXMADE,BSDXNOTE)
|
||||||
. . I +BSDXCNT,BSDXCNT#10=0 S ^BSDXTMP("BSDXCOPY",ZTSK)=BSDXCNT_" records copied." ;every 10th record
|
. . I +BSDXCNT,BSDXCNT#10=0 S ^BSDXTMP("BSDXCOPY",ZTSK)=BSDXCNT_" records copied." ;every 10th record
|
||||||
. . I $D(^BSDXTMP("BSDXCOPY",ZTSK,"CANCEL")) S BSDXQUIT=1 ;Check for cancel flag
|
. . I $D(^BSDXTMP("BSDXCOPY",ZTSK,"CANCEL")) S BSDXQUIT=1 ;Check for cancel flag
|
||||||
|
@ -84,10 +97,13 @@ ZTM ;EP
|
||||||
S ^BSDXTMP("BSDXCOPY",ZTSK)=$S(BSDXQUIT:"Cancelled. No records copied.",1:"Finished. "_BSDXCNT_" records copied.")
|
S ^BSDXTMP("BSDXCOPY",ZTSK)=$S(BSDXQUIT:"Cancelled. No records copied.",1:"Finished. "_BSDXCNT_" records copied.")
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
ZTMERR ;
|
ZTMERR ; For now, error from TM is only in trap; not returned to client.
|
||||||
TROLLBACK
|
N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap
|
||||||
|
; Rollback before logging the error
|
||||||
|
I $TL>0 TROLLBACK
|
||||||
D ^%ZTER
|
D ^%ZTER
|
||||||
Q
|
S $EC="" ; Clear Error
|
||||||
|
QUIT
|
||||||
;
|
;
|
||||||
XFER(BSDXRES,BSDXBEG,BSDXPAT,BSDXLEN,BSDXCLRK,BSDXMADE,BSDXNOTE) ;EP
|
XFER(BSDXRES,BSDXBEG,BSDXPAT,BSDXLEN,BSDXCLRK,BSDXMADE,BSDXNOTE) ;EP
|
||||||
;
|
;
|
||||||
|
@ -131,19 +147,22 @@ XFER(BSDXRES,BSDXBEG,BSDXPAT,BSDXLEN,BSDXCLRK,BSDXMADE,BSDXNOTE) ;EP
|
||||||
;
|
;
|
||||||
ERR(BSDXI,BSDXCNT,BSDXERR) ;Error processing
|
ERR(BSDXI,BSDXCNT,BSDXERR) ;Error processing
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
|
S BSDXERR=$TR(BSDXERR,"^","~")
|
||||||
S ^BSDXTMP($J,BSDXI)=BSDXCNT_"^"_BSDXERR_$C(30)
|
S ^BSDXTMP($J,BSDXI)=BSDXCNT_"^"_BSDXERR_$C(30)
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
S ^BSDXTMP($J,BSDXI)=$C(31)
|
S ^BSDXTMP($J,BSDXI)=$C(31)
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
ETRAP ;EP Error trap entry
|
ETRAP ;EP Error trap entry
|
||||||
|
; No Txn here. So don't rollback anything
|
||||||
|
N $ET S $ET="D ^%ZTER HALT" ; Emergency Error Trap
|
||||||
D ^%ZTER
|
D ^%ZTER
|
||||||
I '$D(BSDXI) N BSDXI S BSDXI=999
|
S $EC="" ; Clear error
|
||||||
S BSDXI=BSDXI+1
|
I '$D(BSDXI) N BSDXI S BSDXI=0
|
||||||
D ERR(BSDXI,$G(BSDXCNT),"Routine: BSDX29, Error: "_$G(%ZTERROR))
|
D ERR(BSDXI,$G(BSDXCNT),"~100~BSDX29, Error: "_$G(%ZTERZE))
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
CPSTAT(BSDXY,BSDXTSK) ;EP
|
CPSTAT(BSDXY,BSDXTSK) ;EP - Note: As of Dec 6 2010: Inactive Code
|
||||||
;Return status (copied record count) of tasked job having ZTSK=BSDXTSK
|
;Return status (copied record count) of tasked job having ZTSK=BSDXTSK
|
||||||
;
|
;
|
||||||
S BSDXY="^BSDXTMP("_$J_")"
|
S BSDXY="^BSDXTMP("_$J_")"
|
||||||
|
@ -159,7 +178,7 @@ CPSTAT(BSDXY,BSDXTSK) ;EP
|
||||||
S ^BSDXTMP($J,BSDXI)=BSDXCNT_"^"_"OK"_$C(30)_$C(31)
|
S ^BSDXTMP($J,BSDXI)=BSDXCNT_"^"_"OK"_$C(30)_$C(31)
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
CPCANC(BSDXY,BSDXTSK) ;EP
|
CPCANC(BSDXY,BSDXTSK) ;EP Note: As of Dec 6 2010: Inactive code.
|
||||||
;Signal tasked job having ZTSK=BSDXTSK to cancel
|
;Signal tasked job having ZTSK=BSDXTSK to cancel
|
||||||
;Returns current record count of copy process
|
;Returns current record count of copy process
|
||||||
;
|
;
|
||||||
|
|
115
m/BSDX31.m
115
m/BSDX31.m
|
@ -1,58 +1,103 @@
|
||||||
BSDX31 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ;
|
BSDX31 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 12/6/10 8:25am
|
||||||
;;1.41;BSDX;;Sep 29, 2010
|
;;1.42;BSDX;;Sep 29, 2010
|
||||||
|
; Change Log:
|
||||||
|
; v1.42 Oct 23 2010 WV/SMH
|
||||||
|
; - Change transaction to restartable. Thanks to Zach Gonzalez
|
||||||
|
; --> and Rick Marshall for their help.
|
||||||
|
; v1.42 Dec 6 2010: Extensive refactoring
|
||||||
|
;
|
||||||
|
; Error Reference:
|
||||||
|
; -1: zero or null Appt ID
|
||||||
|
; -2: Invalid APPT ID (doesn't exist in ^BSDXAPPT)
|
||||||
|
; -3: No-show flag is invalid
|
||||||
|
; -100: M Error
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
NOSHOWD(BSDXY,BSDXAPTID,BSDXNS) ;EP
|
NOSHOWD(BSDXY,BSDXAPTID,BSDXNS) ;EP
|
||||||
;Entry point for debugging
|
;Entry point for debugging
|
||||||
;
|
;
|
||||||
;D DEBUG^%Serenji("NOSHOW^BSDX31(.BSDXY,BSDXAPTID,BSDXNS)")
|
D DEBUG^%Serenji("NOSHOW^BSDX31(.BSDXY,BSDXAPTID,BSDXNS)")
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
NOSHOW(BSDXY,BSDXAPTID,BSDXNS) ;EP
|
UT ; Unit Tests
|
||||||
;Called by BSDX NOSHOW
|
; Test 1: Sanity Check
|
||||||
;Sets appointment noshow flag in BSDX APPOINTMENT file
|
N ZZZ ; Garbage return variable
|
||||||
|
N DATE S DATE=$$NOW^XLFDT()
|
||||||
|
S DATE=$E(DATE,1,12) ; Just get minutes b/c of HL file input transform
|
||||||
|
D APPADD^BSDX07(.ZZZ,DATE,DATE+.0001,3,"Dr Office",30,"Old Note",1)
|
||||||
|
N APPID S APPID=+$P(^BSDXTMP($J,1),U)
|
||||||
|
D NOSHOW(.ZZZ,APPID,1)
|
||||||
|
I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T1",! B
|
||||||
|
I $P(^DPT(3,"S",DATE,0),U,2)'="N" W "ERROR T1",! B
|
||||||
|
; Test 2: Undo noshow
|
||||||
|
D NOSHOW(.ZZZ,APPID,0)
|
||||||
|
I $P(^BSDXAPPT(APPID,0),U,10)'="0" W "ERROR T2",! B
|
||||||
|
I $P(^DPT(3,"S",DATE,0),U,2)'="" W "ERROR T2",! B
|
||||||
|
; Test 3: -1
|
||||||
|
D NOSHOW(.ZZZ,"",0)
|
||||||
|
I $P(^BSDXTMP($J,1),U)'=-1 W "ERROR T3",! B
|
||||||
|
; Test 4: -2
|
||||||
|
D NOSHOW(.ZZZ,2938748233,0)
|
||||||
|
I $P(^BSDXTMP($J,1),U)'=-2 W "ERROR T4",! B
|
||||||
|
QUIT
|
||||||
|
NOSHOW(BSDXY,BSDXAPTID,BSDXNS) ;EP - No show a patient
|
||||||
|
; Called by RPC: BSDX NOSHOW
|
||||||
|
; Sets appointment noshow flag in BSDX APPOINTMENT file and "S" node in File 2
|
||||||
|
;
|
||||||
|
; Parameters:
|
||||||
|
; BSDXY: Global Return
|
||||||
; BSDXAPTID is entry number in BSDX APPOINTMENT file
|
; BSDXAPTID is entry number in BSDX APPOINTMENT file
|
||||||
; BSDXNS = 1: NOSHOW, 0: CANCEL NOSHO
|
; BSDXNS = 1: NOSHOW, 0: CANCEL NOSHO
|
||||||
;Calls CANCEL^BSDAPI to set noshow data in ^DPT
|
|
||||||
;Returns error code in recordset field ERRORID
|
|
||||||
;
|
;
|
||||||
N BSDXNOD,BSDXPATID,BSDXSTART,BSDXID,BSDXI,BSDXZ,BSDXERR,BSDXMSG,BSDXFDA,BSDXIENS
|
; Returns ADO.net record set with fields
|
||||||
N BSDXNOEV
|
; - ERRORID; ERRORTEXT
|
||||||
S BSDXNOEV=1 ;Don't execute protocol
|
; ERRORID of 1 is okay
|
||||||
|
; Anything else is an error.
|
||||||
;
|
;
|
||||||
D ^XBKVAR S X="ETRAP^BSDX31",@^%ZOSF("TRAP")
|
; Return Array; set and clear
|
||||||
S BSDXI=0
|
S BSDXY=$NA(^BSDXTMP($J))
|
||||||
K ^BSDXTMP($J)
|
K ^BSDXTMP($J)
|
||||||
S BSDXY="^BSDXTMP("_$J_")"
|
; $ET
|
||||||
|
N $ET S $ET="G ETRAP^BSDX31"
|
||||||
|
; Basline vars
|
||||||
|
D ^XBKVAR ; Set up baseline variables (DUZ, DUZ(2)) if they don't exist
|
||||||
|
; Counter
|
||||||
|
N BSDXI S BSDXI=0
|
||||||
|
; Header Node
|
||||||
S ^BSDXTMP($J,BSDXI)="I00020ERRORID^T00030ERRORTEXT"_$C(30)
|
S ^BSDXTMP($J,BSDXI)="I00020ERRORID^T00030ERRORTEXT"_$C(30)
|
||||||
S BSDXI=BSDXI+1
|
; Begin transaction
|
||||||
TSTART
|
TSTART (BSDXI,BSDXY,BSDXAPTID,BSDXNS):T="BSDX NOSHOW CANCEL^BSDX29"
|
||||||
I '+BSDXAPTID D ERR(0,"BSDX31: Invalid Appointment ID") Q
|
; Turn off SDAM APPT PROTOCOL BSDX Entries
|
||||||
I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(0,"BSDX31: Invalid Appointment ID") Q
|
N BSDXNOEV S BSDXNOEV=1 ;Don't execute protocol
|
||||||
|
; Appointment ID check
|
||||||
|
I '+BSDXAPTID D ERR(-1,"BSDX31: Invalid Appointment ID") Q
|
||||||
|
I '$D(^BSDXAPPT(BSDXAPTID,0)) D ERR(-2,"BSDX31: Invalid Appointment ID") Q
|
||||||
|
; Noshow value check - Must be 1 or 0
|
||||||
S BSDXNS=+BSDXNS
|
S BSDXNS=+BSDXNS
|
||||||
I BSDXNS'=1&(BSDXNS'=0) D ERR(0,"BSDX31: Invalid No Show value") Q
|
I BSDXNS'=1&(BSDXNS'=0) D ERR(-3,"BSDX31: Invalid No Show value") Q
|
||||||
;
|
; Get Some data
|
||||||
;Edit BSDX APPOINTMENT entry NOSHOW field
|
N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPTID,0) ; Node
|
||||||
S BSDXNOD=^BSDXAPPT(BSDXAPTID,0)
|
N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
|
||||||
I BSDXNOD="" D ERR(0,"BSDX31: Invalid Appointment ID") Q
|
N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Start Date/Time
|
||||||
S BSDXPATID=$P(BSDXNOD,U,5)
|
; Edit BSDX APPOINTMENT entry
|
||||||
S BSDXSTART=$P(BSDXNOD,U)
|
N BSDXMSG ;
|
||||||
;
|
D BSDXNOS(BSDXAPTID,BSDXNS,.BSDXMSG) ;Edit BSDX APPOINTMENT entry NOSHOW field
|
||||||
D BSDXNOS(BSDXAPTID,BSDXNS)
|
I $D(BSDXMSG("DIERR")) S BSDXMSG=$G(BSDXMSG("DIERR",1,"TEXT",1)) D ERR(-4,"BSDX31: "_BSDXMSG) Q
|
||||||
I $D(BSDXMSG("DIERR")) S BSDXMSG=$G(BSDXMSG("DIERR",1,"TEXT",1)) D ERR(0,"BSDX31: "_BSDXMSG) Q
|
; Edit File 2 "S" node entry
|
||||||
;
|
N BSDXZ,BSDXERR ; Error variables to control looping
|
||||||
S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID
|
S BSDXSC1=$P(BSDXNOD,U,7) ;RESOURCEID
|
||||||
I BSDXSC1]"",$D(^BSDXRES(BSDXSC1,0)) D I $G(BSDXZ)]"" S BSDXERR="BSDX31: APNOSHO Returned: "_BSDXZ D ERR(0,BSDXERR) Q
|
; If Resource ID exists, and HL exists (means that Resource is linked), No show in File 2
|
||||||
|
I BSDXSC1]"",$D(^BSDXRES(BSDXSC1,0)) D I $G(BSDXZ)]"" S BSDXERR="BSDX31: APNOSHO Returned: "_BSDXZ D ERR(-5,BSDXERR) Q
|
||||||
. S BSDXNOD=^BSDXRES(BSDXSC1,0)
|
. S BSDXNOD=^BSDXRES(BSDXSC1,0)
|
||||||
. S BSDXSC1=$P(BSDXNOD,U,4) ;HOSPITAL LOCATION
|
. S BSDXSC1=$P(BSDXNOD,U,4) ;HOSPITAL LOCATION
|
||||||
. I BSDXSC1]"",$D(^SC(BSDXSC1,0)) D APNOSHO(.BSDXZ,BSDXSC1,BSDXPATID,BSDXSTART,BSDXNS)
|
. I BSDXSC1]"",$D(^SC(BSDXSC1,0)) D APNOSHO(.BSDXZ,BSDXSC1,BSDXPATID,BSDXSTART,BSDXNS)
|
||||||
;
|
;
|
||||||
TCOMMIT
|
TCOMMIT
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
S ^BSDXTMP($J,BSDXI)="1^"_$C(30)
|
S ^BSDXTMP($J,BSDXI)="1^"_$C(30) ; 1 means everything okay
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
S ^BSDXTMP($J,BSDXI)=$C(31)
|
S ^BSDXTMP($J,BSDXI)=$C(31)
|
||||||
Q
|
QUIT
|
||||||
;
|
;
|
||||||
APNOSHO(BSDXZ,BSDXSC1,BSDXDFN,BSDXSD,BSDXNS) ;
|
APNOSHO(BSDXZ,BSDXSC1,BSDXDFN,BSDXSD,BSDXNS) ;
|
||||||
; update file 2 info
|
; update file 2 info
|
||||||
|
@ -77,14 +122,13 @@ APNOSHO(BSDXZ,BSDXSC1,BSDXDFN,BSDXSD,BSDXNS) ;
|
||||||
S BSDXZ=$G(BSDXMSG("DIERR",1,"TEXT",1))
|
S BSDXZ=$G(BSDXMSG("DIERR",1,"TEXT",1))
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
BSDXNOS(BSDXAPTID,BSDXNS) ;
|
BSDXNOS(BSDXAPTID,BSDXNS,BSDXMSG) ;
|
||||||
;
|
;
|
||||||
N BSDXFDA,BSDXIENS
|
N BSDXFDA,BSDXIENS
|
||||||
S BSDXIENS=BSDXAPTID_","
|
S BSDXIENS=BSDXAPTID_","
|
||||||
S BSDXFDA(9002018.4,BSDXIENS,.1)=BSDXNS ;NOSHOW
|
S BSDXFDA(9002018.4,BSDXIENS,.1)=BSDXNS ;NOSHOW
|
||||||
D FILE^DIE("","BSDXFDA","BSDXMSG")
|
D FILE^DIE("","BSDXFDA","BSDXMSG")
|
||||||
;
|
QUIT
|
||||||
Q
|
|
||||||
;
|
;
|
||||||
NOSEVT(BSDXPAT,BSDXSTART,BSDXSC) ;EP Called by BSDX NOSHOW APPOINTMENT event
|
NOSEVT(BSDXPAT,BSDXSTART,BSDXSC) ;EP Called by BSDX NOSHOW APPOINTMENT event
|
||||||
;when appointments NOSHOW via PIMS interface.
|
;when appointments NOSHOW via PIMS interface.
|
||||||
|
@ -129,7 +173,6 @@ NOSEVT3(BSDXRES) ;
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
ERR(BSDXERID,ERRTXT) ;Error processing
|
ERR(BSDXERID,ERRTXT) ;Error processing
|
||||||
S:'+$G(BSDXI) BSDXI=999999
|
|
||||||
S BSDXI=BSDXI+1
|
S BSDXI=BSDXI+1
|
||||||
TROLLBACK
|
TROLLBACK
|
||||||
S ^BSDXTMP($J,BSDXI)=BSDXERID_"^"_ERRTXT_$C(30)
|
S ^BSDXTMP($J,BSDXI)=BSDXERID_"^"_ERRTXT_$C(30)
|
||||||
|
|
Loading…
Reference in New Issue