SDES2UNDONOSHOW ;ALB/BLB,LAB - SDES2 UNDO NO-SHOW Feb 29, 2024
;;5.3;Scheduling;**871,875**;Aug 13, 1993;Build 25
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
UNDONOSHOW(JSON,SDCONTEXT,NOSHOW) ;
N ERRORS,RETURN,DATA,APPTIEN,DFN,PARENTREQUEST,APPTDATETIME,CLINICIEN,EVENT,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,RECALL,PROVIDER,NOTE,RESOURCE
;
D VALIDATE(.SDCONTEXT,$G(NOSHOW("APPOINTMENT IEN")))
I $D(ERRORS) S ERRORS("UndoNoShow",1)="" D BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS) Q
;
D POPULATE^SDES2NOSHOW(.NOSHOW,.SDCONTEXT,.APPTIEN,.DFN,.APPTDATETIME,.CLINICIEN,.USERID,.REQUESTTYPE,.REQUESTIEN,.CLINICAPPTIEN,.PROVIDER,.NOTE,.RESOURCE,.PARENTREQUEST)
;
D EVENTHANDLER1^SDES2NOSHOW(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
;
D NOSHOW40984(APPTIEN,USERID)
D NOSHOW2(APPTDATETIME,DFN,USERID)
;
I REQUESTTYPE="APPT" D NOSHOW40985(REQUESTIEN,PARENTREQUEST,USERID)
I REQUESTTYPE="RECALL" D REOPEN^SDESRECALLREQ(.RECALL,APPTIEN)
I REQUESTTYPE="CONSULT" D NOSHOW^SDCNSLT(CLINICIEN,APPTDATETIME,DFN,REQUESTIEN,CLINICAPPTIEN),REQSET^SDESCONSULTUPD(REQUESTIEN,PROVIDER,,1,,NOTE,APPTDATETIME,RESOURCE)
;
D EVENTHANDLER2^SDES2NOSHOW(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
;
S RETURN("UndoNoShow",1)="Undo no-show complete."
D BUILDJSON^SDESBUILDJSON(.JSON,.RETURN)
Q
;
NOSHOW40984(APPTIEN,USERID) ;
N FDA,IENS
;
S IENS=APPTIEN_","
S FDA(409.84,IENS,.1)=0
S FDA(409.84,IENS,.101)=""
S FDA(409.84,IENS,.102)=""
S FDA(409.84,IENS,.17)=""
D FILE^DIE(,"FDA") K FDA
Q
;
NOSHOW2(APPTDATETIME,DFN,USERID) ;
N FDA,IENS
;
S IENS=APPTDATETIME_","_DFN_","
S FDA(2.98,IENS,3)=""
S FDA(2.98,IENS,14)=""
S FDA(2.98,IENS,15)=""
D FILE^DIE(,"FDA") K FDA
Q
;
NOSHOW40985(REQUESTIEN,PARENTREQUEST,USERID) ;
N FDA,IENS,CHILDREQUEST,FOUND,CHILDIEN
;
S IENS=REQUESTIEN_","
S FDA(409.85,IENS,49)=0
S FDA(409.85,IENS,19)=DT
S FDA(409.85,IENS,20)=USERID
S FDA(409.85,IENS,21)=3
S FDA(409.85,IENS,23)="C"
D FILE^DIE(,"FDA") K FDA
S FOUND=0
I $G(PARENTREQUEST) D
. S CHILDIEN=""
. F S CHILDIEN=$O(^SDEC(409.85,PARENTREQUEST,2,"B",CHILDIEN)) Q:(CHILDIEN="")!(FOUND) D
. . S FOUND=($$GET1^DIQ(409.85,CHILDIEN_",",23,"E")="OPEN")
. ;
. I 'FOUND D
. . S FDA(409.85,PARENTREQUEST_",",23)="C"
. . D FILE^DIE(,"FDA","ERROR") K FDA
Q
;
VALIDATE(SDCONTEXT,APPTIEN) ;
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
D VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.84,APPTIEN,1,,14,15)
I $D(ERRORS) Q
I '$$GET1^DIQ(409.84,APPTIEN,.1,"I") D ERRLOG^SDESJSON(.ERRORS,368)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2UNDONOSHOW 2625 printed Sep 02, 2024@19:39:44 Page 2
SDES2UNDONOSHOW ;ALB/BLB,LAB - SDES2 UNDO NO-SHOW Feb 29, 2024
+1 ;;5.3;Scheduling;**871,875**;Aug 13, 1993;Build 25
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
UNDONOSHOW(JSON,SDCONTEXT,NOSHOW) ;
+1 NEW ERRORS,RETURN,DATA,APPTIEN,DFN,PARENTREQUEST,APPTDATETIME,CLINICIEN,EVENT,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,RECALL,PROVIDER,NOTE,RESOURCE
+2 ;
+3 DO VALIDATE(.SDCONTEXT,$GET(NOSHOW("APPOINTMENT IEN")))
+4 IF $DATA(ERRORS)
SET ERRORS("UndoNoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS)
QUIT
+5 ;
+6 DO POPULATE^SDES2NOSHOW(.NOSHOW,.SDCONTEXT,.APPTIEN,.DFN,.APPTDATETIME,.CLINICIEN,.USERID,.REQUESTTYPE,.REQUESTIEN,.CLINICAPPTIEN,.PROVIDER,.NOTE,.RESOURCE,.PARENTREQUEST)
+7 ;
+8 DO EVENTHANDLER1^SDES2NOSHOW(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
+9 ;
+10 DO NOSHOW40984(APPTIEN,USERID)
+11 DO NOSHOW2(APPTDATETIME,DFN,USERID)
+12 ;
+13 IF REQUESTTYPE="APPT"
DO NOSHOW40985(REQUESTIEN,PARENTREQUEST,USERID)
+14 IF REQUESTTYPE="RECALL"
DO REOPEN^SDESRECALLREQ(.RECALL,APPTIEN)
+15 IF REQUESTTYPE="CONSULT"
DO NOSHOW^SDCNSLT(CLINICIEN,APPTDATETIME,DFN,REQUESTIEN,CLINICAPPTIEN)
DO REQSET^SDESCONSULTUPD(REQUESTIEN,PROVIDER,,1,,NOTE,APPTDATETIME,RESOURCE)
+16 ;
+17 DO EVENTHANDLER2^SDES2NOSHOW(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
+18 ;
+19 SET RETURN("UndoNoShow",1)="Undo no-show complete."
+20 DO BUILDJSON^SDESBUILDJSON(.JSON,.RETURN)
+21 QUIT
+22 ;
NOSHOW40984(APPTIEN,USERID) ;
+1 NEW FDA,IENS
+2 ;
+3 SET IENS=APPTIEN_","
+4 SET FDA(409.84,IENS,.1)=0
+5 SET FDA(409.84,IENS,.101)=""
+6 SET FDA(409.84,IENS,.102)=""
+7 SET FDA(409.84,IENS,.17)=""
+8 DO FILE^DIE(,"FDA")
KILL FDA
+9 QUIT
+10 ;
NOSHOW2(APPTDATETIME,DFN,USERID) ;
+1 NEW FDA,IENS
+2 ;
+3 SET IENS=APPTDATETIME_","_DFN_","
+4 SET FDA(2.98,IENS,3)=""
+5 SET FDA(2.98,IENS,14)=""
+6 SET FDA(2.98,IENS,15)=""
+7 DO FILE^DIE(,"FDA")
KILL FDA
+8 QUIT
+9 ;
NOSHOW40985(REQUESTIEN,PARENTREQUEST,USERID) ;
+1 NEW FDA,IENS,CHILDREQUEST,FOUND,CHILDIEN
+2 ;
+3 SET IENS=REQUESTIEN_","
+4 SET FDA(409.85,IENS,49)=0
+5 SET FDA(409.85,IENS,19)=DT
+6 SET FDA(409.85,IENS,20)=USERID
+7 SET FDA(409.85,IENS,21)=3
+8 SET FDA(409.85,IENS,23)="C"
+9 DO FILE^DIE(,"FDA")
KILL FDA
+10 SET FOUND=0
+11 IF $GET(PARENTREQUEST)
Begin DoDot:1
+12 SET CHILDIEN=""
+13 FOR
SET CHILDIEN=$ORDER(^SDEC(409.85,PARENTREQUEST,2,"B",CHILDIEN))
if (CHILDIEN="")!(FOUND)
QUIT
Begin DoDot:2
+14 SET FOUND=($$GET1^DIQ(409.85,CHILDIEN_",",23,"E")="OPEN")
End DoDot:2
+15 ;
+16 IF 'FOUND
Begin DoDot:2
+17 SET FDA(409.85,PARENTREQUEST_",",23)="C"
+18 DO FILE^DIE(,"FDA","ERROR")
KILL FDA
End DoDot:2
End DoDot:1
+19 QUIT
+20 ;
VALIDATE(SDCONTEXT,APPTIEN) ;
+1 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+2 DO VALFILEIEN^SDES2VALUTIL(,.ERRORS,409.84,APPTIEN,1,,14,15)
+3 IF $DATA(ERRORS)
QUIT
+4 IF '$$GET1^DIQ(409.84,APPTIEN,.1,"I")
DO ERRLOG^SDESJSON(.ERRORS,368)
+5 QUIT
+6 ;