fix: reload doctor fetch
This commit is contained in:
No files matched your search
@@ -9,10 +9,8 @@ import AppViewHistory from '~/components/app/sep/view-history.vue'
|
|||||||
import { refDebounced } from '@vueuse/core'
|
import { refDebounced } from '@vueuse/core'
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import { getDetail as getDoctorDetail } from '~/services/doctor.service'
|
|
||||||
import { useEncounterEntry } from '~/handlers/encounter-entry.handler'
|
import { useEncounterEntry } from '~/handlers/encounter-entry.handler'
|
||||||
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
|
import { useIntegrationSepEntry } from '~/handlers/integration-sep-entry.handler'
|
||||||
import { genDoctor, type Doctor } from '~/models/doctor'
|
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -42,6 +40,7 @@ const {
|
|||||||
isSaveDisabled,
|
isSaveDisabled,
|
||||||
isLoading,
|
isLoading,
|
||||||
patients,
|
patients,
|
||||||
|
selectedDoctor,
|
||||||
selectedPatient,
|
selectedPatient,
|
||||||
selectedPatientObject,
|
selectedPatientObject,
|
||||||
paginationMeta,
|
paginationMeta,
|
||||||
@@ -53,7 +52,8 @@ const {
|
|||||||
getPatientsList,
|
getPatientsList,
|
||||||
getPatientCurrent,
|
getPatientCurrent,
|
||||||
getPatientByIdentifierSearch,
|
getPatientByIdentifierSearch,
|
||||||
getIsSubspecialist,
|
// getIsSubspecialist,
|
||||||
|
getDoctorInfo,
|
||||||
getValidateMember,
|
getValidateMember,
|
||||||
getValidateSepNumber,
|
getValidateSepNumber,
|
||||||
handleFetchDoctors,
|
handleFetchDoctors,
|
||||||
@@ -61,16 +61,8 @@ const {
|
|||||||
const { recSepId, openHistory, histories, getMonitoringHistoryMappers } = useIntegrationSepEntry()
|
const { recSepId, openHistory, histories, getMonitoringHistoryMappers } = useIntegrationSepEntry()
|
||||||
|
|
||||||
const debouncedSepNumber = refDebounced(sepNumber, 500)
|
const debouncedSepNumber = refDebounced(sepNumber, 500)
|
||||||
const selectedDoctor = ref<Doctor>(genDoctor())
|
|
||||||
|
|
||||||
///// Functions
|
///// Functions
|
||||||
async function getDoctorInfo(value: string) {
|
|
||||||
const resp = await getDoctorDetail(value, { includes: 'unit,specialist,subspecialist'})
|
|
||||||
if (resp.success) {
|
|
||||||
selectedDoctor.value = resp.body.data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSavePatient() {
|
function handleSavePatient() {
|
||||||
selectedPatientObject.value = null
|
selectedPatientObject.value = null
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { toast } from '~/components/pub/ui/toast'
|
|||||||
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
||||||
import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
|
import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
|
||||||
import { paymentTypes, sepRefTypeCodes, participantGroups } from '~/lib/constants.vclaim'
|
import { paymentTypes, sepRefTypeCodes, participantGroups } from '~/lib/constants.vclaim'
|
||||||
|
import { genDoctor, type Doctor } from '~/models/doctor'
|
||||||
|
|
||||||
// Stores
|
// Stores
|
||||||
import { useUserStore } from '~/stores/user'
|
import { useUserStore } from '~/stores/user'
|
||||||
@@ -17,7 +18,7 @@ import {
|
|||||||
getList as getSpecialistList,
|
getList as getSpecialistList,
|
||||||
getValueTreeItems as getSpecialistTreeItems,
|
getValueTreeItems as getSpecialistTreeItems,
|
||||||
} from '~/services/specialist.service'
|
} from '~/services/specialist.service'
|
||||||
import { getValueLabelList as getDoctorValueLabelList } from '~/services/doctor.service'
|
import { getDetail as getDoctorDetail, getValueLabelList as getDoctorValueLabelList } from '~/services/doctor.service'
|
||||||
import {
|
import {
|
||||||
create as createEncounter,
|
create as createEncounter,
|
||||||
getDetail as getEncounterDetail,
|
getDetail as getEncounterDetail,
|
||||||
@@ -67,9 +68,8 @@ export function useEncounterEntry(props: {
|
|||||||
const vclaimReference = ref<any>(null)
|
const vclaimReference = ref<any>(null)
|
||||||
const sepFile = ref<File | null>(null)
|
const sepFile = ref<File | null>(null)
|
||||||
const sippFile = ref<File | null>(null)
|
const sippFile = ref<File | null>(null)
|
||||||
|
const selectedDoctor = ref<Doctor>(genDoctor())
|
||||||
const isEditMode = computed(() => props.id > 0)
|
const isEditMode = computed(() => props.id > 0)
|
||||||
|
|
||||||
const isSaveDisabled = computed(() => {
|
const isSaveDisabled = computed(() => {
|
||||||
return !selectedPatient.value || !selectedPatientObject.value || isSaving.value || isLoadingDetail.value
|
return !selectedPatient.value || !selectedPatientObject.value || isSaving.value || isLoadingDetail.value
|
||||||
})
|
})
|
||||||
@@ -78,15 +78,12 @@ export function useEncounterEntry(props: {
|
|||||||
if (props.classCode === 'ambulatory') {
|
if (props.classCode === 'ambulatory') {
|
||||||
return '/ambulatory/encounter'
|
return '/ambulatory/encounter'
|
||||||
}
|
}
|
||||||
// if (props.classCode === 'ambulatory' && props.subClassCode === 'reg') {
|
if (props.classCode === 'emergency') {
|
||||||
// return '/outpatient/encounter'
|
return '/emergency/encounter'
|
||||||
// }
|
}
|
||||||
// if (props.classCode === 'emergency') {
|
if (props.classCode === 'inpatient') {
|
||||||
// return '/emergency/encounter'
|
return '/inpatient/encounter'
|
||||||
// }
|
}
|
||||||
// if (props.classCode === 'inpatient') {
|
|
||||||
// return '/inpatient/encounter'
|
|
||||||
// }
|
|
||||||
return '/encounter'
|
return '/encounter'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,11 +203,22 @@ export function useEncounterEntry(props: {
|
|||||||
return { specialist_id: null, subspecialist_id: null }
|
return { specialist_id: null, subspecialist_id: null }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getDoctorInfo(value: string) {
|
||||||
|
const resp = await getDoctorDetail(value, { includes: 'unit,specialist,subspecialist' })
|
||||||
|
if (resp.success) {
|
||||||
|
selectedDoctor.value = resp.body.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function getValidateMember(member: string) {
|
async function getValidateMember(member: string) {
|
||||||
if (isCheckingSep.value) return
|
if (isCheckingSep.value) return
|
||||||
isMemberValid.value = false
|
isMemberValid.value = false
|
||||||
try {
|
try {
|
||||||
const result = await getMemberList({ mode: 'by-card', number: member, date: new Date().toISOString().split('T')[0] })
|
const result = await getMemberList({
|
||||||
|
mode: 'by-card',
|
||||||
|
number: member,
|
||||||
|
date: new Date().toISOString().split('T')[0],
|
||||||
|
})
|
||||||
if (result.success && result.body?.response !== null) {
|
if (result.success && result.body?.response !== null) {
|
||||||
const response = result.body?.response || {}
|
const response = result.body?.response || {}
|
||||||
if (Object.keys(response).length > 0) {
|
if (Object.keys(response).length > 0) {
|
||||||
@@ -341,9 +349,9 @@ export function useEncounterEntry(props: {
|
|||||||
try {
|
try {
|
||||||
isLoadingDetail.value = true
|
isLoadingDetail.value = true
|
||||||
const result = await getEncounterDetail(props.id, {
|
const result = await getEncounterDetail(props.id, {
|
||||||
includes: 'patient,patient-person,specialist,subspecialist,EncounterDocuments'
|
includes: 'patient,patient-person,specialist,subspecialist,Appointment_Doctor,EncounterDocuments',
|
||||||
})
|
})
|
||||||
|
|
||||||
if (result.success && result.body?.data) {
|
if (result.success && result.body?.data) {
|
||||||
encounterData.value = result.body.data
|
encounterData.value = result.body.data
|
||||||
await mapEncounterToForm(encounterData.value)
|
await mapEncounterToForm(encounterData.value)
|
||||||
@@ -391,9 +399,10 @@ export function useEncounterEntry(props: {
|
|||||||
formData.medicalRecordNumber = selectedPatientObject.value.number || ''
|
formData.medicalRecordNumber = selectedPatientObject.value.number || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const doctorId = encounter.appointment_doctor_code || encounter.responsible_doctor_code
|
const doctorCode = encounter.appointment_doctor_code || encounter.responsible_doctor_code
|
||||||
if (doctorId) {
|
if (doctorCode) {
|
||||||
formData.doctorId = String(doctorId)
|
formData.doctorCode = String(doctorCode)
|
||||||
|
await getDoctorInfo(doctorCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encounter.subspecialist_id) {
|
if (encounter.subspecialist_id) {
|
||||||
@@ -419,7 +428,7 @@ export function useEncounterEntry(props: {
|
|||||||
if (encounter.registeredAt) {
|
if (encounter.registeredAt) {
|
||||||
const date = new Date(encounter.registeredAt)
|
const date = new Date(encounter.registeredAt)
|
||||||
formData.registerDate = date.toISOString().split('T')[0]
|
formData.registerDate = date.toISOString().split('T')[0]
|
||||||
}
|
}
|
||||||
if (encounter.visitDate) {
|
if (encounter.visitDate) {
|
||||||
const date = new Date(encounter.visitDate)
|
const date = new Date(encounter.visitDate)
|
||||||
formData.registerDate = date.toISOString().split('T')[0]
|
formData.registerDate = date.toISOString().split('T')[0]
|
||||||
@@ -445,7 +454,7 @@ export function useEncounterEntry(props: {
|
|||||||
formData.sepNumber = encounter.ref_number || ''
|
formData.sepNumber = encounter.ref_number || ''
|
||||||
formData.sepType = encounter.sep_type || ''
|
formData.sepType = encounter.sep_type || ''
|
||||||
formData.patientCategory = encounter.participant_group_code || ''
|
formData.patientCategory = encounter.participant_group_code || ''
|
||||||
|
|
||||||
// Map BPJS reference data if available
|
// Map BPJS reference data if available
|
||||||
if (encounter.vclaimReference) {
|
if (encounter.vclaimReference) {
|
||||||
formData.sepReference = encounter.vclaimReference?.noSep || ''
|
formData.sepReference = encounter.vclaimReference?.noSep || ''
|
||||||
@@ -628,6 +637,7 @@ export function useEncounterEntry(props: {
|
|||||||
isEditMode,
|
isEditMode,
|
||||||
isSaveDisabled,
|
isSaveDisabled,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
selectedDoctor,
|
||||||
selectedPatient,
|
selectedPatient,
|
||||||
selectedPatientObject,
|
selectedPatientObject,
|
||||||
paginationMeta,
|
paginationMeta,
|
||||||
@@ -643,6 +653,7 @@ export function useEncounterEntry(props: {
|
|||||||
getPatientsList,
|
getPatientsList,
|
||||||
getPatientCurrent,
|
getPatientCurrent,
|
||||||
getPatientByIdentifierSearch,
|
getPatientByIdentifierSearch,
|
||||||
|
getDoctorInfo,
|
||||||
getValidateMember,
|
getValidateMember,
|
||||||
getValidateSepNumber,
|
getValidateSepNumber,
|
||||||
handleFetchSpecialists,
|
handleFetchSpecialists,
|
||||||
|
|||||||
Reference in New Issue
Block a user