SDES2 QUERY APPT REQUESTS (4998)    REMOTE PROCEDURE (8994)

Name Value
NAME SDES2 QUERY APPT REQUESTS
TAG QUERY
ROUTINE SDES2QRYAPREQS
RETURN VALUE TYPE GLOBAL ARRAY
AVAILABILITY RESTRICTED
WORD WRAP ON FALSE
APP PROXY ALLOWED Yes
DESCRIPTION
This RPC allows the user to query appointment requests, consults and 
recall requests. The query supports multiple filter criteria such as 
patient(s), clinic(s)/service(s), request types, origination date, 
priority group, PID date, wait time, and urgency (consults only).
INPUT PARAMETER
  • SDCONTEXT
    PARAMETER TYPE:   LIST
    REQUIRED:   YES
    SEQUENCE NUMBER:   1
    DESCRIPTION:   
    SDCONTEXT("ACHERON AUDIT ID")
    SDCONTEXT("PATIENT ICN")
     - The ICN of the target patient from the calling application.
     - Up to 40 Character unique ID number. 
     - Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
    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.
    SDCONTEXT("PATIENT DFN")
     - The DFN/IEN of the target patient from the calling application.
    
  • SDINPUT
    PARAMETER TYPE:   LIST
    REQUIRED:   YES
    SEQUENCE NUMBER:   2
    DESCRIPTION:   
    This is the list of filter and sort criteria that controls the behavior 
     SDINPUT("FILTER","REQUEST TYPE","ALL")=""       <- for ALL request types
     SDINPUT("FILTER","REQUEST SUBTYPE","APPT")=""    <- for APPT requests
     SDINPUT("FILTER","REQUEST SUBTYPE","RTC")=""     <- for RTC requests
     SDINPUT("FILTER","REQUEST SUBTYPE","VETERAN")="" <- for VETERAN requests
     SDINPUT("FILTER","REQUEST SUBTYPE","ALL")=""     <- for ALL request 
                                                          sub-types (default)
     
     SDINPUT("FILTER","CLINIC",CLINIC IEN)=""
     SDINPUT("FILTER","SERVICE",AMIS STOP CODE)=""
     SDINPUT("FILTER","PRIORITY GROUP","GROUP 0")="" <- for group 0
    of the query as well as the sorting and number of records to return.
                                      ,"GROUP 1")="" <- for group 1
                                      ,"GROUP 2")="" <- for group 2
                                      ,"GROUP 3")="" <- for group 3
                                      ,"GROUP 4")="" <- for group 4
                                      ,"GROUP 5")="" <- for group 5
                                      ,"GROUP 6")="" <- for group 6
                                      ,"GROUP 7")="" <- for group 7
                                      ,"GROUP 8")="" <- for group 8
                                      ,"ALL")=""     <- for ALL groups
     SDINPUT("FILTER","WAIT TIME")=WAIT TIME
     
                                   ALL - for all days
                                   <30 - less than 30 days
                                   30-60 - 30 to 60 days
                                   60-90 - 60 to 90 days
                                   >=90  - greater than/equal to 90 days
     SDINPUT("FILTER","ORIGINATION DATE")=ORIGINATION DATE
     SDINPUT("FILTER","PID")=PATIENT INDICATED DATE - ALSO DESIRED DATE
     SDINPUT("FILTER","URGENCY")=URGENCY IEN (POINTER TO THE PROTOCOL FILE 
                                 #101) - only applies to consults
     SDINPUT("SORT")=SORT TYPE
     
                        DEFAULT, PATIENT NAME, CLINIC, REQUEST, WAIT TIME, 
                        PRIORITY GROUP, ORIGINATION DATE PID DATE, SERVICE
                        RELATED, SCVISIT
     
     SDINPUT("MAX NUMBER OF RECORDS")=MAX NUMBER OF TOTAL RECORDS (optional - 
                                      max/default 200)
     SDINPUT("RETURN NUMBER OF RECORDS")=NUMBER OF RECORDS RETURNED WITH EACH 
                                         CALL (optional - max/default 50)
     SDINPUT("LAST RECORD")=LAST RECORD IEN RETURNED ON THE PREVIOUS CALL 
    (optional)
     SDINPUT("FILTER","PATIENT",PATIENT IEN)=""      <- for searching by 
                    This is used to get the next batch of records up to the 
                    value of 'RETURN NUMBER OF RECORDS'.
                                                        patient
     SDINPUT("FILTER","REQUEST TYPE","APPT")=""      <- for APPT
     SDINPUT("FILTER","REQUEST TYPE","CONSULT")=""   <- for CONSULT
     SDINPUT("FILTER","REQUEST TYPE","RECALL")=""    <- for RECALL
    
RETURN PARAMETER DESCRIPTION
This is the fully expanded return JSON. Not all components will
  "TotalRecords": 1
     "Type": "TEXT"
    }
   ],
   "CreateDate": "",
   "CreditStopCodeAMIS": 117,
   "CreditStopCodeIEN": 123,
   "CreditStopCodeName": "NURSING (2ND ONLY)",
   "DateLinkedApptMade": "",
   "DateTimeEntered": "",
   "DisplayClinicAppt": "YES",
 },
   "DispositionIEN": "",
   "DispositionReason": "",
   "DispositionedBy": "",
   "DispositionedDate": "",
   "EASTrackingNumber": "",
   "EnrollmentPriorityGroup": "GROUP 3",
   "EnteredByIEN": 123456,
   "EnteredByName": "USER ,TEST G",
   "InstitutionIEN": "",
   "InstitutionName": "",
 "Request": [
   "InstitutionNumber": "",
   "LinkedApptClinic": "",
   "LinkedApptCreditStopCode": "",
   "LinkedApptEnteredBy": "",
   "LinkedApptInstitutionName": "",
   "LinkedApptInstitutionNumber": "",
   "LinkedApptStationNumber": "",
   "LinkedApptStatus": "",
   "LinkedApptStopCode": "",
   "MRTC": [
  {
    {
     "ChildRequestIEN": 264525,
     "ChildRequestSequenceNumber": 1,
     "LinkedAppointmentIEN": 298941,
     "PatientIndicatedDate": "2024-03-06"
    },
    {
     "ChildRequestIEN": 264526,
     "ChildRequestSequenceNumber": 2,
     "LinkedAppointmentIEN": "",
   "ApptType": "",
     "PatientIndicatedDate": "2024-03-13"
    },
    {
     "ChildRequestIEN": 264527,
     "ChildRequestSequenceNumber": 3,
     "LinkedAppointmentIEN": "",
     "PatientIndicatedDate": "2024-03-20"
    }
   ],
   "MRTCDaysBetweenAppts": "",
   "ByPatientOrProvider": "",
   "MRTCHowManyNeeded": "",
   "MRTCNeeded": "",
   "MRTCTotal": "",
   "ModalityCode": "",
   "ModalityName": "",
   "PIDChangeAllowed": "",
   "ParentRequestIEN": "",
   "PatientComment": [
    {
     "Comment": "TESTING TESTING TESTING 123 "
   "CPRSOrderID": "",
    },
    {
     "Comment": "Patient preferred date range #1: Jul 25, 2022@10:00 to 
Jul 31, 2022@10:00 "
    },
    {
     "Comment": "Patient preferred date range #2: Aug 17, 2022@10:00 to 
Aug 31, 2022@10:00 "
    },
    {
   "CPRSPreRequisites": [
     "Comment": "Patient preferred date range #3: Sep 30, 2022@10:00 to 
Oct 01, 2022@10:00"
    }
   ],
   "PatientICN": "",
   "PatientIEN": 11221122,
   "PatientIndicatedDate": "",
   "PatientLast4": 4607,
   "PatientName": "PATIENT, TEST",
   "PatientPhone": 999-999-9999,
    {
   "PatientStatus": "",
   "Priority": "",
   "ProviderIEN": "",
   "ProviderName": "",
   "ProviderSecID": "",
   "RecallAccessionNumber": "",
   "RecallAppointmentLength": 30,
   "RecallAppointmentType": "YEARLY EXAM",
   "RecallClinicSecondaryStopCodeAMIS": 117,
   "RecallClinicSecondaryStopCodeIEN": 123,
     "PreRequisite": "PRE-REQ 434"
   "RecallClinicSecondaryStopCodeName": "NURSING (2ND ONLY)",
   "RecallClinicStopCodeAMIS": 323,
   "RecallClinicStopCodeIEN": 296,
   "RecallClinicStopCodeName": "PRIMARY CARE\/MEDICINE",
   "RecallComment": "RTC IN 1 YEAR W LABS PER RTC ORDER\/\/CID=032918",
   "RecallDateReminderSent": "2018-01-28",
   "RecallEnteredBySecID": 1234,
   "RecallFastingNonFasting": "FASTING",
   "RecallGAFScore": "New GAF Required",
   "RecallProviderIEN": 27,
contain data. For example, if the record is not an MRTC, the 
    },
   "RecallProviderIndicatedDate": "2018-03-29",
   "RecallProviderName": "TEST,PROVIDER A",
   "RecallProviderNewPersonIEN":123123,
   "RecallProviderSecID": "",
   "RecallSecondPrint": "",
   "RecallSimilarPatientData": "",
   "RequestComments": "",
   "RequestIEN": 206674,
   "RequestSubType": "",
   "ScheduledDateOfAppt": "",
    {
   "SdecContactDateOfLastLetterSent": "",
   "SdecContactNumberOfCalls": "",
   "SdecContactNumberOfContacts": 0,
   "SdecContactNumberOfEmailContact": "",
   "SdecContactNumberOfLetters": "",
   "SdecContactNumberOfSecureMessage": "",
   "SdecContactNumberOfTextContact": "",
   "SensitiveRecord": 0,
   "ServiceConnectedPercentage": "",
   "ServiceConnectedPriority": "",
     "PreRequisite": "PRE-REQ 534"
   "Status": "",
   "Type": ""
  }
 ]
}
    },
    {
     "PreRequisite": "PRE-REQ 634"
    }
   ],
   "CPRSStatus": "",
   "CPRSTimeSensitive": "",
MRTC component will exist, but will not have any data. This 
   "ChildRequestSequenceNumber": "",
   "ClinicIEN": "" ,
   "ClinicName": "",
   "ClinicSecondaryStopCodeAMIS": "",
   "ClinicSecondaryStopCodeIEN": "",
   "ClinicSecondaryStopCodeName": "",
   "ClinicStopCodeAMIS": "",
   "ClinicStopCodeIEN": "",
   "ClinicStopCodeName": "",
   "CommentMultiple": [
also applies to other components such as CPRSPreRequisites,
    {
     "Comment": "This is an appt request comment 333333777"
    }
   ],
   "ConsultAssociatedStopCodes": [
    {
     "AmisStopCode": 116,
     "RestrictionType": "E",
     "StopCode": 379,
     "StopCodeName": "RESPIRATORY THERAPY"
ConsultAssociatedStopCodes, ContactAttempts, etc.
    },
    {
     "AmisStopCode": 303,
     "RestrictionType": "E",
     "StopCode": 147,
     "StopCodeName": "CARDIOLOGY"
    },
    {
     "AmisStopCode": 107,
     "RestrictionType": "P",
 
     "StopCode": 114,
     "StopCodeName": "EKG"
    },
    {
     "AmisStopCode": 115,
     "RestrictionType": "E",
     "StopCode": 122,
     "StopCodeName": "ULTRASOUND (US)"
    }
   ],
{
   "ConsultCanEditPid": "",
   "ConsultClinicIndicatedDate": "",
   "ConsultCovidPriority": "",
   "ConsultDateReleasedFromCPRS": "",
   "ConsultProhibitedClinicFlag": "",
   "ConsultRequestType": "",
   "ConsultServiceRenderedAs": "",
   "ConsultToService": "",
   "ConsultUrgencyOrEarliestDate": "",
   "Contact": {
 "QueryResults": {
    "Clinic": 5260,
    "ClinicStopCodeAMIS": 323,
    "ID": 2529,
    "MainSequence": 1,
    "Patient": 7201233,
    "PreferredDate": "2024-02-24",
    "RequestPointer": "12345;SDEC(409.85,",
    "RequestType": "A",
    "Service": ""
   },
  "LastRecord": 1,
   "ContactAttempts": [
    {
     "Comments": "ONE CONTACT ATTEMPT FOR VSE 7306",
     "DateTimeEntered": "2024-02-23T11:43:23-0500",
     "DateTimeOfContact": "2024-02-23T11:42:58-0500",
     "EnteredByIEN": 12345,
     "EnteredByName": "USER, VSETEST",
     "EnteredBySecID": 456789,
     "LeftMessage": "NO",
     "Sequence": 1,