feat(sep): add query from encounter
This commit is contained in:
@@ -37,9 +37,9 @@ const props = defineProps<{
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
submit: [values: DivisionFormData, resetForm: () => void]
|
||||
cancel: [resetForm: () => void]
|
||||
click: (e: Event) => void
|
||||
(e: 'submit', values: DivisionFormData, resetForm: () => void): void
|
||||
(e: 'cancel', resetForm: () => void): void
|
||||
(e: 'click', action: 'search' | 'add' | 'add-sep', values?: any): void
|
||||
}>()
|
||||
|
||||
const relationshipOpts = mapToComboboxOptList(relationshipCodes)
|
||||
@@ -93,15 +93,26 @@ function onSippFileChange(e: Event) {
|
||||
console.log('sipp file', f)
|
||||
}
|
||||
|
||||
function onAddSep() {
|
||||
// contoh handler tombol "+" di sebelah No. SEP
|
||||
console.log('open modal tambah SEP')
|
||||
function onAddSep(formContext: any) {
|
||||
const formValues = {
|
||||
patient_name: formContext?.patient_name,
|
||||
national_identity: formContext?.nik,
|
||||
medical_record_number: formContext?.rm,
|
||||
doctor_id: formContext?.doctor_id,
|
||||
register_date: formContext?.register_date,
|
||||
payment_type: formContext?.payment_type,
|
||||
bpjs_number: formContext?.bpjs_number,
|
||||
sep_type: formContext?.sep_type,
|
||||
sep_number: formContext?.sep_number
|
||||
}
|
||||
|
||||
emit('click', 'add-sep', formValues)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form
|
||||
v-slot="{ handleSubmit, resetForm }"
|
||||
v-slot="{ handleSubmit, resetForm, values }"
|
||||
as=""
|
||||
keep-values
|
||||
:validation-schema="formSchema"
|
||||
@@ -188,7 +199,7 @@ function onAddSep() {
|
||||
<FormField v-slot="{ componentField }" name="doctor_id">
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Combobox id="doctor_id" v-bind="componentField" :items="doctorOpts" />
|
||||
<Combobox id="doctor_id" v-bind="componentField" :items="doctorOpts as any" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
@@ -297,7 +308,7 @@ function onAddSep() {
|
||||
placeholder="Tambah SEP terlebih dahulu"
|
||||
class="flex-1"
|
||||
/>
|
||||
<Button class="bg-primary" size="sm" variant="outline" @click.prevent="onAddSep">+</Button>
|
||||
<Button class="bg-primary" size="sm" variant="outline" @click.prevent="() => onAddSep(values)">+</Button>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -111,6 +111,14 @@ if (mode === 'add') {
|
||||
|
||||
watch(props, (value) => {
|
||||
const patient = value.patient || ({} as PatientEntity)
|
||||
const objects = value.objects || ({} as any)
|
||||
if (Object.keys(objects).length > 0) {
|
||||
sepDate.value = objects?.registerDate || '-'
|
||||
bpjsNumber.value = objects?.bpjsNumber || '-'
|
||||
nationalId.value = objects?.nationalIdentity || '-'
|
||||
medicalRecordNumber.value = objects?.medicalRecordNumber || '-'
|
||||
patientName.value = objects?.patientName || '-'
|
||||
}
|
||||
if (Object.keys(patient).length > 0) {
|
||||
bpjsNumber.value = '-'
|
||||
nationalId.value = patient?.person?.residentIdentityNumber || '-'
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
DialogFooter,
|
||||
} from '~/components/pub/ui/dialog'
|
||||
import ListHistory from './list-history.vue'
|
||||
|
||||
// Types
|
||||
import type { SepHistoryData } from './list-cfg.history'
|
||||
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean
|
||||
histories: Array<SepHistoryData>
|
||||
paginationMeta?: PaginationMeta
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:open', value: boolean): void
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog
|
||||
:open="props.open"
|
||||
@update:open="emit('update:open', $event)"
|
||||
>
|
||||
<DialogTrigger as-child></DialogTrigger>
|
||||
<DialogContent class="max-w-[50%]">
|
||||
<DialogHeader>
|
||||
<DialogTitle>History SEP</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div class="overflow-x-auto rounded-lg border">
|
||||
<ListHistory :data="histories" :pagination-meta="paginationMeta" />
|
||||
</div>
|
||||
|
||||
<DialogFooter></DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { DataTableLoader } from '~/components/pub/my-ui/data-table'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -12,6 +13,18 @@ const isLoading = reactive<DataTableLoader>({
|
||||
isTableLoading: false,
|
||||
})
|
||||
|
||||
const division = {
|
||||
msg: {
|
||||
placeholder: 'Pilih Divisi',
|
||||
search: 'Cari Divisi',
|
||||
empty: 'Divisi tidak ditemukan',
|
||||
},
|
||||
}
|
||||
|
||||
const items = ref([{ value: '1', label: 'Division 1', code: 'DIV1' }])
|
||||
|
||||
const schema = {}
|
||||
|
||||
async function getPatientList() {
|
||||
isLoading.isTableLoading = true
|
||||
const resp = await xfetch('/api/v1/patient')
|
||||
@@ -25,12 +38,38 @@ onMounted(() => {
|
||||
getPatientList()
|
||||
})
|
||||
|
||||
function onClick(e: 'search' | 'add') {
|
||||
function toKebabCase(str: string): string {
|
||||
return str.replace(/_/g, '-').toLowerCase()
|
||||
}
|
||||
|
||||
function toNavigateSep(values: any) {
|
||||
const queryParams = new URLSearchParams()
|
||||
Object.keys(values).forEach(field => {
|
||||
if (values[field]) {
|
||||
queryParams.append(toKebabCase(field), values[field])
|
||||
}
|
||||
})
|
||||
navigateTo('/integration/bpjs/sep/add' + `?${queryParams.toString()}`)
|
||||
}
|
||||
|
||||
function onSubmit(values: any, resetForm: () => void) {
|
||||
console.log('submit', values)
|
||||
resetForm()
|
||||
}
|
||||
|
||||
function onCancel(resetForm: () => void) {
|
||||
console.log('cancel')
|
||||
resetForm()
|
||||
}
|
||||
|
||||
function onClick(e: 'search' | 'add' | 'add-sep', formValues?: any) {
|
||||
console.log('click', e)
|
||||
if (e === 'search') {
|
||||
isOpen.value = true
|
||||
console.log('search')
|
||||
} else if (e === 'add') {
|
||||
navigateTo('/client/patient/add')
|
||||
} else if (e === 'add-sep') {
|
||||
toNavigateSep({ resource: 'encounter', is_service: 'false', ...formValues })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +78,29 @@ provide('table_data_loader', isLoading)
|
||||
|
||||
<template>
|
||||
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
|
||||
<Icon name="i-lucide-user" class="me-2" />
|
||||
<span class="font-semibold">{{ props.formType }}</span> Kunjungan
|
||||
<Icon
|
||||
name="i-lucide-user"
|
||||
class="me-2"
|
||||
/>
|
||||
<span class="font-semibold">{{ props.formType }}</span>
|
||||
Kunjungan
|
||||
</div>
|
||||
<AppEncounterEntryForm @click="onClick" />
|
||||
<AppEncounterEntryForm
|
||||
:division="division"
|
||||
:items="items"
|
||||
:schema="schema"
|
||||
@click="onClick"
|
||||
@submit="onSubmit"
|
||||
@cancel="onCancel"
|
||||
/>
|
||||
<AppSepSmallEntry v-if="props.id" />
|
||||
|
||||
<Dialog v-model:open="isOpen" title="Cari Pasien" size="xl" prevent-outside>
|
||||
<Dialog
|
||||
v-model:open="isOpen"
|
||||
title="Cari Pasien"
|
||||
size="xl"
|
||||
prevent-outside
|
||||
>
|
||||
<AppPatientPicker :data="data" />
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
@@ -37,6 +37,7 @@ import { getValueLabelList as getDiagnoseLabelList } from '~/services/vclaim-dia
|
||||
import { getList as geMonitoringVisitList } from '~/services/vclaim-monitoring-visit.service'
|
||||
import { getList as getMonitoringHistoryList } from '~/services/vclaim-monitoring-history.service'
|
||||
import { create as createSep, makeSepData } from '~/services/vclaim-sep.service'
|
||||
import { se } from 'date-fns/locale'
|
||||
|
||||
const route = useRoute()
|
||||
const openPatient = ref(false)
|
||||
@@ -379,9 +380,20 @@ async function handleInit() {
|
||||
onMounted(async () => {
|
||||
await handleInit()
|
||||
if (route.query) {
|
||||
// resource=encounter®ister-date=2025-10-23&payment-type=bpjs&bpjs-number=121212121222&sep-type=ri
|
||||
const queries = route.query as any
|
||||
selectedObjects.value = { ...queries }
|
||||
isServiceHidden.value = queries['is-service'] === 'true'
|
||||
selectedObjects.value = {}
|
||||
if (queries['bpjs-number']) selectedObjects.value['bpjsNumber'] = queries['bpjs-number']
|
||||
if (queries['sep-type']) selectedObjects.value['sepType'] = queries['sep-type']
|
||||
if (queries['sep-number']) selectedObjects.value['sepNumber'] = queries['sep-number']
|
||||
if (queries['register-date']) selectedObjects.value['registerDate'] = queries['register-date']
|
||||
if (queries['doctor-id']) selectedObjects.value['doctorId'] = queries['doctor-id']
|
||||
if (queries['patient_name']) selectedObjects.value['patientName'] = queries['patient_name']
|
||||
if (queries['national_identity']) selectedObjects.value['nationalIdentity'] = queries['national_identity']
|
||||
if (queries['payment-type']) selectedObjects.value['paymentType'] = queries['payment-type']
|
||||
if (queries['medical_record_number'])
|
||||
selectedObjects.value['medicalRecordNumber'] = queries['medical_record_number']
|
||||
delete selectedObjects.value['is-service']
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user