feat: implement encounter entry form for patient, doctor, payment, and SEP management
This commit is contained in:
@@ -13,6 +13,9 @@ import { genDoctor, type Doctor } from '~/models/doctor'
|
||||
// Stores
|
||||
import { useUserStore } from '~/stores/user'
|
||||
|
||||
// Handlers
|
||||
import { uploadAttachmentCustom } from '~/handlers/supporting-document.handler'
|
||||
|
||||
// Services
|
||||
import {
|
||||
getList as getSpecialistList,
|
||||
@@ -26,7 +29,6 @@ import {
|
||||
} from '~/services/encounter.service'
|
||||
import { getList as getMemberList } from '~/services/vclaim-member.service'
|
||||
import { getList as getSepList } from '~/services/vclaim-sep.service'
|
||||
import { uploadAttachment } from '~/services/supporting-document.service'
|
||||
|
||||
// Handlers
|
||||
import {
|
||||
@@ -468,6 +470,19 @@ export function useEncounterEntry(props: {
|
||||
if (formData.subSpecialistId) {
|
||||
await handleFetchDoctors(formData.subSpecialistId)
|
||||
}
|
||||
if (encounter.encounterDocuments && Array.isArray(encounter.encounterDocuments)) {
|
||||
let sepFileReview = {}
|
||||
let sippFileReview = {}
|
||||
for (const doc of encounter.encounterDocuments) {
|
||||
if (doc.type === 'vclaim-sep') {
|
||||
sepFileReview = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
||||
} else if (doc.type === 'vclaim-sipp') {
|
||||
sippFileReview = { id: doc.id, fileName: doc.fileName, filePath: doc.filePath, type: doc.type_code }
|
||||
}
|
||||
}
|
||||
formData.sepFileReview = sepFileReview
|
||||
formData.sippFileReview = sippFileReview
|
||||
}
|
||||
|
||||
formObjects.value = { ...formData }
|
||||
}
|
||||
@@ -501,7 +516,7 @@ export function useEncounterEntry(props: {
|
||||
const visitDateValue = formValues.visitDate || formValues.registeredAt || formValues.registerDate || ''
|
||||
const memberNumber = formValues.member_number ?? formValues.cardNumber ?? formValues.memberNumber ?? null
|
||||
const refNumber = formValues.ref_number ?? formValues.sepNumber ?? formValues.refNumber ?? null
|
||||
sepFile.value = formValues.sepFile || null
|
||||
sepFile.value = formValues.sepFile || null
|
||||
sippFile.value = formValues.sippFile || null
|
||||
|
||||
let paymentMethodCode = formValues.paymentMethod_code ?? null
|
||||
@@ -519,7 +534,7 @@ export function useEncounterEntry(props: {
|
||||
|
||||
const payload: any = {
|
||||
patient_id: patientId,
|
||||
appointment_doctor_code: formValues.doctorCode || null,
|
||||
appointment_doctor_code: formValues.doctor_code || null,
|
||||
class_code: props.classCode || '',
|
||||
subClass_code: props.subClassCode || '',
|
||||
infra_id: formValues.infra_id ?? null,
|
||||
@@ -578,13 +593,26 @@ export function useEncounterEntry(props: {
|
||||
}
|
||||
|
||||
if (result.success) {
|
||||
// const encounterId = isEditMode.value ? props.id : result.body?.data?.id
|
||||
if (patientId) {
|
||||
const encounterId = isEditMode.value ? props.id : result.body?.data?.id
|
||||
|
||||
if (encounterId) {
|
||||
if (sepFile.value) {
|
||||
await uploadAttachment(sepFile.value, patientId, 'vclaim-sep')
|
||||
await uploadAttachmentCustom({
|
||||
id: isEditMode.value && formValues.sepFileReview ? formValues.sepFileReview.id : null,
|
||||
file: sepFile.value,
|
||||
refId: encounterId,
|
||||
entityTypeCode: 'encounter',
|
||||
type: 'vclaim-sep',
|
||||
})
|
||||
}
|
||||
if (sippFile.value) {
|
||||
await uploadAttachment(sippFile.value, patientId, 'vclaim-sipp')
|
||||
await uploadAttachmentCustom({
|
||||
id: isEditMode.value && formValues.sippFileReview ? formValues.sippFileReview.id : null,
|
||||
file: sippFile.value,
|
||||
refId: encounterId,
|
||||
entityTypeCode: 'encounter',
|
||||
type: 'vclaim-sipp',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user