[iOS] Intake & Visit API

Intake

Intake represents the initial registration information collected from a patient during their visit to a healthcare facility.

Intake Configuration

Use for creating intake information.

Properties

  • type: The type of intake, default value is .walkin.

  • reasonForVisit: The reason for the visit.

  • room: The room associated with the intake, default value is the default room obtained from VCNetworkManager.shared().

Initialization

  • init(reasonForVisit:): Initializes an IntakeConfig object with the given reason for visit.

Create intake

Create an intake with the provided configuration.

 

public func createIntake(with config: IntakeConfig, sucesss: @escaping (Intake) -> Void, failure: @escaping (Error) -> Void)

Parameter

Type

Description

Parameter

Type

Description

config

IntakeConfig

The intake configuration object.

success

Closure

A closure called when the intake creation is successful. It receives an Intake object as a parameter.

failure

Closure

A closure called when an error occurs during the intake creation. It receives an Error as a parameter.

 

Update intake

Update the current intake with the provided parameters.

public func updateIntake(with params: [String: Any], sucesss: @escaping () -> Void, failure: @escaping (Error) -> Void)

Parameter

Type

Description

Parameter

Type

Description

params

[String: Any]

The parameters to update the intake.

success

Closure

A closure called when the intake creation is successful. It receives an Intake object as a parameter.

failure

Closure

A closure called when an error occurs during the intake creation. It receives an Error as a parameter.

 

Visit

Visit refers to an appointment or session of patient care at a healthcare facility, storing relevant details such as appointment time, healthcare provider, and associated intake information.

Create visit from intake

Create a visit with a given intake.

public func createVisitWithIntake(_ intake: Intake, success: @escaping (Visit) -> Void, failure: @escaping (Error) -> Void)

Parameter

Type

Description

Parameter

Type

Description

intake

Intake

The intake object for the visit..

success

Closure

A closure called when the visit creation is successful. It receives a Visit object as a parameter.

failure

Closure

A closure called when an error occurs during the visit creation. It receives an Error object as a parameter.

Schedule a visit

Get consultation list

     Retrieves a list of consultations that are visible to the patient.

Throws: A `ClinicError` if the current room is unavailable or if there is an issue retrieving valid consultations.

Returns: An optional array of `Consultation` objects that are visible to the patient. Returns `nil` if no valid consultations are found.

     This function fetches the current room from `VCNetworkManager`, retrieves the list of consultations associated with the room, and filters out consultations that are not visible to the patient. If successful, it returns an array of visible consultations; otherwise, it throws a `ClinicError` with a corresponding error message.

Example Usage

Update intake with consultation

     Updates the given intake on the server with information from the provided consultation.

Parameter

Type

Description

Parameter

Type

Description

intake

Intake

The intake to be updated.

consultation

Consultation

The consultation whose information will be used for updating the intake.

success

Closure

A closure to be executed upon successful update.

failure

Closure

A closure to be executed in case of failure, providing an `Error` object with details about the failure.

Example Usage

 

Schedule visit with provided intake

Schedules a visit using the provided intake, optional provider, and room slot information.

Parameter

Type

Description

Parameter

Type

Description

intake

Intake

The intake associated with the scheduled visit.

provider

Provider

An optional provider object for the scheduled visit.

slot

RoomSlot

The room slot information for scheduling the visit. RoomSlot records visit start and end times, signaling availability status (booked or open).

success

Closure

A closure that is called when the Visit creation is successful. It takes a Visit object as a parameter, representing the created Visit.

failure

Closure

A closure that is called when an error occurs during Visit creation. It takes an Error as a parameter, indicating the cause of the failure.

Example Usage

 

Get current visit

Retrieves the current in-progress Visit.

Parameter

Type

Description

Parameter

Type

Description

success

Closure

A closure that is called when the retrieval of the current Visit is successful. It takes a Visit object as a parameter, representing the current in-progress Visit.

failure

Closure

A closure that is called when an error occurs during the retrieval of the current Visit. It takes an Error object as a parameter, indicating the cause of the failure.

Example Usage

 

Get Upcoming Visits

Retrieves the list of upcoming Visits.

Parameter

Type

Description

Parameter

Type

Description

success

Closure

A closure that is called when the retrieval of the upcoming Visits is successful. It takes an array of Visit objects as a parameter, representing the list of upcoming Visits.

failure

Closure

A closure that is called when an error occurs during the retrieval of the upcoming Visits. It takes an Error as a parameter, indicating the cause of the failure.

Example Usage

 

Get Past Visits

Retrieves the list of upcoming Visits.

Parameter

Type

Description

Parameter

Type

Description

success

Closure

A closure that is called when the retrieval of the past Visits is successful. It takes an array of Visit objects as a parameter, representing the list of upcoming Visits.

failure

Closure

A closure that is called when an error occurs during the retrieval of the past Visits. It takes an Error as a parameter, indicating the cause of the failure.

Example Usage

 

Enter waiting room

Enter waiting room by native

Starts a Visit by using a native view with the provided visit.

Parameter

Type

Description

Parameter

Type

Description

visit

Visit

The given visit for which to enter the waiting room.

Example Usage

Enter waiting room by browser

Starts a Visit by initiating a browser call with the provided visit.

Parameter

Type

Description

Parameter

Type

Description

visit

Visit

The given visit for which to enter the waiting room.

Example Usage