提交merge1.3

This commit is contained in:
2025-12-27 15:30:40 +08:00
parent 088861f66e
commit 3c497417dc
167 changed files with 0 additions and 17577 deletions

View File

@@ -1,11 +1,3 @@
<<<<<<< HEAD
<!--
* @Author: sjjh
* @Date: 2025-09-18 15:41:10
* @Description: 门诊病历组件
-->
=======
>>>>>>> v1.3
<template>
<div class="emr-use-container">
<div
@@ -51,26 +43,13 @@
<!-- <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"
@@ -79,7 +58,6 @@
@submitOk="handleSubmitOk"
/>
</div>
>>>>>>> v1.3
</el-scrollbar>
</div>
</div>
@@ -92,10 +70,7 @@
@historyClick="handleHistoryClick"
ref="historyRef"
v-model:definitionId="currentSelectTemplate.id"
<<<<<<< HEAD
=======
:selectedRecordId="selectedHistoryRecordId"
>>>>>>> v1.3
/>
</el-tab-pane>
<el-tab-pane label="模版" name="model">
@@ -119,20 +94,6 @@
</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';
import { addRecord, addTemplate } from './api';
import { patientInfo } from '../store/patient.js';
import dayjs from 'dayjs';
// 打印工具
// import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js';
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';
@@ -146,7 +107,6 @@ const { proxy } = getCurrentInstance();
const emits = defineEmits([]);
const props = defineProps({
/** 患者信息 doctorStation 传递信息*/
>>>>>>> v1.3
patientInfo: {
type: Object,
required: true,
@@ -169,10 +129,7 @@ const queryParams = ref({
useRanges: [1, 2], // 0 暂不使用 1 全院 2 科室 3 个人
organizationId: userStore.orgId,
});
<<<<<<< HEAD
=======
const loading = ref(false); // 数据加载状态
>>>>>>> v1.3
const currentSelectTemplate = ref({
id: '',
@@ -182,10 +139,7 @@ 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 = {
@@ -198,12 +152,9 @@ const queryTemplateTree = async () => {
try {
const res = await getTreeList(queryParams.value);
templateData.value = res.data || [];
<<<<<<< HEAD
=======
// 组件挂载后患者信息变化时会自动调用selectDefaultTemplate
// 这里不再重复调用,避免重复操作
>>>>>>> v1.3
} catch (error) {
// ElMessage.error('获取模板树失败');
templateData.value = [];
@@ -223,9 +174,6 @@ const handleNodeClick = (data, node) => {
};
// currentComponent.value = null;
}
<<<<<<< HEAD
historyRef.value?.queryList();
=======
// 确保组件状态更新后再查询历史记录
nextTick(() => {
@@ -240,7 +188,6 @@ const handleNodeClick = (data, node) => {
}, 100);
});
>>>>>>> v1.3
templateRef.value?.queryList();
};
@@ -300,14 +247,6 @@ 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('保存成功');
@@ -320,18 +259,12 @@ const handleSubmitOk = async (data) => {
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);
@@ -346,26 +279,12 @@ const refresh = () => {
templateRef.value?.queryList();
};
<<<<<<< HEAD
const deleteEmr = async () => {
try {
// 这里应该添加实际的删除逻辑
ElMessage.success('删除成功!');
} catch (error) {
ElMessage.error('删除失败');
}
};
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) {
@@ -373,8 +292,6 @@ const save = async () => {
}
};
<<<<<<< HEAD
=======
// 重置表单数据
const resetForm = async () => {
try {
@@ -419,7 +336,6 @@ const resetForm = async () => {
}
};
>>>>>>> v1.3
const historyRef = ref(null);
const handleHistoryClick = (data) => {
newEmr();
@@ -428,8 +344,6 @@ const handleHistoryClick = (data) => {
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contentJson));
});
};
<<<<<<< HEAD
=======
// 默认选中门诊病历模板
const selectOutpatientMedicalRecordTemplate = async () => {
@@ -532,17 +446,13 @@ const loadLatestMedicalRecord = async () => {
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));
});
@@ -555,12 +465,6 @@ const templateEdit = (data) => {
const templateEditVisible = ref(false);
// const templateEditSubmitOk = () => {};
<<<<<<< HEAD
// 打印方法实现
const print = async () => {
try {
// 检查是否有选中的病历模板
=======
// 定义病历模板类型与打印模板的映射关系
const templateToPrintTemplateMap = {
// 手术记录相关模板
@@ -593,46 +497,19 @@ const getPrintTemplateByTemplateName = (templateName) => {
// 打印
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 = {
// // 使用当前选中的模板信息
// templateInfo: currentSelectTemplate.value,
// // 添加患者信息
// patientInfo: props.patientInfo,
// // 添加打印时间
// printTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
// // 添加基本病历信息
// emrInfo: {
// documentName: currentSelectTemplate.value.name || '住院病历',
// documentId: currentSelectTemplate.value.id || '',
// encounterId: props.patientInfo.encounterId || '',
// patientId: props.patientInfo.patientId || '',
// recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
// },
// // 添加病历表单数据(包含红框内的所有字段)
// formData: formData,
// doctorName: userStore.nickName,
// };
=======
// 获取诊断数据
let diagnosisList = [];
let diagnosisText = '';
@@ -659,7 +536,6 @@ const print = async () => {
const selectedPrintTemplate = getPrintTemplateByTemplateName(templateName);
// 打印数据
>>>>>>> v1.3
const printData = {
// 模板信息
templateName: currentSelectTemplate.value.name || '住院病历',
@@ -683,30 +559,16 @@ 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),
};
// 执行打印
await simplePrint(PRINT_TEMPLATE.OUTPATIENT_MEDICAL_RECORD, printData);
ElMessage.success('打印成功');
} catch (error) {
console.error('打印失败:', error);
=======
//病历号
busNo: props.patientInfo.busNo || '',
//费用类型
@@ -733,7 +595,6 @@ const print = async () => {
ElMessage.success('打印成功');
} catch (error) {
>>>>>>> v1.3
ElMessage.error('打印失败: ' + (error.message || '未知错误'));
}
};
@@ -767,17 +628,6 @@ const templateEditSubmitOk = () => {
historyRef.value?.queryList();
templateRef.value?.queryList();
};
<<<<<<< HEAD
// onBeforeMount(() => {});
// 刚进页面默认显示门诊病历
const selectDefaultTemplate = () => {
nextTick(() => {
// 查找门诊病历(1.0.0)节点
const findTemplate = (nodes) => {
for (const node of nodes) {
if (node.children && node.children.length > 0) {
const found = findTemplate(node.children);
=======
// 选择默认模板 - 获取门诊病历分类下的第一个模板
const selectDefaultTemplate = () => {
@@ -805,41 +655,14 @@ const selectDefaultTemplate = () => {
// 递归查找子节点
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) {
// 模拟点击节点
const mockNode = {
isLeaf: true,
};
handleNodeClick(defaultTemplate, mockNode);
}
});
};
onMounted(async () => {
console.log('hospitalizationEmr mounted', userStore);
await queryTemplateTree();
selectDefaultTemplate();
});
defineExpose({ state });
=======
const defaultTemplate = findOutpatientRecordCategoryAndFirstTemplate(templateData.value);
if (defaultTemplate) {
nextTick(() => {
@@ -899,7 +722,6 @@ onMounted(async () => {
});
// defineExpose({ state }); // state未使用
>>>>>>> v1.3
const disNode = () => {
leftShow.value = !leftShow.value;
@@ -1013,14 +835,6 @@ 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;
@@ -1044,7 +858,6 @@ const disNode_R = () => {
.operate-main .template-tree-scrollbar > * {
max-width: 100%;
box-sizing: border-box;
>>>>>>> v1.3
}
}
@@ -1066,13 +879,10 @@ const disNode_R = () => {
transition-duration: 300ms;
}
}
<<<<<<< HEAD
=======
/* 加载状态样式 */
.loading-container {
min-height: 400px;
position: relative;
}
>>>>>>> v1.3
</style>