feat/encounter: done
This commit is contained in:
@@ -0,0 +1,107 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
//
|
||||||
|
import { LucideCheck } from 'lucide-vue-next';
|
||||||
|
import { useForm } from 'vee-validate'
|
||||||
|
import { toTypedSchema } from '@vee-validate/zod'
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import type z from 'zod'
|
||||||
|
import ComboBox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { CheckInFormData } from '~/schemas/encounter.schema'
|
||||||
|
import type { Encounter } from '~/models/encounter'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
schema: z.ZodSchema<any>
|
||||||
|
values: any
|
||||||
|
doctors: { value: string; label: string }[]
|
||||||
|
employees: { value: string; label: string }[]
|
||||||
|
encounter: Encounter
|
||||||
|
isLoading?: boolean
|
||||||
|
isReadonly?: boolean
|
||||||
|
}
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
submit: [values: CheckInFormData]
|
||||||
|
cancel: [resetForm: () => void]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { defineField, errors, meta } = useForm({
|
||||||
|
validationSchema: toTypedSchema(props.schema),
|
||||||
|
initialValues: {
|
||||||
|
responsible_doctor_id: 0,
|
||||||
|
adm_employee_id: 0,
|
||||||
|
registeredAt: props.values.values?.registeredAt || '',
|
||||||
|
} as Partial<CheckInFormData>,
|
||||||
|
})
|
||||||
|
|
||||||
|
const [responsible_doctor_id, responsible_doctor_idAttrs] = defineField('responsible_doctor_id')
|
||||||
|
const [adm_employee_id, adm_employee_idAttrs] = defineField('discharge_method_code')
|
||||||
|
const [registeredAt, registeredAtAttrs] = defineField('registeredAt')
|
||||||
|
|
||||||
|
function submitForm() {
|
||||||
|
const formData: CheckInFormData = {
|
||||||
|
responsible_doctor_id: responsible_doctor_id.value,
|
||||||
|
adm_employee_id: adm_employee_id.value,
|
||||||
|
// registeredAt: registeredAt.value || '',
|
||||||
|
}
|
||||||
|
emit('submit', formData)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<DE.Block :cell-flex="false">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Dokter</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<ComboBox
|
||||||
|
id="doctor"
|
||||||
|
v-model="responsible_doctor_id"
|
||||||
|
v-bind="responsible_doctor_idAttrs"
|
||||||
|
:items="doctors"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
placeholder="Pilih Dokter DPJP"
|
||||||
|
search-placeholder="Pilih DPJP"
|
||||||
|
empty-message="DPJP tidak ditemukan"
|
||||||
|
/>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>PJ Berkas</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<ComboBox
|
||||||
|
id="doctor"
|
||||||
|
v-model="adm_employee_id"
|
||||||
|
v-bind="adm_employee_idAttrs"
|
||||||
|
:items="employees"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
placeholder="Pilih Dokter DPJP"
|
||||||
|
search-placeholder="Pilih petugas"
|
||||||
|
empty-message="Petugas tidak ditemukan"
|
||||||
|
/>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Waktu Masuk</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<Input
|
||||||
|
id="name"
|
||||||
|
v-model="registeredAt"
|
||||||
|
v-bind="registeredAtAttrs"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
/>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
<div class="text-center">
|
||||||
|
<Button @click="submitForm">
|
||||||
|
<LucideCheck />
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
// Components
|
||||||
|
import { LucidePen } from 'lucide-vue-next';
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import Input from '~/components/pub/ui/input/Input.vue';
|
||||||
|
import type { Encounter } from '~/models/encounter'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
encounter: Encounter
|
||||||
|
}
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
const doctor = ref('-belum dipilih-')
|
||||||
|
const adm = ref('-belum dipilih-')
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
edit: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
watch(props.encounter, () => {
|
||||||
|
doctor.value = props.encounter.responsible_doctor?.employee?.person?.name ?? props.encounter.appointment_doctor?.employee?.person?.name ?? '-belum dipilih-'
|
||||||
|
adm.value = props.encounter.adm_employee?.person?.name ?? '-belum dipilih-'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<DE.Block :cell-flex="false">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label class="font-semibold">Dokter</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ doctor }}</div>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label class="font-semibold">PJ Berkas</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ adm }}</div>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label class="font-semibold">Waktu Masuk</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ encounter?.registeredAt || '-' }}</div>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
<div class="text-center">
|
||||||
|
<Button @click="() => emit('edit')">
|
||||||
|
<LucidePen />
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
+78
-68
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
//
|
//
|
||||||
|
import { LucideCheck } from 'lucide-vue-next';
|
||||||
import { useForm, useFieldArray } from 'vee-validate'
|
import { useForm, useFieldArray } from 'vee-validate'
|
||||||
import { toTypedSchema } from '@vee-validate/zod'
|
import { toTypedSchema } from '@vee-validate/zod'
|
||||||
|
|
||||||
@@ -7,16 +8,21 @@ import { toTypedSchema } from '@vee-validate/zod'
|
|||||||
import type z from 'zod'
|
import type z from 'zod'
|
||||||
import * as CB from '~/components/pub/my-ui/combobox'
|
import * as CB from '~/components/pub/my-ui/combobox'
|
||||||
import { dischargeMethodCodes } from '~/lib/constants';
|
import { dischargeMethodCodes } from '~/lib/constants';
|
||||||
import type { CheckOutFormData, ConsulPoliesFormData } from '~/schemas/encounter.schema'
|
import type {
|
||||||
|
CheckOutFormData,
|
||||||
|
CheckOutDeathFormData,
|
||||||
|
CheckOutInternalReferenceFormData
|
||||||
|
} from '~/schemas/encounter.schema'
|
||||||
|
|
||||||
import * as Table from '~/components/pub/ui/table'
|
import * as Table from '~/components/pub/ui/table'
|
||||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { InternalReference, CreateDto as InternalReferenceCreateDto } from '~/models/internal-reference';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
schema: z.ZodSchema<any>
|
schema: z.ZodSchema<any>
|
||||||
|
values: any
|
||||||
units: any[]
|
units: any[]
|
||||||
doctors: any[]
|
doctors: any[]
|
||||||
values: any
|
|
||||||
isLoading?: boolean
|
isLoading?: boolean
|
||||||
isReadonly?: boolean
|
isReadonly?: boolean
|
||||||
}
|
}
|
||||||
@@ -32,44 +38,55 @@ const emit = defineEmits<{
|
|||||||
const { defineField, errors, meta } = useForm({
|
const { defineField, errors, meta } = useForm({
|
||||||
validationSchema: toTypedSchema(props.schema),
|
validationSchema: toTypedSchema(props.schema),
|
||||||
initialValues: {
|
initialValues: {
|
||||||
dischargeMethod_code: '',
|
discharge_method_code: '',
|
||||||
responsible_doctor_id: 0,
|
discharge_date: '',
|
||||||
consulPolies: [],
|
internalReferences: [{ unit_id: 0, doctor_id: 0 }],
|
||||||
|
deathCauses: [""],
|
||||||
} as Partial<CheckOutFormData>,
|
} as Partial<CheckOutFormData>,
|
||||||
})
|
})
|
||||||
const { fields, push, remove } = useFieldArray('consulPolies');
|
const [ discharge_method_code, discharge_method_codeAttrs ] = defineField('discharge_method_code')
|
||||||
|
const [ discharge_date, discharge_dateAttrs ] = defineField('discharge_date')
|
||||||
|
const { fields, push, remove } = useFieldArray<InternalReferenceCreateDto>('internalReferences');
|
||||||
|
|
||||||
const [dischargeMethod_code, dischargeMethod_codeAttrs] = defineField('dischargeMethod_code')
|
function submitForm(values: any) {
|
||||||
// const [consulPolies, consulPoliesAttrs] = defineField<ConsulPoliesFormData[]>([])
|
if (['consul-poly', 'consul-executive'].includes(discharge_method_code.value)) {
|
||||||
const [responsible_doctor_id, responsible_doctor_idAttrs] = defineField('responsible_doctor_id')
|
const formData: CheckOutInternalReferenceFormData = {
|
||||||
|
discharge_method_code: discharge_method_code.value,
|
||||||
function onSubmitForm(values: any) {
|
discharge_date: discharge_date.value,
|
||||||
const formData: CheckOutFormData = {
|
internalReferences: [{ unit_id: 0, doctor_id: 0 }],
|
||||||
dischargeMethod_code: '',
|
}
|
||||||
// unit_id: 0,
|
emit('submit', formData)
|
||||||
responsible_doctor_id: 0,
|
} else if (discharge_method_code.value === 'death') {
|
||||||
consulPolies: [],
|
const formData: CheckOutDeathFormData = {
|
||||||
|
discharge_method_code: discharge_method_code.value,
|
||||||
|
discharge_date: discharge_date.value,
|
||||||
|
death_cause: [""],
|
||||||
|
}
|
||||||
|
emit('submit', formData)
|
||||||
|
} else {
|
||||||
|
const formData: CheckOutFormData = {
|
||||||
|
discharge_method_code: discharge_method_code.value,
|
||||||
|
discharge_date: discharge_date.value,
|
||||||
|
}
|
||||||
|
emit('submit', formData)
|
||||||
}
|
}
|
||||||
emit('submit', formData)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
dischargeMethod_code.value = ''
|
discharge_method_code.value = ''
|
||||||
// unit_id.value = ''
|
discharge_date.value = ''
|
||||||
responsible_doctor_id.value = ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DE.Block :cellFlex="false">
|
<DE.Block :cellFlex="false">
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Cara Keluar</DE.Label>
|
<DE.Label>Alasan Keluar</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
<CB.Combobox
|
<CB.Combobox
|
||||||
id="dischargeMethodItems"
|
id="dischargeMethodItems"
|
||||||
v-model="dischargeMethod_code"
|
v-model="discharge_method_code"
|
||||||
v-bind="dischargeMethod_codeAttrs"
|
v-bind="discharge_method_codeAttrs"
|
||||||
:items="dischargeMethodItems"
|
:items="dischargeMethodItems"
|
||||||
:disabled="isLoading || isReadonly"
|
:disabled="isLoading || isReadonly"
|
||||||
placeholder="Pilih Cara Keluar"
|
placeholder="Pilih Cara Keluar"
|
||||||
@@ -78,39 +95,39 @@ const resetForm = () => {
|
|||||||
/>
|
/>
|
||||||
</DE.Field>
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<!-- <DE.Cell>
|
|
||||||
<DE.Label>Klinik</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
<CB.Combobox
|
|
||||||
id="dischargeMethodItems"
|
|
||||||
v-model="unit_id"
|
|
||||||
v-bind="unit_idAttrs"
|
|
||||||
:items="units"
|
|
||||||
:disabled="isLoading || isReadonly"
|
|
||||||
placeholder="Pilih Klinik"
|
|
||||||
search-placeholder="Cari Klinik"
|
|
||||||
empty-message="Klinik tidak ditemukan"
|
|
||||||
/>
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell> -->
|
|
||||||
|
|
||||||
<DE.Cell v-if="['emergency', 'emergency-covid'].includes(dischargeMethod_code)">
|
|
||||||
<DE.Label>DPJP</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
<CB.Combobox
|
|
||||||
id="dischargeMethodItems"
|
|
||||||
v-model="responsible_doctor_id"
|
|
||||||
v-bind="responsible_doctor_idAttrs"
|
|
||||||
:items="doctors"
|
|
||||||
:disabled="isLoading || isReadonly"
|
|
||||||
placeholder="Pilih Dokter"
|
|
||||||
search-placeholder="Cari Dokter"
|
|
||||||
empty-message="Dokter tidak ditemukan"
|
|
||||||
/>
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
|
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
|
<DE.Label>Waktu Keluar</DE.Label>
|
||||||
|
<DE.Cell>
|
||||||
|
<Input
|
||||||
|
id="discharge_date"
|
||||||
|
v-model="discharge_date"
|
||||||
|
v-bind="discharge_dateAttrs"
|
||||||
|
:disabled="isLoading || isReadonly"
|
||||||
|
/>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Cell>
|
||||||
|
|
||||||
|
<DE.Cell v-if="'death' == discharge_method_code">
|
||||||
|
<DE.Label>Sebab Meninggal</DE.Label>
|
||||||
|
<DE.Cell>
|
||||||
|
<div class="mb-3">
|
||||||
|
<Input />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
v-if="!isReadonly"
|
||||||
|
type="button"
|
||||||
|
:disabled="isLoading || !meta.valid"
|
||||||
|
@click="submitForm"
|
||||||
|
>
|
||||||
|
Tambah Sebab meninggal
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Cell>
|
||||||
|
|
||||||
|
<DE.Cell v-if="['consul-poly', 'consul-executive'].includes(discharge_method_code)">
|
||||||
<DE.Label>Tujuan</DE.Label>
|
<DE.Label>Tujuan</DE.Label>
|
||||||
<DE.Field>
|
<DE.Field>
|
||||||
<Table.Table class="border mb-3">
|
<Table.Table class="border mb-3">
|
||||||
@@ -124,8 +141,7 @@ const resetForm = () => {
|
|||||||
<Table.TableCell class="!p-0.5">
|
<Table.TableCell class="!p-0.5">
|
||||||
<CB.Combobox
|
<CB.Combobox
|
||||||
id="dischargeMethodItems"
|
id="dischargeMethodItems"
|
||||||
v-model="item.value.unit_id"
|
:v-model.number="item.value.unit_id"
|
||||||
v-bind="unit_idAttrs"
|
|
||||||
:items="units"
|
:items="units"
|
||||||
:disabled="isLoading || isReadonly"
|
:disabled="isLoading || isReadonly"
|
||||||
placeholder="Pilih Poly"
|
placeholder="Pilih Poly"
|
||||||
@@ -136,12 +152,11 @@ const resetForm = () => {
|
|||||||
<Table.TableCell class="!p-0.5">
|
<Table.TableCell class="!p-0.5">
|
||||||
<CB.Combobox
|
<CB.Combobox
|
||||||
id="dischargeMethodItems"
|
id="dischargeMethodItems"
|
||||||
v-model="responsible_doctor_id"
|
:v-model.number="item.value.doctor_id"
|
||||||
v-bind="responsible_doctor_idAttrs"
|
|
||||||
:items="units"
|
:items="units"
|
||||||
:disabled="isLoading || isReadonly"
|
:disabled="isLoading || isReadonly"
|
||||||
placeholder="Pilih Dokter"
|
placeholder="Pilih Dokter"
|
||||||
search-placeholder="Cari Dokter"
|
search-placeholder="Pilih Dokter"
|
||||||
empty-message="Dokter tidak ditemukan"
|
empty-message="Dokter tidak ditemukan"
|
||||||
/>
|
/>
|
||||||
</Table.TableCell>
|
</Table.TableCell>
|
||||||
@@ -154,19 +169,14 @@ const resetForm = () => {
|
|||||||
</Table.TableBody>
|
</Table.TableBody>
|
||||||
</Table.Table>
|
</Table.Table>
|
||||||
<div>
|
<div>
|
||||||
<Button @click="push({ unit_id: '', responsible_doctor_id: '' })">Tambah</Button>
|
<Button @click="push({ encounter_id: 0, unit_id: 0, doctor_id: 0 })">Tambah</Button>
|
||||||
</div>
|
</div>
|
||||||
</DE.Field>
|
</DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
</DE.Block>
|
</DE.Block>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<Button
|
<Button @click="submitForm">>
|
||||||
v-if="!isReadonly"
|
<LucideCheck />
|
||||||
type="button"
|
|
||||||
class="w-[120px]"
|
|
||||||
:disabled="isLoading || !meta.valid"
|
|
||||||
@click="onSubmitForm"
|
|
||||||
>
|
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
//
|
||||||
|
import { LucidePen, LucideCheck } from 'lucide-vue-next';
|
||||||
|
|
||||||
|
//
|
||||||
|
import * as CB from '~/components/pub/my-ui/combobox'
|
||||||
|
import { dischargeMethodCodes } from '~/lib/constants';
|
||||||
|
|
||||||
|
import * as Table from '~/components/pub/ui/table'
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { Encounter } from '~/models/encounter';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
encounter: Encounter
|
||||||
|
isLoading?: boolean
|
||||||
|
isReadonly?: boolean
|
||||||
|
}
|
||||||
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
const dischargeMethodItems = CB.recStrToItem(dischargeMethodCodes)
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
edit: [],
|
||||||
|
finish: []
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<DE.Block :cellFlex="false">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label class="font-semibold">Alasan Keluar</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ encounter.discharge_method_code || '-belum ditentukan-' }}</div>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label class="font-semibold">Waktu Keluar</DE.Label>
|
||||||
|
<DE.Cell>
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ encounter.discharge_date || '-belum ditentukan-' }}</div>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Cell>
|
||||||
|
|
||||||
|
<DE.Cell v-if="'death' == encounter.discharge_method_code">
|
||||||
|
<DE.Label class="font-semibold">Sebab Meninggal</DE.Label>
|
||||||
|
<DE.Cell>
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="py-2 border-b border-b-slate-300">{{ encounter.discharge_date }}</div>
|
||||||
|
</div>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Cell>
|
||||||
|
|
||||||
|
<DE.Cell v-if="['consul-poly', 'consul-executive'].includes(encounter.discharge_method_code || '')">
|
||||||
|
<DE.Label class="font-semibold">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 encounter.internalReferences" :key="index">
|
||||||
|
<Table.TableCell class="!p-0.5">
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell class="!p-0.5">
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
</Table.TableCell>
|
||||||
|
</Table.TableRow>
|
||||||
|
</Table.TableBody>
|
||||||
|
</Table.Table>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
<div class="text-center [&>*]:mx-1">
|
||||||
|
<Button @click="() => emit('edit')">
|
||||||
|
<LucidePen />
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
<Button @click="() => emit('finish')">
|
||||||
|
<LucideCheck />
|
||||||
|
Selesai
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
//
|
|
||||||
import { useForm } from 'vee-validate'
|
|
||||||
import { toTypedSchema } from '@vee-validate/zod'
|
|
||||||
|
|
||||||
//
|
|
||||||
import { getValueLabelList } from '~/services/doctor.service'
|
|
||||||
|
|
||||||
// Components
|
|
||||||
import type z from 'zod'
|
|
||||||
import * as CB from '~/components/pub/my-ui/combobox'
|
|
||||||
import ComboBox from '~/components/pub/my-ui/combobox/combobox.vue'
|
|
||||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
|
||||||
import type { CheckInFormData } from '~/schemas/encounter.schema'
|
|
||||||
import type { Encounter } from '~/models/encounter'
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
schema: z.ZodSchema<any>
|
|
||||||
values: any
|
|
||||||
encounter: Encounter
|
|
||||||
isLoading?: boolean
|
|
||||||
isReadonly?: boolean
|
|
||||||
}
|
|
||||||
const props = defineProps<Props>()
|
|
||||||
|
|
||||||
let doctors = await getValueLabelList()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
submit: [values: CheckInFormData]
|
|
||||||
cancel: [resetForm: () => void]
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const { defineField, errors, meta } = useForm({
|
|
||||||
validationSchema: toTypedSchema(props.schema),
|
|
||||||
initialValues: {
|
|
||||||
responsibleDoctor_id: 0,
|
|
||||||
adm_employee_id: 0,
|
|
||||||
registeredAt: '',
|
|
||||||
} as Partial<CheckInFormData>,
|
|
||||||
})
|
|
||||||
|
|
||||||
const [responsibleDoctor_id, responsibleDoctor_idAttrs] = defineField('responsibleDoctor_id')
|
|
||||||
// const [dischargeMethod_code, dischargeMethod_codeAttrs] = defineField('dischargeMethod_code')
|
|
||||||
// const [unit_id, unit_idAttrs] = defineField('unit_id')
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<DE.Block :cell-flex="false">
|
|
||||||
<DE.Cell>
|
|
||||||
<DE.Label>Dokter</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
<ComboBox
|
|
||||||
id="doctor"
|
|
||||||
v-model="responsibleDoctor_id"
|
|
||||||
v-bind="responsibleDoctor_idAttrs"
|
|
||||||
:items="doctors"
|
|
||||||
:disabled="isLoading || isReadonly"
|
|
||||||
placeholder="Pilih Dokter DPJP"
|
|
||||||
search-placeholder="Cari Dokter DPJP"
|
|
||||||
empty-message="Dokter DPJP tidak ditemukan"
|
|
||||||
/>
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell>
|
|
||||||
<DE.Label>PJ Berkas</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
<Input :value="encounter?.adm_employee?.person?.name" />
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell>
|
|
||||||
<DE.Label>Waktu Masuk</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
<Input :value="encounter?.registeredAt" />
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
</DE.Block>
|
|
||||||
<div class="text-center">
|
|
||||||
<Button>Simpan</Button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//
|
//
|
||||||
import { getValueLabelList as getDoctorValueLabelList } from '~/services/doctor.service'
|
import { getValueLabelList as getDoctorValueLabelList } from '~/services/doctor.service'
|
||||||
|
import { getValueLabelList as getEmployeeValueLabelList } from '~/services/employee.service'
|
||||||
import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service'
|
import { getValueLabelList as getUnitValueLabelList } from '~/services/unit.service'
|
||||||
import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema'
|
import type { CheckInFormData, CheckOutFormData } from '~/schemas/encounter.schema'
|
||||||
import { CheckInSchema, CheckOutSchema } from '~/schemas/encounter.schema'
|
import { CheckInSchema, CheckOutSchema } from '~/schemas/encounter.schema'
|
||||||
|
|
||||||
//
|
//
|
||||||
import Checkin from '~/components/app/encounter/checkin-entry.vue'
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
import Checkout from '~/components/app/encounter/checkout-entry.vue'
|
import CheckInView from '~/components/app/encounter/check-in-view.vue'
|
||||||
|
import CheckInEntry from '~/components/app/encounter/check-in-entry.vue'
|
||||||
|
import CheckOutView from '~/components/app/encounter/check-out-view.vue'
|
||||||
|
import CheckOutEntry from '~/components/app/encounter/check-out-entry.vue'
|
||||||
import type { Encounter } from '~/models/encounter'
|
import type { Encounter } from '~/models/encounter'
|
||||||
|
import { checkIn } from '~/services/encounter.service'
|
||||||
|
|
||||||
//
|
//
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -16,19 +21,19 @@ const props = defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
// doctors
|
// doctors
|
||||||
const doctors = await getDoctorValueLabelList()
|
const doctors = await getDoctorValueLabelList({'includes': 'employee,employee-person'})
|
||||||
|
const employees = await getEmployeeValueLabelList({'includes': 'person', 'position-code': 'reg'})
|
||||||
// units
|
|
||||||
const units = await getUnitValueLabelList()
|
const units = await getUnitValueLabelList()
|
||||||
|
|
||||||
// check in
|
// check in
|
||||||
const checkInValues = ref<any>({
|
const checkInValues = ref<any>({
|
||||||
dischargeMethod_code: '',
|
discharge_method_code: '',
|
||||||
unit_id: 0,
|
responsible_doctor_id: 0,
|
||||||
responsibleDoctor_id: 0,
|
// registeredAt: '',
|
||||||
})
|
})
|
||||||
const checkInIsLoading = ref(false)
|
const checkInIsLoading = ref(false)
|
||||||
const checkInIsReadonly = ref(false)
|
const checkInIsReadonly = ref(false)
|
||||||
|
const checkInDialogOpen = ref(false)
|
||||||
|
|
||||||
// check out
|
// check out
|
||||||
const checkOutValues = ref<any>({
|
const checkOutValues = ref<any>({
|
||||||
@@ -38,12 +43,21 @@ const checkOutValues = ref<any>({
|
|||||||
})
|
})
|
||||||
const checkOutIsLoading = ref(false)
|
const checkOutIsLoading = ref(false)
|
||||||
const checkOutIsReadonly = ref(false)
|
const checkOutIsReadonly = ref(false)
|
||||||
|
const checkOutDialogOpen = ref(false)
|
||||||
|
|
||||||
function checkInSubmit(values: CheckInFormData) {
|
function editCheckIn() {
|
||||||
console.log(values)
|
checkInDialogOpen.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkOutSubmit(values: CheckOutFormData) {
|
function submitCheckIn(values: CheckInFormData) {
|
||||||
|
checkIn(props.encounter.id, values)
|
||||||
|
}
|
||||||
|
|
||||||
|
function editCheckOut() {
|
||||||
|
checkOutDialogOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitCheckOut(values: CheckOutFormData) {
|
||||||
console.log(values)
|
console.log(values)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -52,28 +66,60 @@ function checkOutSubmit(values: CheckOutFormData) {
|
|||||||
<div class="lg:grid grid-cols-2">
|
<div class="lg:grid grid-cols-2">
|
||||||
<div class="border-r lg:pe-4 xl:pe-5 mb-10">
|
<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>
|
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Masuk</div>
|
||||||
<Checkin
|
<CheckInView
|
||||||
:schema="CheckInSchema"
|
|
||||||
:doctors="doctors"
|
|
||||||
:encounter="encounter"
|
:encounter="encounter"
|
||||||
:values="checkInValues"
|
|
||||||
:is-loading="checkInIsLoading"
|
:is-loading="checkInIsLoading"
|
||||||
:is-readonly="checkInIsReadonly"
|
:is-readonly="checkInIsReadonly"
|
||||||
@submit="checkInSubmit"
|
@edit="editCheckIn"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="lg:ps-4 xl:ps-5">
|
<div class="lg:ps-4 xl:ps-5">
|
||||||
<Separator class="lg:hidden my-4 xl:my-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>
|
<div class="mb-4 xl:mb-5 text-base text-center font-semibold">Informasi Keluar</div>
|
||||||
<Checkout
|
<CheckOutView
|
||||||
:schema="CheckOutSchema"
|
:encounter="encounter"
|
||||||
:doctors="doctors"
|
|
||||||
:units="units"
|
|
||||||
:values="checkOutValues"
|
|
||||||
:is-loading="checkOutIsLoading"
|
:is-loading="checkOutIsLoading"
|
||||||
:is-readonly="checkOutIsReadonly"
|
:is-readonly="checkOutIsReadonly"
|
||||||
@submit="checkOutSubmit"
|
@edit="editCheckOut"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="checkInDialogOpen"
|
||||||
|
title="Ubah Informasi Masuk"
|
||||||
|
size="md"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<CheckInEntry
|
||||||
|
:schema="CheckInSchema"
|
||||||
|
:values="checkInValues"
|
||||||
|
:encounter="encounter"
|
||||||
|
:doctors="doctors"
|
||||||
|
:employees="employees"
|
||||||
|
:is-loading="checkInIsLoading"
|
||||||
|
:is-readonly="checkInIsReadonly"
|
||||||
|
@submit="submitCheckIn"
|
||||||
|
@cancel="checkInDialogOpen = false"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="checkOutDialogOpen"
|
||||||
|
title="Ubah Informasi Keluar"
|
||||||
|
size="lg"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<CheckOutEntry
|
||||||
|
:schema="CheckOutSchema"
|
||||||
|
:values="checkOutValues"
|
||||||
|
:encounter="encounter"
|
||||||
|
:units="units"
|
||||||
|
:doctors="doctors"
|
||||||
|
:is-loading="checkInIsLoading"
|
||||||
|
:is-readonly="checkInIsReadonly"
|
||||||
|
@submit="submitCheckOut"
|
||||||
|
@cancel="checkInDialogOpen = false"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export interface DeathCause {
|
||||||
|
id: bigint;
|
||||||
|
encounter_id: bigint;
|
||||||
|
value: any; // json mapped to 'any' type
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import type { DeathCause } from "./death-cause"
|
||||||
import { type Doctor, genDoctor } from "./doctor"
|
import { type Doctor, genDoctor } from "./doctor"
|
||||||
import { genEmployee, type Employee } from "./employee"
|
import { genEmployee, type Employee } from "./employee"
|
||||||
|
import type { InternalReference } from "./internal-reference"
|
||||||
import { type Patient, genPatient } from "./patient"
|
import { type Patient, genPatient } from "./patient"
|
||||||
import type { Specialist } from "./specialist"
|
import type { Specialist } from "./specialist"
|
||||||
import type { Subspecialist } from "./subspecialist"
|
import type { Subspecialist } from "./subspecialist"
|
||||||
@@ -29,8 +31,11 @@ export interface Encounter {
|
|||||||
earlyEducation?: string
|
earlyEducation?: string
|
||||||
medicalDischargeEducation: string
|
medicalDischargeEducation: string
|
||||||
admDischargeEducation?: string
|
admDischargeEducation?: string
|
||||||
dischargeMethod_code?: string
|
discharge_method_code?: string
|
||||||
discharge_reason?: string
|
discharge_reason?: string
|
||||||
|
discharge_date?: string
|
||||||
|
internalReferences?: InternalReference[]
|
||||||
|
deathCause?: DeathCause
|
||||||
status_code: string
|
status_code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
export interface InternalReference {
|
||||||
|
id: number;
|
||||||
|
encounter_id: number;
|
||||||
|
unit_id: number; // smallint mapped to number
|
||||||
|
doctor_id: number; // int mapped to number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateDto {
|
||||||
|
encounter_id: number;
|
||||||
|
unit_id: number; // smallint mapped to number
|
||||||
|
doctor_id: number; // int mapped to number
|
||||||
|
}
|
||||||
@@ -1,31 +1,48 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
import { InternalReferenceSchema } from './internal-reference.schema'
|
||||||
|
|
||||||
// Check In
|
// Check In
|
||||||
const CheckInSchema = z.object({
|
const CheckInSchema = z.object({
|
||||||
registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
|
// registeredAt: z.string({ required_error: 'Tanggal masuk harus diisi' }),
|
||||||
responsible_doctor_id: z.number({ required_error: 'Dokter harus diisi' }).gt(0, 'Dokter harus diisi'),
|
responsible_doctor_id: z.number({ required_error: 'Dokter harus diisi' }).gt(0, 'Dokter harus diisi'),
|
||||||
adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
|
adm_employee_id: z.number({ required_error: 'PJA harus diisi' }).gt(0, 'PJA harus diisi'),
|
||||||
})
|
})
|
||||||
type CheckInFormData = z.infer<typeof CheckInSchema>
|
type CheckInFormData = z.infer<typeof CheckInSchema>
|
||||||
|
|
||||||
// Check Out Consul Polis
|
|
||||||
const ConsulPoliesSchema = z.object({
|
|
||||||
unit_id: z.number(),
|
|
||||||
responsible_doctor_id: z.number(),
|
|
||||||
|
|
||||||
})
|
|
||||||
type ConsulPoliesFormData = z.infer<typeof ConsulPoliesSchema>
|
|
||||||
|
|
||||||
// Checkout
|
// Checkout
|
||||||
const CheckOutSchema = z.object({
|
const CheckOutSchema = z.object({
|
||||||
dischargeMethod_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
||||||
// unit_id: z.number(),
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
||||||
consulPolies: z.array(ConsulPoliesSchema),
|
|
||||||
responsible_doctor_id: z.number(),
|
|
||||||
|
|
||||||
})
|
})
|
||||||
type CheckOutFormData = z.infer<typeof CheckOutSchema>
|
type CheckOutFormData = z.infer<typeof CheckOutSchema>
|
||||||
|
|
||||||
|
// CheckoutDeath
|
||||||
|
const CheckOutDeathSchema = z.object({
|
||||||
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
||||||
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
||||||
|
death_cause: z.array(z.string()).nonempty(),
|
||||||
|
})
|
||||||
|
type CheckOutDeathFormData = z.infer<typeof CheckOutDeathSchema>
|
||||||
|
|
||||||
|
// CheckoutDeath
|
||||||
|
const CheckOutInternalReferenceSchema = z.object({
|
||||||
|
discharge_method_code: z.string({ required_error: 'Metode pulang harus diisi' }),
|
||||||
|
discharge_date: z.string({ required_error: 'Tanggal pulang harus diisi' }),
|
||||||
|
internalReferences: z.array(InternalReferenceSchema).nonempty(),
|
||||||
|
})
|
||||||
|
type CheckOutInternalReferenceFormData = z.infer<typeof CheckOutInternalReferenceSchema>
|
||||||
|
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
export { CheckInSchema, CheckOutSchema }
|
export {
|
||||||
export type { CheckInFormData, CheckOutFormData, ConsulPoliesFormData }
|
CheckInSchema,
|
||||||
|
CheckOutSchema,
|
||||||
|
CheckOutDeathSchema,
|
||||||
|
CheckOutInternalReferenceSchema
|
||||||
|
}
|
||||||
|
export type {
|
||||||
|
CheckInFormData,
|
||||||
|
CheckOutFormData,
|
||||||
|
CheckOutDeathFormData,
|
||||||
|
CheckOutInternalReferenceFormData
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import type { InternalReference } from '~/models/internal-reference'
|
||||||
|
|
||||||
|
const InternalReferenceSchema = z.object({
|
||||||
|
'unit_id': z.number({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||||
|
'doctor_id': z.number({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||||
|
})
|
||||||
|
|
||||||
|
type InternalReferenceFormData = z.infer<typeof InternalReferenceSchema> & Partial<InternalReference>
|
||||||
|
|
||||||
|
export { InternalReferenceSchema }
|
||||||
|
export type { InternalReferenceFormData }
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
import type { Doctor } from "~/models/doctor";
|
import type { Doctor } from "~/models/doctor";
|
||||||
|
|
||||||
const path = '/api/v1/device'
|
const path = '/api/v1/doctor'
|
||||||
const name = 'device'
|
const name = 'device'
|
||||||
|
|
||||||
export function create(data: any) {
|
export function create(data: any) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st
|
|||||||
const resultData = result.body?.data || []
|
const resultData = result.body?.data || []
|
||||||
data = resultData.map((item: any) => ({
|
data = resultData.map((item: any) => ({
|
||||||
value: item.id ? Number(item.id) : item.code,
|
value: item.id ? Number(item.id) : item.code,
|
||||||
label: item.name,
|
label: item.person.name,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Base
|
// Base
|
||||||
|
import type { CheckInFormData } from '~/schemas/encounter.schema'
|
||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
@@ -46,3 +47,16 @@ export function getValueLabelListConstants() {
|
|||||||
.filter(([key]) => allowed.includes(key))
|
.filter(([key]) => allowed.includes(key))
|
||||||
.map(([key, value]) => ({ value: key, label: value }))
|
.map(([key, value]) => ({ value: key, label: value }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function checkIn(id: number, data: CheckInFormData) {
|
||||||
|
try {
|
||||||
|
const resp = await xfetch(`${path}/${id}/check-in`, 'PATCH', data)
|
||||||
|
const result: any = {}
|
||||||
|
result.success = resp.success
|
||||||
|
result.body = (resp.body as Record<string, any>) || {}
|
||||||
|
return result
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error putting ${name}:`, error)
|
||||||
|
throw new Error(`Failed to put ${name}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user