Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDES2UNDONOSHOW

SDES2UNDONOSHOW.m

Go to the documentation of this file.
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
 ;