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

No files matched your search

+18 -19
View File
@@ -26,6 +26,7 @@ const props = defineProps<{
doctors: any[] doctors: any[]
diagnoses: any[] diagnoses: any[]
facilities: any[] facilities: any[]
supportCodes: any[]
patient?: PatientEntity | null | undefined patient?: PatientEntity | null | undefined
values?: any values?: any
}>() }>()
@@ -43,12 +44,6 @@ const admissionTypes = [
{ value: '2', label: 'Rujukan' }, { 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) // Validation schema (moved to shared file)
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationBpjsFormData>({ const { handleSubmit, errors, defineField, meta } = useForm<IntegrationBpjsFormData>({
validationSchema: toTypedSchema(IntegrationBpjsSchema), validationSchema: toTypedSchema(IntegrationBpjsSchema),
@@ -69,8 +64,10 @@ const [attendingDoctor, attendingDoctorAttrs] = defineField('attendingDoctor')
const [initialDiagnosis, initialDiagnosisAttrs] = defineField('initialDiagnosis') const [initialDiagnosis, initialDiagnosisAttrs] = defineField('initialDiagnosis')
const [cob, cobAttrs] = defineField('cob') const [cob, cobAttrs] = defineField('cob')
const [cataract, cataractAttrs] = defineField('cataract') const [cataract, cataractAttrs] = defineField('cataract')
const [clinicExcecutive, clinicExcecutiveAttrs] = defineField('clinicExcecutive')
const [procedureType, procedureTypeAttrs] = defineField('procedureType') const [procedureType, procedureTypeAttrs] = defineField('procedureType')
const [supportCode, supportCodeAttrs] = defineField('supportCode') const [supportCode, supportCodeAttrs] = defineField('supportCode')
const [note, noteAttrs] = defineField('note')
// Submit handler // Submit handler
const onSubmit = handleSubmit((values) => { const onSubmit = handleSubmit((values) => {
@@ -313,23 +310,23 @@ watch(props, (value) => {
</Label> </Label>
<Field :errMessage="errors.cob"> <Field :errMessage="errors.cob">
<RadioGroup <RadioGroup
v-model="cob" v-model="clinicExcecutive"
v-bind="clinicExcecutiveAttrs"
class="flex items-center gap-2" class="flex items-center gap-2"
v-bind="cobAttrs"
> >
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
value="yes" value="yes"
id="cob-yes" id="clinicExcecutive-yes"
/> />
<Label for="cob-yes">Ya</Label> <Label for="clinicExcecutive-yes">Ya</Label>
</div> </div>
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
value="no" value="no"
id="cob-no" id="clinicExcecutive-no"
/> />
<Label for="cob-no">Tidak</Label> <Label for="clinicExcecutive-no">Tidak</Label>
</div> </div>
</RadioGroup> </RadioGroup>
</Field> </Field>
@@ -350,7 +347,7 @@ watch(props, (value) => {
placeholder="Pilih DPJP" placeholder="Pilih DPJP"
search-placeholder="Cari DPJP" search-placeholder="Cari DPJP"
empty-message="Item tidak ditemukan" empty-message="Item tidak ditemukan"
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })" @update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
/> />
</Field> </Field>
</Cell> </Cell>
@@ -379,7 +376,7 @@ watch(props, (value) => {
<Block <Block
labelSize="thin" labelSize="thin"
class="!pt-0" class="!pt-0"
:colCount="1" :colCount="2"
:cellFlex="false" :cellFlex="false"
> >
<Cell> <Cell>
@@ -387,6 +384,8 @@ watch(props, (value) => {
<Field> <Field>
<Textarea <Textarea
id="note" id="note"
v-model="note"
v-bind="noteAttrs"
class="h-[200px] w-full border-gray-400 bg-white" class="h-[200px] w-full border-gray-400 bg-white"
placeholder="Masukkan catatan opsional" placeholder="Masukkan catatan opsional"
:disabled="isLoading || isReadonly" :disabled="isLoading || isReadonly"
@@ -402,8 +401,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cob"> <Field :errMessage="errors.cob">
<RadioGroup <RadioGroup
v-model="cob" v-model="cob"
class="flex items-center gap-2"
v-bind="cobAttrs" v-bind="cobAttrs"
class="flex items-center gap-2"
> >
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
@@ -431,8 +430,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cataract"> <Field :errMessage="errors.cataract">
<RadioGroup <RadioGroup
v-model="cataract" v-model="cataract"
class="flex items-center gap-2"
v-bind="cataractAttrs" v-bind="cataractAttrs"
class="flex items-center gap-2"
> >
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
@@ -465,14 +464,14 @@ watch(props, (value) => {
> >
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
value="procedure-one" value="0"
id="procedure-one" id="procedure-one"
/> />
<Label for="procedure-one">Prosedur tidak berkelanjutan</Label> <Label for="procedure-one">Prosedur tidak berkelanjutan</Label>
</div> </div>
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<RadioGroupItem <RadioGroupItem
value="procedure-two" value="1"
id="procedure-two" id="procedure-two"
/> />
<Label for="procedure-two">Prosedur dan terapi berkelanjutan</Label> <Label for="procedure-two">Prosedur dan terapi berkelanjutan</Label>
@@ -499,7 +498,7 @@ watch(props, (value) => {
icon-name="i-lucide-chevron-down" icon-name="i-lucide-chevron-down"
v-model="supportCode" v-model="supportCode"
v-bind="supportCodeAttrs" v-bind="supportCodeAttrs"
:items="items" :items="supportCodes"
:disabled="isLoading || isReadonly" :disabled="isLoading || isReadonly"
placeholder="Pilih Kode Penunjang" 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 { SepHistoryData } from '~/components/app/sep/list-cfg.history'
import type { SepVisitData } from '~/components/app/sep/list-cfg.visit' import type { SepVisitData } from '~/components/app/sep/list-cfg.visit'
// Constants
import { supportCodes } from '~/lib/constants'
// Services // Services
import { getPatientDetail, getPatients } from '~/services/patient.service' import { getPatientDetail, getPatients } from '~/services/patient.service'
import { getList as getProvinceList } from '~/services/vclaim-region-province.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 doctors = ref<Array<{ value: string | number; label: string }>>([])
const diagnoses = 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 facilities = ref<Array<{ value: string | number; label: string }>>([])
const supportCodesList = ref<Array<{ value: string; label: string }>>([])
const isPatientsLoading = ref(false) const isPatientsLoading = ref(false)
const paginationMeta = ref<PaginationMeta>({ const paginationMeta = ref<PaginationMeta>({
recordCount: 0, recordCount: 0,
@@ -203,7 +207,7 @@ function handleSaveLetter() {
console.log('Letter dipilih:', selectedLetter.value) console.log('Letter dipilih:', selectedLetter.value)
} }
function handleEvent(menu: string, value: string) { function handleEvent(menu: string, value: any) {
if (menu === 'admission-type') { if (menu === 'admission-type') {
console.log('service-type:', value) console.log('service-type:', value)
return return
@@ -230,7 +234,7 @@ function handleEvent(menu: string, value: string) {
navigateTo('/integration/bpjs/sep') navigateTo('/integration/bpjs/sep')
} }
if (menu === 'save-sep') { if (menu === 'save-sep') {
createSep(createSepPayload()).then(() => { createSep(createSepPayload(value)).then(() => {
navigateTo('/integration/bpjs/sep') navigateTo('/integration/bpjs/sep')
}) })
} }
@@ -270,6 +274,7 @@ onMounted(async () => {
getDiagnoseReferralList().then((value) => { getDiagnoseReferralList().then((value) => {
console.log('value:', value) console.log('value:', value)
}) })
supportCodesList.value = Object.keys(supportCodes).map((item) => ({ value: item.toString(), label: supportCodes[item] })) as any
}) })
</script> </script>
@@ -287,6 +292,7 @@ onMounted(async () => {
:diagnoses="diagnoses" :diagnoses="diagnoses"
:facilities="facilities" :facilities="facilities"
:patient="selectedPatientObject" :patient="selectedPatientObject"
:support-codes="supportCodesList"
@fetch="handleFetch" @fetch="handleFetch"
@event="handleEvent" @event="handleEvent"
/> />
+5
View File
@@ -1,3 +1,4 @@
import { not } from "@vueuse/math"
import { z } from 'zod' import { z } from 'zod'
const ERROR_MESSAGES = { const ERROR_MESSAGES = {
@@ -16,8 +17,10 @@ const ERROR_MESSAGES = {
initialDiagnosis: 'Diagnosa Awal wajib diisi', initialDiagnosis: 'Diagnosa Awal wajib diisi',
cob: 'COB wajib diisi', cob: 'COB wajib diisi',
cataract: 'Katarak wajib diisi', cataract: 'Katarak wajib diisi',
clinicExcecutive: 'Klinkik eksekutif wajib diisi',
procedureType: 'Jenis Prosedur wajib diisi', procedureType: 'Jenis Prosedur wajib diisi',
supportCode: 'Kode Penunjang wajib diisi', supportCode: 'Kode Penunjang wajib diisi',
note: 'Catatan wajib diisi',
}, },
} }
@@ -58,12 +61,14 @@ const IntegrationBpjsSchema = z.object({
.min(1, ERROR_MESSAGES.required.initialDiagnosis), .min(1, ERROR_MESSAGES.required.initialDiagnosis),
cob: z.string({ required_error: ERROR_MESSAGES.required.cob }).min(1, ERROR_MESSAGES.required.cob), cob: z.string({ required_error: ERROR_MESSAGES.required.cob }).min(1, ERROR_MESSAGES.required.cob),
cataract: z.string({ required_error: ERROR_MESSAGES.required.cataract }).min(1, ERROR_MESSAGES.required.cataract), cataract: z.string({ required_error: ERROR_MESSAGES.required.cataract }).min(1, ERROR_MESSAGES.required.cataract),
clinicExcecutive: z.string({ required_error: ERROR_MESSAGES.required.clinicExcecutive }).min(1, ERROR_MESSAGES.required.clinicExcecutive),
procedureType: z procedureType: z
.string({ required_error: ERROR_MESSAGES.required.procedureType }) .string({ required_error: ERROR_MESSAGES.required.procedureType })
.min(1, ERROR_MESSAGES.required.procedureType), .min(1, ERROR_MESSAGES.required.procedureType),
supportCode: z supportCode: z
.string({ required_error: ERROR_MESSAGES.required.supportCode }) .string({ required_error: ERROR_MESSAGES.required.supportCode })
.min(1, ERROR_MESSAGES.required.supportCode), .min(1, ERROR_MESSAGES.required.supportCode),
note: z.string({ required_error: ERROR_MESSAGES.required.note }).min(1, ERROR_MESSAGES.required.note).optional(),
}) })
type IntegrationBpjsFormData = z.infer<typeof IntegrationBpjsSchema> type IntegrationBpjsFormData = z.infer<typeof IntegrationBpjsSchema>
+22 -16
View File
@@ -8,48 +8,54 @@ export function create(data: any) {
return base.create(path, data, name) return base.create(path, data, name)
} }
export function createPayload() { export function createPayload(data: any) {
// "nationalId": "5617213001231231",
// "referralLetterNumber": "12233",
// "referralLetterDate": "2025-10-21",
// "attendingDoctor": "25107",
console.log('data:', data)
const content = { const content = {
noKartu: '0001116500714', noKartu: data.bpjsNumber || '',
tglSep: '2025-08-21', tglSep: data.sepDate,
ppkPelayanan: '1323R001', ppkPelayanan: '1323R001',
jnsPelayanan: '2', jnsPelayanan: data.admissionType ? String(data.admissionType) : '1',
klsRawat: { klsRawat: {
klsRawatHak: '2', klsRawatHak: '2',
klsRawatNaik: '', klsRawatNaik: '',
pembiayaan: '', pembiayaan: '',
penanggungJawab: '', penanggungJawab: '',
}, },
noMR: 'MR9835', noMR: data.med,
rujukan: { rujukan: {
asalRujukan: '1', asalRujukan: '1',
tglRujukan: '2025-08-20', tglRujukan: '2025-08-20',
noRujukan: 'RJKMR9835001', noRujukan: 'RJKMR9835001',
ppkRujukan: '0301R011', ppkRujukan: '0301R011',
}, },
catatan: 'testinsert RI', catatan: data.note || '',
diagAwal: 'E10', diagAwal: data.initialDiagnosis || '',
poli: { poli: {
tujuan: '', tujuan: data.destinationClinic || '',
eksekutif: '0', eksekutif: data.clinicExcecutive === 'yes' ? '1' : '0',
}, },
cob: { cob: {
cob: '0', cob: data.cob === 'yes' ? '1' : '0',
}, },
katarak: { katarak: {
katarak: '0', katarak: data.cataract === 'yes' ? '1' : '0',
}, },
tujuanKunj: '0', tujuanKunj: data.destinationClinic || '',
flagProcedure: '', flagProcedure: data.procedureType || '',
kdPenunjang: '', kdPenunjang: data.supportCode || '',
assesmentPel: '', assesmentPel: '',
skdp: { skdp: {
noSurat: '0208R0060825K000001', noSurat: '0208R0060825K000001',
kodeDPJP: '6546', kodeDPJP: '6546',
}, },
dpjpLayan: '000002', dpjpLayan: '000002',
noTelp: '081111111101', noTelp: data.phoneNumber || '',
user: 'Coba Ws', user: data.patientName || '',
jaminan: { jaminan: {
lakaLantas: '0', lakaLantas: '0',
noLP: '12345', noLP: '12345',