SDES2NOSHOW ;ALB/BLB,BLB/JAS - SDES2 NO-SHOW ; Mar 18, 2024@10:30am
;;5.3;Scheduling;**871,875**;Aug 13, 1993;Build 25
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
NOSHOW(JSON,SDCONTEXT,NOSHOW) ;
N ERRORS,RETURN,DATA,APPTIEN,DFN,PARENTREQUEST,APPTDATETIME,CLINICIEN,EVENT,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,RECALL
;
D VALIDATE(.SDCONTEXT,$G(NOSHOW("APPOINTMENT IEN")))
I $D(ERRORS) S ERRORS("NoShow",1)="" D BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS) Q
;
D POPULATE(.NOSHOW,.SDCONTEXT,.APPTIEN,.DFN,.APPTDATETIME,.CLINICIEN,.USERID,.REQUESTTYPE,.REQUESTIEN,.CLINICAPPTIEN,,,,.PARENTREQUEST)
;
D EVENTHANDLER1(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
;
D NOSHOW40984(APPTIEN,USERID)
D NOSHOW2(APPTDATETIME,DFN,USERID)
;
I REQUESTTYPE="APPT" D NOSHOW40985(REQUESTIEN,PARENTREQUEST)
I REQUESTTYPE="RECALL" D REOPEN^SDESRECALLREQ(.RECALL,APPTIEN,,,,1)
I REQUESTTYPE="CONSULT" D NOSHOW^SDCNSLT(CLINICIEN,APPTDATETIME,DFN,REQUESTIEN,CLINICAPPTIEN)
;
;
D EVENTHANDLER2(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
;
S RETURN("NoShow",1)="No-show complete."
D BUILDJSON^SDESBUILDJSON(.JSON,.RETURN)
Q
;
NOSHOW40984(APPTIEN,USERID) ;
N FDA,IENS
;
S IENS=APPTIEN_","
S FDA(409.84,IENS,.1)=1
S FDA(409.84,IENS,.101)=$$NOW^XLFDT
S FDA(409.84,IENS,.102)=USERID
S FDA(409.84,IENS,.17)="N"
D FILE^DIE(,"FDA") K FDA
Q
;
NOSHOW2(APPTDATETIME,DFN,USERID) ;
N FDA,IENS
;
S IENS=APPTDATETIME_","_DFN_","
S FDA(2.98,IENS,3)="N"
S FDA(2.98,IENS,14)=USERID
S FDA(2.98,IENS,15)=$$NOW^XLFDT
D FILE^DIE(,"FDA") K FDA
Q
;
NOSHOW40985(REQUESTIEN,PARENTREQUEST) ;
N FDA,IENS
;
S IENS=REQUESTIEN_","
S FDA(409.85,IENS,49)=1
S FDA(409.85,IENS,19)=""
S FDA(409.85,IENS,20)=""
S FDA(409.85,IENS,21)=""
S FDA(409.85,IENS,23)="O"
D FILE^DIE(,"FDA") K FDA
;
I $G(PARENTREQUEST),$$GET1^DIQ(409.85,PARENTREQUEST,23,"I")="C" D
.S FDA(409.85,PARENTREQUEST_",",23)="O"
.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,367)
I $$NOW^XLFDT<$$GET1^DIQ(409.84,APPTIEN,.01,"I") D ERRLOG^SDESJSON(.ERRORS,369)
Q
;
GET44APPTIEN(CLINICIEN,APPTDATETIME,DFN) ;
N FOUND,SUBIEN,RECORDIEN
S FOUND=0,RECORDIEN=""
S SUBIEN=0
F S SUBIEN=$O(^SC(CLINICIEN,"S",APPTDATETIME,1,SUBIEN)) Q:'SUBIEN!($G(FOUND)=1) D
.I $$GET1^DIQ(44.003,SUBIEN_","_APPTDATETIME_","_CLINICIEN_",",310)="CANCELLED" Q
.I $$GET1^DIQ(44.003,SUBIEN_","_APPTDATETIME_","_CLINICIEN_",",.01,"I")=DFN D
..S RECORDIEN=SUBIEN,FOUND=1
Q RECORDIEN
;
EVENTHANDLER1(DATA,DFN,APPTDATETIME,CLINICIEN,EVENT,CLINICAPPTIEN) ;
S DATA=CLINICAPPTIEN_U_DFN_U_APPTDATETIME_U_CLINICIEN
S EVENT=$$HANDLE^SDAMEVT(1)
D BEFORE^SDAMEVT(.DATA,DFN,APPTDATETIME,CLINICIEN,CLINICAPPTIEN,EVENT)
Q
;
EVENTHANDLER2(DATA,DFN,APPTDATETIME,CLINICIEN,EVENT,CLINICAPPTIEN) ;
D AFTER^SDAMEVT(.DATA,DFN,APPTDATETIME,CLINICIEN,CLINICAPPTIEN,EVENT)
D EVT^SDAMEVT(.DATA,3,2,EVENT) ;
I $$GETAPT^SDESCHECKOUT(DFN,APPTDATETIME,CLINICIEN) D
.D EN^SDCODEL($$GETAPT^SDESCHECKOUT(DFN,APPTDATETIME,CLINICIEN),2,"","NOSHOW")
Q
;
POPULATE(NOSHOW,SDCONTEXT,APPTIEN,DFN,APPTDATETIME,CLINICIEN,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,PROVIDER,NOTE,RESOURCE,PARENTREQUEST) ;
S APPTIEN=$G(NOSHOW("APPOINTMENT IEN"))
S DFN=$$GET1^DIQ(409.84,APPTIEN,.05,"I")
S APPTDATETIME=$$GET1^DIQ(409.84,APPTIEN,.01,"I")
S CLINICIEN=$$GET1^DIQ(409.831,$$GET1^DIQ(409.84,APPTIEN,.07,"I"),.04,"I")
S USERID=$S($G(SDCONTEXT("USER DUZ"))'="":SDCONTEXT("USER DUZ"),1:DUZ)
S REQUESTTYPE=$$GET1^DIQ(409.84,APPTIEN,.22)
S REQUESTIEN=$P($$GET1^DIQ(409.84,APPTIEN,.22,"I"),";")
S CLINICAPPTIEN=$$GET44APPTIEN(CLINICIEN,APPTDATETIME,DFN)
S PROVIDER=$$GET1^DIQ(409.84,APPTIEN,.16,"I")
S NOTE=$$GET1^DIQ(409.84,APPTIEN,1,"E")
S RESOURCE=$$GET1^DIQ(409.84,APPTIEN,.07,"I")
S PARENTREQUEST=$$GET1^DIQ(409.85,REQUESTIEN,43.8,"I")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2NOSHOW 4140 printed Oct 16, 2024@18:54:54 Page 2
SDES2NOSHOW ;ALB/BLB,BLB/JAS - SDES2 NO-SHOW ; Mar 18, 2024@10:30am
+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 ;
NOSHOW(JSON,SDCONTEXT,NOSHOW) ;
+1 NEW ERRORS,RETURN,DATA,APPTIEN,DFN,PARENTREQUEST,APPTDATETIME,CLINICIEN,EVENT,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,RECALL
+2 ;
+3 DO VALIDATE(.SDCONTEXT,$GET(NOSHOW("APPOINTMENT IEN")))
+4 IF $DATA(ERRORS)
SET ERRORS("NoShow",1)=""
DO BUILDJSON^SDESBUILDJSON(.JSON,.ERRORS)
QUIT
+5 ;
+6 DO POPULATE(.NOSHOW,.SDCONTEXT,.APPTIEN,.DFN,.APPTDATETIME,.CLINICIEN,.USERID,.REQUESTTYPE,.REQUESTIEN,.CLINICAPPTIEN,,,,.PARENTREQUEST)
+7 ;
+8 DO EVENTHANDLER1(.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)
+14 IF REQUESTTYPE="RECALL"
DO REOPEN^SDESRECALLREQ(.RECALL,APPTIEN,,,,1)
+15 IF REQUESTTYPE="CONSULT"
DO NOSHOW^SDCNSLT(CLINICIEN,APPTDATETIME,DFN,REQUESTIEN,CLINICAPPTIEN)
+16 ;
+17 ;
+18 DO EVENTHANDLER2(.DATA,DFN,APPTDATETIME,CLINICIEN,.EVENT,CLINICAPPTIEN)
+19 ;
+20 SET RETURN("NoShow",1)="No-show complete."
+21 DO BUILDJSON^SDESBUILDJSON(.JSON,.RETURN)
+22 QUIT
+23 ;
NOSHOW40984(APPTIEN,USERID) ;
+1 NEW FDA,IENS
+2 ;
+3 SET IENS=APPTIEN_","
+4 SET FDA(409.84,IENS,.1)=1
+5 SET FDA(409.84,IENS,.101)=$$NOW^XLFDT
+6 SET FDA(409.84,IENS,.102)=USERID
+7 SET FDA(409.84,IENS,.17)="N"
+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)="N"
+5 SET FDA(2.98,IENS,14)=USERID
+6 SET FDA(2.98,IENS,15)=$$NOW^XLFDT
+7 DO FILE^DIE(,"FDA")
KILL FDA
+8 QUIT
+9 ;
NOSHOW40985(REQUESTIEN,PARENTREQUEST) ;
+1 NEW FDA,IENS
+2 ;
+3 SET IENS=REQUESTIEN_","
+4 SET FDA(409.85,IENS,49)=1
+5 SET FDA(409.85,IENS,19)=""
+6 SET FDA(409.85,IENS,20)=""
+7 SET FDA(409.85,IENS,21)=""
+8 SET FDA(409.85,IENS,23)="O"
+9 DO FILE^DIE(,"FDA")
KILL FDA
+10 ;
+11 IF $GET(PARENTREQUEST)
IF $$GET1^DIQ(409.85,PARENTREQUEST,23,"I")="C"
Begin DoDot:1
+12 SET FDA(409.85,PARENTREQUEST_",",23)="O"
+13 DO FILE^DIE(,"FDA","ERROR")
KILL FDA
End DoDot:1
+14 QUIT
+15 ;
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 ;
+5 IF $$GET1^DIQ(409.84,APPTIEN,.1,"I")
DO ERRLOG^SDESJSON(.ERRORS,367)
+6 IF $$NOW^XLFDT<$$GET1^DIQ(409.84,APPTIEN,.01,"I")
DO ERRLOG^SDESJSON(.ERRORS,369)
+7 QUIT
+8 ;
GET44APPTIEN(CLINICIEN,APPTDATETIME,DFN) ;
+1 NEW FOUND,SUBIEN,RECORDIEN
+2 SET FOUND=0
SET RECORDIEN=""
+3 SET SUBIEN=0
+4 FOR
SET SUBIEN=$ORDER(^SC(CLINICIEN,"S",APPTDATETIME,1,SUBIEN))
if 'SUBIEN!($GET(FOUND)=1)
QUIT
Begin DoDot:1
+5 IF $$GET1^DIQ(44.003,SUBIEN_","_APPTDATETIME_","_CLINICIEN_",",310)="CANCELLED"
QUIT
+6 IF $$GET1^DIQ(44.003,SUBIEN_","_APPTDATETIME_","_CLINICIEN_",",.01,"I")=DFN
Begin DoDot:2
+7 SET RECORDIEN=SUBIEN
SET FOUND=1
End DoDot:2
End DoDot:1
+8 QUIT RECORDIEN
+9 ;
EVENTHANDLER1(DATA,DFN,APPTDATETIME,CLINICIEN,EVENT,CLINICAPPTIEN) ;
+1 SET DATA=CLINICAPPTIEN_U_DFN_U_APPTDATETIME_U_CLINICIEN
+2 SET EVENT=$$HANDLE^SDAMEVT(1)
+3 DO BEFORE^SDAMEVT(.DATA,DFN,APPTDATETIME,CLINICIEN,CLINICAPPTIEN,EVENT)
+4 QUIT
+5 ;
EVENTHANDLER2(DATA,DFN,APPTDATETIME,CLINICIEN,EVENT,CLINICAPPTIEN) ;
+1 DO AFTER^SDAMEVT(.DATA,DFN,APPTDATETIME,CLINICIEN,CLINICAPPTIEN,EVENT)
+2 ;
DO EVT^SDAMEVT(.DATA,3,2,EVENT)
+3 IF $$GETAPT^SDESCHECKOUT(DFN,APPTDATETIME,CLINICIEN)
Begin DoDot:1
+4 DO EN^SDCODEL($$GETAPT^SDESCHECKOUT(DFN,APPTDATETIME,CLINICIEN),2,"","NOSHOW")
End DoDot:1
+5 QUIT
+6 ;
POPULATE(NOSHOW,SDCONTEXT,APPTIEN,DFN,APPTDATETIME,CLINICIEN,USERID,REQUESTTYPE,REQUESTIEN,CLINICAPPTIEN,PROVIDER,NOTE,RESOURCE,PARENTREQUEST) ;
+1 SET APPTIEN=$GET(NOSHOW("APPOINTMENT IEN"))
+2 SET DFN=$$GET1^DIQ(409.84,APPTIEN,.05,"I")
+3 SET APPTDATETIME=$$GET1^DIQ(409.84,APPTIEN,.01,"I")
+4 SET CLINICIEN=$$GET1^DIQ(409.831,$$GET1^DIQ(409.84,APPTIEN,.07,"I"),.04,"I")
+5 SET USERID=$SELECT($GET(SDCONTEXT("USER DUZ"))'="":SDCONTEXT("USER DUZ"),1:DUZ)
+6 SET REQUESTTYPE=$$GET1^DIQ(409.84,APPTIEN,.22)
+7 SET REQUESTIEN=$PIECE($$GET1^DIQ(409.84,APPTIEN,.22,"I"),";")
+8 SET CLINICAPPTIEN=$$GET44APPTIEN(CLINICIEN,APPTDATETIME,DFN)
+9 SET PROVIDER=$$GET1^DIQ(409.84,APPTIEN,.16,"I")
+10 SET NOTE=$$GET1^DIQ(409.84,APPTIEN,1,"E")
+11 SET RESOURCE=$$GET1^DIQ(409.84,APPTIEN,.07,"I")
+12 SET PARENTREQUEST=$$GET1^DIQ(409.85,REQUESTIEN,43.8,"I")
+13 QUIT
+14 ;