feat(sep): adjust entry form of sep
This commit is contained in:
@@ -11,10 +11,12 @@ import { Textarea } from '~/components/pub/ui/textarea'
|
||||
import Select from '~/components/pub/ui/select/Select.vue'
|
||||
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
|
||||
import TreeSelect from '~/components/pub/my-ui/select-tree/tree-select.vue'
|
||||
|
||||
// Types
|
||||
import { IntegrationBpjsSchema, type IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema'
|
||||
import type { PatientEntity } from '~/models/patient'
|
||||
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
||||
|
||||
// Helpers
|
||||
import { watch } from 'vue'
|
||||
@@ -45,6 +47,7 @@ const props = defineProps<{
|
||||
provinces: any[]
|
||||
cities: any[]
|
||||
districts: any[]
|
||||
specialists?: TreeItem[]
|
||||
patient?: PatientEntity | null | undefined
|
||||
objects?: any
|
||||
values?: any
|
||||
@@ -96,6 +99,7 @@ const [accidentCity, accidentCityAttrs] = defineField('accidentCity')
|
||||
const [accidentDistrict, accidentDistrictAttrs] = defineField('accidentDistrict')
|
||||
const [suplesi, suplesiAttrs] = defineField('suplesi')
|
||||
const [suplesiNumber, suplesiNumberAttrs] = defineField('suplesiNumber')
|
||||
const [subSpecialistId, subSpecialistIdAttrs] = defineField('subSpecialistId')
|
||||
const titleLetterNumber = computed(() => (admissionType.value === '3' ? 'Surat Kontrol' : 'Surat Rujukan'))
|
||||
const titleLetterDate = computed(() =>
|
||||
admissionType.value === '3' ? 'Tanggal Surat Kontrol' : 'Tanggal Surat Rujukan',
|
||||
@@ -123,6 +127,10 @@ if (mode === 'add') {
|
||||
sepDate.value = `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
async function onFetchChildren(parentId: string): Promise<void> {
|
||||
console.log('onFetchChildren', parentId)
|
||||
}
|
||||
|
||||
// Submit handler
|
||||
const onSubmit = handleSubmit((values) => {
|
||||
console.log('✅ Validated form values:', JSON.stringify(values, null, 2))
|
||||
@@ -456,7 +464,7 @@ onMounted(() => {
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Cell v-if="isShowPatient">
|
||||
<Label height="compact">
|
||||
Klinik Tujuan
|
||||
<span class="text-red-500">*</span>
|
||||
@@ -476,6 +484,22 @@ onMounted(() => {
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Spesialis / Subspesialis
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.subSpecialistId">
|
||||
<TreeSelect
|
||||
id="subSpecialistId"
|
||||
v-model="subSpecialistId"
|
||||
v-bind="subSpecialistIdAttrs"
|
||||
:data="specialists || []"
|
||||
:on-fetch-children="onFetchChildren"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
DPJP
|
||||
|
||||
@@ -11,6 +11,7 @@ import { toast } from '~/components/pub/ui/toast'
|
||||
|
||||
// Types
|
||||
import type { SepHistoryData } from '~/components/app/sep/list-cfg.history'
|
||||
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
||||
|
||||
// Constants
|
||||
import {
|
||||
@@ -27,6 +28,10 @@ import {
|
||||
} from '~/lib/constants.vclaim'
|
||||
|
||||
// Services
|
||||
import {
|
||||
getList as getSpecialistList,
|
||||
getValueTreeItems as getSpecialistTreeItems,
|
||||
} from '~/services/specialist.service'
|
||||
import { getValueLabelList as getProvinceList } from '~/services/vclaim-region-province.service'
|
||||
import { getValueLabelList as getCityList } from '~/services/vclaim-region-city.service'
|
||||
import { getValueLabelList as getDistrictList } from '~/services/vclaim-region-district.service'
|
||||
@@ -79,6 +84,7 @@ const classPaySourcesList = ref<Array<{ value: string; label: string }>>([])
|
||||
const isServiceHidden = ref(false)
|
||||
const isSaveLoading = ref(false)
|
||||
const isLetterReadonly = ref(false)
|
||||
const specialistsTree = ref<TreeItem[]>([])
|
||||
const resourceType = ref('')
|
||||
const resourcePath = ref('')
|
||||
|
||||
@@ -247,7 +253,8 @@ async function handleEvent(menu: string, value: any) {
|
||||
if (menu === 'search-patient-by-identifier') {
|
||||
const text = value.text
|
||||
const type = value.type
|
||||
if (type === 'nationalId') {
|
||||
const prevCardNumber = selectedPatientObject.value?.person?.residentIdentityNumber || ''
|
||||
if (type === 'nationalId' && text !== prevCardNumber) {
|
||||
getPatientByIdentifierSearch(text)
|
||||
}
|
||||
return
|
||||
@@ -336,6 +343,18 @@ async function handleFetch(params: any) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFetchSpecialists() {
|
||||
try {
|
||||
const specialistsResult = await getSpecialistList({ 'page-size': 100, includes: 'subspecialists' })
|
||||
if (specialistsResult.success) {
|
||||
const specialists = specialistsResult.body?.data || []
|
||||
specialistsTree.value = getSpecialistTreeItems(specialists)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching specialist-subspecialist tree:', error)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleInit() {
|
||||
const facilities = await getHealthFacilityLabelList({
|
||||
healthcare: 'Puskesmas',
|
||||
@@ -392,6 +411,7 @@ async function handleInit() {
|
||||
value: item.toString(),
|
||||
label: classPaySources[item],
|
||||
})) as any
|
||||
await handleFetchSpecialists()
|
||||
if (route.query) {
|
||||
const queries = route.query as any
|
||||
isServiceHidden.value = queries['is-service'] === 'true'
|
||||
@@ -448,6 +468,8 @@ onMounted(async () => {
|
||||
SEP
|
||||
</div>
|
||||
<AppSepEntryForm
|
||||
:is-save-loading="isSaveLoading"
|
||||
:is-service="isServiceHidden"
|
||||
:doctors="doctors"
|
||||
:diagnoses="diagnoses"
|
||||
:facilities-from="facilitiesFrom"
|
||||
@@ -465,8 +487,7 @@ onMounted(async () => {
|
||||
:class-levels="classLevelsList"
|
||||
:class-level-upgrades="classLevelUpgradesList"
|
||||
:class-pay-sources="classPaySourcesList"
|
||||
:is-save-loading="isSaveLoading"
|
||||
:is-service="isServiceHidden"
|
||||
:specialists="specialistsTree"
|
||||
:patient="selectedPatientObject"
|
||||
:objects="selectedObjects"
|
||||
@fetch="handleFetch"
|
||||
|
||||
@@ -19,6 +19,7 @@ const ERROR_MESSAGES = {
|
||||
cob: 'COB wajib diisi',
|
||||
cataract: 'Katarak wajib diisi',
|
||||
clinicExcecutive: 'Klinkik eksekutif wajib diisi',
|
||||
subSpecialistId: 'Subspesialis wajib diisi',
|
||||
procedureType: 'Jenis Prosedur wajib diisi',
|
||||
supportCode: 'Kode Penunjang wajib diisi',
|
||||
note: 'Catatan wajib diisi',
|
||||
@@ -89,6 +90,10 @@ const IntegrationBpjsSchema = z
|
||||
clinicExcecutive: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.clinicExcecutive })
|
||||
.min(1, ERROR_MESSAGES.required.clinicExcecutive),
|
||||
subSpecialistId: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.subSpecialistId })
|
||||
.min(1, ERROR_MESSAGES.required.subSpecialistId)
|
||||
.optional(),
|
||||
procedureType: z
|
||||
.string({ required_error: ERROR_MESSAGES.required.procedureType })
|
||||
.min(1, ERROR_MESSAGES.required.procedureType)
|
||||
|
||||
Reference in New Issue
Block a user