SDES2GETREQS ;ALB/BWF - VISTA SCHEDULING GET REQUEST RPCS ;FEB 08, 2024
;;5.3;Scheduling;**873**;Aug 13, 1993;Build 10
;;Per VHA Directive 6402, this routine should not be modified
;
;
Q
; Input:
; SDCONTEXT
; SDINPUT("PATIENT IEN")=Patient DFN from the PATIENT file (#2)
;
GETREQLISTBYDFN(JSONRETURN,SDCONTEXT,SDINPUT) ;
N ERRORS,REQUESTIEN,REQUEST,CONSULTIEN,CPRSSTATUS,IFCROLE,RECALLIEN,SDDUZ,DFN,VRET
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
I $D(ERRORS) S ERRORS("Request",1)="" D BUILDJSON^SDES2JSON(.JSONRETURN,.ERRORS) Q
D VALFILEIEN^SDES2VALUTIL(.VRET,.ERRORS,2,$G(SDINPUT("PATIENT IEN")),1,,1,2)
I $D(ERRORS) S ERRORS("Request",1)="" D BUILDJSON^SDES2JSON(.JSONRETURN,.ERRORS) Q
;
S DFN=$G(SDINPUT("PATIENT IEN"))
S SDDUZ=$S($G(SDCONTEXT("USER DUZ"))'="":SDCONTEXT("USER DUZ"),1:DUZ)
S REQUESTIEN=0
F S REQUESTIEN=$O(^SDEC(409.85,"B",DFN,REQUESTIEN)) Q:'REQUESTIEN D
.I $$GET1^DIQ(409.85,REQUESTIEN,23,"I")="C" Q
.D GETREQUEST^SDES2GETAPPTREQ(.REQUEST,REQUESTIEN,SDDUZ)
;
S RECALLIEN=0
F S RECALLIEN=$O(^SD(403.5,"B",DFN,RECALLIEN)) Q:RECALLIEN="" D
.S DFN=$$GET1^DIQ(403.5,RECALLIEN,.01,"I")
.D GETRECALL^SDES2GETRECALL(.REQUEST,RECALLIEN,DFN,SDDUZ)
;
S CONSULTIEN=0
F S CONSULTIEN=$O(^GMR(123,"F",DFN,CONSULTIEN)) Q:'CONSULTIEN D
.S CPRSSTATUS=$$GET1^DIQ(123,CONSULTIEN,8,"E"),IFCROLE=$$GET1^DIQ(123,CONSULTIEN,.125,"E")
.I CPRSSTATUS'="PENDING",CPRSSTATUS'="ACTIVE" Q
.I IFCROLE="PLACER" Q
.D GETCONSULT^SDES2GETCONSULTS(.REQUEST,CONSULTIEN,SDDUZ)
;
I '$D(REQUEST) S REQUEST("Request",1)=""
D BUILDJSON^SDES2JSON(.JSONRETURN,.REQUEST)
Q
;
APPTREQUEST(REQUEST,NUM) ;
;
S REQUEST("Request",NUM,"ApptType")=""
S REQUEST("Request",NUM,"InstitutionIEN")=""
S REQUEST("Request",NUM,"InstitutionName")=""
S REQUEST("Request",NUM,"InstitutionNumber")=""
S REQUEST("Request",NUM,"RequestSubType")=""
S REQUEST("Request",NUM,"ChildRequestSequenceNumber")=""
S REQUEST("Request",NUM,"ClinicStopCodeIEN")=""
S REQUEST("Request",NUM,"ClinicStopCodeName")=""
S REQUEST("Request",NUM,"ClinicSecondaryStopCodeIEN")=""
S REQUEST("Request",NUM,"ClinicSecondaryStopCodeName")=""
S REQUEST("Request",NUM,"DateTimeEntered")=""
S REQUEST("Request",NUM,"Priority")=""
S REQUEST("Request",NUM,"ByPatientOrProvider")=""
S REQUEST("Request",NUM,"DateLinkedApptMade")=""
S REQUEST("Request",NUM,"LinkedApptClinic")=""
S REQUEST("Request",NUM,"LinkedApptStopCode")=""
S REQUEST("Request",NUM,"LinkedApptCreditStopCode")=""
S REQUEST("Request",NUM,"LinkedApptStationNumber")=""
S REQUEST("Request",NUM,"LinkedApptEnteredBy")=""
S REQUEST("Request",NUM,"LinkedApptStatus")=""
S REQUEST("Request",NUM,"LinkedApptInstitutionName")=""
S REQUEST("Request",NUM,"LinkedApptInstitutionNumber")=""
S REQUEST("Request",NUM,"MRTCNeeded")=""
S REQUEST("Request",NUM,"MRTCDaysBetweenAppts")=""
S REQUEST("Request",NUM,"MRTCHowManyNeeded")=""
S REQUEST("Request",NUM,"MRTCTotal")=""
S REQUEST("Request",NUM,"ModalityCode")=""
S REQUEST("Request",NUM,"ModalityName")=""
I '$D(REQUEST("Request",NUM,"EASTrackingNumber")) S REQUEST("Request",NUM,"EASTrackingNumber")=""
S REQUEST("Request",NUM,"DispositionedDate")=""
S REQUEST("Request",NUM,"DispositionedBy")=""
S REQUEST("Request",NUM,"DispositionReason")=""
S REQUEST("Request",NUM,"ServiceConnectedPriority")=""
S REQUEST("Request",NUM,"PatientStatus")=""
S REQUEST("Request",NUM,"ParentRequestIEN")=""
S REQUEST("Request",NUM,"Status")=""
S REQUEST("Request",NUM,"MRTC",1)=""
S REQUEST("Request",NUM,"PatientComment",1)=""
S REQUEST("Request",NUM,"ScheduledDateOfAppt")=""
S REQUEST("Request",NUM,"CPRSOrderID")=""
S REQUEST("Request",NUM,"CPRSTimeSensitive")=""
S REQUEST("Request",NUM,"CPRSPreRequisites",1)=""
S REQUEST("Request",NUM,"ClinicSecondaryStopCodeAMIS")=""
S REQUEST("Request",NUM,"ClinicStopCodeAMIS")=""
S REQUEST("Request",NUM,"CommentMultiple",1)=""
S REQUEST("Request",NUM,"RequestComments")=""
S REQUEST("Request",NUM,"ServiceConnectedPercentage")=""
S REQUEST("Request",NUM,"PIDChangeAllowed")=""
S REQUEST("Request",NUM,"DispositionIEN")=""
Q
;
SDECONTACT(REQUEST,NUM) ;
S REQUEST("Request",NUM,"SdecContactNumberOfCalls")=""
S REQUEST("Request",NUM,"SdecContactNumberOfEmailContact")=""
S REQUEST("Request",NUM,"SdecContactNumberOfTextContact")=""
S REQUEST("Request",NUM,"SdecContactNumberOfSecureMessage")=""
S REQUEST("Request",NUM,"SdecContactDateOfLastLetterSent")=""
S REQUEST("Request",NUM,"SdecContactNumberOfLetters")=""
S REQUEST("Request",NUM,"SdecContactNumberOfContacts")=0
Q
;
RECALL(REQUEST,NUM) ;
;
S REQUEST("Request",NUM,"RecallAccessionNumber")=""
S REQUEST("Request",NUM,"RecallComment")=""
S REQUEST("Request",NUM,"RecallFastingNonFasting")=""
S REQUEST("Request",NUM,"RecallProviderIEN")=""
S REQUEST("Request",NUM,"RecallProviderName")=""
S REQUEST("Request",NUM,"RecallAppointmentLength")=""
S REQUEST("Request",NUM,"RecallProviderIndicatedDate")=""
S REQUEST("Request",NUM,"RecallDateReminderSent")=""
S REQUEST("Request",NUM,"RecallSecondPrint")=""
S REQUEST("Request",NUM,"RecallGAFScore")=""
S REQUEST("Request",NUM,"RecallSimilarPatientData")=""
S REQUEST("Request",NUM,"RecallAppointmentType")=""
S REQUEST("Request",NUM,"RecallProviderNewPersonIEN")=""
S REQUEST("Request",NUM,"RecallProviderSecID")=""
S REQUEST("Request",NUM,"RecallClinicStopCodeIEN")=""
S REQUEST("Request",NUM,"RecallClinicStopCodeAMIS")=""
S REQUEST("Request",NUM,"RecallClinicStopCodeName")=""
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeIEN")=""
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeAMIS")=""
S REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeName")=""
S REQUEST("Request",NUM,"RecallEnteredBySecID")=""
I '$D(REQUEST("Request",NUM,"EASTrackingNumber")) S REQUEST("Request",NUM,"EASTrackingNumber")=""
Q
;
CONSULT(REQUEST,NUM) ;
;
S REQUEST("Request",NUM,"ConsultAssociatedStopCodes",1)=""
S REQUEST("Request",NUM,"ConsultRequestType")=""
S REQUEST("Request",NUM,"ConsultToService")=""
S REQUEST("Request",NUM,"ConsultCovidPriority")=""
S REQUEST("Request",NUM,"ConsultDateReleasedFromCPRS")="" ; check
S REQUEST("Request",NUM,"ConsultUrgencyOrEarliestDate")=""
S REQUEST("Request",NUM,"ConsultServiceRenderedAs")=""
S REQUEST("Request",NUM,"ConsultProhibitedClinicFlag")=""
S REQUEST("Request",NUM,"ConsultClinicIndicatedDate")=""
S REQUEST("Request",NUM,"ConsultCanEditPid")=""
S REQUEST("Request",NUM,"CPRSStatus")=""
I '$D(REQUEST("Request",NUM,"EASTrackingNumber")) S REQUEST("Request",NUM,"EASTrackingNumber")=""
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETREQS 6699 printed Oct 16, 2024@18:54:40 Page 2
SDES2GETREQS ;ALB/BWF - VISTA SCHEDULING GET REQUEST RPCS ;FEB 08, 2024
+1 ;;5.3;Scheduling;**873**;Aug 13, 1993;Build 10
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ;
+5 QUIT
+6 ; Input:
+7 ; SDCONTEXT
+8 ; SDINPUT("PATIENT IEN")=Patient DFN from the PATIENT file (#2)
+9 ;
GETREQLISTBYDFN(JSONRETURN,SDCONTEXT,SDINPUT) ;
+1 NEW ERRORS,REQUESTIEN,REQUEST,CONSULTIEN,CPRSSTATUS,IFCROLE,RECALLIEN,SDDUZ,DFN,VRET
+2 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+3 IF $DATA(ERRORS)
SET ERRORS("Request",1)=""
DO BUILDJSON^SDES2JSON(.JSONRETURN,.ERRORS)
QUIT
+4 DO VALFILEIEN^SDES2VALUTIL(.VRET,.ERRORS,2,$GET(SDINPUT("PATIENT IEN")),1,,1,2)
+5 IF $DATA(ERRORS)
SET ERRORS("Request",1)=""
DO BUILDJSON^SDES2JSON(.JSONRETURN,.ERRORS)
QUIT
+6 ;
+7 SET DFN=$GET(SDINPUT("PATIENT IEN"))
+8 SET SDDUZ=$SELECT($GET(SDCONTEXT("USER DUZ"))'="":SDCONTEXT("USER DUZ"),1:DUZ)
+9 SET REQUESTIEN=0
+10 FOR
SET REQUESTIEN=$ORDER(^SDEC(409.85,"B",DFN,REQUESTIEN))
if 'REQUESTIEN
QUIT
Begin DoDot:1
+11 IF $$GET1^DIQ(409.85,REQUESTIEN,23,"I")="C"
QUIT
+12 DO GETREQUEST^SDES2GETAPPTREQ(.REQUEST,REQUESTIEN,SDDUZ)
End DoDot:1
+13 ;
+14 SET RECALLIEN=0
+15 FOR
SET RECALLIEN=$ORDER(^SD(403.5,"B",DFN,RECALLIEN))
if RECALLIEN=""
QUIT
Begin DoDot:1
+16 SET DFN=$$GET1^DIQ(403.5,RECALLIEN,.01,"I")
+17 DO GETRECALL^SDES2GETRECALL(.REQUEST,RECALLIEN,DFN,SDDUZ)
End DoDot:1
+18 ;
+19 SET CONSULTIEN=0
+20 FOR
SET CONSULTIEN=$ORDER(^GMR(123,"F",DFN,CONSULTIEN))
if 'CONSULTIEN
QUIT
Begin DoDot:1
+21 SET CPRSSTATUS=$$GET1^DIQ(123,CONSULTIEN,8,"E")
SET IFCROLE=$$GET1^DIQ(123,CONSULTIEN,.125,"E")
+22 IF CPRSSTATUS'="PENDING"
IF CPRSSTATUS'="ACTIVE"
QUIT
+23 IF IFCROLE="PLACER"
QUIT
+24 DO GETCONSULT^SDES2GETCONSULTS(.REQUEST,CONSULTIEN,SDDUZ)
End DoDot:1
+25 ;
+26 IF '$DATA(REQUEST)
SET REQUEST("Request",1)=""
+27 DO BUILDJSON^SDES2JSON(.JSONRETURN,.REQUEST)
+28 QUIT
+29 ;
APPTREQUEST(REQUEST,NUM) ;
+1 ;
+2 SET REQUEST("Request",NUM,"ApptType")=""
+3 SET REQUEST("Request",NUM,"InstitutionIEN")=""
+4 SET REQUEST("Request",NUM,"InstitutionName")=""
+5 SET REQUEST("Request",NUM,"InstitutionNumber")=""
+6 SET REQUEST("Request",NUM,"RequestSubType")=""
+7 SET REQUEST("Request",NUM,"ChildRequestSequenceNumber")=""
+8 SET REQUEST("Request",NUM,"ClinicStopCodeIEN")=""
+9 SET REQUEST("Request",NUM,"ClinicStopCodeName")=""
+10 SET REQUEST("Request",NUM,"ClinicSecondaryStopCodeIEN")=""
+11 SET REQUEST("Request",NUM,"ClinicSecondaryStopCodeName")=""
+12 SET REQUEST("Request",NUM,"DateTimeEntered")=""
+13 SET REQUEST("Request",NUM,"Priority")=""
+14 SET REQUEST("Request",NUM,"ByPatientOrProvider")=""
+15 SET REQUEST("Request",NUM,"DateLinkedApptMade")=""
+16 SET REQUEST("Request",NUM,"LinkedApptClinic")=""
+17 SET REQUEST("Request",NUM,"LinkedApptStopCode")=""
+18 SET REQUEST("Request",NUM,"LinkedApptCreditStopCode")=""
+19 SET REQUEST("Request",NUM,"LinkedApptStationNumber")=""
+20 SET REQUEST("Request",NUM,"LinkedApptEnteredBy")=""
+21 SET REQUEST("Request",NUM,"LinkedApptStatus")=""
+22 SET REQUEST("Request",NUM,"LinkedApptInstitutionName")=""
+23 SET REQUEST("Request",NUM,"LinkedApptInstitutionNumber")=""
+24 SET REQUEST("Request",NUM,"MRTCNeeded")=""
+25 SET REQUEST("Request",NUM,"MRTCDaysBetweenAppts")=""
+26 SET REQUEST("Request",NUM,"MRTCHowManyNeeded")=""
+27 SET REQUEST("Request",NUM,"MRTCTotal")=""
+28 SET REQUEST("Request",NUM,"ModalityCode")=""
+29 SET REQUEST("Request",NUM,"ModalityName")=""
+30 IF '$DATA(REQUEST("Request",NUM,"EASTrackingNumber"))
SET REQUEST("Request",NUM,"EASTrackingNumber")=""
+31 SET REQUEST("Request",NUM,"DispositionedDate")=""
+32 SET REQUEST("Request",NUM,"DispositionedBy")=""
+33 SET REQUEST("Request",NUM,"DispositionReason")=""
+34 SET REQUEST("Request",NUM,"ServiceConnectedPriority")=""
+35 SET REQUEST("Request",NUM,"PatientStatus")=""
+36 SET REQUEST("Request",NUM,"ParentRequestIEN")=""
+37 SET REQUEST("Request",NUM,"Status")=""
+38 SET REQUEST("Request",NUM,"MRTC",1)=""
+39 SET REQUEST("Request",NUM,"PatientComment",1)=""
+40 SET REQUEST("Request",NUM,"ScheduledDateOfAppt")=""
+41 SET REQUEST("Request",NUM,"CPRSOrderID")=""
+42 SET REQUEST("Request",NUM,"CPRSTimeSensitive")=""
+43 SET REQUEST("Request",NUM,"CPRSPreRequisites",1)=""
+44 SET REQUEST("Request",NUM,"ClinicSecondaryStopCodeAMIS")=""
+45 SET REQUEST("Request",NUM,"ClinicStopCodeAMIS")=""
+46 SET REQUEST("Request",NUM,"CommentMultiple",1)=""
+47 SET REQUEST("Request",NUM,"RequestComments")=""
+48 SET REQUEST("Request",NUM,"ServiceConnectedPercentage")=""
+49 SET REQUEST("Request",NUM,"PIDChangeAllowed")=""
+50 SET REQUEST("Request",NUM,"DispositionIEN")=""
+51 QUIT
+52 ;
SDECONTACT(REQUEST,NUM) ;
+1 SET REQUEST("Request",NUM,"SdecContactNumberOfCalls")=""
+2 SET REQUEST("Request",NUM,"SdecContactNumberOfEmailContact")=""
+3 SET REQUEST("Request",NUM,"SdecContactNumberOfTextContact")=""
+4 SET REQUEST("Request",NUM,"SdecContactNumberOfSecureMessage")=""
+5 SET REQUEST("Request",NUM,"SdecContactDateOfLastLetterSent")=""
+6 SET REQUEST("Request",NUM,"SdecContactNumberOfLetters")=""
+7 SET REQUEST("Request",NUM,"SdecContactNumberOfContacts")=0
+8 QUIT
+9 ;
RECALL(REQUEST,NUM) ;
+1 ;
+2 SET REQUEST("Request",NUM,"RecallAccessionNumber")=""
+3 SET REQUEST("Request",NUM,"RecallComment")=""
+4 SET REQUEST("Request",NUM,"RecallFastingNonFasting")=""
+5 SET REQUEST("Request",NUM,"RecallProviderIEN")=""
+6 SET REQUEST("Request",NUM,"RecallProviderName")=""
+7 SET REQUEST("Request",NUM,"RecallAppointmentLength")=""
+8 SET REQUEST("Request",NUM,"RecallProviderIndicatedDate")=""
+9 SET REQUEST("Request",NUM,"RecallDateReminderSent")=""
+10 SET REQUEST("Request",NUM,"RecallSecondPrint")=""
+11 SET REQUEST("Request",NUM,"RecallGAFScore")=""
+12 SET REQUEST("Request",NUM,"RecallSimilarPatientData")=""
+13 SET REQUEST("Request",NUM,"RecallAppointmentType")=""
+14 SET REQUEST("Request",NUM,"RecallProviderNewPersonIEN")=""
+15 SET REQUEST("Request",NUM,"RecallProviderSecID")=""
+16 SET REQUEST("Request",NUM,"RecallClinicStopCodeIEN")=""
+17 SET REQUEST("Request",NUM,"RecallClinicStopCodeAMIS")=""
+18 SET REQUEST("Request",NUM,"RecallClinicStopCodeName")=""
+19 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeIEN")=""
+20 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeAMIS")=""
+21 SET REQUEST("Request",NUM,"RecallClinicSecondaryStopCodeName")=""
+22 SET REQUEST("Request",NUM,"RecallEnteredBySecID")=""
+23 IF '$DATA(REQUEST("Request",NUM,"EASTrackingNumber"))
SET REQUEST("Request",NUM,"EASTrackingNumber")=""
+24 QUIT
+25 ;
CONSULT(REQUEST,NUM) ;
+1 ;
+2 SET REQUEST("Request",NUM,"ConsultAssociatedStopCodes",1)=""
+3 SET REQUEST("Request",NUM,"ConsultRequestType")=""
+4 SET REQUEST("Request",NUM,"ConsultToService")=""
+5 SET REQUEST("Request",NUM,"ConsultCovidPriority")=""
+6 ; check
SET REQUEST("Request",NUM,"ConsultDateReleasedFromCPRS")=""
+7 SET REQUEST("Request",NUM,"ConsultUrgencyOrEarliestDate")=""
+8 SET REQUEST("Request",NUM,"ConsultServiceRenderedAs")=""
+9 SET REQUEST("Request",NUM,"ConsultProhibitedClinicFlag")=""
+10 SET REQUEST("Request",NUM,"ConsultClinicIndicatedDate")=""
+11 SET REQUEST("Request",NUM,"ConsultCanEditPid")=""
+12 SET REQUEST("Request",NUM,"CPRSStatus")=""
+13 IF '$DATA(REQUEST("Request",NUM,"EASTrackingNumber"))
SET REQUEST("Request",NUM,"EASTrackingNumber")=""
+14 QUIT