diff --git a/src/api/inspect/inspectpatient/index.ts b/src/api/inspect/inspectpatient/index.ts index 223397f..15b56aa 100644 --- a/src/api/inspect/inspectpatient/index.ts +++ b/src/api/inspect/inspectpatient/index.ts @@ -26,6 +26,9 @@ export interface PatientVO { chargetime: Date // 收费时间 headimage: string // 个人信息图片 domicileaddress: string // 住址 + xcgcode: string // 血常规编号 + ncgcode: string // 尿常规编号 + shqx: string // 生化编号 } // 患者信息 API @@ -34,7 +37,10 @@ export const PatientApi = { getPatientPage: async (params: any) => { return await request.get({ url: `/inspect/patient/page`, params }) }, - + //根据体检获得患者信息 + getPatientInfo: async (medicalSn: string) => { + return await request.get({ url: `/inspect/patient/getpatientjson?medicalSn=` + medicalSn }) + }, // 查询患者信息详情 getPatient: async (id: number) => { return await request.get({ url: `/inspect/patient/get?id=` + id }) @@ -63,5 +69,24 @@ export const PatientApi = { // 导入患者信息 uploadExcel: async (data: FormData) => { return await request.upload({ url: `/inspect/patient/uploadExcel`, data }) - } + }, + + //发送检验申请单 + syncinspectApplyTj: async (medicalSn: string) => { + return await request.get({ url: `/inspect/patient/syncinspectApplyTj?medicalSn=` + medicalSn }) + }, + + //获取检验报告 + getReportTj: async (medicalSn: string,type:string) => { + return await request.get({ url: `/inspect/patient/getReportTj?medicalSn=` + medicalSn + `&type=` + type }) + }, + + //获取超声报告 + getUSTj: async (medicalSn: string) => { + return await request.get({ url: `/inspect/patient/getUSTj?medicalSn=` + medicalSn}) + }, + //获取心电报告 + GetApiEcgInfo: async (medicalSn: string) => { + return await request.get({ url: `/inspect/patient/getecgTj?medicalSn=` + medicalSn}) + }, } diff --git a/src/views/Department-entry/All.vue b/src/views/Department-entry/All.vue index b655c88..7d018d8 100644 --- a/src/views/Department-entry/All.vue +++ b/src/views/Department-entry/All.vue @@ -124,6 +124,7 @@ const getImageUrls = async () => { pacsData.value = response.list let filteredData = response.list + // 确保根据当前检查类型过滤数据 if (props.examType) { const typePatterns = { 'ultrasound': ['ultrasound', 'us', '超声', '彩超', 'b超', 'doppler'], @@ -144,6 +145,10 @@ const getImageUrls = async () => { } } + // 清空旧数据 + mediaFiles.value = [] + imageUrls.value = [] + if (filteredData.length === 0) { return [] } @@ -163,6 +168,7 @@ const getImageUrls = async () => { type: isPDF ? 'pdf' : 'image' } }).filter(item => item) + // 只收集图片URL用于预览 imageUrls.value = mediaFiles.value .filter(file => file.type === 'image') @@ -324,13 +330,7 @@ const loadPatientData = async (patient) => { } try { - const cacheKey = patient.id - if (patientDataCache.value.has(cacheKey)) { - const cachedData = patientDataCache.value.get(cacheKey) - reportData.value = cachedData.reportData - return - } - + // 不再使用缓存,每次都重新加载 const loading = ElLoading.service({ lock: true, text: '加载中...', @@ -365,44 +365,92 @@ const loadPatientData = async (patient) => { imageDiagnosis.value = currentItem.value.itemResult || '' } - // 加载所有影像数据,不再按类型过滤 + // 加载所有影像数据 imageUrls.value = await getImageUrls() + } else { + // 如果没有找到检查项目,清空数据 + currentItem.value = null + imageFinding.value = '' + imageDiagnosis.value = '' + mediaFiles.value = [] + imageUrls.value = [] } } catch (error) { console.error('获取患者检查项目失败:', error) + // 出错时也清空数据 + currentItem.value = null + imageFinding.value = '' + imageDiagnosis.value = '' + mediaFiles.value = [] + imageUrls.value = [] } } - - // 缓存数据 - patientDataCache.value.set(cacheKey, { - reportData: { ...reportData.value } - }) } finally { loading.close() } } catch (error) { console.error('获取患者详细信息出错:', error) ElMessage.error('获取患者详细信息失败') + // 出错时清空数据 + mediaFiles.value = [] + imageUrls.value = [] } } -// 监听患者变化 +// 修改检查类型变化的监听器 +watch( + () => props.examType, + async (newType, oldType) => { + console.log(`[All.vue] examType 变化: 从 ${oldType} 到 ${newType}`) + + if (!newType) return + + // 如果新旧类型相同,不执行任何操作 + if (newType === oldType) return + + // 无论如何都清空当前数据 + mediaFiles.value = [] + imageUrls.value = [] + + if (reportData.value.medicalSn) { + // 显示加载中 + const loading = ElLoading.service({ + lock: true, + text: '加载中...', + background: 'rgba(255, 255, 255, 0.7)' + }) + + try { + console.log(`[All.vue] 重新获取 ${newType} 类型的影像数据`) + // 重新获取影像数据 + await getImageUrls() + console.log(`[All.vue] 获取到 ${mediaFiles.value.length} 个媒体文件`) + } finally { + loading.close() + } + } + }, + { immediate: false } +) + +// 修改患者变化的监听器 watch( () => props.patient, (newPatient) => { + console.log(`[All.vue] 患者变化: ${newPatient?.pname}, ID: ${newPatient?.id}`) + if (newPatient) { - loadPatientData(newPatient) - } - }, - { immediate: true } -) - -// 监听检查类型变化 -watch( - () => props.examType, - async (newType) => { - if (newType && reportData.value.medicalSn) { - imageUrls.value = await getImageUrls() + // 保存当前检查类型 + const currentExamType = props.examType + console.log(`[All.vue] 当前检查类型: ${currentExamType}`) + + loadPatientData(newPatient).then(() => { + // 如果有检查类型,确保加载对应类型的影像数据 + if (currentExamType && reportData.value.medicalSn) { + console.log(`[All.vue] 加载 ${currentExamType} 类型的影像数据`) + getImageUrls() + } + }) } }, { immediate: true } @@ -411,8 +459,20 @@ watch( // 修改组件挂载时的逻辑 onMounted(async () => { if (props.patient) { + // 保存当前检查类型 + const currentExamType = props.examType + + // 清空当前数据 + mediaFiles.value = [] + imageUrls.value = [] + // 加载患者数据和检查项目 await loadPatientData(props.patient) + + // 在加载完患者数据后,手动获取影像数据 + if (currentExamType && reportData.value.medicalSn) { + await getImageUrls() + } } }) diff --git a/src/views/Department-entry/Medical-examination-vehicle.vue b/src/views/Department-entry/Medical-examination-vehicle.vue index 228ab33..b8e7733 100644 --- a/src/views/Department-entry/Medical-examination-vehicle.vue +++ b/src/views/Department-entry/Medical-examination-vehicle.vue @@ -21,7 +21,7 @@ @click="handleRefresh" :icon="Refresh" > - 刷新 + 刷新列表 @@ -307,7 +307,7 @@