Retail Visit

The RetailService provides the ability to schedule a same-day or next-day appointment at a supported physical facility.

Unlike Virtual visits, the DexCare SDK contains no UI for Retail visits - it is solely network calls.

Getting the list of supported facilities

The first step in the Retail scheduling flow is to get the list of supported facilities, and somehow display them to the app user. How the clinics are displayed to the user is entirely up to the SDK-implementing app.

DexCareSDK.retailService.getRetailDepartments(brand: String) should be used to fetch this list of supported departments/facilities. The method returns a list of RetailDepartment objects, which contain a wide variety of information about a particular facility, including:

  • The associated EHR system
  • Address
  • Phone number
  • Latitude & Longitude
  • A URL to a preview image
  • And more…
  • let dexcareSDK = DexcareSDK(configuration: ...)
    
    // brand will be provided by your DexCare contact
    dexcareSDK.retailService.getRetailDepartments(
      brand: brand,
      success: { departmentList in
          // An array of RetailDepartment objects.
      },
      failure: { error in
          //handle error
      }
    )
    // Swift Concurrency
    
    do {
        let clinicList = try dexcareSDK.retailService.getRetailDepartments(brand: brand)
    } catch {
         //handle error
    }
    
    
  • // brand will be provided by your DexCare contact
    DexCareSDK.retailService.getRetailDepartments(brand)
        .subscribe({ retailDepartmentsList ->
            // populate a map with the clinics, show a list of the clinics, or anything else
        }, { error ->
            // handle the error
        })
    

Getting available time slots

Each clinic/facility has a list of “time slots”, a pre-determined time period that a retail visit can be scheduled to. The list of time slots can be retrieved through a separate SDK call: RetailService.getTimeSlots(departmentName, allowedVisitType?).

  • departmentName should be the departmentName property as received in a particular Clinic object.
  • allowedVisitType is an optional parameter to allow filtering time slots based on their associated AllowedVisitType. Each Clinic object contains a list of AllowedVisitType objects, each representing a type of visit supported by that clinic. When the parameter is not specified, the default visit type Illness is used.

The return type is RetailAppointmentTimeslots, which represents a grouping of time slots for a particular clinic.

  • let dexcareSDK = DexcareSDK(configuration: ...)
    
    dexcareSDK.retailService.getTimeSlots(
        departmentName: clinic.departmentName,
        allowedVisitType: allowedVisitType,
        success: { clinicTimeSlot in
            // display the list of available time slots to the user and allow them to select one
        },
        failure: { error in
            // handle the error
        }
    )
    
    // Swift Concurrency
    do {
        let clinicTimeSlot = dexcareSDK.retailService.getTimeSlots(departmentName: clinic.departmentName,allowedVisitType: allowedVisitType)
         // display the list of available time slots to the user and allow them to select one
    } catch {
        // handle the error 
    }
    
  • DexCareSDK.retailService.getTimeSlots(clinic.departmentName)
        .subscribe({ retailAppointmentTimeslot ->
            // display the list of available time slots to the user and allow them to select one
        }, { error ->
            // handle the error
        })
    

Creating the Patient

Now that the user has selected a time slot, we next have to ensure the patient’s demographics have been created and exist in the required EHR system.

Now that we have determined the state in which care is being requested, we next have to ensure the patient’s demographics have been created and exist in the required EHR system.

Note: If a patients demographic is known to exist in the EHR System, these calls to findOrCreate(Dependent)Patient are NOT required. However you must have a full DexCarePatient object in order to book a retail visit.

For more information on how to create patients - visit the Patient Service section

Payment Method

One of the required parameters for scheduling a retail visit is the patient’s payment/billing information.

Please see the Payment Method guide for more detail on how to collect the patient’s payment information.

RetailVisitInformation

The last step before scheduling the visit is creating the RetailVisitInformation object. This object will contain the remaining bits and pieces of information required to schedule the visit.

The RetailVisitInformation has several parameters:

  • visitReason - A short description describing the reason for scheduling the virtual visit.
  • patientDeclaration An enum used to determine who the visit should be scheduled for.
  • userEmail This should always be a non-empty email address which can be used to contact the app user. Note: the patient email address as returned by Epic is not guaranteed to be present. For this reason, it is recommended to always collect this information from an alternative source, e.g. Auth0 email.
  • contactPhoneNumber A phone number that can be used to communicate with the patient.
  • NEW 4.X actorRelationshipToPatient - optional. When booking for a dependent, this must be filled in. It is not required when booking for the logged in patient. Note: actorRelationshipToPatient is no longer required on PatientDemographics on 4.x

Scheduling the retail visit

Now that all of the required information has been collected, the retail visit may now be scheduled.

4.X

  • let dexcareSDK = DexcareSDK(configuration: ...)
    
    dexcareSDK.retailService.scheduleRetailAppointment(
       paymentMethod: paymentMethod,
       visitInformation: visitInformation,
       timeslot: timeslot,
       success: {
          // The visitId is returned upon success.  For "dependent" visits, this is the only place the visitId is ever returned.
          // Appointments scheduled for the authenticated user (not dependent patient) will be returned in AppointmentService.getRetailVisits(), which do contain the visitId.
       },
       failure: { error in
         // handle the error
         // In some cases, a different user may have already scheduled a visit in the time slot.
         // In this case, the user will be required to select a different time slot, and
         // it will be necessary to try scheduling the visit again.
       }
    )
    
    
  • DexCareSDK.retailService.scheduleRetailAppointment(
            paymentMethod,
            retailVisitInformation,
            timeSlot
        ).subscribe({ visitId ->
            // The visitId is returned upon success.  For "dependent" visits, this is the only place the visitId is ever returned.
            // Appointments scheduled for the authenticated user (not dependent patient) will be returned in AppointmentService.getRetailVisits(), which do contain the visitId.
        }, { error ->
            // handle the error
            // In some cases, a different user may have already scheduled a visit in the time slot.
            // In this case, the user will be required to select a different time slot, and
            // it will be necessary to try scheduling the visit again.
        })
    

Appointment Service

The appointment service provides the ability for a patient to review or cancel their upcoming Retail appointments.

Please see the Appointment Service page for more details.