提交merge1.3
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
<<<<<<< HEAD
|
||||
<!--
|
||||
* @Author: sjjh
|
||||
* @Date: 2025-09-18 15:41:10
|
||||
* @Description: 门诊病历组件
|
||||
-->
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
<template>
|
||||
<div class="emr-use-container">
|
||||
<div
|
||||
@@ -48,18 +51,35 @@
|
||||
<!-- <el-button type="primary" @click="newEmr">新建</el-button> -->
|
||||
<el-button type="primary" @click="saveAsModel">存为模版</el-button>
|
||||
<el-button @click="refresh">刷新</el-button>
|
||||
<<<<<<< HEAD
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<!-- <el-button type="primary" @click="print">打印</el-button> -->
|
||||
=======
|
||||
<el-button @click="resetForm">重置</el-button>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="print">打印</el-button>
|
||||
>>>>>>> v1.3
|
||||
</el-space>
|
||||
</div>
|
||||
<div class="operate-main">
|
||||
<el-scrollbar class="template-tree-scrollbar">
|
||||
<<<<<<< HEAD
|
||||
<component
|
||||
:is="currentComponent"
|
||||
ref="emrComponentRef"
|
||||
:patientInfo="props.patientInfo"
|
||||
@submitOk="handleSubmitOk"
|
||||
/>
|
||||
=======
|
||||
<div v-loading="loading" class="loading-container">
|
||||
<component
|
||||
:is="currentComponent"
|
||||
ref="emrComponentRef"
|
||||
:patientInfo="props.patientInfo"
|
||||
@submitOk="handleSubmitOk"
|
||||
/>
|
||||
</div>
|
||||
>>>>>>> v1.3
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,6 +92,10 @@
|
||||
@historyClick="handleHistoryClick"
|
||||
ref="historyRef"
|
||||
v-model:definitionId="currentSelectTemplate.id"
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
:selectedRecordId="selectedHistoryRecordId"
|
||||
>>>>>>> v1.3
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="模版" name="model">
|
||||
@@ -95,6 +119,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
<<<<<<< HEAD
|
||||
import { getCurrentInstance, nextTick, onBeforeMount, onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import { getTreeList } from '@/views/basicmanage/caseTemplates/api';
|
||||
@@ -107,6 +132,21 @@ const { proxy } = getCurrentInstance();
|
||||
const emits = defineEmits(['emrSaved']);
|
||||
const props = defineProps({
|
||||
/** 患者信息 doctorStation 传递信息*/
|
||||
=======
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { getTreeList } from '@/views/basicmanage/caseTemplates/api';
|
||||
import { saveOrUpdateRecord, addTemplate, getRecordByEncounterIdList, recordPrint } from './api';
|
||||
import { patientInfo } from '../store/patient.js';
|
||||
import dayjs from 'dayjs';
|
||||
// 打印工具
|
||||
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js';
|
||||
import { getEncounterDiagnosis } from '../api';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emits = defineEmits([]);
|
||||
const props = defineProps({
|
||||
/** 患者信息 doctorStation 传递信息*/
|
||||
>>>>>>> v1.3
|
||||
patientInfo: {
|
||||
type: Object,
|
||||
required: true,
|
||||
@@ -129,6 +169,10 @@ const queryParams = ref({
|
||||
useRanges: [1, 2], // 0 暂不使用 1 全院 2 科室 3 个人
|
||||
organizationId: userStore.orgId,
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
const loading = ref(false); // 数据加载状态
|
||||
>>>>>>> v1.3
|
||||
|
||||
const currentSelectTemplate = ref({
|
||||
id: '',
|
||||
@@ -138,6 +182,10 @@ const emrComponentRef = ref(null);
|
||||
const quicklyactiveName = ref('history');
|
||||
const leftShow = ref(true);
|
||||
const rightShow = ref(true);
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
const templateTree = ref(null);
|
||||
>>>>>>> v1.3
|
||||
|
||||
// 树配置(模板树)
|
||||
const defaultProps = {
|
||||
@@ -150,6 +198,12 @@ const queryTemplateTree = async () => {
|
||||
try {
|
||||
const res = await getTreeList(queryParams.value);
|
||||
templateData.value = res.data || [];
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
// 组件挂载后,患者信息变化时会自动调用selectDefaultTemplate
|
||||
// 这里不再重复调用,避免重复操作
|
||||
>>>>>>> v1.3
|
||||
} catch (error) {
|
||||
// ElMessage.error('获取模板树失败');
|
||||
templateData.value = [];
|
||||
@@ -169,7 +223,24 @@ const handleNodeClick = (data, node) => {
|
||||
};
|
||||
// currentComponent.value = null;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
historyRef.value?.queryList();
|
||||
=======
|
||||
|
||||
// 确保组件状态更新后再查询历史记录
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
|
||||
// 选择任何病历模板后,都加载该病历类型的最新历史记录
|
||||
if (node.isLeaf && props.patientInfo && props.patientInfo.patientId) {
|
||||
loadLatestMedicalRecord();
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
>>>>>>> v1.3
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
|
||||
@@ -229,19 +300,38 @@ const handleSubmitOk = async (data) => {
|
||||
editForm.value.encounterId = patientInfo.value.encounterId;
|
||||
editForm.value.patientId = patientInfo.value.patientId;
|
||||
editForm.value.recordTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
<<<<<<< HEAD
|
||||
await addRecord(editForm.value);
|
||||
ElMessage.success('病历保存成功');
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
// 通知父组件病历保存成功
|
||||
emits('emrSaved', true);
|
||||
=======
|
||||
// 提交病历
|
||||
await saveOrUpdateRecord(editForm.value);
|
||||
ElMessage.success('保存成功');
|
||||
|
||||
// 刷新历史记录列表
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
|
||||
// 等待历史记录列表更新后,重新加载最新病历并更新选中状态
|
||||
setTimeout(() => {
|
||||
loadLatestMedicalRecord();
|
||||
}, 100);
|
||||
>>>>>>> v1.3
|
||||
} catch (error) {
|
||||
ElMessage.error('提交失败');
|
||||
console.log(error);
|
||||
}
|
||||
} else if (currentOperate.value === 'addTemplate') {
|
||||
<<<<<<< HEAD
|
||||
// 新增或者编辑模板
|
||||
// editTemplateForm.value.id=
|
||||
=======
|
||||
// 新增或修改模板
|
||||
>>>>>>> v1.3
|
||||
editTemplateForm.value.name =
|
||||
currentSelectTemplate.value.name + dayjs().format('YYYY/MM/DD HH:mm');
|
||||
editTemplateForm.value.contextJson = JSON.stringify(data);
|
||||
@@ -256,6 +346,7 @@ const refresh = () => {
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const deleteEmr = async () => {
|
||||
try {
|
||||
// 这里应该添加实际的删除逻辑
|
||||
@@ -267,6 +358,14 @@ const deleteEmr = async () => {
|
||||
|
||||
const save = async () => {
|
||||
try {
|
||||
=======
|
||||
const save = async () => {
|
||||
try {
|
||||
if (editForm.value && editForm.value.printCount && editForm.value.printCount > 0) {
|
||||
ElMessage.warning('该病历已打印,不允许修改');
|
||||
return;
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
currentOperate.value = 'add';
|
||||
await emrComponentRef.value?.submit();
|
||||
} catch (error) {
|
||||
@@ -274,6 +373,53 @@ const save = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 重置表单数据
|
||||
const resetForm = async () => {
|
||||
try {
|
||||
// 重置editForm为初始值
|
||||
editForm.value = {
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1,
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
};
|
||||
|
||||
// 先将组件设置为空,强制卸载
|
||||
const currentComponentName = currentComponent.value;
|
||||
if (currentComponentName) {
|
||||
currentComponent.value = '';
|
||||
|
||||
// 等待DOM更新
|
||||
await nextTick();
|
||||
|
||||
// 重新加载组件
|
||||
currentComponent.value = currentComponentName;
|
||||
|
||||
// 再次等待DOM更新后设置空数据
|
||||
await nextTick();
|
||||
}
|
||||
|
||||
// 重置动态组件表单数据
|
||||
if (emrComponentRef.value && emrComponentRef.value.setFormData) {
|
||||
emrComponentRef.value.setFormData({});
|
||||
}
|
||||
|
||||
ElMessage.success('表单已重置');
|
||||
} catch (error) {
|
||||
ElMessage.error('重置表单失败');
|
||||
}
|
||||
};
|
||||
|
||||
>>>>>>> v1.3
|
||||
const historyRef = ref(null);
|
||||
const handleHistoryClick = (data) => {
|
||||
newEmr();
|
||||
@@ -282,11 +428,121 @@ const handleHistoryClick = (data) => {
|
||||
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contentJson));
|
||||
});
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
// 默认选中门诊病历模板
|
||||
const selectOutpatientMedicalRecordTemplate = async () => {
|
||||
if (!templateData.value || templateData.value.length === 0) {
|
||||
await queryTemplateTree();
|
||||
}
|
||||
|
||||
// 查找门诊病历模板
|
||||
const findOutpatientTemplate = (nodes) => {
|
||||
for (const node of nodes) {
|
||||
if (node.children && node.children.length > 0) {
|
||||
const found = findOutpatientTemplate(node.children);
|
||||
if (found) return found;
|
||||
}
|
||||
if (
|
||||
node.document &&
|
||||
node.document.name &&
|
||||
(node.document.name.includes('门诊病历') ||
|
||||
node.document.name === '门诊病历 (1.0.0)' ||
|
||||
node.document.name === '门诊病历(1.0.0)')
|
||||
) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const outpatientTemplateNode = findOutpatientTemplate(templateData.value);
|
||||
if (outpatientTemplateNode) {
|
||||
//选中节点
|
||||
nextTick(() => {
|
||||
if (templateTree.value && outpatientTemplateNode.id) {
|
||||
templateTree.value.setCurrentKey(outpatientTemplateNode.id);
|
||||
}
|
||||
|
||||
// 选中门诊病历模板
|
||||
handleNodeClick(outpatientTemplateNode, {
|
||||
isLeaf: true,
|
||||
data: outpatientTemplateNode,
|
||||
});
|
||||
|
||||
// 等待模板加载完成,然后获取并回显最新病历数据
|
||||
setTimeout(() => {
|
||||
historyRef.value?.queryList();
|
||||
loadLatestMedicalRecord();
|
||||
}, 500);
|
||||
});
|
||||
} else {
|
||||
ElMessage.info('未找到门诊病历模板');
|
||||
}
|
||||
};
|
||||
|
||||
// 当前选中的历史病历ID,用于在History组件中高亮显示
|
||||
const selectedHistoryRecordId = ref('');
|
||||
|
||||
// 加载最新的病历数据并回显
|
||||
const loadLatestMedicalRecord = async () => {
|
||||
if (!patientInfo.value.encounterId || !currentSelectTemplate.value.id) return;
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
// 获取患者的历史病历记录
|
||||
const res = await getRecordByEncounterIdList({
|
||||
isPage: 0,
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
patientId: patientInfo.value.patientId,
|
||||
definitionId: currentSelectTemplate.value.id,
|
||||
});
|
||||
|
||||
const historyRecords = res.data || [];
|
||||
if (historyRecords.length > 0) {
|
||||
// 按时间排序,获取最新的病历记录
|
||||
historyRecords.sort((a, b) => new Date(b.recordTime) - new Date(a.recordTime));
|
||||
const latestRecord = historyRecords[0];
|
||||
|
||||
// 保存最新病历ID,用于在History组件中高亮显示
|
||||
selectedHistoryRecordId.value = latestRecord.id;
|
||||
|
||||
// 自动回显最新病历数据到模板
|
||||
editForm.value = latestRecord;
|
||||
nextTick(() => {
|
||||
if (emrComponentRef.value && latestRecord.contentJson) {
|
||||
emrComponentRef.value.setFormData(JSON.parse(latestRecord.contentJson));
|
||||
}
|
||||
|
||||
// 通知History组件更新选中状态
|
||||
if (historyRef.value && typeof historyRef.value.updateSelectedRecord === 'function') {
|
||||
historyRef.value.updateSelectedRecord(latestRecord.id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 清空选中状态
|
||||
selectedHistoryRecordId.value = '';
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('加载最新病历数据失败');
|
||||
// 出错时也清空选中状态
|
||||
selectedHistoryRecordId.value = '';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
>>>>>>> v1.3
|
||||
const templateRef = ref(null);
|
||||
|
||||
const handleTemplateClick = (data) => {
|
||||
newEmr();
|
||||
editForm.value = data;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
editForm.value.id = '';
|
||||
editForm.value.recordTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
>>>>>>> v1.3
|
||||
nextTick(() => {
|
||||
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contextJson));
|
||||
});
|
||||
@@ -299,18 +555,62 @@ const templateEdit = (data) => {
|
||||
const templateEditVisible = ref(false);
|
||||
// const templateEditSubmitOk = () => {};
|
||||
|
||||
<<<<<<< HEAD
|
||||
// 打印方法实现
|
||||
const print = async () => {
|
||||
try {
|
||||
// 检查是否有选中的病历模板
|
||||
=======
|
||||
// 定义病历模板类型与打印模板的映射关系
|
||||
const templateToPrintTemplateMap = {
|
||||
// 手术记录相关模板
|
||||
手术记录: PRINT_TEMPLATE.OPERATIVE_RECORD,
|
||||
'手术记录(1.0.0)': PRINT_TEMPLATE.OPERATIVE_RECORD,
|
||||
tySurgicalRecord: PRINT_TEMPLATE.OPERATIVE_RECORD,
|
||||
// 门诊病历相关模板
|
||||
门诊病历: PRINT_TEMPLATE.HQOUTPATIENT_MEDICAL_RECORD,
|
||||
'门诊病历(1.0.0)': PRINT_TEMPLATE.HQOUTPATIENT_MEDICAL_RECORD,
|
||||
测试新增: PRINT_TEMPLATE.HQOUTPATIENT_MEDICAL_RECORD,
|
||||
};
|
||||
|
||||
// 根据模板名称获取对应的打印模板
|
||||
const getPrintTemplateByTemplateName = (templateName) => {
|
||||
// 默认使用门诊病历模板
|
||||
let printTemplate = PRINT_TEMPLATE.OUTPATIENT_MEDICAL_RECORD;
|
||||
|
||||
if (templateName) {
|
||||
for (const [key, value] of Object.entries(templateToPrintTemplateMap)) {
|
||||
if (templateName.includes(key)) {
|
||||
printTemplate = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return printTemplate;
|
||||
};
|
||||
|
||||
// 打印
|
||||
const print = async () => {
|
||||
try {
|
||||
>>>>>>> v1.3
|
||||
if (!currentSelectTemplate.value || !currentSelectTemplate.value.id) {
|
||||
ElMessage.warning('请先选择病历模板');
|
||||
return;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 检查是否已保存
|
||||
if (!editForm.value.id || editForm.value.id === '') {
|
||||
ElMessage.warning('请先保存病历后再进行打印');
|
||||
return;
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
|
||||
// 获取当前病历组件的表单数据
|
||||
const formData = emrComponentRef.value?.formData || {};
|
||||
|
||||
<<<<<<< HEAD
|
||||
// 准备打印数据(不依赖子组件的getPrintData方法)
|
||||
// const printData = {
|
||||
// // 使用当前选中的模板信息
|
||||
@@ -332,6 +632,34 @@ const print = async () => {
|
||||
// doctorName: userStore.nickName,
|
||||
// };
|
||||
|
||||
=======
|
||||
// 获取诊断数据
|
||||
let diagnosisList = [];
|
||||
let diagnosisText = '';
|
||||
if (props.patientInfo && props.patientInfo.encounterId) {
|
||||
try {
|
||||
const diagnosisRes = await getEncounterDiagnosis(props.patientInfo.encounterId);
|
||||
diagnosisList = diagnosisRes.data || [];
|
||||
// 格式化诊断文本,区分主诊断和其他诊断
|
||||
diagnosisText = diagnosisList
|
||||
.map((item) => {
|
||||
const prefix = item.maindiseFlag === 1 ? '[主]' : '';
|
||||
return `${prefix}${item.name || ''}`;
|
||||
})
|
||||
.join(';');
|
||||
} catch (error) {
|
||||
ElMessage.error('获取诊断数据失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前模板名称
|
||||
const templateName = currentSelectTemplate.value.name || '';
|
||||
|
||||
// 根据模板名称获取对应的打印模板
|
||||
const selectedPrintTemplate = getPrintTemplateByTemplateName(templateName);
|
||||
|
||||
// 打印数据
|
||||
>>>>>>> v1.3
|
||||
const printData = {
|
||||
// 模板信息
|
||||
templateName: currentSelectTemplate.value.name || '住院病历',
|
||||
@@ -355,12 +683,20 @@ const print = async () => {
|
||||
department: props.patientInfo.department || '',
|
||||
attendingDoctor: props.patientInfo.attendingDoctor || '',
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 诊断信息
|
||||
diagnosisList: JSON.stringify(diagnosisList),
|
||||
diagnosisText: diagnosisText,
|
||||
|
||||
>>>>>>> v1.3
|
||||
// 病历信息
|
||||
documentName: currentSelectTemplate.value.name || '住院病历',
|
||||
documentId: currentSelectTemplate.value.id || '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
printTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
|
||||
<<<<<<< HEAD
|
||||
// 表单数据 - 需要将嵌套结构展开
|
||||
...flattenObject(formData),
|
||||
};
|
||||
@@ -370,6 +706,34 @@ const print = async () => {
|
||||
ElMessage.success('打印成功');
|
||||
} catch (error) {
|
||||
console.error('打印失败:', error);
|
||||
=======
|
||||
//病历号
|
||||
busNo: props.patientInfo.busNo || '',
|
||||
//费用类型
|
||||
contractName: props.patientInfo.contractName || '',
|
||||
|
||||
// 表单数据 - 需要将嵌套结构展开
|
||||
...flattenObject(formData),
|
||||
};
|
||||
console.log('打印数据:', printData);
|
||||
|
||||
// 执行打印,使用根据模板类型选择的打印模板
|
||||
await simplePrint(selectedPrintTemplate, printData);
|
||||
|
||||
// 调用打印记录接口
|
||||
try {
|
||||
await recordPrint(editForm.value.id);
|
||||
|
||||
// 刷新历史记录列表,确保删除按钮状态根据最新的printCount值更新
|
||||
historyRef.value?.queryList();
|
||||
} catch (printLogError) {
|
||||
ElMessage.error('保存打印记录失败');
|
||||
// 打印记录失败不影响打印成功提示
|
||||
}
|
||||
|
||||
ElMessage.success('打印成功');
|
||||
} catch (error) {
|
||||
>>>>>>> v1.3
|
||||
ElMessage.error('打印失败: ' + (error.message || '未知错误'));
|
||||
}
|
||||
};
|
||||
@@ -403,6 +767,7 @@ const templateEditSubmitOk = () => {
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
// onBeforeMount(() => {});
|
||||
// 刚进页面默认显示门诊病历
|
||||
const selectDefaultTemplate = () => {
|
||||
@@ -412,18 +777,51 @@ const selectDefaultTemplate = () => {
|
||||
for (const node of nodes) {
|
||||
if (node.children && node.children.length > 0) {
|
||||
const found = findTemplate(node.children);
|
||||
=======
|
||||
|
||||
// 选择默认模板 - 获取门诊病历分类下的第一个模板
|
||||
const selectDefaultTemplate = () => {
|
||||
nextTick(() => {
|
||||
if (!templateData.value || templateData.value.length === 0) {
|
||||
console.log('模板数据为空,无法选择默认模板');
|
||||
return;
|
||||
}
|
||||
|
||||
// 查找门诊病历分类节点,然后获取其下的第一个模板
|
||||
const findOutpatientRecordCategoryAndFirstTemplate = (nodes) => {
|
||||
for (const node of nodes) {
|
||||
// 检查是否是门诊病历分类节点
|
||||
if (!node.document && node.name && node.name.includes('门诊病历')) {
|
||||
// 这是一个分类节点,检查是否有子节点
|
||||
if (node.children && node.children.length > 0) {
|
||||
// 返回第一个有document属性的子节点(即第一个模板)
|
||||
for (const child of node.children) {
|
||||
if (child.document) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 递归查找子节点
|
||||
if (node.children && node.children.length > 0) {
|
||||
const found = findOutpatientRecordCategoryAndFirstTemplate(node.children);
|
||||
>>>>>>> v1.3
|
||||
if (found) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
// 根据ID查找门诊病历模板
|
||||
if (node.document && node.document.id === '1963474077201162242') {
|
||||
return node;
|
||||
}
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
const defaultTemplate = findTemplate(templateData.value);
|
||||
if (defaultTemplate) {
|
||||
// 模拟点击节点
|
||||
@@ -441,6 +839,67 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
defineExpose({ state });
|
||||
=======
|
||||
const defaultTemplate = findOutpatientRecordCategoryAndFirstTemplate(templateData.value);
|
||||
if (defaultTemplate) {
|
||||
nextTick(() => {
|
||||
templateTree.value?.setCurrentKey(defaultTemplate.id);
|
||||
// 模拟点击节点
|
||||
const mockNode = {
|
||||
isLeaf: true,
|
||||
};
|
||||
handleNodeClick(defaultTemplate, mockNode);
|
||||
|
||||
// 直接加载最新病历数据,不再使用额外的setTimeout延迟
|
||||
// 因为handleNodeClick中已经有nextTick和setTimeout处理组件渲染
|
||||
loadLatestMedicalRecord();
|
||||
});
|
||||
} else {
|
||||
console.log('未找到门诊病历模板');
|
||||
}
|
||||
});
|
||||
};
|
||||
// 监听患者信息变化,实现联动显示
|
||||
watch(
|
||||
() => props.patientInfo,
|
||||
(newPatientInfo) => {
|
||||
// 当患者信息变化时,默认选中门诊病历模板并加载最新病历数据
|
||||
if (newPatientInfo && newPatientInfo.patientId && Object.keys(newPatientInfo).length > 0) {
|
||||
// 确保模板树已经加载
|
||||
if (templateData.value && templateData.value.length > 0) {
|
||||
// 优先尝试使用更精确的selectDefaultTemplate函数
|
||||
selectDefaultTemplate();
|
||||
} else {
|
||||
// 重新加载模板树
|
||||
queryTemplateTree().then(() => {
|
||||
// 使用nextTick确保DOM更新,移除setTimeout避免多次渲染
|
||||
nextTick(() => {
|
||||
selectDefaultTemplate();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await queryTemplateTree();
|
||||
// 组件挂载完成后,如果已有患者信息,默认选中门诊病历模板
|
||||
if (
|
||||
props.patientInfo &&
|
||||
props.patientInfo.patientId &&
|
||||
Object.keys(props.patientInfo).length > 0
|
||||
) {
|
||||
// 使用nextTick确保模板树数据已更新
|
||||
nextTick(() => {
|
||||
selectDefaultTemplate();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// defineExpose({ state }); // state未使用
|
||||
>>>>>>> v1.3
|
||||
|
||||
const disNode = () => {
|
||||
leftShow.value = !leftShow.value;
|
||||
@@ -554,12 +1013,38 @@ const disNode_R = () => {
|
||||
}
|
||||
|
||||
.operate-main {
|
||||
<<<<<<< HEAD
|
||||
height: calc(100vh - 150px);
|
||||
flex: auto;
|
||||
}
|
||||
.operate-main .template-tree-scrollbar {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
=======
|
||||
flex: 1;
|
||||
min-height: 0; /* 允许flex子项高度收缩 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.operate-main .template-tree-scrollbar {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
/* 确保滚动条样式正常 */
|
||||
-ms-overflow-style: auto;
|
||||
scrollbar-width: auto;
|
||||
}
|
||||
/* 确保动态加载的组件不会破坏布局 */
|
||||
.operate-main .template-tree-scrollbar > .loading-container {
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* 确保组件内部内容不会溢出 */
|
||||
.operate-main .template-tree-scrollbar > * {
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,4 +1066,13 @@ const disNode_R = () => {
|
||||
transition-duration: 300ms;
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
/* 加载状态样式 */
|
||||
.loading-container {
|
||||
min-height: 400px;
|
||||
position: relative;
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user