SDESNOSHOW ;ALB/BWF,BLB,ANU - VISTA SCHEDULING RPCS NOSHOW/UNDO NOSHOW ; OCT 25, 2023
;;5.3;Scheduling;**831,835,847,853,864**;Aug 13, 1993;Build 15
;;Per VHA Directive 6402, this routine should not be modified
;
Q
NOSHOW(SDESRES,APPTIEN) ;
N DFN,APPTDTTM,REQTYPE,PROVIDER,NOTE,RESOURCE,SDECNOEV,SDESENCOUNTER,REQIEN,APPTIENS,NOSHOW
N SDATA,SDCIHDL,SDDA,CURRENTSTAT,CURNOSHOWDTTM,ERRORS,RESTYPE,CLINICIEN,RESULT,UPDSTAT,FDA
S SDECNOEV=1 ;Don't execute protocol
;
S APPTIEN=$G(APPTIEN)
;validate appointment ID
D VALAPPTIEN^SDESVALUTIL(.ERRORS,APPTIEN)
I $D(ERRORS) S ERRORS("NoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
D GETVARS(APPTIEN,.CURRENTSTAT,.CURNOSHOWDTTM,.DFN,.APPTDTTM,.PROVIDER,.REQIEN,.NOSHOW,.REQTYPE,.USERIEN,.RESOURCE)
S SDESNOSHOWDTTM=$$NOW^XLFDT
;
; check resource and clinic validity
I 'RESOURCE D ERRLOG^SDESJSON(.ERRORS,282)
S CLINICIEN=$$GET1^DIQ(409.831,RESOURCE,.04,"I")
I 'CLINICIEN D ERRLOG^SDESJSON(.ERRORS,283)
; already in noshow status
I NOSHOW!(CURRENTSTAT="N"!(CURNOSHOWDTTM]"")) D ERRLOG^SDESJSON(.ERRORS,367)
I $D(ERRORS) S ERRORS("NoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
; make sure no-show is not occuring before appointment date/time
I SDESNOSHOWDTTM<APPTDTTM S ERRORS("NoShow",1)="" D ERRLOG^SDESJSON(.ERRORS,369)
I $D(ERRORS) S ERRORS("NoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
; Event driver "BEFORE" actions
S SDDA=$$FIND^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
D BEFOREEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,.SDCIHDL)
;
; Process no show
;
D UPDNOSHOWSTAT(.ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,1)
; if an error was returned, build the JSON and quit
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,370)
.S ERRORS("NoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
D APPTNOSHOW(.ERRORS,CLINICIEN,DFN,APPTDTTM,USERIEN,SDESNOSHOWDTTM,APPTIEN)
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,371)
.S ERRORS("NoShow",1)=""
.D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
;
; only update PID if the updates to 409.84 and 2.98 were successful
; PID CHANGE ALLOWED Field in 409.85 based on whether no-show or cancel no-show
S UPDSTAT=$$GET1^DIQ(409.84,APPTIEN,.17,"I")
I REQTYPE="APPT",UPDSTAT="N" D
.S FDA(409.85,REQIEN_",",19)=""
.S FDA(409.85,REQIEN_",",20)=""
.S FDA(409.85,REQIEN_",",21)=""
.; 864
.;S FDA(409.85,REQIEN_",",23)="OPEN"
.S FDA(409.85,REQIEN_",",23)="O"
.S FDA(409.85,REQIEN_",",49)=1
.D FILE^DIE("","FDA") K FDA
;
; fix action required in PCE after no-show from GUI
; SDESENCOUNTER - outpatient encounter
; Anu
;S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN,.ERRORS)
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,174)
.S ERRORS("NoShow",1)=""
.D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
;
I SDESENCOUNTER D EN^SDCODEL(SDESENCOUNTER,2,"","NOSHOW") ;suppress event logging for cancel checkout when no-showing
;
; Event driver "AFTER" actions
D AFTEREVTS(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
;
S RESULT("NoShow")="No-show complete."
D BUILDJSON^SDESBUILDJSON(.SDESRES,.RESULT)
Q
UNDONOSHOW(SDESRES,APPTIEN) ;
N DFN,APPTDTTM,REQTYPE,CONS,CONSULTIEN,PROVIDER,NOTE,RESOURCE,SDECNOEV,SDESENCOUNTER,REQIEN,APPTIENS,NOSHOW,RESTXT
N CURRENTSTAT,CURNOSHOWDTTM,ERRORS,RESTYPE,CLINICIEN,RESULT,UPDSTAT,FDA
N SDATA,SDCIHDL,SDDA
S SDECNOEV=1 ;Don't execute protocol
;
S APPTIEN=$G(APPTIEN)
;validate appointment ID
D VALAPPTIEN^SDESVALUTIL(.ERRORS,APPTIEN)
I $D(ERRORS) S ERRORS("UndoNoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
D GETVARS(APPTIEN,.CURRENTSTAT,.CURNOSHOWDTTM,.DFN,.APPTDTTM,.PROVIDER,.REQIEN,.NOSHOW,.REQTYPE,.USERIEN,.RESOURCE)
S SDESNOSHOWDTTM=""
;
; check resource and clinic validity
I 'RESOURCE D ERRLOG^SDESJSON(.ERRORS,282)
S CLINICIEN=$$GET1^DIQ(409.831,RESOURCE,.04,"I")
I 'CLINICIEN D ERRLOG^SDESJSON(.ERRORS,283)
;
; if not in no-show already do not continue
I 'NOSHOW!(CURRENTSTAT'="N") D ERRLOG^SDESJSON(.ERRORS,368)
I $D(ERRORS) S ERRORS("UndoNoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
; Event driver "BEFORE" actions
S SDDA=$$FIND^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
D BEFOREEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,.SDCIHDL)
;
; Process no show
;
D UPDNOSHOWSTAT(.ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,0)
; if an error was returned, build the JSON and quit
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,370)
.S ERRORS("UndoNoShow",1)="" D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS) Q
;
D APPTUNDONOSHOW(.ERRORS,CLINICIEN,DFN,APPTDTTM,USERIEN,SDESNOSHOWDTTM,APPTIEN)
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,371)
.S ERRORS("UndoNoShow",1)=""
.D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
;
; only update PID if the updates to 409.84 and 2.98 were successful
; PID CHANGE ALLOWED Field in 409.85 based on whether no-show or cancel no-show
S UPDSTAT=$$GET1^DIQ(409.84,APPTIEN,.17,"I")
I REQTYPE="APPT",UPDSTAT'="N" D
.S FDA(409.85,REQIEN_",",19)=""
.S FDA(409.85,REQIEN_",",20)=""
.S FDA(409.85,REQIEN_",",21)=""
.; 864
.;S FDA(409.85,REQIEN_",",23)="CLOSED"
.S FDA(409.85,REQIEN_",",23)="C"
.S FDA(409.85,REQIEN_",",49)=0
.D FILE^DIE("","FDA") K FDA
;
;
; fix action required in PCE after no-show from GUI
; SDESENCOUNTER - outpatient encounter
; Anu
;S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN,.ERRORS)
I $D(ERRORS) D Q
.D ERRLOG^SDESJSON(.ERRORS,174)
.S ERRORS("UndoNoShow",1)=""
.D BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
;
I SDESENCOUNTER D EN^SDCODEL(SDESENCOUNTER,2,"","NOSHOW") ;suppress event logging for cancel checkout when no-showing
;
; Event driver "AFTER" actions
;
;remove undo no-show from grid; /BLB/
;
I REQTYPE="CONSULT" D CONSREQUESTSET(PROVIDER,APPTDTTM,RESOURCE)
D AFTEREVTS(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
;
S RESULT("UndoNoShow")="Undo No-show complete."
D BUILDJSON^SDESBUILDJSON(.SDESRES,.RESULT)
Q
; get variables needed for processing
GETVARS(APPTIEN,CURRENTSTAT,CURNOSHOWDTTM,DFN,APPTDTTM,PROVIDER,REQIEN,NOSHOW,REQTYPE,USERIEN,RESOURCE) ;
N APPTIENS,APPTDAT,APPTERR
S APPTIENS=APPTIEN_","
D GETS^DIQ(409.84,APPTIENS,".01;.05;.07;.16;.17;.1;.101;.102;.22","I","APPTDAT","APPTERR")
S CURRENTSTAT=$G(APPTDAT(409.84,APPTIENS,.17,"I"))
S CURNOSHOWDTTM=$G(APPTDAT(409.84,APPTIENS,.101,"I"))
S DFN=$G(APPTDAT(409.84,APPTIENS,.05,"I"))
S APPTDTTM=$G(APPTDAT(409.84,APPTIENS,.01,"I"))
S PROVIDER=$G(APPTDAT(409.84,APPTIENS,.16,"I"))
S REQIEN=$P($G(APPTDAT(409.84,APPTIENS,.22,"I")),";")
S NOSHOW=$G(APPTDAT(409.84,APPTIENS,.1,"I"))
S REQTYPE=$$GET1^DIQ(409.84,APPTIENS,.22,"E")
S USERIEN=$G(DUZ)
S RESOURCE=$G(APPTDAT(409.84,APPTIENS,.07,"I"))
Q
;
CONSREQUESTSET(PROVIDER,APPTDTTM,RESOURCE) ;
N REQTYPE,CONS,CONSULTIEN,NOTE
S REQTYPE=$$GET1^DIQ(409.84,APPTIEN,.22,"E")
I REQTYPE="CONSULT" D
.S CONS=$$GET1^DIQ(409.84,APPTIEN,.22,"I")
.S CONSULTIEN=$P(CONS,";",1)
.S NOTE=$$GET1^DIQ(409.84,APPTIEN,1,"E")
.D REQSET^SDESCONSULTUPD(CONSULTIEN,PROVIDER,,1,,NOTE,APPTDTTM,RESOURCE)
Q
;
; update file 2 info
;Set noshow for patient DFN in CLINICIEN SDCL
;at time SDT
APPTNOSHOW(ERRORS,SDCL,DFN,SDT,USERIEN,SDECCDT,SDAPID) ;
N SDRTYP,SDECIENS,SDFDA,SDECMSG,IEN
S SDECIENS=SDT_","_DFN_","
S SDFDA(2.98,SDECIENS,3)="N"
S SDFDA(2.98,SDECIENS,14)=USERIEN
S SDFDA(2.98,SDECIENS,15)=SDECCDT
D FILE^DIE("","SDFDA","SDECMSG")
I $D(SDECMSG) D ERRLOG^SDESJSON(.ERRORS,52,$G(SDECMSG("DIERR",1,"TEXT",1))) Q
D UPDCNSLT(SDAPID,DFN,SDCL,SDT)
Q
; Remove no-show fields from file 2
APPTUNDONOSHOW(ERRORS,SDCL,DFN,SDT,USERIEN,SDECCDT,SDAPID) ;
N SDRTYP,SDECIENS,SDFDA,SDECMSG,IEN
S SDECIENS=SDT_","_DFN_","
S SDFDA(2.98,SDECIENS,3)=""
S SDFDA(2.98,SDECIENS,14)=""
S SDFDA(2.98,SDECIENS,15)=""
D FILE^DIE("","SDFDA","SDECMSG")
I $D(SDECMSG) D ERRLOG^SDESJSON(.ERRORS,52,$G(SDECMSG("DIERR",1,"TEXT",1))) Q
D UPDCNSLT(SDAPID,DFN,SDCL,SDT)
Q
; update consult
UPDCNSLT(SDAPID,DFN,SDCL,SDT) ;
N SDRTYP,IEN,SDRES
S SDRTYP=$$GET1^DIQ(409.84,SDAPID_",",.22,"I")
I $P(SDRTYP,";",2)="GMR(123," D
.S IEN=$$SCIEN^SDECU2(DFN,SDCL,SDT)
.D NOSHOW^SDCNSLT(SDCL,SDT,DFN,$P(SDRTYP,";",1),IEN)
;for Recall Request APPT NOSHOW
I $P(SDRTYP,";",2)="SD(403.5," D REOPEN^SDESRECALLREQ(.SDESRES,APPTIEN,SDRTYP)
Q
; set 409.84 no-show fields
UPDNOSHOWSTAT(ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,NOSHOWSTAT) ;
N SDFDA,SDECIENS,SDECMSG
S SDECIENS=APPTIEN_","
S SDFDA(409.84,SDECIENS,.1)=NOSHOWSTAT ;NOSHOW
S SDFDA(409.84,SDECIENS,.101)=$G(SDESNOSHOWDTTM) ;NOSHOW DATE
S SDFDA(409.84,SDECIENS,.102)=$G(USERIEN) ;NOSHOW USER
S SDFDA(409.84,SDECIENS,.17)=$S(NOSHOWSTAT:"N",1:"") ; Update STATUS
D FILE^DIE("","SDFDA","SDECMSG")
I $D(SDECMSG("DIERR")) S SDECMSG=$G(SDECMSG("DIERR",1,"TEXT",1)) D ERRLOG^SDESJSON(.ERRORS,52,SDECMSG)
Q
;
BEFOREEVT(SDATA,DFN,APPTDTTM,CLINICIEN,SDCIHDL) ;
S SDATA=SDDA_U_DFN_U_APPTDTTM_U_CLINICIEN
S SDCIHDL=$$HANDLE^SDAMEVT(1)
D BEFORE^SDAMEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
Q
AFTEREVTS(SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL) ;
D AFTER^SDAMEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
; Execute event driver. 3=no show (see #409.66), 2=non-interactive
D EVT^SDAMEVT(.SDATA,3,2,SDCIHDL) ;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESNOSHOW 9516 printed Dec 13, 2024@02:57:23 Page 2
SDESNOSHOW ;ALB/BWF,BLB,ANU - VISTA SCHEDULING RPCS NOSHOW/UNDO NOSHOW ; OCT 25, 2023
+1 ;;5.3;Scheduling;**831,835,847,853,864**;Aug 13, 1993;Build 15
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
NOSHOW(SDESRES,APPTIEN) ;
+1 NEW DFN,APPTDTTM,REQTYPE,PROVIDER,NOTE,RESOURCE,SDECNOEV,SDESENCOUNTER,REQIEN,APPTIENS,NOSHOW
+2 NEW SDATA,SDCIHDL,SDDA,CURRENTSTAT,CURNOSHOWDTTM,ERRORS,RESTYPE,CLINICIEN,RESULT,UPDSTAT,FDA
+3 ;Don't execute protocol
SET SDECNOEV=1
+4 ;
+5 SET APPTIEN=$GET(APPTIEN)
+6 ;validate appointment ID
+7 DO VALAPPTIEN^SDESVALUTIL(.ERRORS,APPTIEN)
+8 IF $DATA(ERRORS)
SET ERRORS("NoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
+9 ;
+10 DO GETVARS(APPTIEN,.CURRENTSTAT,.CURNOSHOWDTTM,.DFN,.APPTDTTM,.PROVIDER,.REQIEN,.NOSHOW,.REQTYPE,.USERIEN,.RESOURCE)
+11 SET SDESNOSHOWDTTM=$$NOW^XLFDT
+12 ;
+13 ; check resource and clinic validity
+14 IF 'RESOURCE
DO ERRLOG^SDESJSON(.ERRORS,282)
+15 SET CLINICIEN=$$GET1^DIQ(409.831,RESOURCE,.04,"I")
+16 IF 'CLINICIEN
DO ERRLOG^SDESJSON(.ERRORS,283)
+17 ; already in noshow status
+18 IF NOSHOW!(CURRENTSTAT="N"!(CURNOSHOWDTTM]""))
DO ERRLOG^SDESJSON(.ERRORS,367)
+19 IF $DATA(ERRORS)
SET ERRORS("NoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
+20 ; make sure no-show is not occuring before appointment date/time
+21 IF SDESNOSHOWDTTM<APPTDTTM
SET ERRORS("NoShow",1)=""
DO ERRLOG^SDESJSON(.ERRORS,369)
+22 IF $DATA(ERRORS)
SET ERRORS("NoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
+23 ;
+24 ; Event driver "BEFORE" actions
+25 SET SDDA=$$FIND^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
+26 DO BEFOREEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,.SDCIHDL)
+27 ;
+28 ; Process no show
+29 ;
+30 DO UPDNOSHOWSTAT(.ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,1)
+31 ; if an error was returned, build the JSON and quit
+32 IF $DATA(ERRORS)
Begin DoDot:1
+33 DO ERRLOG^SDESJSON(.ERRORS,370)
+34 SET ERRORS("NoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
End DoDot:1
QUIT
+35 ;
+36 DO APPTNOSHOW(.ERRORS,CLINICIEN,DFN,APPTDTTM,USERIEN,SDESNOSHOWDTTM,APPTIEN)
+37 IF $DATA(ERRORS)
Begin DoDot:1
+38 DO ERRLOG^SDESJSON(.ERRORS,371)
+39 SET ERRORS("NoShow",1)=""
+40 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
End DoDot:1
QUIT
+41 ;
+42 ; only update PID if the updates to 409.84 and 2.98 were successful
+43 ; PID CHANGE ALLOWED Field in 409.85 based on whether no-show or cancel no-show
+44 SET UPDSTAT=$$GET1^DIQ(409.84,APPTIEN,.17,"I")
+45 IF REQTYPE="APPT"
IF UPDSTAT="N"
Begin DoDot:1
+46 SET FDA(409.85,REQIEN_",",19)=""
+47 SET FDA(409.85,REQIEN_",",20)=""
+48 SET FDA(409.85,REQIEN_",",21)=""
+49 ; 864
+50 ;S FDA(409.85,REQIEN_",",23)="OPEN"
+51 SET FDA(409.85,REQIEN_",",23)="O"
+52 SET FDA(409.85,REQIEN_",",49)=1
+53 DO FILE^DIE("","FDA")
KILL FDA
End DoDot:1
+54 ;
+55 ; fix action required in PCE after no-show from GUI
+56 ; SDESENCOUNTER - outpatient encounter
+57 ; Anu
+58 ;S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
+59 SET SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN,.ERRORS)
+60 IF $DATA(ERRORS)
Begin DoDot:1
+61 DO ERRLOG^SDESJSON(.ERRORS,174)
+62 SET ERRORS("NoShow",1)=""
+63 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
End DoDot:1
QUIT
+64 ;
+65 ;suppress event logging for cancel checkout when no-showing
IF SDESENCOUNTER
DO EN^SDCODEL(SDESENCOUNTER,2,"","NOSHOW")
+66 ;
+67 ; Event driver "AFTER" actions
+68 DO AFTEREVTS(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
+69 ;
+70 SET RESULT("NoShow")="No-show complete."
+71 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.RESULT)
+72 QUIT
UNDONOSHOW(SDESRES,APPTIEN) ;
+1 NEW DFN,APPTDTTM,REQTYPE,CONS,CONSULTIEN,PROVIDER,NOTE,RESOURCE,SDECNOEV,SDESENCOUNTER,REQIEN,APPTIENS,NOSHOW,RESTXT
+2 NEW CURRENTSTAT,CURNOSHOWDTTM,ERRORS,RESTYPE,CLINICIEN,RESULT,UPDSTAT,FDA
+3 NEW SDATA,SDCIHDL,SDDA
+4 ;Don't execute protocol
SET SDECNOEV=1
+5 ;
+6 SET APPTIEN=$GET(APPTIEN)
+7 ;validate appointment ID
+8 DO VALAPPTIEN^SDESVALUTIL(.ERRORS,APPTIEN)
+9 IF $DATA(ERRORS)
SET ERRORS("UndoNoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
+10 ;
+11 DO GETVARS(APPTIEN,.CURRENTSTAT,.CURNOSHOWDTTM,.DFN,.APPTDTTM,.PROVIDER,.REQIEN,.NOSHOW,.REQTYPE,.USERIEN,.RESOURCE)
+12 SET SDESNOSHOWDTTM=""
+13 ;
+14 ; check resource and clinic validity
+15 IF 'RESOURCE
DO ERRLOG^SDESJSON(.ERRORS,282)
+16 SET CLINICIEN=$$GET1^DIQ(409.831,RESOURCE,.04,"I")
+17 IF 'CLINICIEN
DO ERRLOG^SDESJSON(.ERRORS,283)
+18 ;
+19 ; if not in no-show already do not continue
+20 IF 'NOSHOW!(CURRENTSTAT'="N")
DO ERRLOG^SDESJSON(.ERRORS,368)
+21 IF $DATA(ERRORS)
SET ERRORS("UndoNoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
+22 ;
+23 ; Event driver "BEFORE" actions
+24 SET SDDA=$$FIND^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
+25 DO BEFOREEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,.SDCIHDL)
+26 ;
+27 ; Process no show
+28 ;
+29 DO UPDNOSHOWSTAT(.ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,0)
+30 ; if an error was returned, build the JSON and quit
+31 IF $DATA(ERRORS)
Begin DoDot:1
+32 DO ERRLOG^SDESJSON(.ERRORS,370)
+33 SET ERRORS("UndoNoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
QUIT
End DoDot:1
QUIT
+34 ;
+35 DO APPTUNDONOSHOW(.ERRORS,CLINICIEN,DFN,APPTDTTM,USERIEN,SDESNOSHOWDTTM,APPTIEN)
+36 IF $DATA(ERRORS)
Begin DoDot:1
+37 DO ERRLOG^SDESJSON(.ERRORS,371)
+38 SET ERRORS("UndoNoShow",1)=""
+39 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
End DoDot:1
QUIT
+40 ;
+41 ; only update PID if the updates to 409.84 and 2.98 were successful
+42 ; PID CHANGE ALLOWED Field in 409.85 based on whether no-show or cancel no-show
+43 SET UPDSTAT=$$GET1^DIQ(409.84,APPTIEN,.17,"I")
+44 IF REQTYPE="APPT"
IF UPDSTAT'="N"
Begin DoDot:1
+45 SET FDA(409.85,REQIEN_",",19)=""
+46 SET FDA(409.85,REQIEN_",",20)=""
+47 SET FDA(409.85,REQIEN_",",21)=""
+48 ; 864
+49 ;S FDA(409.85,REQIEN_",",23)="CLOSED"
+50 SET FDA(409.85,REQIEN_",",23)="C"
+51 SET FDA(409.85,REQIEN_",",49)=0
+52 DO FILE^DIE("","FDA")
KILL FDA
End DoDot:1
+53 ;
+54 ;
+55 ; fix action required in PCE after no-show from GUI
+56 ; SDESENCOUNTER - outpatient encounter
+57 ; Anu
+58 ;S SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN)
+59 SET SDESENCOUNTER=$$GETAPT^SDESCHECKOUT(DFN,APPTDTTM,CLINICIEN,.ERRORS)
+60 IF $DATA(ERRORS)
Begin DoDot:1
+61 DO ERRLOG^SDESJSON(.ERRORS,174)
+62 SET ERRORS("UndoNoShow",1)=""
+63 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.ERRORS)
End DoDot:1
QUIT
+64 ;
+65 ;suppress event logging for cancel checkout when no-showing
IF SDESENCOUNTER
DO EN^SDCODEL(SDESENCOUNTER,2,"","NOSHOW")
+66 ;
+67 ; Event driver "AFTER" actions
+68 ;
+69 ;remove undo no-show from grid; /BLB/
+70 ;
+71 IF REQTYPE="CONSULT"
DO CONSREQUESTSET(PROVIDER,APPTDTTM,RESOURCE)
+72 DO AFTEREVTS(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
+73 ;
+74 SET RESULT("UndoNoShow")="Undo No-show complete."
+75 DO BUILDJSON^SDESBUILDJSON(.SDESRES,.RESULT)
+76 QUIT
+77 ; get variables needed for processing
GETVARS(APPTIEN,CURRENTSTAT,CURNOSHOWDTTM,DFN,APPTDTTM,PROVIDER,REQIEN,NOSHOW,REQTYPE,USERIEN,RESOURCE) ;
+1 NEW APPTIENS,APPTDAT,APPTERR
+2 SET APPTIENS=APPTIEN_","
+3 DO GETS^DIQ(409.84,APPTIENS,".01;.05;.07;.16;.17;.1;.101;.102;.22","I","APPTDAT","APPTERR")
+4 SET CURRENTSTAT=$GET(APPTDAT(409.84,APPTIENS,.17,"I"))
+5 SET CURNOSHOWDTTM=$GET(APPTDAT(409.84,APPTIENS,.101,"I"))
+6 SET DFN=$GET(APPTDAT(409.84,APPTIENS,.05,"I"))
+7 SET APPTDTTM=$GET(APPTDAT(409.84,APPTIENS,.01,"I"))
+8 SET PROVIDER=$GET(APPTDAT(409.84,APPTIENS,.16,"I"))
+9 SET REQIEN=$PIECE($GET(APPTDAT(409.84,APPTIENS,.22,"I")),";")
+10 SET NOSHOW=$GET(APPTDAT(409.84,APPTIENS,.1,"I"))
+11 SET REQTYPE=$$GET1^DIQ(409.84,APPTIENS,.22,"E")
+12 SET USERIEN=$GET(DUZ)
+13 SET RESOURCE=$GET(APPTDAT(409.84,APPTIENS,.07,"I"))
+14 QUIT
+15 ;
CONSREQUESTSET(PROVIDER,APPTDTTM,RESOURCE) ;
+1 NEW REQTYPE,CONS,CONSULTIEN,NOTE
+2 SET REQTYPE=$$GET1^DIQ(409.84,APPTIEN,.22,"E")
+3 IF REQTYPE="CONSULT"
Begin DoDot:1
+4 SET CONS=$$GET1^DIQ(409.84,APPTIEN,.22,"I")
+5 SET CONSULTIEN=$PIECE(CONS,";",1)
+6 SET NOTE=$$GET1^DIQ(409.84,APPTIEN,1,"E")
+7 DO REQSET^SDESCONSULTUPD(CONSULTIEN,PROVIDER,,1,,NOTE,APPTDTTM,RESOURCE)
End DoDot:1
+8 QUIT
+9 ;
+10 ; update file 2 info
+11 ;Set noshow for patient DFN in CLINICIEN SDCL
+12 ;at time SDT
APPTNOSHOW(ERRORS,SDCL,DFN,SDT,USERIEN,SDECCDT,SDAPID) ;
+1 NEW SDRTYP,SDECIENS,SDFDA,SDECMSG,IEN
+2 SET SDECIENS=SDT_","_DFN_","
+3 SET SDFDA(2.98,SDECIENS,3)="N"
+4 SET SDFDA(2.98,SDECIENS,14)=USERIEN
+5 SET SDFDA(2.98,SDECIENS,15)=SDECCDT
+6 DO FILE^DIE("","SDFDA","SDECMSG")
+7 IF $DATA(SDECMSG)
DO ERRLOG^SDESJSON(.ERRORS,52,$GET(SDECMSG("DIERR",1,"TEXT",1)))
QUIT
+8 DO UPDCNSLT(SDAPID,DFN,SDCL,SDT)
+9 QUIT
+10 ; Remove no-show fields from file 2
APPTUNDONOSHOW(ERRORS,SDCL,DFN,SDT,USERIEN,SDECCDT,SDAPID) ;
+1 NEW SDRTYP,SDECIENS,SDFDA,SDECMSG,IEN
+2 SET SDECIENS=SDT_","_DFN_","
+3 SET SDFDA(2.98,SDECIENS,3)=""
+4 SET SDFDA(2.98,SDECIENS,14)=""
+5 SET SDFDA(2.98,SDECIENS,15)=""
+6 DO FILE^DIE("","SDFDA","SDECMSG")
+7 IF $DATA(SDECMSG)
DO ERRLOG^SDESJSON(.ERRORS,52,$GET(SDECMSG("DIERR",1,"TEXT",1)))
QUIT
+8 DO UPDCNSLT(SDAPID,DFN,SDCL,SDT)
+9 QUIT
+10 ; update consult
UPDCNSLT(SDAPID,DFN,SDCL,SDT) ;
+1 NEW SDRTYP,IEN,SDRES
+2 SET SDRTYP=$$GET1^DIQ(409.84,SDAPID_",",.22,"I")
+3 IF $PIECE(SDRTYP,";",2)="GMR(123,"
Begin DoDot:1
+4 SET IEN=$$SCIEN^SDECU2(DFN,SDCL,SDT)
+5 DO NOSHOW^SDCNSLT(SDCL,SDT,DFN,$PIECE(SDRTYP,";",1),IEN)
End DoDot:1
+6 ;for Recall Request APPT NOSHOW
+7 IF $PIECE(SDRTYP,";",2)="SD(403.5,"
DO REOPEN^SDESRECALLREQ(.SDESRES,APPTIEN,SDRTYP)
+8 QUIT
+9 ; set 409.84 no-show fields
UPDNOSHOWSTAT(ERRORS,APPTIEN,USERIEN,SDESNOSHOWDTTM,NOSHOWSTAT) ;
+1 NEW SDFDA,SDECIENS,SDECMSG
+2 SET SDECIENS=APPTIEN_","
+3 ;NOSHOW
SET SDFDA(409.84,SDECIENS,.1)=NOSHOWSTAT
+4 ;NOSHOW DATE
SET SDFDA(409.84,SDECIENS,.101)=$GET(SDESNOSHOWDTTM)
+5 ;NOSHOW USER
SET SDFDA(409.84,SDECIENS,.102)=$GET(USERIEN)
+6 ; Update STATUS
SET SDFDA(409.84,SDECIENS,.17)=$SELECT(NOSHOWSTAT:"N",1:"")
+7 DO FILE^DIE("","SDFDA","SDECMSG")
+8 IF $DATA(SDECMSG("DIERR"))
SET SDECMSG=$GET(SDECMSG("DIERR",1,"TEXT",1))
DO ERRLOG^SDESJSON(.ERRORS,52,SDECMSG)
+9 QUIT
+10 ;
BEFOREEVT(SDATA,DFN,APPTDTTM,CLINICIEN,SDCIHDL) ;
+1 SET SDATA=SDDA_U_DFN_U_APPTDTTM_U_CLINICIEN
+2 SET SDCIHDL=$$HANDLE^SDAMEVT(1)
+3 DO BEFORE^SDAMEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
+4 QUIT
AFTEREVTS(SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL) ;
+1 DO AFTER^SDAMEVT(.SDATA,DFN,APPTDTTM,CLINICIEN,SDDA,SDCIHDL)
+2 ; Execute event driver. 3=no show (see #409.66), 2=non-interactive
+3 ;
DO EVT^SDAMEVT(.SDATA,3,2,SDCIHDL)
+4 QUIT