[Android] Intake & Visit API
A clinic visit is an appointment with a healthcare provider in a medical facility such as a clinic or hospital. It is an opportunity for patients to receive medical care and treatment for their health concerns.
A clinic visit intake is a process of collecting medical information from patients before their appointment with a healthcare provider. It includes questions about the patient’s medical history, current health status, and any medications they are taking.
Intake and Visit Interface
/**
* Interface for visiting.
*/
interface VisitApi {
/**
* Create intake.
*
* @param data The data for creating intake.
* @return A resource containing the created intake.
*/
suspend fun createIntake(data: CreateIntakeRequest): Resource<Intake>
/**
* Get intake by ID.
*
* @param intakeId The ID of the intake.
* @return A resource containing the intake.
*/
suspend fun getIntake(intakeId: String): Resource<Intake>
/**
* Edit intake by ID.
*
* @param intakeId The ID of the intake.
* @param data The data for editing the intake.
* @return A resource containing the edited intake.
*/
suspend fun editIntake(intakeId: String, data: EditIntakeRequest): Resource<Intake>
/**
* Get EMR by user ID.
*
* @param userId The ID of the user.
* @return A resource containing the EMR.
*/
suspend fun getEmr(userId: String): Resource<Emr>
/**
* Get visits with options.
*
* @param options The options for getting visits.
* @return A resource containing a list of visits.
*/
suspend fun getVisits(options: Map<String, String?>): Resource<List<VisitResponse>>
/**
* Get visit by ID.
*
* @param visitId The ID of the visit.
* @return A resource containing the visit.
*/
suspend fun getVisit(visitId: String): Resource<VisitResponse>
/**
* Create walk-in visit.
*
* @param data The data for creating walk-in visit.
* @return A resource containing the created walk-in visit.
*/
suspend fun createWalkin(data: CreateWalkinRequest): Resource<VisitResponse>
}
Create Intake
Example Usage
Â
/**
* Launches a coroutine to create intake.
*
* @param reasonForVisit The reason for the visit.
*/
fun createIntake(reasonForVisit: String) {
val request = CreateIntakeRequest(
reasonForVisit = reasonForVisit,
type = 1,
roomCode = VseeApi.session.getRoomCode().orEmpty(),
consent = true
)
viewModelScope.launch {
val res = VseeApi.visitApi.createIntake(request)
when (res) {
is Resource.Success -> res.data?.let { data ->
// Save intake data.
}
is Resource.Error -> Timber.e("Unable to create visit intake: ${res.message}")
}
}
}
Â
Create Walkin
Example Usage
/**
* Launches a coroutine to create walk-in visit.
*
* @param intakeId The ID of the intake.
* @param roomCode The code of the room.
*/
fun createWalkin(intakeId: String, roomCode: String) {
viewModelScope.launch {
val res = VseeApi.visitApi.createWalkin(
CreateWalkinRequest(
intakeId = intakeId,
roomCode = roomCode
)
)
when (res) {
is Resource.Success -> res.data?.let {
// Save walkin data.
}
is Resource.Error -> Timber.e("Create walkin [intakeId = $intakeId, roomCode = $roomCode] error: ${res.message}")
}
}
}