Fix: Refactor surat kontrol

This commit is contained in:
hasyim_kai
2025-11-13 11:56:21 +07:00
parent a14c4a5d3c
commit f582090d18
17 changed files with 17 additions and 18 deletions
@@ -36,11 +36,10 @@ async function fetchDpjp(specialistId: string, subspecialistId: string) {
doctors.value = await getDoctorLabelList({ doctors.value = await getDoctorLabelList({
serviceType: 1, serviceType: 1,
serviceDate: new Date().toISOString().substring(0, 10), serviceDate: new Date().toISOString().substring(0, 10),
specialistCode: 0,
includes: 'employee-person', includes: 'employee-person',
// "unit-id": parseInt(unitId), // "unit-id": parseInt(unitId),
"specialist-id": String(specialistId), "specialist-code": String(specialistId),
"subspecialist-id": String(subspecialistId), "subspecialist-code": String(subspecialistId),
}, true) }, true)
} }
@@ -53,7 +52,8 @@ const selectedSubSpecialistId = inject<Ref<string | null>>("selectedSubSpecialis
// } // }
watch([ selectedSpecialistId, selectedSubSpecialistId], () => { watch([ selectedSpecialistId, selectedSubSpecialistId], () => {
if ( selectedSpecialistId.value && selectedSubSpecialistId.value) { if (selectedSpecialistId.value && selectedSubSpecialistId.value) {
console.log(`Select Doctor`)
fetchDpjp( selectedSpecialistId.value, selectedSubSpecialistId.value) fetchDpjp( selectedSpecialistId.value, selectedSubSpecialistId.value)
} }
}) })
@@ -54,7 +54,6 @@ watch([selectedUnitId], () => {
fetchSpecialists(selectedUnitId.value) fetchSpecialists(selectedUnitId.value)
} }
}) })
console.log(selectedUnitId.value)
</script> </script>
<template> <template>
@@ -37,7 +37,7 @@ async function fetchSubSpecialists(specialistId: string) {
serviceType: 1, serviceType: 1,
serviceDate: new Date().toISOString().substring(0, 10), serviceDate: new Date().toISOString().substring(0, 10),
specialistCode: 0, specialistCode: 0,
"specialist-id": String(specialistId), "specialist-code": String(specialistId),
}, true) }, true)
} }
@@ -108,7 +108,7 @@ provide("selectedSubSpecialistId", selectedSubSpecialistId);
<template> <template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Tambah Surat Kontrol</div> <div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Tambah Surat Kontrol</div>
<AppOutpatientEncounterEntryForm <AppControlLetterEntryForm
ref="controlLetterForm" ref="controlLetterForm"
:schema="ControlLetterSchema" :schema="ControlLetterSchema"
:selected-unit-id="selectedUnitId" :selected-unit-id="selectedUnitId"
@@ -75,5 +75,5 @@ function handleAction(type: string) {
<template> <template>
<Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" /> <Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" />
<AppOutpatientEncounterPreview :instance="controlLetter" @click="handleAction" /> <AppControlLetterPreview :instance="controlLetter" @click="handleAction" />
</template> </template>
@@ -61,9 +61,9 @@ onMounted(async () => {
const result = await getDetail(controlLetterId) const result = await getDetail(controlLetterId)
if (result.success) { if (result.success) {
const responseData = {...result.body.data, date: formatDateYyyyMmDd(result.body.data.date)} const responseData = {...result.body.data, date: formatDateYyyyMmDd(result.body.data.date)}
selectedUnitId.value = responseData?.unit_id selectedUnitId.value = responseData?.unit_code
selectedSpecialistId.value = responseData?.specialist_id selectedSpecialistId.value = responseData?.specialist_code
selectedSubSpecialistId.value = responseData?.subspecialist_id selectedSubSpecialistId.value = responseData?.subspecialist_code
controlLetter.value = responseData controlLetter.value = responseData
controlLetterForm.value?.setValues(responseData) controlLetterForm.value?.setValues(responseData)
@@ -135,7 +135,7 @@ provide("selectedSubSpecialistId", selectedSubSpecialistId);
<template> <template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Update Surat Kontrol</div> <div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Update Surat Kontrol</div>
<AppOutpatientEncounterEntryForm <AppControlLetterEntryForm
ref="controlLetterForm" ref="controlLetterForm"
:schema="ControlLetterSchema" :schema="ControlLetterSchema"
:selected-unit-id="selectedUnitId" :selected-unit-id="selectedUnitId"
@@ -151,7 +151,7 @@ watch([recId, recAction], () => {
:ref-search-nav="refSearchNav" :ref-search-nav="refSearchNav"
@search="handleSearch" /> @search="handleSearch" />
<AppOutpatientEncounterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <AppControlLetterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem" <RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation"> @confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
+2 -2
View File
@@ -16,7 +16,7 @@ import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue' import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
import PrescriptionList from '~/components/content/prescription/list.vue' import PrescriptionList from '~/components/content/prescription/list.vue'
import Consultation from '~/components/content/consultation/list.vue' import Consultation from '~/components/content/consultation/list.vue'
import EncounterList from '~/components/content/outpatient/encounter/list.vue' import ControlLetterList from '~/components/content/control-letter/list.vue'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
@@ -71,7 +71,7 @@ const tabs: TabItem[] = [
{ value: 'mcu-result', label: 'Hasil Penunjang' }, { value: 'mcu-result', label: 'Hasil Penunjang' },
{ value: 'consultation', label: 'Konsultasi', component: Consultation, props: { encounter: data } }, { value: 'consultation', label: 'Konsultasi', component: Consultation, props: { encounter: data } },
{ value: 'resume', label: 'Resume' }, { value: 'resume', label: 'Resume' },
{ value: 'control', label: 'Surat Kontrol', component: EncounterList, props: { encounter: data } }, { value: 'control', label: 'Surat Kontrol', component: ControlLetterList, props: { encounter: data } },
{ value: 'screening', label: 'Skrinning MPP' }, { value: 'screening', label: 'Skrinning MPP' },
{ value: 'supporting-document', label: 'Upload Dokumen Pendukung' }, { value: 'supporting-document', label: 'Upload Dokumen Pendukung' },
] ]
@@ -34,7 +34,7 @@ const canRead = true
<template> <template>
<div> <div>
<div v-if="canRead"> <div v-if="canRead">
<ContentOutpatientEncounterEdit /> <ContentControlLetterEdit />
</div> </div>
<Error v-else :status-code="403" /> <Error v-else :status-code="403" />
</div> </div>
@@ -34,7 +34,7 @@ const canRead = true
<template> <template>
<div> <div>
<div v-if="canRead"> <div v-if="canRead">
<ContentOutpatientEncounterDetail :patient-id="Number(route.params.id)" /> <ContentControlLetterDetail :patient-id="Number(route.params.id)" />
</div> </div>
<Error v-else :status-code="403" /> <Error v-else :status-code="403" />
</div> </div>
@@ -35,7 +35,7 @@ const callbackUrl = route.query['return-path'] as string | undefined
<template> <template>
<div> <div>
<div v-if="canRead"> <div v-if="canRead">
<ContentOutpatientEncounterAdd :callback-url="callbackUrl" /> <ContentControlLetterAdd :callback-url="callbackUrl" />
</div> </div>
<Error v-else :status-code="403" /> <Error v-else :status-code="403" />
</div> </div>