样式以及逻辑BUG修复

This commit is contained in:
Euni4U 2025-03-15 14:43:42 +08:00
parent bf92e61236
commit 63a168ba69
2 changed files with 356 additions and 228 deletions

View File

@ -394,65 +394,6 @@ const loadPatientData = async (patient) => {
}
}
//
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) {
//
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 }
)
//
onMounted(async () => {
if (props.patient) {
@ -473,6 +414,41 @@ onMounted(async () => {
}
})
// watch examType
watch(
() => props.examType,
async (newExamType, oldExamType) => {
if (newExamType !== oldExamType && props.patient && reportData.value.medicalSn) {
//
mediaFiles.value = []
imageUrls.value = []
//
await getImageUrls()
}
}
)
// watch patient
watch(
() => props.patient,
async (newPatient, oldPatient) => {
if (newPatient && (!oldPatient || newPatient.id !== oldPatient.id)) {
//
mediaFiles.value = []
imageUrls.value = []
//
await loadPatientData(newPatient)
//
if (props.examType && reportData.value.medicalSn) {
await getImageUrls()
}
}
}
)
//
const getExamTypeTitle = () => {
const typeMap = {

View File

@ -12,6 +12,7 @@
size="small"
@click="handleSync"
:icon="RefreshRight"
:disabled="isExamCompleted"
>
同步
</el-button>
@ -279,9 +280,28 @@
<!-- 底部操作栏 -->
<div class="action-footer">
<div class="left-section">
<span>检查医生</span>
<span>{{ selectedPatient?.status === '1' || selectedPatient?.status === 1 ? (inspectDoctor || ' ') : ' ' }}</span>
<span style="margin-left: 100px;">检查日期{{ selectedPatient?.status === '1' || selectedPatient?.status === 1 ? (inspectTime || ' ') : ' ' }}</span>
<div class="doctor-select-container">
<span>检查医生</span>
<!-- 根据检查状态显示不同内容 -->
<template v-if="isExamCompleted">
<span>{{ inspectDoctor }}</span>
</template>
<template v-else>
<!-- 修改选择控件 -->
<el-select v-model="inspectDoctor" placeholder="请选择检查医生" :disabled="isDisabled" class="doctor-select">
<el-option
v-for="item in getStrDictOptions('doctor_unit')"
:key="item.value"
:label="item.label"
:value="`${item.label}|${item.value}`"
/>
</el-select>
</template>
</div>
<div class="date-container">
<span>检查日期</span>
<span>{{ inspectTime || formatDate(new Date()) }}</span>
</div>
</div>
<div class="right-section">
<div class="action-buttons">
@ -310,6 +330,9 @@ import { getUserProfile } from '@/api/system/user/profile'
import ExamImages from './Exam_images.vue'
import { ArrowDown, Refresh, RefreshRight } from '@element-plus/icons-vue'
import All from './All.vue' // All
import { PacsDataApi } from '@/api/inspect/inspectpacsdata' // PacsDataApi
import { getStrDictOptions } from '@/utils/dict'//
const dialogTitle = ref('体检报告')
const { t } = useI18n() //
@ -533,14 +556,8 @@ const getpatientitemData = async (medicalSn) => {
}
}
// loadPatientData currentTab
// loadPatientData
const loadPatientData = async (patient) => {
console.log(`[loadPatientData] 开始加载患者数据: ${patient.pname}, ID: ${patient.id}`)
console.log(`[loadPatientData] 加载前的当前标签: ${currentTab.value}`)
// 便
//const savedTab = currentTab.value
try {
const loading = ElLoading.service({
lock: true,
@ -557,6 +574,13 @@ const loadPatientData = async (patient) => {
const patientData = await PatientApi.getPatient(patient.id)
reportData.value = patientData
//
inspectDoctor.value = ''
inspectTime.value = ''
// true
isExamCompleted.value = patient.status === '1' || patient.status === 1
//
const itemsRes = await PatientitemsApi.getPatientitemsPage({
medicalSn: patient.medicalSn,
@ -579,20 +603,17 @@ const loadPatientData = async (patient) => {
biochemical: { summary: '' }
}
//
inspectDoctor.value = ''
inspectTime.value = ''
//
const checkedItems = itemsRes.list.filter(item =>
item.itemStatus === '1' &&
item.sectionID === user.value.deptId
)
//
const checkedItems = itemsRes.list.filter(item => item.itemStatus === '1')
if (checkedItems.length > 0) {
// 使
// 使
const firstCheckedItem = checkedItems[0]
inspectDoctor.value = firstCheckedItem.inspectdoctor || ''
//
if (firstCheckedItem.inspectdoctor) {
inspectDoctor.value = firstCheckedItem.inspectdoctor
}
//
if (firstCheckedItem.inspecttime) {
@ -625,35 +646,32 @@ const loadPatientData = async (patient) => {
ElMessage.error('加载患者数据失败')
} finally {
loading.close()
//
// if (currentTab.value !== savedTab) {
// console.log(`[loadPatientData] : ${currentTab.value} ${savedTab}`)
// currentTab.value = savedTab
// }
}
} catch (error) {
console.error('加载患者数据失败:', error)
ElMessage.error('加载患者数据失败')
}
//
console.log(`[loadPatientData] 加载完成后的当前标签: ${currentTab.value}`)
}
// handlePatientSelect
// handlePatientSelect
const handlePatientSelect = async (patient) => {
try {
//
examConclusion.value = ''
examItems.value = {}
//
selectedPatient.value = patient
//
console.log(`[handlePatientSelect] 开始加载患者数据`)
//
inspectDoctor.value = ''
inspectTime.value = ''
//
isExamCompleted.value = patient.status === '1' || patient.status === 1
await loadPatientData(patient)
console.log(`[handlePatientSelect] 患者数据加载完成`)
currentTab.value='general'
currentTab.value = 'general'
} catch (error) {
console.error('[handlePatientSelect] 切换患者失败:', error)
message.error('切换患者失败')
@ -1027,40 +1045,126 @@ const handleSync = async () => {
throw new Error('未选择患者或体检编号为空')
}
const medicalSn = selectedPatient.value.medicalSn
// 便
const currentSelectedPatient = { ...selectedPatient.value }
const medicalSn = currentSelectedPatient.medicalSn
//
const types = ['XCG', 'NCG', 'SHQX','ECG','YBJC']
const types = ['XCG', 'NCG', 'SHQX', 'ECG', 'YBJC']
//
const syncPromises = [
//
...types.map(type =>
//
const existingDataPromises = types.map(type =>
PacsDataApi.getPacsDataPage({
code: medicalSn,
type: type,
pageNo: 1,
pageSize: 1
}).catch(error => {
console.warn(`检查${type}数据是否存在时出错:`, error)
return { list: [] }
})
)
//
const usExistingData = await PacsDataApi.getPacsDataPage({
code: medicalSn,
type: 'US',
pageNo: 1,
pageSize: 1
}).catch(error => {
console.warn('检查超声数据是否存在时出错:', error)
return { list: [] }
})
//
const ecgExistingData = await PacsDataApi.getPacsDataPage({
code: medicalSn,
type: 'ECG',
pageNo: 1,
pageSize: 1
}).catch(error => {
console.warn('检查心电图数据是否存在时出错:', error)
return { list: [] }
})
//
const existingDataResults = await Promise.all(existingDataPromises)
//
const typesToSync = []
existingDataResults.forEach((result, index) => {
const type = types[index]
//
const needsSync = !result.list || result.list.length === 0 ||
(result.list[0] && (!result.list[0].data || result.list[0].data === ''))
if (needsSync) {
typesToSync.push(type)
} else {
console.log(`${type}数据已存在且不为空,跳过同步`)
}
})
//
const needsSyncUS = !usExistingData.list || usExistingData.list.length === 0 ||
(usExistingData.list[0] && (!usExistingData.list[0].data || usExistingData.list[0].data === ''))
//
const needsSyncECG = !ecgExistingData.list || ecgExistingData.list.length === 0 ||
(ecgExistingData.list[0] && (!ecgExistingData.list[0].data || ecgExistingData.list[0].data === ''))
//
const syncPromises = []
//
typesToSync.forEach(type => {
syncPromises.push(
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)
)
})
//
if (needsSyncUS) {
syncPromises.push(
PatientApi.getUSTj(medicalSn)
.catch(error => {
console.warn('获取心电报告失败:', error)
console.warn('获取超声报告失败:', error)
return null
}),
//
PatientApi.GetApiYbjcInfo(medicalSn, selectedPatient.value?.cardId)//
})
)
}
//
if (needsSyncECG) {
syncPromises.push(
PatientApi.GetApiEcgInfo(medicalSn)
.catch(error => {
console.warn('获取心电图报告失败:', error)
return null
})
)
}
//
if (typesToSync.includes('YBJC')) {
syncPromises.push(
PatientApi.GetApiYbjcInfo(medicalSn, currentSelectedPatient.cardId)
.catch(error => {
console.warn('获取一般检查报告失败:', error)
return null
})
]
)
}
//
if (syncPromises.length === 0) {
loading.close()
ElMessage.info('所有报告数据已存在,无需同步')
return
}
const results = await Promise.all(syncPromises)
@ -1071,66 +1175,24 @@ const handleSync = async () => {
}
//
results.forEach((result, index) => {
let successCount = 0
results.forEach(result => {
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('超声报告同步成功')
}
successCount++
}
})
//
await new Promise(resolve => setTimeout(resolve, 1000))
//
const today = new Date()
const todayStart = new Date(today.setHours(0, 0, 0, 0))
const todayEnd = new Date(today.setHours(23, 59, 59, 999))
const params = {
pageNo: pageNo.value,
pageSize: pageSize.value,
medicalDateTime: [
`${formatDate(todayStart)} 00:00:00`,
`${formatDate(todayEnd)} 23:59:59`
]
}
const res = await PatientApi.getPatientPage(params)
//
patients.value = res.list
originalPatients.value = res.list
total.value = res.total
//
patientDataCache.value.clear()
//
if (selectedPatient.value) {
await loadPatientData(selectedPatient.value)
}
//
await loadPatientData(currentSelectedPatient)
loading.close()
ElMessage.success('同步成功')
ElMessage.success(`同步成功,共同步了${successCount}个报告`)
} catch (error) {
loading.close()
console.error('同步数据失败:', error)
@ -1473,6 +1535,13 @@ const handleSaveAllResults = async () => {
const userProfile = await getUserProfile()
user.value = userProfile
const currentTimestamp = Date.now()
const currentDate = formatDate(new Date())
//
let doctorName = inspectDoctor.value
if (doctorName && doctorName.includes('|')) {
doctorName = doctorName.split('|')[0] //
}
//
let allUpdatedItems = []
@ -1489,9 +1558,10 @@ const handleSaveAllResults = async () => {
id: item.id,
medicalSn: selectedPatient.value?.medicalSn,
itemStatus: '1', //
inspectdoctor: user.value?.nickname || '',
inspecttime: currentTimestamp,
sectionID: user.value?.deptId
inspectdoctor: doctorName || user.value?.nickname || '',
inspecttime: currentTimestamp, // 使
sectionID: user.value?.deptId,
itemResult: item.value || '' //
}
//
@ -1523,27 +1593,27 @@ const handleSaveAllResults = async () => {
allUpdatedItems.push({
...baseFields,
analyse: conclusionData.value.blood?.summary?.trim() || '', // analyse
itemResult: conclusionData.value.blood?.summary?.trim() || '' // itemResult
itemResult: item.value || conclusionData.value.blood?.summary?.trim() || '' //
})
} else if (itemName.includes('尿常规') || itemName.includes('尿液分析')) {
allUpdatedItems.push({
...baseFields,
analyse: conclusionData.value.urine?.summary?.trim() || '', // analyse
itemResult: conclusionData.value.urine?.summary?.trim() || '' // itemResult
itemResult: item.value || conclusionData.value.urine?.summary?.trim() || '' //
})
} else if (itemName.includes('生化') || itemName.includes('肝功能') || itemName.includes('肾功能') ||
itemName.includes('血脂') || itemName.includes('血糖') || itemName.includes('电解质')) {
allUpdatedItems.push({
...baseFields,
analyse: conclusionData.value.biochemical?.summary?.trim() || '', // analyse
itemResult: conclusionData.value.biochemical?.summary?.trim() || '' // itemResult
itemResult: item.value || conclusionData.value.biochemical?.summary?.trim() || '' //
})
} else {
//
allUpdatedItems.push({
...baseFields,
analyse: conclusionData.value.general?.summary?.trim() || '', // analyse
itemResult: conclusionData.value.general?.summary?.trim() || '' // itemResult
itemResult: item.value || conclusionData.value.general?.summary?.trim() || '' //
})
}
})
@ -1558,8 +1628,7 @@ const handleSaveAllResults = async () => {
await PatientitemsApi.updatePatientitemsBatch(allUpdatedItems)
//
inspectDoctor.value = user.value?.nickname || ''
inspectTime.value = formatDate(new Date())
inspectTime.value = currentDate
// - API
if (selectedPatient.value) {
@ -1567,7 +1636,7 @@ const handleSaveAllResults = async () => {
await PatientApi.updatePatient({
id: selectedPatient.value.id,
status: 1, //
medicalDateTime: currentTimestamp //
medicalDateTime: currentTimestamp //
})
//
@ -1599,7 +1668,7 @@ const handleSaveAllResults = async () => {
}
}
//
// refreshExamData
const refreshExamData = async () => {
try {
//
@ -1633,8 +1702,30 @@ const refreshExamData = async () => {
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
)
if (checkedItems.length > 0) {
// 使
const firstCheckedItem = checkedItems[0]
//
if (firstCheckedItem.inspectdoctor) {
inspectDoctor.value = firstCheckedItem.inspectdoctor
//
isExamCompleted.value = true
}
//
if (firstCheckedItem.inspecttime) {
const inspectDate = new Date(Number(firstCheckedItem.inspecttime))
inspectTime.value = formatDate(inspectDate)
}
}
}
} catch (error) {
console.error('刷新数据失败:', error)
@ -1644,6 +1735,7 @@ const refreshExamData = async () => {
//
const inspectDoctor = ref('')
const inspectTime = ref('')
// inspectDate 使
//
const isSpecialExam = computed(() => {
@ -1683,25 +1775,28 @@ const handleStatusFilterChange = (value) => {
selectedPatient.value = null
}
// currentTab
watch(currentTab, (newTab, oldTab) => {
console.log(`[watch] currentTab 变化: 从 ${oldTab}${newTab}`)
}, { immediate: true })
//
const isExamCompleted = ref(false)
</script>
<style scoped>
.medical-report {
display: flex;
height: 83vh;
min-height: 600px;
overflow: hidden;
display: flex;
height: calc(100vh - 120px); /* 使用视口高度减去头部和其他元素的高度 */
min-height: 600px;
overflow: hidden;
width: 100%;
}
.patient-list {
width: 280px;
background: #fff;
border-right: 1px solid #e6e6e6;
width: 280px;
min-width: 250px; /* 设置最小宽度 */
background: #fff;
border-right: 1px solid #e6e6e6;
display: flex;
flex-direction: column; /* 确保子元素垂直排列 */
height: 100%;
}
.list-header {
@ -1805,11 +1900,13 @@ border-bottom: 1px solid #e6e6e6;
}
.report-content {
flex: 1;
display: flex;
flex-direction: column;
position: relative;
background: #fff;
flex: 1;
display: flex;
flex-direction: column;
position: relative;
background: #fff;
overflow: auto; /* 添加滚动条 */
height: 100%;
}
.main-content {
@ -1858,11 +1955,10 @@ border-left-color: #409EFF;
}
.basic-info {
display: flex;
gap: 20px;
padding: 10px;
background: #F8F9FA;
border-radius: 4px;
flex-shrink: 0; /* 防止基本信息区域被压缩 */
}
.photo-box {
@ -1974,13 +2070,14 @@ flex: 1;
}
.result-table {
margin: 2px 0;
border: 1px solid #ebeef5;
border-radius: 4px;
height: 366px; /* 固定高度与Charge.vue保持一致 */
display: flex;
flex-direction: column;
background: #fff;
flex: 1;
overflow: auto; /* 使表格可滚动 */
border: 1px solid #ebeef5;
border-radius: 4px;
display: flex;
flex-direction: column;
background: #fff;
min-height: 200px; /* 设置最小高度 */
}
/* 表头样式 */
@ -2053,10 +2150,11 @@ background: #f5f7fa;
/* 修改体检小结样式 */
.summary-section {
margin-top: 20px;
padding: 20px;
margin-top: 15px;
padding: 15px;
background: #f8f9fa;
border-radius: 4px;
flex-shrink: 0; /* 防止被压缩 */
}
.section-title {
@ -2070,7 +2168,7 @@ border-left: 4px solid #409eff;
.summary-textarea {
width: 100%;
height: 120px;
height: 100px; /* 减小高度 */
padding: 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
@ -2091,7 +2189,7 @@ cursor: not-allowed;
}
.action-footer {
position: absolute;
position: sticky; /* 改为粘性定位 */
bottom: 0;
left: 0;
right: 0;
@ -2102,12 +2200,14 @@ padding: 10px 20px;
background: #fff;
border-top: 1px solid #ebeef5;
z-index: 10;
flex-shrink: 0; /* 防止被压缩 */
}
.left-section {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: nowrap; /* 防止换行 */
}
.signature {
@ -2205,7 +2305,7 @@ flex-wrap: wrap;
}
.list-content {
height: calc(100% - 180px);
flex: 1; /* 让列表内容区域占据剩余空间 */
overflow-y: auto;
position: relative;
display: flex;
@ -2304,9 +2404,11 @@ background: #fff;
/* 确保图片展示组件能够正确填充空间 */
:deep(.exam-images) {
height: 100%;
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
overflow: auto;
}
/* 美化滚动条样式 */
@ -2502,7 +2604,6 @@ cursor: not-allowed;
flex-direction: column;
height: 100%;
overflow: hidden;
padding: 3px;
}
.tabs-container {
@ -2544,29 +2645,17 @@ cursor: not-allowed;
.findings-diagnosis-container {
display: flex;
gap: 20px;
margin: 15px 0;
margin-top: 15px;
flex-shrink: 0; /* 防止被压缩 */
}
.findings-section,
.diagnosis-section {
.findings-section, .diagnosis-section {
flex: 1;
padding: 15px;
background: #f8f9fa;
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
display: flex;
flex-direction: column;
}
.section-title {
font-size: 16px;
font-weight: 500;
color: #303133;
margin-bottom: 15px;
padding-left: 10px;
border-left: 4px solid #409eff;
}
.findings-textarea,
.diagnosis-textarea {
.findings-textarea, .diagnosis-textarea {
width: 100%;
height: 120px;
padding: 12px;
@ -2630,4 +2719,67 @@ cursor: not-allowed;
:deep(.el-radio__label) {
font-size: 13px;
}
/* 添加媒体查询,适应不同屏幕尺寸 */
@media screen and (max-width: 1366px) {
.findings-diagnosis-container {
flex-direction: column;
gap: 10px;
}
.findings-textarea, .diagnosis-textarea, .summary-textarea {
height: 80px;
}
.exam-tabs {
flex-wrap: wrap;
}
}
@media screen and (max-width: 1024px) {
.patient-list {
width: 240px;
}
.info-row {
flex-direction: column;
gap: 8px;
}
.info-item {
width: 100%;
}
}
/* 添加这些新样式 */
.doctor-select-container {
display: flex;
align-items: center;
white-space: nowrap;
}
.doctor-select {
margin-left: 8px;
width: 180px;
}
.date-container {
display: flex;
align-items: center;
white-space: nowrap;
}
/* 修改左侧区域样式 */
.left-section {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: nowrap; /* 防止换行 */
}
/* 确保 el-select 不会被挤压 */
:deep(.el-select) {
width: auto;
min-width: 180px;
}
</style>