新增汇总页面展示相关
This commit is contained in:
parent
0a860f7418
commit
2d6814d348
@ -139,9 +139,17 @@
|
||||
|
||||
<!-- 检查结果表格 -->
|
||||
<div class="result-table">
|
||||
<!-- 汇总页面 -->
|
||||
<Summary
|
||||
v-if="currentTab === 'summary'"
|
||||
:patient="selectedPatient"
|
||||
:report-data="reportData"
|
||||
:conclusion-data="conclusionData"
|
||||
/>
|
||||
|
||||
<!-- 特殊检查类型 -->
|
||||
<All
|
||||
v-if="isSpecialExam"
|
||||
v-else-if="isSpecialExam"
|
||||
:patient="selectedPatient"
|
||||
:exam-type="currentTab"
|
||||
/>
|
||||
@ -265,11 +273,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 其他类型使用单栏小结 -->
|
||||
<div v-else class="summary-section">
|
||||
<!-- 其他类型使用单栏小结,但不包括汇总标签 -->
|
||||
<div v-else-if="currentTab !== 'summary'" class="summary-section">
|
||||
<div class="section-title">体检小结</div>
|
||||
<textarea
|
||||
v-model="conclusionData[currentTab].summary"
|
||||
v-model="currentSummary"
|
||||
placeholder="输入多个以分号隔开"
|
||||
class="summary-textarea"
|
||||
:readonly="isReadOnly"
|
||||
@ -332,6 +340,7 @@ 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'//导入字典
|
||||
import Summary from './summary.vue' // 导入Summary组件用于汇总页面
|
||||
|
||||
|
||||
const dialogTitle = ref('体检报告')
|
||||
@ -389,7 +398,8 @@ const examTabs = ref([
|
||||
{ id: 'ecg', name: '心电图', color: '#00CCFF' },
|
||||
{ id: 'blood', name: '血常规', color: '#66CCFF' },
|
||||
{ id: 'urine', name: '尿常规', color: '#99CCFF' },
|
||||
{ id: 'biochemical', name: '生化', color: '#0099CC' }
|
||||
{ id: 'biochemical', name: '生化', color: '#0099CC' },
|
||||
{ id: 'summary', name: '汇总', color: '#0099CC' }
|
||||
])
|
||||
|
||||
const currentTab = ref('general')
|
||||
@ -419,20 +429,21 @@ return [...currentExamItems.value].sort((a, b) => {
|
||||
});
|
||||
});
|
||||
|
||||
// 修改 switchTab 函数,添加防止重复设置的逻辑
|
||||
// 修改 switchTab 函数,添加对汇总标签的特殊处理
|
||||
const switchTab = async (tabId) => {
|
||||
// 设置新的当前标签
|
||||
currentTab.value = tabId
|
||||
}
|
||||
|
||||
// 修改 conclusionData 的数据结构
|
||||
// 修改 conclusionData 的数据结构,添加 summary 字段
|
||||
const conclusionData = ref({
|
||||
general: { summary: '' },
|
||||
ultrasound: { finding: '', diagnosis: '' },
|
||||
ecg: { finding: '', diagnosis: '' },
|
||||
blood: { summary: '' },
|
||||
urine: { summary: '' },
|
||||
biochemical: { summary: '' } // 添加生化检查的小结
|
||||
biochemical: { summary: '' },
|
||||
summary: { summary: '' } // 确保这里有 summary 对象
|
||||
})
|
||||
|
||||
// 其他数据
|
||||
@ -1756,7 +1767,7 @@ const inspectDoctor = ref('')
|
||||
const inspectTime = ref('')
|
||||
// 不再需要 inspectDate 变量,直接使用当前日期
|
||||
|
||||
// 添加特殊检查类型的计算属性
|
||||
// 修改特殊检查类型的计算属性,移除summary
|
||||
const isSpecialExam = computed(() => {
|
||||
return ['ultrasound', 'ecg', 'blood', 'urine', 'biochemical'].includes(currentTab.value)
|
||||
})
|
||||
@ -1797,6 +1808,25 @@ const handleStatusFilterChange = (value) => {
|
||||
// 添加检查是否已完成的响应式引用
|
||||
const isExamCompleted = ref(false)
|
||||
|
||||
// 添加计算属性处理小结内容
|
||||
const currentSummary = computed({
|
||||
get() {
|
||||
if (conclusionData.value[currentTab.value]?.summary) {
|
||||
return conclusionData.value[currentTab.value].summary;
|
||||
} else if (typeof conclusionData.value[currentTab.value] === 'string') {
|
||||
return conclusionData.value[currentTab.value];
|
||||
}
|
||||
return '';
|
||||
},
|
||||
set(value) {
|
||||
if (typeof conclusionData.value[currentTab.value] === 'object') {
|
||||
conclusionData.value[currentTab.value].summary = value;
|
||||
} else {
|
||||
conclusionData.value[currentTab.value] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
381
src/views/Department-entry/summary.vue
Normal file
381
src/views/Department-entry/summary.vue
Normal file
@ -0,0 +1,381 @@
|
||||
<template>
|
||||
<div class="summary-container">
|
||||
<div class="summary-header">
|
||||
<div class="title-with-button">
|
||||
<h3>体检汇总</h3>
|
||||
<el-button
|
||||
type="success"
|
||||
circle
|
||||
size="small"
|
||||
@click="loadPatientItems"
|
||||
class="refresh-button"
|
||||
>
|
||||
<el-icon><Refresh /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="summary-content">
|
||||
<!-- 始终显示文本框,即使没有数据 -->
|
||||
<div class="summary-textarea-container">
|
||||
<textarea
|
||||
class="summary-textarea"
|
||||
v-model="editableSummary"
|
||||
placeholder="请输入体检汇总内容"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { PatientitemsApi } from '@/api/inspect/inspectpatientitems'
|
||||
import { ElLoading, ElMessage } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
|
||||
const props = defineProps({
|
||||
patient: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
reportData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
conclusionData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
// 汇总数据
|
||||
const summaryData = ref({
|
||||
general: { summary: '' },
|
||||
ultrasound: { finding: '', diagnosis: '' },
|
||||
ecg: { finding: '', diagnosis: '' },
|
||||
blood: { summary: '' },
|
||||
urine: { summary: '' },
|
||||
biochemical: { summary: '' }
|
||||
})
|
||||
|
||||
// 可编辑的汇总文本
|
||||
const editableSummary = ref('')
|
||||
|
||||
// 格式化汇总数据为文本
|
||||
const formatSummaryData = () => {
|
||||
let result = '';
|
||||
|
||||
// 一般检查
|
||||
if (summaryData.value.general?.summary) {
|
||||
result += '【一般检查】\n' + summaryData.value.general.summary + '\n\n';
|
||||
}
|
||||
|
||||
// 超声检查
|
||||
if (summaryData.value.ultrasound?.finding || summaryData.value.ultrasound?.diagnosis) {
|
||||
result += '【超声】\n';
|
||||
if (summaryData.value.ultrasound.finding) {
|
||||
result += '检查所见:' + summaryData.value.ultrasound.finding + '\n';
|
||||
}
|
||||
if (summaryData.value.ultrasound.diagnosis) {
|
||||
result += '检查结果:' + summaryData.value.ultrasound.diagnosis + '\n';
|
||||
}
|
||||
result += '\n';
|
||||
}
|
||||
|
||||
// 心电图检查
|
||||
if (summaryData.value.ecg?.finding || summaryData.value.ecg?.diagnosis) {
|
||||
result += '【心电图】\n';
|
||||
if (summaryData.value.ecg.finding) {
|
||||
result += '检查所见:' + summaryData.value.ecg.finding + '\n';
|
||||
}
|
||||
if (summaryData.value.ecg.diagnosis) {
|
||||
result += '检查结果:' + summaryData.value.ecg.diagnosis + '\n';
|
||||
}
|
||||
result += '\n';
|
||||
}
|
||||
|
||||
// 血常规
|
||||
if (summaryData.value.blood?.summary) {
|
||||
result += '【血常规】\n' + summaryData.value.blood.summary + '\n\n';
|
||||
}
|
||||
|
||||
// 尿常规
|
||||
if (summaryData.value.urine?.summary) {
|
||||
result += '【尿常规】\n' + summaryData.value.urine.summary + '\n\n';
|
||||
}
|
||||
|
||||
// 生化
|
||||
if (summaryData.value.biochemical?.summary) {
|
||||
result += '【生化】\n' + summaryData.value.biochemical.summary + '\n\n';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 从DOM中获取各个标签页的数据
|
||||
const getDataFromDOM = () => {
|
||||
console.log('尝试从DOM中获取数据...')
|
||||
|
||||
try {
|
||||
const parentDoc = window.parent ? window.parent.document : document
|
||||
|
||||
// 更新选择器以匹配体检车页面的结构
|
||||
const selectors = {
|
||||
general: [
|
||||
'[data-tab="general"] .summary-textarea',
|
||||
'#体检小结',
|
||||
'[placeholder*="体检小结"]'
|
||||
],
|
||||
ultrasoundFinding: [
|
||||
'[data-tab="ultrasound"] .findings-textarea',
|
||||
'[data-tab="ultrasound-finding"]'
|
||||
],
|
||||
ultrasoundDiagnosis: [
|
||||
'[data-tab="ultrasound"] .diagnosis-textarea',
|
||||
'[data-tab="ultrasound-diagnosis"]'
|
||||
],
|
||||
ecgFinding: [
|
||||
'[data-tab="ecg"] .findings-textarea',
|
||||
'[data-tab="ecg-finding"]'
|
||||
],
|
||||
ecgDiagnosis: [
|
||||
'[data-tab="ecg"] .diagnosis-textarea',
|
||||
'[data-tab="ecg-diagnosis"]'
|
||||
],
|
||||
blood: ['[data-tab="blood"] .summary-textarea'],
|
||||
urine: ['[data-tab="urine"] .summary-textarea'],
|
||||
biochemical: ['[data-tab="biochemical"] .summary-textarea']
|
||||
}
|
||||
|
||||
// 尝试使用不同的选择器获取元素
|
||||
const getElementValue = (selectorList) => {
|
||||
for (const selector of selectorList) {
|
||||
const element = parentDoc.querySelector(selector)
|
||||
if (element) {
|
||||
console.log(`找到元素 ${selector}:`, element)
|
||||
return element.value || ''
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// 获取各个标签页的内容
|
||||
const generalSummary = getElementValue(selectors.general)
|
||||
const ultrasoundFinding = getElementValue(selectors.ultrasoundFinding)
|
||||
const ultrasoundDiagnosis = getElementValue(selectors.ultrasoundDiagnosis)
|
||||
const ecgFinding = getElementValue(selectors.ecgFinding)
|
||||
const ecgDiagnosis = getElementValue(selectors.ecgDiagnosis)
|
||||
const bloodSummary = getElementValue(selectors.blood)
|
||||
const urineSummary = getElementValue(selectors.urine)
|
||||
const biochemicalSummary = getElementValue(selectors.biochemical)
|
||||
|
||||
console.log('从DOM获取的数据:')
|
||||
console.log('一般检查小结:', generalSummary)
|
||||
console.log('超声检查所见:', ultrasoundFinding)
|
||||
console.log('超声检查结果:', ultrasoundDiagnosis)
|
||||
console.log('心电图检查所见:', ecgFinding)
|
||||
console.log('心电图检查结果:', ecgDiagnosis)
|
||||
console.log('血常规小结:', bloodSummary)
|
||||
console.log('尿常规小结:', urineSummary)
|
||||
console.log('生化小结:', biochemicalSummary)
|
||||
|
||||
// 如果没有找到一般检查小结,尝试从体检小结文本框获取
|
||||
if (!generalSummary) {
|
||||
console.log('尝试从体检小结文本框获取数据...')
|
||||
const generalTextarea = parentDoc.querySelector('#体检小结') ||
|
||||
parentDoc.querySelector('.体检小结') ||
|
||||
parentDoc.querySelector('[placeholder*="体检小结"]')
|
||||
|
||||
if (generalTextarea) {
|
||||
console.log('找到体检小结文本框:', generalTextarea)
|
||||
const generalText = generalTextarea.value || ''
|
||||
console.log('体检小结内容:', generalText)
|
||||
|
||||
// 更新汇总数据
|
||||
return {
|
||||
general: { summary: generalText },
|
||||
ultrasound: { finding: ultrasoundFinding, diagnosis: ultrasoundDiagnosis },
|
||||
ecg: { finding: ecgFinding, diagnosis: ecgDiagnosis },
|
||||
blood: { summary: bloodSummary },
|
||||
urine: { summary: urineSummary },
|
||||
biochemical: { summary: biochemicalSummary }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新汇总数据
|
||||
return {
|
||||
general: { summary: generalSummary },
|
||||
ultrasound: { finding: ultrasoundFinding, diagnosis: ultrasoundDiagnosis },
|
||||
ecg: { finding: ecgFinding, diagnosis: ecgDiagnosis },
|
||||
blood: { summary: bloodSummary },
|
||||
urine: { summary: urineSummary },
|
||||
biochemical: { summary: biochemicalSummary }
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('从DOM中获取数据失败:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// 加载患者的所有检查项目数据
|
||||
const loadPatientItems = async () => {
|
||||
if (!props.patient || !props.patient.medicalSn) {
|
||||
console.error('患者信息不存在或体检编号为空', props.patient)
|
||||
ElMessage.warning('患者信息不完整,无法加载汇总数据')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '加载汇总数据中...',
|
||||
background: 'rgba(255, 255, 255, 0.7)'
|
||||
})
|
||||
|
||||
console.log('当前患者信息:', props.patient)
|
||||
|
||||
// 优先使用props中的conclusionData
|
||||
if (props.conclusionData) {
|
||||
console.log('从props获取conclusionData:', props.conclusionData)
|
||||
summaryData.value = props.conclusionData
|
||||
} else if (window.parent?.conclusionData) {
|
||||
console.log('父窗口conclusionData:', window.parent.conclusionData)
|
||||
const parentData = window.parent.conclusionData
|
||||
|
||||
// 复制父组件的数据到本地
|
||||
summaryData.value = {
|
||||
general: { summary: parentData.general?.summary || '' },
|
||||
ultrasound: {
|
||||
finding: parentData.ultrasound?.finding || '',
|
||||
diagnosis: parentData.ultrasound?.diagnosis || ''
|
||||
},
|
||||
ecg: {
|
||||
finding: parentData.ecg?.finding || '',
|
||||
diagnosis: parentData.ecg?.diagnosis || ''
|
||||
},
|
||||
blood: { summary: parentData.blood?.summary || '' },
|
||||
urine: { summary: parentData.urine?.summary || '' },
|
||||
biochemical: { summary: parentData.biochemical?.summary || '' }
|
||||
}
|
||||
|
||||
console.log('从父窗口获取的汇总数据:', summaryData.value)
|
||||
} else {
|
||||
console.warn('父窗口中没有找到conclusionData,尝试从全局变量获取')
|
||||
|
||||
// 尝试从全局变量获取
|
||||
if (window.conclusionData) {
|
||||
console.log('从全局变量获取conclusionData:', window.conclusionData)
|
||||
summaryData.value = window.conclusionData
|
||||
} else {
|
||||
console.warn('全局变量中没有找到conclusionData,尝试从props获取')
|
||||
|
||||
// 尝试从props中获取数据
|
||||
if (props.reportData && props.reportData.conclusionData) {
|
||||
console.log('从props.reportData中获取数据:', props.reportData.conclusionData)
|
||||
summaryData.value = props.reportData.conclusionData
|
||||
} else {
|
||||
// 尝试直接从父组件的DOM中获取数据
|
||||
const domData = getDataFromDOM()
|
||||
if (domData) {
|
||||
summaryData.value = domData
|
||||
} else {
|
||||
console.error('无法从任何来源获取汇总数据')
|
||||
ElMessage.warning('无法获取汇总数据,请检查数据来源')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化汇总数据并设置为可编辑文本
|
||||
const formattedText = formatSummaryData()
|
||||
console.log('格式化后的文本:', formattedText)
|
||||
editableSummary.value = formattedText
|
||||
|
||||
loading.close()
|
||||
|
||||
if (formattedText) {
|
||||
ElMessage.success('体检汇总数据已刷新')
|
||||
} else {
|
||||
ElMessage.warning('未找到可用的体检汇总数据')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载汇总数据失败:', error)
|
||||
ElMessage.error('加载汇总数据失败: ' + error.message)
|
||||
loading.close()
|
||||
}
|
||||
}
|
||||
|
||||
// 移除自动加载的监听器和onMounted钩子
|
||||
// 只有点击刷新按钮时才会调用loadPatientItems函数
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.summary-container {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.summary-header {
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.title-with-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.summary-header h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.summary-content {
|
||||
height: calc(100% - 60px);
|
||||
}
|
||||
|
||||
.summary-textarea-container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.summary-textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 500px;
|
||||
padding: 20px;
|
||||
border: 1px solid #333333;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
color: #606266;
|
||||
resize: none;
|
||||
background-color: #ffffff;
|
||||
font-family: Arial, sans-serif;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.summary-textarea:focus {
|
||||
border-color: #333333;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.empty-data {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 300px;
|
||||
background: #ffffff;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdfe6;
|
||||
}
|
||||
|
||||
.refresh-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user