feat: enhance SEP handling by adding source path to navigation and initializing form data
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { inject, type Ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
// Components
|
||||
import { Button } from '~/components/pub/ui/button'
|
||||
|
||||
@@ -8,13 +8,14 @@ const props = defineProps<{
|
||||
rec: { sepNumber: string; }
|
||||
}>()
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const record = props.rec || {}
|
||||
const recSepId = inject('rec_sep_id') as Ref<string>
|
||||
|
||||
function handleSelection() {
|
||||
recSepId.value = record.sepNumber || ''
|
||||
const pathUrl = `/integration/bpjs-vclaim/sep/${record.sepNumber || ''}/link`
|
||||
const pathUrl = `/integration/bpjs-vclaim/sep/${record.sepNumber || ''}/link?source-path=${route.path}`
|
||||
router.push({ path: pathUrl })
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -28,7 +28,7 @@ const props = defineProps<{
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
isService?: boolean
|
||||
isShowPatient?: boolean;
|
||||
isShowPatient?: boolean
|
||||
doctors: any[]
|
||||
diagnoses: any[]
|
||||
facilitiesFrom: any[]
|
||||
@@ -135,7 +135,7 @@ const onBack = () => {
|
||||
}
|
||||
|
||||
const onSaveNumber = () => {
|
||||
emit('event', 'save-sep-number', { sepNumber: props.sepNumber})
|
||||
emit('event', 'save-sep-number', { sepNumber: props.sepNumber })
|
||||
}
|
||||
|
||||
// Submit handler
|
||||
@@ -144,26 +144,122 @@ const onSubmit = handleSubmit((values) => {
|
||||
emit('event', 'save-sep', values)
|
||||
})
|
||||
|
||||
const onInitialized = (objects: any) => {
|
||||
sepDate.value = objects?.registerDate || new Date().toISOString().substring(0, 10)
|
||||
cardNumber.value = objects?.cardNumber || '-'
|
||||
nationalId.value = objects?.nationalIdentity || '-'
|
||||
medicalRecordNumber.value = objects?.medicalRecordNumber || '-'
|
||||
patientName.value = objects?.patientName || '-'
|
||||
phoneNumber.value = objects?.phoneNumber || '-'
|
||||
if (objects?.sepType === 'internal') {
|
||||
admissionType.value = '4'
|
||||
}
|
||||
if (objects?.sepType === 'external') {
|
||||
admissionType.value = '1'
|
||||
}
|
||||
if (objects?.diagnoseLabel) {
|
||||
initialDiagnosis.value = objects?.diagnoseLabel
|
||||
}
|
||||
// Patient data
|
||||
if (objects?.serviceType) {
|
||||
serviceType.value = objects?.serviceType
|
||||
}
|
||||
if (objects?.fromClinic) {
|
||||
fromClinic.value = objects?.fromClinic
|
||||
}
|
||||
if (objects?.destinationClinic) {
|
||||
destinationClinic.value = objects?.destinationClinic
|
||||
}
|
||||
// Doctor & Support data
|
||||
if (objects?.attendingDoctor) {
|
||||
attendingDoctor.value = objects?.attendingDoctor
|
||||
}
|
||||
if (objects?.cob) {
|
||||
cob.value = objects?.cob
|
||||
}
|
||||
if (objects?.cataract) {
|
||||
cataract.value = objects?.cataract
|
||||
}
|
||||
if (objects?.clinicExcecutive) {
|
||||
clinicExcecutive.value = objects?.clinicExcecutive
|
||||
}
|
||||
if (objects?.procedureType) {
|
||||
procedureType.value = objects?.procedureType
|
||||
}
|
||||
if (objects?.supportCode) {
|
||||
supportCode.value = objects?.supportCode
|
||||
}
|
||||
// Class & Payment data
|
||||
if (objects?.classLevel) {
|
||||
classLevel.value = objects?.classLevel
|
||||
}
|
||||
if (objects?.classLevelUpgrade) {
|
||||
classLevelUpgrade.value = objects?.classLevelUpgrade
|
||||
}
|
||||
if (objects?.classPaySource) {
|
||||
classPaySource.value = objects?.classPaySource
|
||||
}
|
||||
if (objects?.responsiblePerson) {
|
||||
responsiblePerson.value = objects?.responsiblePerson
|
||||
}
|
||||
// Accident data
|
||||
if (objects?.trafficAccident) {
|
||||
accident.value = objects?.trafficAccident
|
||||
}
|
||||
if (objects?.lpNumber) {
|
||||
lpNumber.value = objects?.lpNumber
|
||||
}
|
||||
if (objects?.accidentDate) {
|
||||
accidentDate.value = objects?.accidentDate
|
||||
}
|
||||
if (objects?.accidentNote) {
|
||||
accidentNote.value = objects?.accidentNote
|
||||
}
|
||||
if (objects?.accidentProvince) {
|
||||
accidentProvince.value = objects?.accidentProvince
|
||||
}
|
||||
if (objects?.accidentCity) {
|
||||
accidentCity.value = objects?.accidentCity
|
||||
}
|
||||
if (objects?.accidentDistrict) {
|
||||
accidentDistrict.value = objects?.accidentDistrict
|
||||
}
|
||||
if (objects?.suplesi) {
|
||||
suplesi.value = objects?.suplesi
|
||||
}
|
||||
if (objects?.suplesiNumber) {
|
||||
suplesiNumber.value = objects?.suplesiNumber
|
||||
}
|
||||
// Visit purpose & Assessment
|
||||
if (objects?.purposeOfVisit) {
|
||||
purposeOfVisit.value = objects?.purposeOfVisit
|
||||
}
|
||||
if (objects?.serviceAssessment) {
|
||||
serviceAssessment.value = objects?.serviceAssessment
|
||||
}
|
||||
// Note & Specialist
|
||||
if (objects?.note) {
|
||||
note.value = objects?.note
|
||||
}
|
||||
if (objects?.subSpecialistId) {
|
||||
subSpecialistId.value = objects?.subSpecialistId
|
||||
}
|
||||
// Referral letter
|
||||
if (objects?.referralLetterNumber) {
|
||||
referralLetterNumber.value = objects?.referralLetterNumber
|
||||
}
|
||||
}
|
||||
|
||||
watch(props, (value) => {
|
||||
const objects = value.objects || ({} as any)
|
||||
if (Object.keys(objects).length > 0) {
|
||||
sepDate.value = objects?.registerDate || new Date().toISOString().substring(0, 10)
|
||||
cardNumber.value = objects?.cardNumber || '-'
|
||||
nationalId.value = objects?.nationalIdentity || '-'
|
||||
medicalRecordNumber.value = objects?.medicalRecordNumber || '-'
|
||||
patientName.value = objects?.patientName || '-'
|
||||
phoneNumber.value = objects?.phoneNumber || '-'
|
||||
if (objects?.sepType === 'internal') {
|
||||
admissionType.value = '4'
|
||||
}
|
||||
if (objects?.sepType === 'external') {
|
||||
admissionType.value = '1'
|
||||
}
|
||||
if (objects?.diagnoseLabel) {
|
||||
initialDiagnosis.value = objects?.diagnoseLabel
|
||||
}
|
||||
onInitialized(objects)
|
||||
isDateReload.value = true
|
||||
setTimeout(() => {
|
||||
if (objects?.sepDate) {
|
||||
sepDate.value = objects?.sepDate
|
||||
referralLetterDate.value = objects?.sepDate
|
||||
}
|
||||
if (objects?.letterDate) {
|
||||
referralLetterDate.value = objects?.letterDate
|
||||
}
|
||||
@@ -426,7 +522,7 @@ onMounted(() => {
|
||||
Klinik Eksekutif
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.cob">
|
||||
<Field :errMessage="errors.clinicExcecutive">
|
||||
<RadioGroup
|
||||
v-model="clinicExcecutive"
|
||||
v-bind="clinicExcecutiveAttrs"
|
||||
@@ -490,7 +586,7 @@ onMounted(() => {
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Spesialis / Subspesialis
|
||||
<span class="text-red-500">*</span>
|
||||
@@ -975,7 +1071,7 @@ onMounted(() => {
|
||||
<!-- Actions -->
|
||||
<div class="mt-6 flex justify-end gap-2">
|
||||
<Button
|
||||
v-if="props.mode === 'detail'"
|
||||
v-if="props.mode === 'detail'"
|
||||
variant="ghost"
|
||||
type="button"
|
||||
class="h-[40px] min-w-[120px] text-orange-400 hover:bg-green-50"
|
||||
|
||||
@@ -13,15 +13,6 @@ export function useIntegrationSepDetail() {
|
||||
return typeof route.params.id === 'string' ? route.params.id : ''
|
||||
})
|
||||
|
||||
function mapServiceCodeToLabel(value: any): string | null {
|
||||
if (!value) return null
|
||||
const s = String(value).toLowerCase()
|
||||
if (s.includes('jalan')) return '2'
|
||||
if (s.includes('inap')) return '1'
|
||||
if (/^\d+$/.test(String(value))) return String(value)
|
||||
return String(value)
|
||||
}
|
||||
|
||||
async function getSepDetail() {
|
||||
if (!noSep.value) {
|
||||
toast({
|
||||
|
||||
@@ -443,7 +443,8 @@ export function useIntegrationSepEntry() {
|
||||
navigateTo('/integration/bpjs-vclaim/sep')
|
||||
}
|
||||
if (menu === 'save-sep-number') {
|
||||
navigateTo({ path: resourcePath.value, query: { 'sep-number': value.sepNumber || '' } })
|
||||
const sourcePath = route.query['source-path'] || '' as any
|
||||
navigateTo({ path: sourcePath, query: { 'sep-number': value.sepNumber || '' } })
|
||||
}
|
||||
if (menu === 'save-sep') {
|
||||
isSaveLoading.value = true
|
||||
|
||||
Reference in New Issue
Block a user