[Android] Schedule appointment flow
5. Start or cancel an appointment
Â
Before scheduling an appointment with a provider, users must first authenticate themselves by logging in to their patient accounts. The authentication process involves the following steps:
1. Authentication
val res = VseeApi.auth.loginAsPatient(username = username, password = password)
when (res) {
is Resource.Success -> {}
is Resource.Error -> {}
}
Â
Â
Â
Initiating Login:
The system calls the
VseeApi.auth.loginAsPatient
function, passing the provided username and password as arguments.
Handling Response:
The function returns a
Resource
object, indicating either success or failure:Success: If authentication is successful, the subsequent code within the
Resource.Success
block executes.Error: If authentication fails, the code within the
Resource.Error
block handles the error appropriately.
This ensures that only authorized patients can access and schedule appointments with providers.
For detailed information about the authentication process, please refer to this document.
2. Create intake
The Intake form, accessed through the 'Schedule an appointment' button, allows patients to update their visit-related information such as reason for visit and consultation type…
Â
Update Reason for visit:
3. Select a consultation
After specifying the reason for their appointment, users need to choose a type of consultation.
val res = VseeApi.visitApi.updateConsultation(intakeId, consultationId)
res.doIfSuccess {
_updatedIntake.postValue(it)
}
res.doIfFailure {
Timber.e("Unable to update consultation: $it")
}
Â
Â
Use this API to retrieve the details of available consultations, including types, slots, and price.
val res = VseeApi.roomApi.getRoom(roomCode = it, timeZone = TimeZone.getDefault().id)
res.doIfSuccess { room ->
if (room.payment?.consultations?.isEmpty() == true) {
error.postValue("No consultation types are available in this room currently.")
} else {
_consultations.postValue(room.payment!!)
}
}
res.doIfFailure {
Timber.e("Unable to get room: $it")
}
Â
4. Select appointment time
Once you've chosen a consultation type, select a convenient time slot from those available.
Note: Available appointment slots are managed by providers. If you cannot find a convenient time, reach out to the provider for additional options.
Â
Â
To finalize your selected appointment time, do the following process:
Initiates API Call:
The application invokes the
createVisit
API, passing essential details for visit creation:Intake ID: Unique identifier for the health intake form.
Member ID: ID of the patient scheduling the appointment.
Slot Start: The selected appointment's start time.
Slot End: The selected appointment's end time.
Room Code: Code for the virtual consultation room
Handles API Response:
The API returns a response indicating success or failure:
Success:
It updates the user interface to reflect the successful appointment creation.
Failure:
It informs the user about the failure and prompts them to retry or seek assistance.
Â
Â
Â
5. Start or cancel an appointment
To retrieve a list of upcoming appointments, call the getVisits
API and set the filter
parameter to 'upcoming'
Â
When the scheduled time arrives, you can choose to start the meeting with your provider or cancel the appointment.
Â
Starting an Appointment:
Â
Canceling an Appointment: