SDES2GETRECALL ;ALB/TJB,BWF,JAS - VISTA SCHEDULING - GET RECALL REQUESTS ;APR 16, 2024
;;5.3;Scheduling;**871,873,877**;Aug 13, 1993;Build 14
;;Per VHA Directive 6402, this routine should not be modified
;
; Reference to ^VA(200 in ICR #10060 ;
;
; SDES2 GET RECALL BY IEN
; SDES2 GET RECALLS BY DFN
;
; SDCONTEXT("ACHERON AUDIT ID") = Up to 40 Character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
; SDCONTEXT("PATIENT DFN") = The DFN/IEN of the target patient from the calling application.
; SDCONTEXT("PATIENT ICN") = The ICN of the target patient from the calling application.
; SDCONTEXT("USER DUZ") = The DUZ of the user taking action in the calling application.
; SDCONTEXT("USER SECID") = The SECID of the user taking action in the calling application.
;
; SDES2 GET RECALL BY IEN:
; SDPARAM("RECALL IEN") = POINTER TO RECALL REMINDERS File (#403.5) (required)
Q
;
GETBYIEN(JSONRETURN,SDCONTEXT,SDPARAM) ;
N DFN,ISRECALLIENVALID,RETURN,REQUEST,ERRORS,RETNVAL,SDDUZ
;
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
S RECALLIEN=$G(SDPARAM("RECALL IEN"))
D VALFILEIEN^SDES2VALUTIL(.RETNVAL,.ERRORS,403.5,RECALLIEN,1,0,16,17) ;
I $D(ERRORS) S ERRORS("Request",1)="" M RETURN=ERRORS
;
I '$D(ERRORS) D
. S DFN=$$GET1^DIQ(403.5,RECALLIEN,.01,"I")
. D GETRECALL(.REQUEST,RECALLIEN,DFN,$G(SDCONTEXT("USER DUZ")))
I '$D(REQUEST) S REQUEST("Request",1)=""
M RETURN=REQUEST
;
D BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN)
Q
;
; SDES2 GET RECALL BY DFN:
; SDPARAM("PATIENT IEN") = POINTER TO PATIENT (#2) FILE (required)
GETBYDFN(JSONRETURN,SDCONTEXT,SDPARAM) ;
N DFN,ISDFNVALID,REQUEST,RECALLIEN,ERRORS,RETURN,SDDUZ
;
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
S DFN=$G(SDPARAM("PATIENT IEN"))
D VALPATDFN^SDES2VAL2(.ERRORS,DFN,1,0)
I $D(ERRORS) S ERRORS("Request",1)="" M RETURN=ERRORS D BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN) Q
;
S RECALLIEN=0
F S RECALLIEN=$O(^SD(403.5,"B",DFN,RECALLIEN)) Q:RECALLIEN="" D
. D GETRECALL(.REQUEST,RECALLIEN,DFN,$G(SDCONTEXT("USER DUZ")))
I '$D(REQUEST) S REQUEST("Request",1)=""
M RETURN=REQUEST
D BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN)
Q
;
GETRECALL(REQUEST,RECALLIEN,DFN,SDDUZ) ;
N F,RECARY,NUM,IENS,RECPROVIEN,RECPROVIEN200,RECPROVIEN40954,RECCLINICIEN,SENSITIVE,STOPCDIEN,SECSTOPCDIEN,VA,YSZ,CONTACTIEN,PRIOGROUP
D GETS^DIQ(403.5,RECALLIEN,"**","IE","RECARY","SDMSG")
S F=403.5,NUM=""
S NUM=$O(REQUEST("Request",NUM),-1)+1
S IENS=RECALLIEN_","
;
S RECPROVIEN40954=$G(RECARY(F,IENS,4,"I"))
S RECPROVIEN200=$$GET1^DIQ(403.54,RECPROVIEN40954,.01,"I")
S RECCLINICIEN=$G(RECARY(F,IENS,4.5,"I"))
S STOPCDIEN=$$GET1^DIQ(44,RECCLINICIEN,8,"I")
S SECSTOPCDIEN=$$GET1^DIQ(44,RECCLINICIEN,2503,"I")
D GETCONTACTIEN^SDES2CONTACTS(.CONTACTIEN,RECALLIEN_";SD(403.5,")
D BUILDSDECONTACT^SDES2GETAPPTREQ(.REQUEST,RECALLIEN,NUM,"R")
I 'CONTACTIEN D SDECONTACT^SDES2GETREQS(.REQUEST,NUM)
S SDDUZ=$S($G(SDDUZ)'="":SDDUZ,1:DUZ)
D SENSITIVE^SDES2UTIL(.SENSITIVE,DFN,$G(SDDUZ))
S PRIOGROUP=$$PRIORITY^DGENA(DFN) I PRIOGROUP S PRIOGROUP="GROUP "_PRIOGROUP
;
S REQUEST("Request",NUM,"Type")="Recall"
S REQUEST("Request",NUM,"RecallAppointmentType")=$G(RECARY(F,IENS,3,"E"))
S REQUEST("Request",NUM,"PatientIEN")=DFN
S REQUEST("Request",NUM,"PatientICN")=$$GETPATICN^SDESINPUTVALUTL(DFN)
S REQUEST("Request",NUM,"PatientName")=RECARY(F,IENS,.01,"E")
S REQUEST("Request",NUM,"PatientPhone")=$$GET1^DIQ(2,DFN_",",.131,"E")
S REQUEST("Request",NUM,"RequestIEN")=RECALLIEN
S REQUEST("Request",NUM,"EnrollmentPriorityGroup")=PRIOGROUP
S REQUEST("Request",NUM,"EASTrackingNumber")=RECARY(F,IENS,100,"E")
S REQUEST("Request",NUM,"RecallAccessionNumber")=RECARY(F,IENS,2,"E")
S REQUEST("Request",NUM,"RecallComment")=RECARY(F,IENS,2.5,"E")
S REQUEST("Request",NUM,"RecallFastingNonFasting")=RECARY(F,IENS,2.6,"E")
S REQUEST("Request",NUM,"RecallProviderNewPersonIEN")=RECPROVIEN200
S REQUEST("Request",NUM,"RecallProviderIEN")=RECARY(F,IENS,4,"I")
S REQUEST("Request",NUM,"RecallProviderName")=$$GET1^DIQ(403.54,RECARY(F,IENS,4,"I"),.01,"E")
S REQUEST("Request",NUM,"RecallProviderSecID")=$$GET1^DIQ(200,RECPROVIEN200,205.1,"E")
S REQUEST("Request",NUM,"ClinicIEN")=RECARY(F,IENS,4.5,"I")
S REQUEST("Request",NUM,"ClinicName")=RECARY(F,IENS,4.5,"E")
S REQUEST("Request",NUM,"RecallClinicStopCodeIEN")=STOPCDIEN
S REQUEST("Request",NUM,"RecallClinicStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(STOPCDIEN)
S REQUEST("Request",NUM,"RecallClinicStopCodeName")=$$GET1^DIQ(40.7,STOPCDIEN,.01,"E")
S REQUEST("Request",NUM,"DisplayClinicAppt")=$$GET1^DIQ(44,RECCLINICIEN,62,"E")
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeIEN")=SECSTOPCDIEN
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(SECSTOPCDIEN)
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeName")=$$GET1^DIQ(40.7,SECSTOPCDIEN,.01,"E")
S REQUEST("Request",NUM,"CreditStopCodeIEN")=SECSTOPCDIEN
S REQUEST("Request",NUM,"CreditStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(SECSTOPCDIEN)
S REQUEST("Request",NUM,"CreditStopCodeName")=$$GET1^DIQ(40.7,SECSTOPCDIEN,.01,"E")
S REQUEST("Request",NUM,"RecallAppointmentLength")=RECARY(F,IENS,4.7,"E") ;
S REQUEST("Request",NUM,"RecallProviderIndicatedDate")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,5,"I"))
S REQUEST("Request",NUM,"PatientIndicatedDate")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,5.5,"I"))
S REQUEST("Request",NUM,"RecallDateReminderSent")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,6,"I"))
S REQUEST("Request",NUM,"EnteredByIEN")=RECARY(F,IENS,7,"I")
S REQUEST("Request",NUM,"EnteredByName")=RECARY(F,IENS,7,"E")
S REQUEST("Request",NUM,"RecallEnteredBySecID")=$$GET1^DIQ(200,RECARY(F,IENS,7,"I"),205.1,"E")
S REQUEST("Request",NUM,"RecallSecondPrint")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,8,"I"))
S REQUEST("Request",NUM,"CreateDate")=$$FMTISO^SDAMUTDT(RECARY(403.5,IENS,7.5,"I"))
S REQUEST("Request",NUM,"RecallGAFScore")=$$GAF^SDECU2(DFN)
S REQUEST("Request",NUM,"SensitiveRecord")=$G(SENSITIVE(1))
S REQUEST("Request",NUM,"RecallSimilarPatientData")=$$SIM^SDECU3(DFN)
S REQUEST("Request",NUM,"PatientLast4")=$$LAST4SSN^SDESINPUTVALUTL(DFN)
S REQUEST("Request",NUM,"ProviderIEN")=""
S REQUEST("Request",NUM,"ProviderName")=""
S REQUEST("Request",NUM,"ProviderSecID")=""
;
I '$D(REQUEST("Request",NUM,"PatientIndicatedDate")) D
.S REQUEST("Request",NUM,"PatientIndicatedDate")=""
; build appointment request and consult
D APPTREQUEST^SDES2GETREQS(.REQUEST,NUM)
D CONSULT^SDES2GETREQS(.REQUEST,NUM)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETRECALL 6602 printed Nov 22, 2024@18:04:04 Page 2
SDES2GETRECALL ;ALB/TJB,BWF,JAS - VISTA SCHEDULING - GET RECALL REQUESTS ;APR 16, 2024
+1 ;;5.3;Scheduling;**871,873,877**;Aug 13, 1993;Build 14
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ; Reference to ^VA(200 in ICR #10060 ;
+5 ;
+6 ; SDES2 GET RECALL BY IEN
+7 ; SDES2 GET RECALLS BY DFN
+8 ;
+9 ; SDCONTEXT("ACHERON AUDIT ID") = Up to 40 Character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
+10 ; SDCONTEXT("PATIENT DFN") = The DFN/IEN of the target patient from the calling application.
+11 ; SDCONTEXT("PATIENT ICN") = The ICN of the target patient from the calling application.
+12 ; SDCONTEXT("USER DUZ") = The DUZ of the user taking action in the calling application.
+13 ; SDCONTEXT("USER SECID") = The SECID of the user taking action in the calling application.
+14 ;
+15 ; SDES2 GET RECALL BY IEN:
+16 ; SDPARAM("RECALL IEN") = POINTER TO RECALL REMINDERS File (#403.5) (required)
+17 QUIT
+18 ;
GETBYIEN(JSONRETURN,SDCONTEXT,SDPARAM) ;
+1 NEW DFN,ISRECALLIENVALID,RETURN,REQUEST,ERRORS,RETNVAL,SDDUZ
+2 ;
+3 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+4 SET RECALLIEN=$GET(SDPARAM("RECALL IEN"))
+5 ;
DO VALFILEIEN^SDES2VALUTIL(.RETNVAL,.ERRORS,403.5,RECALLIEN,1,0,16,17)
+6 IF $DATA(ERRORS)
SET ERRORS("Request",1)=""
MERGE RETURN=ERRORS
+7 ;
+8 IF '$DATA(ERRORS)
Begin DoDot:1
+9 SET DFN=$$GET1^DIQ(403.5,RECALLIEN,.01,"I")
+10 DO GETRECALL(.REQUEST,RECALLIEN,DFN,$GET(SDCONTEXT("USER DUZ")))
End DoDot:1
+11 IF '$DATA(REQUEST)
SET REQUEST("Request",1)=""
+12 MERGE RETURN=REQUEST
+13 ;
+14 DO BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN)
+15 QUIT
+16 ;
+17 ; SDES2 GET RECALL BY DFN:
+18 ; SDPARAM("PATIENT IEN") = POINTER TO PATIENT (#2) FILE (required)
GETBYDFN(JSONRETURN,SDCONTEXT,SDPARAM) ;
+1 NEW DFN,ISDFNVALID,REQUEST,RECALLIEN,ERRORS,RETURN,SDDUZ
+2 ;
+3 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+4 SET DFN=$GET(SDPARAM("PATIENT IEN"))
+5 DO VALPATDFN^SDES2VAL2(.ERRORS,DFN,1,0)
+6 IF $DATA(ERRORS)
SET ERRORS("Request",1)=""
MERGE RETURN=ERRORS
DO BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN)
QUIT
+7 ;
+8 SET RECALLIEN=0
+9 FOR
SET RECALLIEN=$ORDER(^SD(403.5,"B",DFN,RECALLIEN))
if RECALLIEN=""
QUIT
Begin DoDot:1
+10 DO GETRECALL(.REQUEST,RECALLIEN,DFN,$GET(SDCONTEXT("USER DUZ")))
End DoDot:1
+11 IF '$DATA(REQUEST)
SET REQUEST("Request",1)=""
+12 MERGE RETURN=REQUEST
+13 DO BUILDJSON^SDES2JSON(.JSONRETURN,.RETURN)
+14 QUIT
+15 ;
GETRECALL(REQUEST,RECALLIEN,DFN,SDDUZ) ;
+1 NEW F,RECARY,NUM,IENS,RECPROVIEN,RECPROVIEN200,RECPROVIEN40954,RECCLINICIEN,SENSITIVE,STOPCDIEN,SECSTOPCDIEN,VA,YSZ,CONTACTIEN,PRIOGROUP
+2 DO GETS^DIQ(403.5,RECALLIEN,"**","IE","RECARY","SDMSG")
+3 SET F=403.5
SET NUM=""
+4 SET NUM=$ORDER(REQUEST("Request",NUM),-1)+1
+5 SET IENS=RECALLIEN_","
+6 ;
+7 SET RECPROVIEN40954=$GET(RECARY(F,IENS,4,"I"))
+8 SET RECPROVIEN200=$$GET1^DIQ(403.54,RECPROVIEN40954,.01,"I")
+9 SET RECCLINICIEN=$GET(RECARY(F,IENS,4.5,"I"))
+10 SET STOPCDIEN=$$GET1^DIQ(44,RECCLINICIEN,8,"I")
+11 SET SECSTOPCDIEN=$$GET1^DIQ(44,RECCLINICIEN,2503,"I")
+12 DO GETCONTACTIEN^SDES2CONTACTS(.CONTACTIEN,RECALLIEN_";SD(403.5,")
+13 DO BUILDSDECONTACT^SDES2GETAPPTREQ(.REQUEST,RECALLIEN,NUM,"R")
+14 IF 'CONTACTIEN
DO SDECONTACT^SDES2GETREQS(.REQUEST,NUM)
+15 SET SDDUZ=$SELECT($GET(SDDUZ)'="":SDDUZ,1:DUZ)
+16 DO SENSITIVE^SDES2UTIL(.SENSITIVE,DFN,$GET(SDDUZ))
+17 SET PRIOGROUP=$$PRIORITY^DGENA(DFN)
IF PRIOGROUP
SET PRIOGROUP="GROUP "_PRIOGROUP
+18 ;
+19 SET REQUEST("Request",NUM,"Type")="Recall"
+20 SET REQUEST("Request",NUM,"RecallAppointmentType")=$GET(RECARY(F,IENS,3,"E"))
+21 SET REQUEST("Request",NUM,"PatientIEN")=DFN
+22 SET REQUEST("Request",NUM,"PatientICN")=$$GETPATICN^SDESINPUTVALUTL(DFN)
+23 SET REQUEST("Request",NUM,"PatientName")=RECARY(F,IENS,.01,"E")
+24 SET REQUEST("Request",NUM,"PatientPhone")=$$GET1^DIQ(2,DFN_",",.131,"E")
+25 SET REQUEST("Request",NUM,"RequestIEN")=RECALLIEN
+26 SET REQUEST("Request",NUM,"EnrollmentPriorityGroup")=PRIOGROUP
+27 SET REQUEST("Request",NUM,"EASTrackingNumber")=RECARY(F,IENS,100,"E")
+28 SET REQUEST("Request",NUM,"RecallAccessionNumber")=RECARY(F,IENS,2,"E")
+29 SET REQUEST("Request",NUM,"RecallComment")=RECARY(F,IENS,2.5,"E")
+30 SET REQUEST("Request",NUM,"RecallFastingNonFasting")=RECARY(F,IENS,2.6,"E")
+31 SET REQUEST("Request",NUM,"RecallProviderNewPersonIEN")=RECPROVIEN200
+32 SET REQUEST("Request",NUM,"RecallProviderIEN")=RECARY(F,IENS,4,"I")
+33 SET REQUEST("Request",NUM,"RecallProviderName")=$$GET1^DIQ(403.54,RECARY(F,IENS,4,"I"),.01,"E")
+34 SET REQUEST("Request",NUM,"RecallProviderSecID")=$$GET1^DIQ(200,RECPROVIEN200,205.1,"E")
+35 SET REQUEST("Request",NUM,"ClinicIEN")=RECARY(F,IENS,4.5,"I")
+36 SET REQUEST("Request",NUM,"ClinicName")=RECARY(F,IENS,4.5,"E")
+37 SET REQUEST("Request",NUM,"RecallClinicStopCodeIEN")=STOPCDIEN
+38 SET REQUEST("Request",NUM,"RecallClinicStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(STOPCDIEN)
+39 SET REQUEST("Request",NUM,"RecallClinicStopCodeName")=$$GET1^DIQ(40.7,STOPCDIEN,.01,"E")
+40 SET REQUEST("Request",NUM,"DisplayClinicAppt")=$$GET1^DIQ(44,RECCLINICIEN,62,"E")
+41 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeIEN")=SECSTOPCDIEN
+42 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(SECSTOPCDIEN)
+43 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeName")=$$GET1^DIQ(40.7,SECSTOPCDIEN,.01,"E")
+44 SET REQUEST("Request",NUM,"CreditStopCodeIEN")=SECSTOPCDIEN
+45 SET REQUEST("Request",NUM,"CreditStopCodeAMIS")=$$STOPCODETOAMIS^SDES2UTIL(SECSTOPCDIEN)
+46 SET REQUEST("Request",NUM,"CreditStopCodeName")=$$GET1^DIQ(40.7,SECSTOPCDIEN,.01,"E")
+47 ;
SET REQUEST("Request",NUM,"RecallAppointmentLength")=RECARY(F,IENS,4.7,"E")
+48 SET REQUEST("Request",NUM,"RecallProviderIndicatedDate")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,5,"I"))
+49 SET REQUEST("Request",NUM,"PatientIndicatedDate")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,5.5,"I"))
+50 SET REQUEST("Request",NUM,"RecallDateReminderSent")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,6,"I"))
+51 SET REQUEST("Request",NUM,"EnteredByIEN")=RECARY(F,IENS,7,"I")
+52 SET REQUEST("Request",NUM,"EnteredByName")=RECARY(F,IENS,7,"E")
+53 SET REQUEST("Request",NUM,"RecallEnteredBySecID")=$$GET1^DIQ(200,RECARY(F,IENS,7,"I"),205.1,"E")
+54 SET REQUEST("Request",NUM,"RecallSecondPrint")=$$FMTISO^SDAMUTDT(RECARY(F,IENS,8,"I"))
+55 SET REQUEST("Request",NUM,"CreateDate")=$$FMTISO^SDAMUTDT(RECARY(403.5,IENS,7.5,"I"))
+56 SET REQUEST("Request",NUM,"RecallGAFScore")=$$GAF^SDECU2(DFN)
+57 SET REQUEST("Request",NUM,"SensitiveRecord")=$GET(SENSITIVE(1))
+58 SET REQUEST("Request",NUM,"RecallSimilarPatientData")=$$SIM^SDECU3(DFN)
+59 SET REQUEST("Request",NUM,"PatientLast4")=$$LAST4SSN^SDESINPUTVALUTL(DFN)
+60 SET REQUEST("Request",NUM,"ProviderIEN")=""
+61 SET REQUEST("Request",NUM,"ProviderName")=""
+62 SET REQUEST("Request",NUM,"ProviderSecID")=""
+63 ;
+64 IF '$DATA(REQUEST("Request",NUM,"PatientIndicatedDate"))
Begin DoDot:1
+65 SET REQUEST("Request",NUM,"PatientIndicatedDate")=""
End DoDot:1
+66 ; build appointment request and consult
+67 DO APPTREQUEST^SDES2GETREQS(.REQUEST,NUM)
+68 DO CONSULT^SDES2GETREQS(.REQUEST,NUM)
+69 QUIT