ClinicKit Mobile SDK / Android

Intake & Visit API (Android)

  • A clinic visit is an appointment with a healthcare provider, where the patient receives care and treatment for their health concerns.
  • A visit intake collects medical information from the patient before the appointment: their medical history, current health status, and any medications they take.

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 walk-in

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}")
        }
    }
}