diff --git a/app/components/app/sep/entry-form.vue b/app/components/app/sep/entry-form.vue index e5ad833a..1ef55b58 100644 --- a/app/components/app/sep/entry-form.vue +++ b/app/components/app/sep/entry-form.vue @@ -27,7 +27,8 @@ const props = defineProps<{ mode?: string doctors: any[] diagnoses: any[] - facilities: any[] + facilitiesFrom: any[] + facilitiesTo: any[] serviceTypes: any[] registerMethods: any[] accidents: any[] @@ -376,12 +377,12 @@ watch(props, (value) => { id="fromClinic" v-model="fromClinic" v-bind="fromClinicAttrs" - :items="facilities" + :items="facilitiesFrom" :is-disabled="isLoading || isReadonly" placeholder="Pilih Asal" search-placeholder="Cari Asal" empty-message="Item tidak ditemukan" - @update:searchText="emit('fetch', { menu: 'clinic', value: $event })" + @update:searchText="emit('fetch', { menu: 'clinic-from', value: $event })" /> @@ -396,12 +397,12 @@ watch(props, (value) => { id="destinationClinic" v-model="destinationClinic" v-bind="destinationClinicAttrs" - :items="facilities" + :items="facilitiesTo" :is-disabled="isLoading || isReadonly" placeholder="Pilih Klinik" search-placeholder="Cari Klinik" empty-message="Item tidak ditemukan" - @update:searchText="emit('fetch', { menu: 'clinic', value: $event })" + @update:searchText="emit('fetch', { menu: 'clinic-to', value: $event })" /> diff --git a/app/components/content/sep/entry.vue b/app/components/content/sep/entry.vue index e153aa5f..0d9e385b 100644 --- a/app/components/content/sep/entry.vue +++ b/app/components/content/sep/entry.vue @@ -32,7 +32,7 @@ import { getValueLabelList as getHealthFacilityLabelList } from '~/services/vcla import { getValueLabelList as getDiagnoseLabelList } from '~/services/vclaim-diagnose.service' import { getList as geMonitoringVisitList } from '~/services/vclaim-monitoring-visit.service' import { getList as getMonitoringHistoryList } from '~/services/vclaim-monitoring-history.service' -import { create as createSep, createPayload as createSepPayload } from '~/services/vclaim-sep.service' +import { create as createSep, makeSepData } from '~/services/vclaim-sep.service' const route = useRoute() const openPatient = ref(false) @@ -48,7 +48,8 @@ const visits = ref>([]) const patients = ref>([]) const doctors = ref>([]) const diagnoses = ref>([]) -const facilities = ref>([]) +const facilitiesFrom = ref>([]) +const facilitiesTo = ref>([]) const supportCodesList = ref>([]) const serviceTypesList = ref>([]) const registerMethodsList = ref>([]) @@ -227,11 +228,19 @@ function handleSaveLetter() { console.log('Letter dipilih:', selectedLetter.value) } -function handleEvent(menu: string, value: any) { +async function handleEvent(menu: string, value: any) { if (menu === 'admission-type') { console.log('service-type:', value) return } + if (menu === 'service-type') { + selectedServiceType.value = value + doctors.value = await getDoctorLabelList({ + 'jenis-pelayanan': selectedServiceType.value || 1, + 'tgl-pelayanan': new Date().toISOString().substring(0, 10), + 'kode-spesialis': 0, + }) + } if (menu === 'search-patient') { getPatientsList({ 'page-size': 10, includes: 'person' }).then(() => { openPatient.value = true @@ -254,8 +263,9 @@ function handleEvent(menu: string, value: any) { navigateTo('/integration/bpjs/sep') } if (menu === 'save-sep') { - createSep(createSepPayload(value)).then(() => { - navigateTo('/integration/bpjs/sep') + createSep(makeSepData(value)).then((value) => { + console.log('value:', value) + // navigateTo('/integration/bpjs/sep') }) } } @@ -263,25 +273,19 @@ function handleEvent(menu: string, value: any) { async function handleFetch(params: any) { const menu = params.menu || '' const value = params.value || '' - if (menu === 'service-type') { - selectedServiceType.value = value - } if (menu === 'diagnosis') { diagnoses.value = await getDiagnoseLabelList({ diagnosa: value }) } - if (menu === 'clinic') { - facilities.value = await getHealthFacilityLabelList({ + if (menu === 'clinic-from') { + facilitiesFrom.value = await getHealthFacilityLabelList({ faskes: value, 'jenis-faskes': selectedServiceType.value || 1, }) - facilities.value = await getHealthFacilityLabelList({ - faskes: 'Puskesmas', - 'jenis-faskes': selectedLetter.value || 1, - }) - doctors.value = await getDoctorLabelList({ - 'jenis-pelayanan': selectedServiceType.value || 1, - 'tgl-pelayanan': new Date().toISOString().substring(0, 10), - 'kode-spesialis': 0, + } + if (menu === 'clinic-to') { + facilitiesTo.value = await getHealthFacilityLabelList({ + faskes: value, + 'jenis-faskes': selectedServiceType.value || 1, }) } if (menu === 'province') { @@ -294,11 +298,13 @@ async function handleFetch(params: any) { } async function handleInit() { - diagnoses.value = await getDiagnoseLabelList({ diagnosa: 'paru' }) - facilities.value = await getHealthFacilityLabelList({ + const facilities = await getHealthFacilityLabelList({ faskes: 'Puskesmas', 'jenis-faskes': selectedLetter.value || 1, }) + diagnoses.value = await getDiagnoseLabelList({ diagnosa: 'paru' }) + facilitiesFrom.value = facilities + facilitiesTo.value = facilities doctors.value = await getDoctorLabelList({ 'jenis-pelayanan': selectedServiceType.value || 1, 'tgl-pelayanan': new Date().toISOString().substring(0, 10), @@ -339,15 +345,6 @@ async function handleInit() { onMounted(async () => { await handleInit() - // getProvinceList().then((value) => { - // console.log('value:', value) - // }) - // getCityList({ province: '14' }).then((value) => { - // console.log('value:', value) - // }) - // getDistrictList({ city: '0187' }).then((value) => { - // console.log('value:', value) - // }) if (route.query) { selectedObjects.value = { ...route.query } } @@ -367,7 +364,8 @@ onMounted(async () => {