feat(sep): refactor schema

This commit is contained in:
riefive
2025-10-21 14:56:42 +07:00
parent 539b70b4b7
commit 437d1f3fc7
4 changed files with 53 additions and 37 deletions
+18 -19
View File
@@ -26,6 +26,7 @@ const props = defineProps<{
doctors: any[]
diagnoses: any[]
facilities: any[]
supportCodes: any[]
patient?: PatientEntity | null | undefined
values?: any
}>()
@@ -43,12 +44,6 @@ const admissionTypes = [
{ value: '2', label: 'Rujukan' },
]
const items = [
{ value: 'item-1', label: 'Item 1' },
{ value: 'item-2', label: 'Item 2' },
{ value: 'item-3', label: 'Item 3' },
]
// Validation schema (moved to shared file)
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationBpjsFormData>({
validationSchema: toTypedSchema(IntegrationBpjsSchema),
@@ -69,8 +64,10 @@ const [attendingDoctor, attendingDoctorAttrs] = defineField('attendingDoctor')
const [initialDiagnosis, initialDiagnosisAttrs] = defineField('initialDiagnosis')
const [cob, cobAttrs] = defineField('cob')
const [cataract, cataractAttrs] = defineField('cataract')
const [clinicExcecutive, clinicExcecutiveAttrs] = defineField('clinicExcecutive')
const [procedureType, procedureTypeAttrs] = defineField('procedureType')
const [supportCode, supportCodeAttrs] = defineField('supportCode')
const [note, noteAttrs] = defineField('note')
// Submit handler
const onSubmit = handleSubmit((values) => {
@@ -313,23 +310,23 @@ watch(props, (value) => {
</Label>
<Field :errMessage="errors.cob">
<RadioGroup
v-model="cob"
v-model="clinicExcecutive"
v-bind="clinicExcecutiveAttrs"
class="flex items-center gap-2"
v-bind="cobAttrs"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="yes"
id="cob-yes"
id="clinicExcecutive-yes"
/>
<Label for="cob-yes">Ya</Label>
<Label for="clinicExcecutive-yes">Ya</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="no"
id="cob-no"
id="clinicExcecutive-no"
/>
<Label for="cob-no">Tidak</Label>
<Label for="clinicExcecutive-no">Tidak</Label>
</div>
</RadioGroup>
</Field>
@@ -350,7 +347,7 @@ watch(props, (value) => {
placeholder="Pilih DPJP"
search-placeholder="Cari DPJP"
empty-message="Item tidak ditemukan"
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
/>
</Field>
</Cell>
@@ -379,7 +376,7 @@ watch(props, (value) => {
<Block
labelSize="thin"
class="!pt-0"
:colCount="1"
:colCount="2"
:cellFlex="false"
>
<Cell>
@@ -387,6 +384,8 @@ watch(props, (value) => {
<Field>
<Textarea
id="note"
v-model="note"
v-bind="noteAttrs"
class="h-[200px] w-full border-gray-400 bg-white"
placeholder="Masukkan catatan opsional"
:disabled="isLoading || isReadonly"
@@ -402,8 +401,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cob">
<RadioGroup
v-model="cob"
class="flex items-center gap-2"
v-bind="cobAttrs"
class="flex items-center gap-2"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
@@ -431,8 +430,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cataract">
<RadioGroup
v-model="cataract"
class="flex items-center gap-2"
v-bind="cataractAttrs"
class="flex items-center gap-2"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
@@ -465,14 +464,14 @@ watch(props, (value) => {
>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="procedure-one"
value="0"
id="procedure-one"
/>
<Label for="procedure-one">Prosedur tidak berkelanjutan</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="procedure-two"
value="1"
id="procedure-two"
/>
<Label for="procedure-two">Prosedur dan terapi berkelanjutan</Label>
@@ -499,7 +498,7 @@ watch(props, (value) => {
icon-name="i-lucide-chevron-down"
v-model="supportCode"
v-bind="supportCodeAttrs"
:items="items"
:items="supportCodes"
:disabled="isLoading || isReadonly"
placeholder="Pilih Kode Penunjang"
/>
+8 -2
View File
@@ -10,6 +10,9 @@ import type { PatientEntity } from '~/models/patient'
import type { SepHistoryData } from '~/components/app/sep/list-cfg.history'
import type { SepVisitData } from '~/components/app/sep/list-cfg.visit'
// Constants
import { supportCodes } from '~/lib/constants'
// Services
import { getPatientDetail, getPatients } from '~/services/patient.service'
import { getList as getProvinceList } from '~/services/vclaim-region-province.service'
@@ -35,6 +38,7 @@ const patients = ref<Array<{ id: string; identity: string; number: string; bpjs:
const doctors = ref<Array<{ value: string | number; label: string }>>([])
const diagnoses = ref<Array<{ value: string | number; label: string }>>([])
const facilities = ref<Array<{ value: string | number; label: string }>>([])
const supportCodesList = ref<Array<{ value: string; label: string }>>([])
const isPatientsLoading = ref(false)
const paginationMeta = ref<PaginationMeta>({
recordCount: 0,
@@ -203,7 +207,7 @@ function handleSaveLetter() {
console.log('Letter dipilih:', selectedLetter.value)
}
function handleEvent(menu: string, value: string) {
function handleEvent(menu: string, value: any) {
if (menu === 'admission-type') {
console.log('service-type:', value)
return
@@ -230,7 +234,7 @@ function handleEvent(menu: string, value: string) {
navigateTo('/integration/bpjs/sep')
}
if (menu === 'save-sep') {
createSep(createSepPayload()).then(() => {
createSep(createSepPayload(value)).then(() => {
navigateTo('/integration/bpjs/sep')
})
}
@@ -270,6 +274,7 @@ onMounted(async () => {
getDiagnoseReferralList().then((value) => {
console.log('value:', value)
})
supportCodesList.value = Object.keys(supportCodes).map((item) => ({ value: item.toString(), label: supportCodes[item] })) as any
})
</script>
@@ -287,6 +292,7 @@ onMounted(async () => {
:diagnoses="diagnoses"
:facilities="facilities"
:patient="selectedPatientObject"
:support-codes="supportCodesList"
@fetch="handleFetch"
@event="handleEvent"
/>