修改BUG

This commit is contained in:
Euni4U 2025-03-13 15:35:35 +08:00
parent 761857cec5
commit b0556140d6
4 changed files with 349 additions and 249 deletions

View File

@ -26,6 +26,9 @@ export interface PatientVO {
chargetime: Date // 收费时间 chargetime: Date // 收费时间
headimage: string // 个人信息图片 headimage: string // 个人信息图片
domicileaddress: string // 住址 domicileaddress: string // 住址
xcgcode: string // 血常规编号
ncgcode: string // 尿常规编号
shqx: string // 生化编号
} }
// 患者信息 API // 患者信息 API
@ -34,7 +37,10 @@ export const PatientApi = {
getPatientPage: async (params: any) => { getPatientPage: async (params: any) => {
return await request.get({ url: `/inspect/patient/page`, params }) 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) => { getPatient: async (id: number) => {
return await request.get({ url: `/inspect/patient/get?id=` + id }) return await request.get({ url: `/inspect/patient/get?id=` + id })
@ -63,5 +69,24 @@ export const PatientApi = {
// 导入患者信息 // 导入患者信息
uploadExcel: async (data: FormData) => { uploadExcel: async (data: FormData) => {
return await request.upload({ url: `/inspect/patient/uploadExcel`, data }) 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})
},
} }

View File

@ -124,6 +124,7 @@ const getImageUrls = async () => {
pacsData.value = response.list pacsData.value = response.list
let filteredData = response.list let filteredData = response.list
//
if (props.examType) { if (props.examType) {
const typePatterns = { const typePatterns = {
'ultrasound': ['ultrasound', 'us', '超声', '彩超', 'b超', 'doppler'], 'ultrasound': ['ultrasound', 'us', '超声', '彩超', 'b超', 'doppler'],
@ -144,6 +145,10 @@ const getImageUrls = async () => {
} }
} }
//
mediaFiles.value = []
imageUrls.value = []
if (filteredData.length === 0) { if (filteredData.length === 0) {
return [] return []
} }
@ -163,6 +168,7 @@ const getImageUrls = async () => {
type: isPDF ? 'pdf' : 'image' type: isPDF ? 'pdf' : 'image'
} }
}).filter(item => item) }).filter(item => item)
// URL // URL
imageUrls.value = mediaFiles.value imageUrls.value = mediaFiles.value
.filter(file => file.type === 'image') .filter(file => file.type === 'image')
@ -324,13 +330,7 @@ const loadPatientData = async (patient) => {
} }
try { 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({ const loading = ElLoading.service({
lock: true, lock: true,
text: '加载中...', text: '加载中...',
@ -365,44 +365,92 @@ const loadPatientData = async (patient) => {
imageDiagnosis.value = currentItem.value.itemResult || '' imageDiagnosis.value = currentItem.value.itemResult || ''
} }
// //
imageUrls.value = await getImageUrls() imageUrls.value = await getImageUrls()
} else {
//
currentItem.value = null
imageFinding.value = ''
imageDiagnosis.value = ''
mediaFiles.value = []
imageUrls.value = []
} }
} catch (error) { } catch (error) {
console.error('获取患者检查项目失败:', error) console.error('获取患者检查项目失败:', error)
//
currentItem.value = null
imageFinding.value = ''
imageDiagnosis.value = ''
mediaFiles.value = []
imageUrls.value = []
} }
} }
//
patientDataCache.value.set(cacheKey, {
reportData: { ...reportData.value }
})
} finally { } finally {
loading.close() loading.close()
} }
} catch (error) { } catch (error) {
console.error('获取患者详细信息出错:', error) console.error('获取患者详细信息出错:', error)
ElMessage.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( watch(
() => props.patient, () => props.patient,
(newPatient) => { (newPatient) => {
if (newPatient) { console.log(`[All.vue] 患者变化: ${newPatient?.pname}, ID: ${newPatient?.id}`)
loadPatientData(newPatient)
}
},
{ immediate: true }
)
// if (newPatient) {
watch( //
() => props.examType, const currentExamType = props.examType
async (newType) => { console.log(`[All.vue] 当前检查类型: ${currentExamType}`)
if (newType && reportData.value.medicalSn) {
imageUrls.value = await getImageUrls() loadPatientData(newPatient).then(() => {
//
if (currentExamType && reportData.value.medicalSn) {
console.log(`[All.vue] 加载 ${currentExamType} 类型的影像数据`)
getImageUrls()
}
})
} }
}, },
{ immediate: true } { immediate: true }
@ -411,8 +459,20 @@ watch(
// //
onMounted(async () => { onMounted(async () => {
if (props.patient) { if (props.patient) {
//
const currentExamType = props.examType
//
mediaFiles.value = []
imageUrls.value = []
// //
await loadPatientData(props.patient) await loadPatientData(props.patient)
//
if (currentExamType && reportData.value.medicalSn) {
await getImageUrls()
}
} }
}) })

View File

@ -21,7 +21,7 @@
@click="handleRefresh" @click="handleRefresh"
:icon="Refresh" :icon="Refresh"
> >
刷新 刷新列表
</el-button> </el-button>
</div> </div>
</div> </div>
@ -307,7 +307,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed, onBeforeUnmount } from 'vue' import { ref, onMounted, computed, onBeforeUnmount, watch } from 'vue'
import { ElDialog, ElLoading, ElMessage, ElMessageBox } from 'element-plus' import { ElDialog, ElLoading, ElMessage, ElMessageBox } from 'element-plus'
import { PatientApi } from '@/api/inspect/inspectpatient' import { PatientApi } from '@/api/inspect/inspectpatient'
import { PatientitemsApi } from '@/api/inspect/inspectpatientitems' import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
@ -401,33 +401,10 @@ return [...currentExamItems.value].sort((a, b) => {
}); });
}); });
// // switchTab
const switchTab = (tabId) => { const switchTab = async (tabId) => {
// //
if (currentTab.value && examItems.value) { currentTab.value = tabId
//
const currentItems = sortedExamItems.value || [];
//
if (tabId !== currentTab.value) {
//
currentTab.value = tabId;
//
if (!examItems.value[tabId] || examItems.value[tabId].length === 0) {
//
examItems.value[tabId] = [];
}
}
} else {
//
currentTab.value = tabId;
//
if (!examItems.value[tabId]) {
examItems.value[tabId] = [];
}
}
} }
// conclusionData // conclusionData
@ -517,15 +494,6 @@ const getpatientitemData = async (medicalSn) => {
if (itemsRes.list && itemsRes.list.length > 0) { if (itemsRes.list && itemsRes.list.length > 0) {
patientitemData.value = itemsRes.list[0] patientitemData.value = itemsRes.list[0]
//
const userProfile = await getUserProfile()
user.value = userProfile
//
const currentDeptItems = itemsRes.list.filter(item =>
item.sectionID === userProfile.deptId || item.sectionID == userProfile.deptId
)
// //
if (currentDeptItems.length > 0 && currentDeptItems.every(item => item.itemStatus === '1')) { if (currentDeptItems.length > 0 && currentDeptItems.every(item => item.itemStatus === '1')) {
// //
@ -544,22 +512,15 @@ const getpatientitemData = async (medicalSn) => {
} }
} }
// loadPatientData // loadPatientData currentTab
const loadPatientData = async (patient) => { const loadPatientData = async (patient) => {
try { console.log(`[loadPatientData] 开始加载患者数据: ${patient.pname}, ID: ${patient.id}`)
// console.log(`[loadPatientData] 加载前的当前标签: ${currentTab.value}`)
const cacheKey = patient.id
if (patientDataCache.value.has(cacheKey)) {
const cachedData = patientDataCache.value.get(cacheKey)
reportData.value = cachedData.reportData
examItems.value = cachedData.examItems
conclusionData.value = cachedData.conclusionData
currentTab.value = cachedData.currentTab
inspectDoctor.value = cachedData.inspectDoctor || ''
inspectTime.value = cachedData.inspectTime || ''
return
}
// 便
//const savedTab = currentTab.value
try {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '加载中...', text: '加载中...',
@ -575,16 +536,6 @@ const loadPatientData = async (patient) => {
const patientData = await PatientApi.getPatient(patient.id) const patientData = await PatientApi.getPatient(patient.id)
reportData.value = patientData reportData.value = patientData
//
const hasItems = await checkPatientHasItems(patient.medicalSn)
//
if (!hasItems) {
console.log('患者没有检查项目,需要同步')
ElMessage.info('该患者没有检查项目,请点击"同步"按钮获取最新数据')
//
}
// //
const itemsRes = await PatientitemsApi.getPatientitemsPage({ const itemsRes = await PatientitemsApi.getPatientitemsPage({
medicalSn: patient.medicalSn, medicalSn: patient.medicalSn,
@ -604,7 +555,7 @@ const loadPatientData = async (patient) => {
ecg: { finding: '', diagnosis: '' }, ecg: { finding: '', diagnosis: '' },
blood: { summary: '' }, blood: { summary: '' },
urine: { summary: '' }, urine: { summary: '' },
biochemical: { summary: '' } // biochemical: { summary: '' }
} }
// //
@ -647,27 +598,46 @@ const loadPatientData = async (patient) => {
examItems.value = groupedItems examItems.value = groupedItems
conclusionData.value = conclusions conclusionData.value = conclusions
//
patientDataCache.value.set(cacheKey, {
reportData: { ...reportData.value },
examItems: { ...examItems.value },
conclusionData: { ...conclusionData.value },
currentTab: currentTab.value,
inspectDoctor: inspectDoctor.value,
inspectTime: inspectTime.value
})
} }
} catch (error) { } catch (error) {
console.error('加载患者数据失败:', error) console.error('加载患者数据失败:', error)
ElMessage.error('加载患者数据失败') ElMessage.error('加载患者数据失败')
} finally { } finally {
loading.close() loading.close()
//
// if (currentTab.value !== savedTab) {
// console.log(`[loadPatientData] : ${currentTab.value} ${savedTab}`)
// currentTab.value = savedTab
// }
} }
} catch (error) { } catch (error) {
console.error('加载患者数据失败:', error) console.error('加载患者数据失败:', error)
ElMessage.error('加载患者数据失败') ElMessage.error('加载患者数据失败')
} }
//
console.log(`[loadPatientData] 加载完成后的当前标签: ${currentTab.value}`)
}
// handlePatientSelect
const handlePatientSelect = async (patient) => {
try {
//
examConclusion.value = ''
examItems.value = {}
//
selectedPatient.value = patient
//
console.log(`[handlePatientSelect] 开始加载患者数据`)
await loadPatientData(patient)
console.log(`[handlePatientSelect] 患者数据加载完成`)
currentTab.value='general'
} catch (error) {
console.error('[handlePatientSelect] 切换患者失败:', error)
message.error('切换患者失败')
isImageDepartment.value = false
}
} }
// //
@ -839,79 +809,6 @@ const getTabColor = (index) => {
return tabColors[index % tabColors.length] return tabColors[index % tabColors.length]
} }
//
const handlePatientSelect = async (patient) => {
try {
//
examConclusion.value = ''
examItems.value = {}
currentTab.value = 'general' //
//
if (patientDataCache.value.has(patient.id)) {
patientDataCache.value.delete(patient.id)
}
//
selectedPatient.value = patient
//
await loadPatientData(patient)
//
if (patient.medicalSn) {
await getpatientitemData(patient.medicalSn)
//
try {
const params = {
medicalSn: patient.medicalSn,
pageNo: 1,
pageSize: 100
}
const itemsRes = await PatientitemsApi.getPatientitemsPage(params)
if (itemsRes.list && itemsRes.list.length > 0) {
//
const checkedItems = itemsRes.list.filter(item =>
item.itemStatus === '1' &&
(item.sectionID === user.value.deptId || item.sectionID == user.value.deptId)
)
if (checkedItems.length > 0) {
// 使
const firstCheckedItem = checkedItems[0]
inspectDoctor.value = firstCheckedItem.inspectdoctor || ''
//
if (firstCheckedItem.inspecttime) {
const inspectDate = new Date(Number(firstCheckedItem.inspecttime))
inspectTime.value = formatDate(inspectDate)
}
} else {
//
inspectDoctor.value = ''
inspectTime.value = ''
}
}
} catch (error) {
console.error('获取检查医生和检查日期失败:', error)
inspectDoctor.value = ''
inspectTime.value = ''
}
}
//
currentTab.value = 'general'
} catch (error) {
console.error('切换患者失败:', error)
message.error('切换患者失败')
//
isImageDepartment.value = false
}
}
onMounted(async () => { onMounted(async () => {
// //
patients.value = [] patients.value = []
@ -1058,15 +955,8 @@ const age = computed(() => {
// //
const gender = computed(() => { const gender = computed(() => {
if (!reportData.value.cardId) return reportData.value.gender || '' // 使reportDatagender
return reportData.value.gender || ''
//
const idCard = reportData.value.cardId
if (idCard.length !== 18) return reportData.value.gender || '' // 18
// 17
const genderCode = parseInt(idCard.charAt(16))
return genderCode % 2 === 1 ? '男' : '女'
}) })
// //
@ -1112,8 +1002,73 @@ const handleSync = async () => {
}) })
try { try {
// if (!selectedPatient.value?.medicalSn) {
await PatientitemsApi.createPatientapiInfo({}) throw new Error('未选择患者或体检编号为空')
}
const medicalSn = selectedPatient.value.medicalSn
//
const types = ['XCG', 'NCG', 'SHQX','ECG']
//
const syncPromises = [
//
...types.map(type =>
PatientApi.getReportTj(medicalSn, type)
.catch(error => {
console.warn(`获取${type}报告失败:`, error)
return null
})
),
//
PatientApi.getUSTj(medicalSn)
.catch(error => {
console.warn('获取超声报告失败:', error)
return null
}),
//
PatientApi.GetApiEcgInfo(medicalSn)
.catch(error => {
console.warn('获取心电报告失败:', error)
return null
})
]
const results = await Promise.all(syncPromises)
//
const allFailed = results.every(result => result === null)
if (allFailed) {
throw new Error('所有报告同步失败')
}
//
results.forEach((result, index) => {
if (result) {
if (index < types.length) {
//
const type = types[index]
switch (type) {
case 'XCG':
console.log('血常规报告同步成功')
break
case 'NCG':
console.log('尿常规报告同步成功')
break
case 'SHQX':
console.log('生化报告同步成功')
break
case 'ECG':
console.log('心电报告同步成功')
break
}
} else {
//
console.log('超声报告同步成功')
}
}
})
// //
await new Promise(resolve => setTimeout(resolve, 1000)) await new Promise(resolve => setTimeout(resolve, 1000))
@ -1142,21 +1097,28 @@ const handleSync = async () => {
// //
patientDataCache.value.clear() patientDataCache.value.clear()
//
if (selectedPatient.value) {
await loadPatientData(selectedPatient.value)
}
loading.close() loading.close()
ElMessage.success('同步成功') ElMessage.success('同步成功')
} catch (error) { } catch (error) {
loading.close() loading.close()
console.error('同步数据失败:', error) console.error('同步数据失败:', error)
ElMessage.error('同步数据失败,请稍后重试') ElMessage.error(error.message || '同步数据失败,请稍后重试')
} }
} catch (error) { } catch (error) {
console.error('同步失败:', error) console.error('同步失败:', error)
ElMessage.error('同步失败,请稍后重试') ElMessage.error(error.message || '同步失败,请稍后重试')
} }
} }
// - const handleRefresh = async (e) => {
const handleRefresh = async () => { //
if (e) e.preventDefault()
try { try {
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
@ -1164,26 +1126,25 @@ const handleRefresh = async () => {
background: 'rgba(255, 255, 255, 0.7)' background: 'rgba(255, 255, 255, 0.7)'
}) })
// //
searchQuery.value = '' selectedPatient.value = null //
selectedPatient.value = null reportData.value = {} //
pageNo.value = 1 examItems.value = {} //
statusFilter.value = '0' // conclusionData.value = { //
general: { summary: '' },
try { ultrasound: { finding: '', diagnosis: '' },
// ecg: { finding: '', diagnosis: '' },
await getPatientList() blood: { summary: '' },
urine: { summary: '' },
// biochemical: { summary: '' }
patientDataCache.value.clear()
loading.close()
ElMessage.success('刷新成功')
} catch (error) {
loading.close()
console.error('刷新数据失败:', error)
ElMessage.error('刷新数据失败,请稍后重试')
} }
//
await getPatientList()
//
currentTab.value = 'general'
loading.close()
ElMessage.success('刷新成功')
} catch (error) { } catch (error) {
console.error('刷新失败:', error) console.error('刷新失败:', error)
ElMessage.error('刷新失败,请稍后重试') ElMessage.error('刷新失败,请稍后重试')
@ -1689,6 +1650,11 @@ const handleStatusFilterChange = (value) => {
selectedPatient.value = null selectedPatient.value = null
} }
// currentTab
watch(currentTab, (newTab, oldTab) => {
console.log(`[watch] currentTab 变化: 从 ${oldTab}${newTab}`)
}, { immediate: true })
</script> </script>
<style scoped> <style scoped>

View File

@ -1,6 +1,13 @@
<template> <template>
<div id="PrintElementOptionSetting" style="display:none;"></div> <div id="PrintElementOptionSetting" style="display:none;"></div>
<!-- 添加全屏加载遮罩 -->
<div
v-loading.fullscreen.lock="fullscreenLoading"
element-loading-text="正在导入数据,请勿关闭页面..."
element-loading-background="rgba(0, 0, 0, 0.8)">
</div>
<ContentWrap style="height: 70px; display: flex; align-items: center;"> <ContentWrap style="height: 70px; display: flex; align-items: center;">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
@ -15,6 +22,7 @@
v-model="queryParams.medicalSn" v-model="queryParams.medicalSn"
placeholder="请输入体检编号" placeholder="请输入体检编号"
clearable clearable
@input="handleQuery"
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-200px" class="!w-200px"
/> />
@ -25,29 +33,25 @@
placeholder="请输入姓名" placeholder="请输入姓名"
clearable clearable
@input="handleQuery" @input="handleQuery"
@keyup.enter="handleQuery"
class="!w-200px" class="!w-200px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="体检日期" prop="medicalDateTime"> <el-form-item label="身份证号" prop="cardId">
<el-date-picker <el-input
v-model="queryParams.medicalDateTime" v-model="queryParams.cardId"
type="daterange" placeholder="请输入身份证号"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD HH:mm:ss"
:default-time="[
new Date(2000, 1, 1, 0, 0, 0),
new Date(2000, 1, 1, 23, 59, 59)
]"
clearable clearable
class="!w-320px" @input="handleQuery"
@keyup.enter="handleQuery"
class="!w-200px"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleQuery"> <el-button type="primary" @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 查询 <Icon icon="ep:search" class="mr-5px" /> 查询
</el-button> </el-button>
<el-button type="success" @click="handleImport"> <el-button type="success" :loading="importLoading" @click="handleImport">
<Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件 <Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件
</el-button> </el-button>
<input <input
@ -77,7 +81,7 @@
<el-table-column label="身份证号" align="center" prop="cardId" /> <el-table-column label="身份证号" align="center" prop="cardId" />
<el-table-column label="联系电话" align="center" prop="phoneNum" /> <el-table-column label="联系电话" align="center" prop="phoneNum" />
<el-table-column label="住址" align="center" prop="domicileaddress" /> <el-table-column label="住址" align="center" prop="domicileaddress" />
<el-table-column label="体检日期" align="center" prop="medicalDateTime" :formatter="dateFormatter" /> <el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
<el-table-column label="操作" align="center" fixed="right" width="120px"> <el-table-column label="操作" align="center" fixed="right" width="120px">
<template #default="scope"> <template #default="scope">
<el-button <el-button
@ -108,23 +112,26 @@ import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient'
import * as SummaryApi from "@/api/summary"; import * as SummaryApi from "@/api/summary";
import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper"; import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper";
import template from "@/views/summary/print/template"; import template from "@/views/summary/print/template";
import { ElMessageBox } from 'element-plus';
defineOptions({ name: 'Department' }) defineOptions({ name: 'Department' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const loading = ref(true) // const loading = ref(true) //
const importLoading = ref(false) // Excel
const fullscreenLoading = ref(false) //
const list = ref<PatientVO[]>([]) // const list = ref<PatientVO[]>([]) //
const total = ref(0) // const total = ref(0) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
medicalSn: undefined, medicalSn: undefined as string | undefined,
pname: undefined, pname: undefined as string | undefined,
medicalDateTime: [], medicalDateTime: [],
cardId: undefined, cardId: undefined as string | undefined,
phoneNum: undefined, phoneNum: undefined as string | undefined,
domicileaddress: undefined domicileaddress: undefined as string | undefined
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const fileInputRef = ref<HTMLInputElement | null>(null) // const fileInputRef = ref<HTMLInputElement | null>(null) //
@ -134,17 +141,20 @@ const getList = async () => {
loading.value = true loading.value = true
try { try {
const data = await PatientApi.getPatientPage({ const data = await PatientApi.getPatientPage({
pageNo: queryParams.pageNo, ...queryParams,
pageSize: queryParams.pageSize, pname: queryParams.pname?.trim() || undefined
medicalSn: queryParams.medicalSn,
pname: queryParams.pname,
medicalDateTime: queryParams.medicalDateTime,
cardId: queryParams.cardId,
phoneNum: queryParams.phoneNum,
domicileaddress: queryParams.domicileaddress
}) })
list.value = data.list
total.value = data.total //
if (queryParams.pname) {
list.value = data.list.filter(item => item.pname === queryParams.pname?.trim())
total.value = list.value.length
} else {
list.value = data.list
total.value = data.total
}
} catch (error) {
console.error('查询出错:', error)
} finally { } finally {
loading.value = false loading.value = false
} }
@ -155,6 +165,7 @@ const handleQuery = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1
getList() getList()
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
/** 初始化 **/ /** 初始化 **/
@ -164,11 +175,38 @@ onMounted(() => {
/** 打印报告按钮操作 */ /** 打印报告按钮操作 */
const handlePrint = async (row: PatientVO) => { const handlePrint = async (row: PatientVO) => {
const data = await PatientApi.getPatientInfo(row.medicalSn)
//尿
if(!data.xcgcode && !data.ncgcode && !data.shqx){
await PatientApi.syncinspectApplyTj(row.medicalSn)
createPrint(row.medicalSn)
} else {
//
const confirmResult = await ElMessageBox.confirm(
'检验单已存在,是否重新创建?',
'提示',
{
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
}
).catch(() => 'cancel')
// ""
if (confirmResult === 'confirm') {
await PatientApi.syncinspectApplyTj(row.medicalSn)
}
// ""
createPrint(row.medicalSn)
}
}
/** 打印导检单 */
const createPrint = async (medicalSn) => {
try { try {
console.log('开始打印,体检编号:', row.medicalSn);
// 使SummaryApi // 使SummaryApi
const dataPrint = await SummaryApi.printInfoOfMedicalSn(row.medicalSn); const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn);
console.log('获取到的打印数据:', dataPrint); console.log('获取到的打印数据:', dataPrint);
// - 使 // - 使
@ -198,12 +236,18 @@ const handlePrint = async (row: PatientVO) => {
message.error(`打印导检单失败: ${error.message || '未知错误'}`); message.error(`打印导检单失败: ${error.message || '未知错误'}`);
} }
} }
/** 状态格式化 */
/** 日期格式化 */ const statusFormatter = (row: any) => {
const dateFormatter = (row: any, column: any) => { const statusMap: Record<string, string> = {
if (!row.medicalDateTime) return '' '0': '待检查',
const date = new Date(row.medicalDateTime) '1': '已检查',
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}` '2': '放弃',
'3': '挂起,择日检',
'4': '已汇总',
'5': '终检审核',
'6': '报告已取'
}
return statusMap[row.status] || '未知'
} }
/** 处理导入按钮点击 */ /** 处理导入按钮点击 */
@ -225,7 +269,10 @@ const uploadFile = async (event: Event) => {
} }
try { try {
loading.value = true importLoading.value = true // true
fullscreenLoading.value = true // true
console.log('全屏加载状态已设置为:', fullscreenLoading.value) //
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)
@ -241,7 +288,9 @@ const uploadFile = async (event: Event) => {
console.error('导入失败:', error) console.error('导入失败:', error)
message.error('导入失败,请检查文件格式是否正确') message.error('导入失败,请检查文件格式是否正确')
} finally { } finally {
loading.value = false importLoading.value = false // false
fullscreenLoading.value = false // false
console.log('全屏加载状态已重置为:', fullscreenLoading.value) //
} }
} }
</script> </script>