/
[Android] Clinic & Room API
[Android] Clinic & Room API
- 1 Get Account
- 1.1 Example Usage
- 2 Get room
- 2.1 Example Usage
- 3 Get providers
- 3.1 Example Usage
A clinic is a medical facility that provides healthcare services remotely through telecommunication technologies.
Get Account
/**
* Interface for getting account details.
*/
interface AccountApi {
/**
* Get account details by code.
*
* @param code The code of the account.
* @return A resource containing the account details.
*/
suspend fun getAccount(code: String): Resource<Account>
}
Example Usage
/**
* Launches a coroutine to get account details by code.
*
* @param accountCode The code of the room.
*/
viewModelScope.launch {
val res = VseeApi.accountApi.getAccount(code = accountCode)
when (res) {
is Resource.Success -> {
// Save account data.
}
is Resource.Error -> Timber.e("Get account detail $accountCode error: ${res.message}")
}
}
Get room
A clinic room is a room in a medical facility where patients are examined and treated by healthcare professionals.
/**
* Interface for getting room details.
*/
interface RoomApi {
/**
* Get room details by code.
*
* @param roomCode The code of the room.
* @param timeZone The time zone of the user.
* @return A resource containing the room details.
*/
suspend fun getRoom(roomCode: String, timeZone: String): Resource<Room>
/**
* Get providers by room code.
*
* @param roomCode The code of the room.
* @return A resource containing a list of providers.
*/
suspend fun getProviders(roomCode: String): Resource<List<User>>
}
Example Usage
/**
* Launches a coroutine to get room details.
*
* @param roomCode The code of the room.
*/
viewModelScope.launch {
/**
* Get room details by code.
*
* @param roomCode The code of the room.
* @param timeZone The time zone of the user.
* @return A resource containing the room details.
*/
val res = VseeApi.roomApi.getRoom(roomCode = roomCode, timeZone = TimeZone.getDefault().id)
when (res) {
is Resource.Success -> {
// Save room data.
}
is Resource.Error -> Timber.e("Get room detail $roomCode error: ${res.message}")
}
}
Get providers
Clinic providers are healthcare professionals who work in medical facilities such as clinics and hospitals1. They provide medical care to patients and may include doctors, nurses, physician assistants, and other healthcare professionals.
Example Usage
/**
* Launches a coroutine to get providers.
*/
fun getProviders() {
viewModelScope.launch {
/**
* Get providers by room code.
*
* @param roomCode The code of the room.
*/
when (val res = VseeApi.roomApi.getProviders(roomCode)) {
is Resource.Success -> {
// Save providers data.
}
is Resource.Error -> Timber.e("Could not get providers: ${res.message}")
}
}
}
, multiple selections available,
Related content
[iOS] Clinic & Room API
[iOS] Clinic & Room API
More like this
[Android] Intake & Visit API
[Android] Intake & Visit API
More like this
[React Native] Clinic & Room API
[React Native] Clinic & Room API
More like this