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

SDES2GETRECALL.m

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