feat (summary-medic): implement summary medic entry form

This commit is contained in:
Abizrh
2025-12-03 22:26:32 +07:00
parent 409e8fd1ed
commit 15db237f30
4 changed files with 64 additions and 69 deletions
+27 -25
View File
@@ -36,13 +36,20 @@ const {
watch(values, (val) => emit('update:modelValue', val), { deep: true })
// Define form fields
const [relatives, relativesAttrs] = defineField('relatives')
const [responsibleName, responsibleNameAttrs] = defineField('responsibleName')
const [responsiblePhone, responsiblePhoneAttrs] = defineField('responsiblePhone')
const [informant, informantAttrs] = defineField('informant')
const [witness1, witness1Attrs] = defineField('witness1')
const [witness2, witness2Attrs] = defineField('witness2')
const [tanggal, tanggalAttrs] = defineField('tanggal')
// const [relatives, relativesAttrs] = defineField('relatives')
const [date, dateAttrs] = defineField('date')
const [doctor, doctorAttrs] = defineField('doctor')
const [diagnosis, diagnosisAttrs] = defineField('diagnosis')
const [essay, essayAttrs] = defineField('essay')
const [plan, planAttrs] = defineField('plan')
const [note, noteAttrs] = defineField('note')
const tanggal = ref('')
const tanggalAttrs = ref({
type: 'date',
required: true,
disabled: props.isReadonly,
})
// Relatives list handling
const addRelative = () => {
@@ -77,9 +84,9 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Tanggal</Label>
<Field>
<Input
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="date"
v-bind="dateAttrs"
type="date"
/>
</Field>
</Cell>
@@ -87,9 +94,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Dokter</Label>
<Field>
<Input
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="doctor"
v-bind="doctorAttrs"
/>
</Field>
</Cell>
@@ -99,9 +105,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Diagnosis Penting</Label>
<Field>
<Textarea
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="diagnosis"
v-bind="diagnosisAttrs"
/>
</Field>
</Cell>
@@ -109,9 +114,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Uraian Klinik Penting</Label>
<Field>
<Textarea
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="essay"
v-bind="essayAttrs"
/>
</Field>
</Cell>
@@ -121,9 +125,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Rencana Penting</Label>
<Field>
<Textarea
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="plan"
v-bind="planAttrs"
/>
</Field>
</Cell>
@@ -131,9 +134,8 @@ const isExcluded = (key: string) => props.excludeFields?.includes(key)
<Label dynamic>Catatan</Label>
<Field>
<Textarea
v-model="tanggal"
v-bind="tanggalAttrs"
:disabled="props.isReadonly"
v-model="note"
v-bind="noteAttrs"
/>
</Field>
</Cell>
+19 -41
View File
@@ -1,13 +1,12 @@
<script setup lang="ts">
import { z } from 'zod'
import Entry from '~/components/app/summary-medic/entry.vue'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su-pr.vue'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import ActionDialog from '~/components/pub/my-ui/nav-footer/ba-su.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import { GeneralConsentSchema } from '~/schemas/general-consent.schema'
import { SummaryMedicSchema } from '~/schemas/soapi.schema'
import { toast } from '~/components/pub/ui/toast'
import { handleActionSave, handleActionEdit } from '~/handlers/general-consent.handler'
import { create } from '~/services/generate-file.service'
import { handleActionSave, handleActionEdit } from '~/handlers/soapi-early.handler'
// Services
import { getDetail } from '~/services/summary-medic.service'
const { backToList } = useQueryCRUDMode('mode')
@@ -23,18 +22,20 @@ const fungsional = ref([])
const selectedProcedure = ref<any>(null)
const selectedDiagnose = ref<any>(null)
const selectedFungsional = ref<any>(null)
const schema = GeneralConsentSchema
const schema = SummaryMedicSchema
const payload = ref({
typeCode: 'amb-resume',
encounter_id: 0,
time: '',
value: '',
})
const model = ref({
relatives: [],
responsibleName: '',
responsiblePhone: '',
informant: '',
witness1: '',
witness2: '',
date: '',
doctor: '',
diagnosis: '',
essay: '',
plan: '',
note: '',
})
const fileUrl = ref('')
@@ -63,9 +64,7 @@ async function getProcedures() {
onMounted(() => {
const mode = route.query.mode
const recordId = route.query['record-id']
if (mode === 'entry' && recordId) {
loadEntryForEdit(+recordId)
}
})
@@ -74,15 +73,6 @@ const loadEntryForEdit = async (id: number) => {
const result = await getDetail(id)
if (result?.success) {
const data = result.body?.data || {}
const value = JSON.parse(data.value || '{}')
model.value.witness1 = value?.witness1 || ''
model.value.witness2 = value?.witness2 || ''
model.value.informant = value?.informant || ''
model.value.responsibleName = value?.responsible || ''
model.value.responsiblePhone = value?.responsiblePhone || ''
model.value.relatives = value?.relatives || []
console.log('model', model.value)
}
}
@@ -103,19 +93,15 @@ async function actionHandler(type: string) {
return
}
if (type === 'print') {
const data = await getDetail(recordId.value)
const detail = data.body?.data
fileUrl.value = detail?.fileUrl
isOpenDiagnose.value = true
return
}
const result = await entryGeneralConsent.value?.validate()
if (result?.valid) {
if (result.data.relatives.length > 0) {
result.data.relatives = result.data.relatives.map((item: any) => {
return item.name
})
}
// if (result.data.relatives.length > 0) {
// result.data.relatives = result.data.relatives.map((item: any) => {
// return item.name
// })
// }
console.log('data', result)
const resp = await handleActionSave(
@@ -123,21 +109,13 @@ async function actionHandler(type: string) {
...payload.value,
value: JSON.stringify(result.data),
encounter_id: +route.params.id,
time: new Date().toISOString(),
},
() => {},
() => {},
toast,
)
const data = resp.body?.data
if (data) {
const resp2 = await create({
entityType_code: 'encounter',
ref_id: data?.id,
type_code: 'general-consent',
})
console.log('resp2', resp2.body?.data)
backToList()
}
backToList()
} else {
console.log('Ada error di form', result)
}
@@ -3,7 +3,7 @@
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import List from '~/components/app/summary-medic/list.vue'
import List from '~/components/app/soapi/list.vue'
import Entry from '~/components/app/summary-medic/entry.vue'
// Helpers
@@ -31,7 +31,7 @@ import {
} from '~/handlers/summary-medic.handler'
// Services
import { getList, getDetail } from '~/services/summary-medic.service'
import { getList, getDetail } from '~/services/soapi-early.service'
// Models
import type { Encounter } from '~/models/encounter'
@@ -61,7 +61,13 @@ const {
fetchData: getMyList,
} = usePaginatedList({
fetchFn: async ({ page, search }) => {
const result = await getList({ 'encounter-id': props.encounter.id, includes: '', search, page })
const result = await getList({
'encounter-id': route.params.id,
includes: 'encounter,employee',
'type-code': 'amb-resume',
search,
page,
})
if (result.success) {
data.value = result.body.data
}
+9
View File
@@ -153,6 +153,15 @@ export const ObjectSchema = z.object({
'head-to-toe': z.record(z.string()).default({}),
})
export const SummaryMedicSchema = z.object({
date: z.string().default(''),
doctor: z.string().default(''),
diagnosis: z.string().default(''),
essay: z.string().default(''),
plan: z.string().default(''),
note: z.string().default(''),
})
const AssessmentSchema = z.object({
'early-diag': AssessmentSectionSchema,
'late-diag': AssessmentSectionSchema,