feat/encounter: wip
This commit is contained in:
@@ -40,13 +40,13 @@ const { defineField, errors, meta } = useForm({
|
||||
})
|
||||
|
||||
const [responsibleDoctor_id, responsibleDoctor_idAttrs] = defineField('responsibleDoctor_id')
|
||||
const [dischargeMethod_code, dischargeMethod_codeAttrs] = defineField('dischargeMethod_code')
|
||||
const [unit_id, unit_idAttrs] = defineField('unit_id')
|
||||
// const [dischargeMethod_code, dischargeMethod_codeAttrs] = defineField('dischargeMethod_code')
|
||||
// const [unit_id, unit_idAttrs] = defineField('unit_id')
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DE.Block>
|
||||
<DE.Block :cell-flex="false">
|
||||
<DE.Cell>
|
||||
<DE.Label>Dokter</DE.Label>
|
||||
<DE.Field>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
//
|
||||
import { useForm } from 'vee-validate'
|
||||
import { useForm, useFieldArray } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
|
||||
//
|
||||
import type z from 'zod'
|
||||
import * as CB from '~/components/pub/my-ui/combobox'
|
||||
import { dischargeMethodCodes } from '~/lib/constants';
|
||||
import type { CheckOutFormData } from '~/schemas/encounter.schema'
|
||||
import type { CheckOutFormData, ConsulPoliesFormData } from '~/schemas/encounter.schema'
|
||||
|
||||
import * as Table from '~/components/pub/ui/table'
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
|
||||
interface Props {
|
||||
@@ -32,34 +33,36 @@ const { defineField, errors, meta } = useForm({
|
||||
validationSchema: toTypedSchema(props.schema),
|
||||
initialValues: {
|
||||
dischargeMethod_code: '',
|
||||
unit_id: 0,
|
||||
responsible_doctor_id: 0,
|
||||
consulPolies: [],
|
||||
} as Partial<CheckOutFormData>,
|
||||
})
|
||||
const { fields, push, remove } = useFieldArray('consulPolies');
|
||||
|
||||
const [dischargeMethod_code, dischargeMethod_codeAttrs] = defineField('dischargeMethod_code')
|
||||
const [unit_id, unit_idAttrs] = defineField('unit_id')
|
||||
// const [consulPolies, consulPoliesAttrs] = defineField<ConsulPoliesFormData[]>([])
|
||||
const [responsible_doctor_id, responsible_doctor_idAttrs] = defineField('responsible_doctor_id')
|
||||
|
||||
function onSubmitForm(values: any) {
|
||||
const formData: CheckOutFormData = {
|
||||
dischargeMethod_code: '',
|
||||
unit_id: 0,
|
||||
// unit_id: 0,
|
||||
responsible_doctor_id: 0,
|
||||
consulPolies: [],
|
||||
}
|
||||
emit('submit', formData)
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
dischargeMethod_code.value = ''
|
||||
unit_id.value = ''
|
||||
// unit_id.value = ''
|
||||
responsible_doctor_id.value = ''
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DE.Block>
|
||||
<DE.Block :cellFlex="false">
|
||||
<DE.Cell>
|
||||
<DE.Label>Cara Keluar</DE.Label>
|
||||
<DE.Field>
|
||||
@@ -73,10 +76,9 @@ const resetForm = () => {
|
||||
search-placeholder="Cari Cara Keluar"
|
||||
empty-message="Cara Keluar tidak ditemukan"
|
||||
/>
|
||||
{{ dischargeMethod_code }}
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<!-- <DE.Cell>
|
||||
<DE.Label>Klinik</DE.Label>
|
||||
<DE.Field>
|
||||
<CB.Combobox
|
||||
@@ -90,8 +92,9 @@ const resetForm = () => {
|
||||
empty-message="Klinik tidak ditemukan"
|
||||
/>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
</DE.Cell> -->
|
||||
|
||||
<DE.Cell v-if="['emergency', 'emergency-covid'].includes(dischargeMethod_code)">
|
||||
<DE.Label>DPJP</DE.Label>
|
||||
<DE.Field>
|
||||
<CB.Combobox
|
||||
@@ -106,6 +109,55 @@ const resetForm = () => {
|
||||
/>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<DE.Cell>
|
||||
<DE.Label>Tujuan</DE.Label>
|
||||
<DE.Field>
|
||||
<Table.Table class="border mb-3">
|
||||
<Table.TableHeader class="bg-neutral-100 dark:bg-slate-800">
|
||||
<Table.TableCell class="text-center">Poly</Table.TableCell>
|
||||
<Table.TableCell class="text-center">DPJP</Table.TableCell>
|
||||
<Table.TableCell class="text-center !w-10"></Table.TableCell>
|
||||
</Table.TableHeader>
|
||||
<Table.TableBody>
|
||||
<Table.TableRow v-for="(item, index) in fields" :key="index">
|
||||
<Table.TableCell class="!p-0.5">
|
||||
<CB.Combobox
|
||||
id="dischargeMethodItems"
|
||||
v-model="item.value.unit_id"
|
||||
v-bind="unit_idAttrs"
|
||||
:items="units"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Poly"
|
||||
search-placeholder="Cari Poly"
|
||||
empty-message="Poly tidak ditemukan"
|
||||
/>
|
||||
</Table.TableCell>
|
||||
<Table.TableCell class="!p-0.5">
|
||||
<CB.Combobox
|
||||
id="dischargeMethodItems"
|
||||
v-model="responsible_doctor_id"
|
||||
v-bind="responsible_doctor_idAttrs"
|
||||
:items="units"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Dokter"
|
||||
search-placeholder="Cari Dokter"
|
||||
empty-message="Dokter tidak ditemukan"
|
||||
/>
|
||||
</Table.TableCell>
|
||||
<Table.TableCell>
|
||||
<Button variant="destructive" size="xs" @click="remove(index)" class="w-6 h-6 rounded-full">
|
||||
X
|
||||
</Button>
|
||||
</Table.TableCell>
|
||||
</Table.TableRow>
|
||||
</Table.TableBody>
|
||||
</Table.Table>
|
||||
<div>
|
||||
<Button @click="push({ unit_id: '', responsible_doctor_id: '' })">Tambah</Button>
|
||||
</div>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
<div class="text-center">
|
||||
<Button
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// Type Const Var
|
||||
import { dischargeMethodCodes } from '~/lib/constants'
|
||||
import { type Item, recStrToItem } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
|
||||
// Components
|
||||
// import ComboBox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
import ComboBox from '~/components/pub/my-ui/form/combobox.vue'
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
|
||||
const dischargeMethodItems = recStrToItem(dischargeMethodCodes)
|
||||
let selectedItemLabel = 'test'
|
||||
let selectedItem = ref<Item>({ label: '', value: '' })
|
||||
|
||||
const selectDischargeMethod = (item: Item) => {
|
||||
selectedItem.value = item
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="lg:grid grid-cols-2">
|
||||
<div class="border-r lg:pe-4 xl:pe-5">
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
|
||||
</div>
|
||||
<div class="lg:ps-4 xl:ps-5">
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
|
||||
<DE.Block>
|
||||
<DE.Cell>
|
||||
<DE.Label>Cara Keluar</DE.Label>
|
||||
<DE.Field>
|
||||
<ComboBox id="sumpeh_lu" :items="dischargeMethodItems" :modelValue="selectedItemLabel" />
|
||||
<!-- {{ selectedItem.value }} -
|
||||
{{ selectedItem.label }} -->
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -9,13 +9,13 @@ import type { TabItem } from '~/components/pub/my-ui/comp-tab/type'
|
||||
|
||||
import { getDetail } from '~/services/encounter.service'
|
||||
|
||||
import AssesmentFunctionList from '~/components/content/assesment-function/list.vue'
|
||||
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
||||
import PrescriptionList from '~/components/content/prescription/list.vue'
|
||||
import type { Encounter } from '~/models/encounter'
|
||||
import Status from '~/components/app/encounter/status.vue'
|
||||
// import AssesmentFunctionList from '~/components/content/assesment-function/list.vue'
|
||||
|
||||
import AssesmentFunctionList from '~/components/content/assesment-function/list.vue'
|
||||
import Status from '~/components/content/encounter/status.vue'
|
||||
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
||||
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
|
||||
import PrescriptionList from '~/components/content/prescription/list.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
@@ -50,19 +50,20 @@ function checkOutSubmit(values: CheckOutFormData) {
|
||||
|
||||
<template>
|
||||
<div class="lg:grid grid-cols-2">
|
||||
<div class="border-r lg:pe-4 xl:pe-5">
|
||||
<div class="border-r lg:pe-4 xl:pe-5 mb-10">
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
|
||||
<Checkin
|
||||
:schema="CheckInSchema"
|
||||
:doctors="doctors"
|
||||
:encounter="encounter"
|
||||
:values="checkInValues"
|
||||
:is-loading="checkOutIsLoading"
|
||||
:is-readonly="checkOutIsReadonly"
|
||||
:is-loading="checkInIsLoading"
|
||||
:is-readonly="checkInIsReadonly"
|
||||
@submit="checkInSubmit"
|
||||
/>
|
||||
</div>
|
||||
<div class="lg:ps-4 xl:ps-5">
|
||||
<Separator class="lg:hidden my-4 xl:my-5" />
|
||||
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
|
||||
<Checkout
|
||||
:schema="CheckOutSchema"
|
||||
|
||||
@@ -8,16 +8,24 @@ const CheckInSchema = z.object({
|
||||
})
|
||||
type CheckInFormData = z.infer<typeof CheckInSchema>
|
||||
|
||||
export { CheckInSchema }
|
||||
export type { CheckInFormData }
|
||||
|
||||
// Check Out
|
||||
const CheckOutSchema = z.object({
|
||||
dischargeMethod_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
||||
// Check Out Consul Polis
|
||||
const ConsulPoliesSchema = z.object({
|
||||
unit_id: z.number(),
|
||||
responsible_doctor_id: z.number(),
|
||||
|
||||
})
|
||||
type ConsulPoliesFormData = z.infer<typeof ConsulPoliesSchema>
|
||||
|
||||
// Checkout
|
||||
const CheckOutSchema = z.object({
|
||||
dischargeMethod_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
||||
// unit_id: z.number(),
|
||||
consulPolies: z.array(ConsulPoliesSchema),
|
||||
responsible_doctor_id: z.number(),
|
||||
|
||||
})
|
||||
type CheckOutFormData = z.infer<typeof CheckOutSchema>
|
||||
|
||||
export { CheckOutSchema }
|
||||
export type { CheckOutFormData }
|
||||
// Exports
|
||||
export { CheckInSchema, CheckOutSchema }
|
||||
export type { CheckInFormData, CheckOutFormData, ConsulPoliesFormData }
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Base
|
||||
import * as base from './_crud-base'
|
||||
import type { Doctor } from "~/models/doctor";
|
||||
|
||||
const path = '/api/v1/device'
|
||||
const name = 'device'
|
||||
|
||||
export function create(data: any) {
|
||||
return base.create(path, data, name)
|
||||
}
|
||||
|
||||
export function getList(params: any = null) {
|
||||
return base.getList(path, params, name)
|
||||
}
|
||||
|
||||
export function getDetail(id: number | string) {
|
||||
return base.getDetail(path, id, name)
|
||||
}
|
||||
|
||||
export function update(id: number | string, data: any) {
|
||||
return base.update(path, id, data, name)
|
||||
}
|
||||
|
||||
export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Doctor) => ({
|
||||
value: item.id,
|
||||
label: item.employee.person.name,
|
||||
}))
|
||||
}
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user