修改病历格式

This commit is contained in:
Auora
2025-11-03 13:38:47 +08:00
parent bc91eb7cdc
commit f03d2e1633

View File

@@ -10,174 +10,95 @@
<el-button type="primary" plain @click="handleEmrHistory()" style="margin-left: 20px"> <el-button type="primary" plain @click="handleEmrHistory()" style="margin-left: 20px">
历史病历 历史病历
</el-button> </el-button>
<!-- <el-button type="primary" plain @click="handleReceive()" style="margin-left: 20px"> <!-- 可选添加打印按钮 -->
<!-- <el-button type="primary" plain @click="printEmr" style="margin-left: 20px">
打印病历 打印病历
</el-button> --> </el-button> -->
</div> </div>
<div style="max-height: 650px; overflow-y: auto; overflow-x: hidden">
<div style="text-align: center; font-size: 18px; font-weight: bold; margin-bottom: 10px;"> <div
ref="printArea"
style="max-height: 650px; overflow-y: auto; overflow-x: hidden; font-family: 'SimSun', '宋体', sans-serif;"
>
<!-- 标题 -->
<div style="text-align: center; font-size: 18px; font-weight: bold; margin-bottom: 10px;">
{{ visitType === 'FIRST' ? '门诊初诊病历' : '门诊复诊病历' }} {{ visitType === 'FIRST' ? '门诊初诊病历' : '门诊复诊病历' }}
</div> </div>
<el-form ref="emrRef" :model="form" :rules="rules" label-width="80px">
<el-row :gutter="4"> <!-- 患者基本信息 -->
<el-col :span="4"> <div style="display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ebeef5;">
<el-form-item label="就诊卡号" prop="patientId" style="width: 100%"> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-input placeholder="" v-model="patientInfo.patientId" class="input-with-bottom-border"/> <strong>就诊卡号:</strong> {{ patientInfo.patientId || '' }}
</el-form-item> </div>
</el-col> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-col :span="4"> <strong>姓名:</strong> {{ patientInfo.patientName || '' }}
<el-form-item label="姓名" prop="patientName" style="width: 100%"> </div>
<el-input placeholder="" v-model="patientInfo.patientName" class="input-with-bottom-border"/> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
</el-form-item> <strong>性别:</strong> {{ patientInfo.genderEnum_enumText || '' }}
</el-col> </div>
<el-col :span="4"> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-form-item label="性别" prop="genderEnum_enumText" style="width: 100%"> <strong>年龄:</strong> {{ patientInfo.age || '' }}
<el-input placeholder="" v-model="patientInfo.genderEnum_enumText" class="input-with-bottom-border"/> </div>
</el-form-item> </div>
</el-col>
<el-col :span="4"> <!-- 就诊信息 -->
<el-form-item label="年龄" prop="age" style="width: 100%"> <div style="display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ebeef5;">
<el-input placeholder="" v-model="patientInfo.age" class="input-with-bottom-border"/> <div style="flex: 1; min-width: 200px; font-size: 14px; line-height: 24px;">
</el-form-item> <strong>就诊日期:</strong> {{ currentVisitDate }}
</el-col> </div>
<el-col :span="4"> <div style="flex: 1; min-width: 200px; font-size: 14px; line-height: 24px;">
<el-form-item label="就诊日期" prop="currentVisitDate" style="width: 100%"> <strong>就诊科室:</strong> {{ patientInfo.organizationName || '' }}
<el-input placeholder="" v-model="currentVisitDate" class="input-with-bottom-border"/> </div>
</el-form-item> </div>
</el-col>
<el-col :span="4"> <!-- 生命体征 -->
<el-form-item label="就诊科室" prop="organizationName" style="width: 100%"> <div style="display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ebeef5;">
<el-input placeholder="" v-model="patientInfo.organizationName" class="input-with-bottom-border"/> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
</el-form-item> <strong>身高:</strong> {{ form.height ? form.height + ' cm' : '' }}
</el-col> </div>
</el-row> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-row :gutter="24"> <strong>体重:</strong> {{ form.weight ? form.weight + ' kg' : '' }}
<el-col :span="6"> </div>
<el-form-item label="身高" prop="height" style="width: 100%"> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-input placeholder="" v-model="form.height" class="input-with-bottom-border"> <strong>体温:</strong> {{ form.temperature ? form.temperature + ' ℃' : '' }}
<template #suffix>cm</template> </div>
</el-input> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
</el-form-item> <strong>脉搏:</strong> {{ form.pulse ? form.pulse + ' 次/分' : '' }}
</el-col> </div>
<el-col :span="6"> </div>
<el-form-item label="体重" prop="weight" style="width: 100%">
<el-input placeholder="" v-model="form.weight" class="input-with-bottom-border"> <!-- 主诉 + 发病日期 -->
<template #suffix>kg</template> <div style="display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-bottom: 1px solid #ebeef5;">
</el-input> <div style="flex: 1; min-width: 300px; font-size: 14px; line-height: 24px;">
</el-form-item> <strong>主诉:</strong> {{ form.chiefComplaint || '' }}
</el-col> </div>
<el-col :span="6"> <div style="flex: 1; min-width: 120px; font-size: 14px; line-height: 24px;">
<el-form-item label="体温" prop="temperature" style="width: 100%"> <strong>发病日期:</strong> {{ formatDate(form.onsetDate) }}
<el-input placeholder="" v-model="form.temperature" class="input-with-bottom-border"> </div>
<template #suffix></template> </div>
</el-input>
</el-form-item> <!-- 多行文本字段 -->
</el-col> <div v-for="field in textFieldList" :key="field.key" style="padding: 10px 0;">
<el-col :span="6"> <div style="font-size: 14px; margin-bottom: 5px;">
<el-form-item label="脉搏" prop="pulse" style="width: 100%"> <strong>{{ field.label }}:</strong>
<el-input placeholder="" v-model="form.pulse" class="input-with-bottom-border"> </div>
<template #suffix>/</template> <div style="font-size: 14px; line-height: 1.5; white-space: pre-wrap;">
</el-input> {{ form[field.key] || '' }}
</el-form-item> </div>
</el-col> </div>
</el-row>
<el-row :gutter="24"> <!-- 弹窗 -->
<!-- <el-col :span="6">
<el-form-item
label="血糖"
prop="chiefComplaint"
style="width: 100%"
>
<el-input placeholder="" class="input-with-bottom-border">
<template #suffix></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="血糖"
prop="chiefComplaint"
style="width: 100%"
>
<el-input placeholder="" class="input-with-bottom-border">
<template #suffix>mmol/L</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="收缩压"
prop="chiefComplaint"
style="width: 100%"
>
<el-input placeholder="" class="input-with-bottom-border">
<template #suffix>mmHg</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="舒张压"
prop="chiefComplaint"
style="width: 100%"
>
<el-input placeholder="" class="input-with-bottom-border">
<template #suffix>mmHg</template>
</el-input>
</el-form-item>
</el-col> -->
</el-row>
<el-row :gutter="24">
<el-col :span="18">
<el-form-item label="主诉" prop="chiefComplaint">
<el-input v-model="form.chiefComplaint" type="textarea" :rows="1" placeholder="" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发病日期" prop="onsetDate">
<el-date-picker
v-model="form.onsetDate"
type="date"
size="default"
style="width: 100% !important"
placement="bottom"
/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="现病史" prop="currentIllnessHistory">
<el-input v-model="form.currentIllnessHistory" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="既往史" prop="pastMedicalHistory">
<el-input v-model="form.pastMedicalHistory" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="个人史" prop="menstrualHistory">
<el-input v-model="form.menstrualHistory" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="过敏史" prop="allergyHistory">
<el-input v-model="form.allergyHistory" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="查体" prop="physicalExamination">
<el-input v-model="form.physicalExamination" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="处理" prop="treatment">
<el-input v-model="form.treatment" type="textarea" :rows="2" placeholder="" />
</el-form-item>
<el-form-item label="辅助检查" prop="auxiliaryExamination">
<el-input v-model="form.auxiliaryExamination" type="textarea" :rows="2" placeholder="" />
</el-form-item>
</el-form>
<el-dialog <el-dialog
:title="emrTitle" :title="emrTitle"
v-model="openEmrTemplate" v-model="openEmrTemplate"
:width="showDialog == 'emrHistory'?'800px':'600px'" :width="showDialog === 'emrHistory' ? '800px' : '600px'"
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<emrTemplate v-if="showDialog == 'emrTemplate'" @selectRow="templateSelect" /> <emrTemplate v-if="showDialog === 'emrTemplate'" @selectRow="templateSelect" />
<emrhistory v-if="showDialog == 'emrHistory'" @selectRow="emrHistorySelect" /> <emrhistory v-if="showDialog === 'emrHistory'" @selectRow="emrHistorySelect" />
<div v-if="showDialog == 'saveTemplate'"> <div v-if="showDialog === 'saveTemplate'">
<span> 模板名称 </span> <span>模板名称</span>
<el-input <el-input
v-model="templateName" v-model="templateName"
style="width: 260px; margin-top: 10px; margin-right: 20px" style="width: 260px; margin-top: 10px; margin-right: 20px"
@@ -204,94 +125,113 @@ import emrTemplate from '../emr/emrtemplate.vue';
import emrhistory from '../emr/emrhistory.vue'; import emrhistory from '../emr/emrhistory.vue';
import { ref, computed, watch, getCurrentInstance } from 'vue'; import { ref, computed, watch, getCurrentInstance } from 'vue';
import { formatDate } from '@/utils/index'; import { formatDate as formatDateUtil } from '@/utils/index';
// 2. 当前就诊日期(默认为当前时间;复诊为初诊日期) // Props
const props = defineProps({ const props = defineProps({
patientInfo: { patientInfo: {
type: Object, type: Object,
required: true, required: true,
}, },
visitType: { // 接收父组件传来的值 visitType: {
type: String, type: String,
default: '', default: '',
}, },
firstVisitDate: { // 父组件计算的初诊日期(若有历史病历) firstVisitDate: {
type: String, type: String,
default: '', default: '',
}, },
}); });
// Computed: 当前就诊日期
const currentVisitDate = computed(() => { const currentVisitDate = computed(() => {
// 复诊优先展示初诊日期
if (props.visitType === 'FOLLOW_UP' && props.firstVisitDate) { if (props.visitType === 'FOLLOW_UP' && props.firstVisitDate) {
return props.firstVisitDate; return props.firstVisitDate;
} }
// 初诊或未获取初诊日期时,展示挂号时间或当前时间 return formatDateUtil(props.patientInfo?.registerTime || new Date());
return formatDate(props.patientInfo?.registerTime || new Date());
}); });
const form = ref({}); // 表单数据
const form = ref({
height: '',
weight: '',
temperature: '',
pulse: '',
chiefComplaint: '',
onsetDate: '',
currentIllnessHistory: '',
pastMedicalHistory: '',
menstrualHistory: '',
allergyHistory: '',
physicalExamination: '',
treatment: '',
auxiliaryExamination: '',
});
// 文本字段配置(用于循环渲染)
const textFieldList = [
{ key: 'currentIllnessHistory', label: '现病史' },
{ key: 'pastMedicalHistory', label: '既往史' },
{ key: 'menstrualHistory', label: '个人史' },
{ key: 'allergyHistory', label: '过敏史' },
{ key: 'physicalExamination', label: '查体' },
{ key: 'treatment', label: '处理' },
{ key: 'auxiliaryExamination', label: '辅助检查' },
];
// 弹窗控制
const emrTitle = ref(''); const emrTitle = ref('');
const radio = ref(1); const radio = ref(1);
const rules = ref({
chiefComplaint: [{ required: true, message: '请输入主诉', trigger: 'blur' }],
});
const emits = defineEmits(['save']);
const { proxy } = getCurrentInstance();
const showDialog = ref(''); const showDialog = ref('');
const openEmrTemplate = ref(false); const openEmrTemplate = ref(false);
const templateName = ref(''); const templateName = ref('');
// 事件
const emits = defineEmits(['save']);
const { proxy } = getCurrentInstance();
// 监听表单变化
watch( watch(
() => form.value, () => form.value,
() => { () => {
// 如果表单数据有变化,通知父组件保存
emits('save', false); emits('save', false);
}, },
{ deep: true } { deep: true }
); );
/** // 格式化日期(用于 onsetDate
* 保存病历 function formatDate(date) {
*/ if (!date) return '';
return formatDateUtil(date);
}
// 保存病历
function addEmr() { function addEmr() {
proxy.$refs['emrRef'].validate((valid) => { // 简单校验主诉
if (valid) { if (!form.value.chiefComplaint) {
saveEmr({ proxy.$message.warning('请输入主诉');
patientId: props.patientInfo.patientId, return;
encounterId: props.patientInfo.encounterId, }
contextJson: form.value, saveEmr({
}).then((res) => { patientId: props.patientInfo.patientId,
if (res.code == 200) { encounterId: props.patientInfo.encounterId,
proxy.$modal.msgSuccess('病历已保存'); contextJson: form.value,
emits('save', true); }).then((res) => {
} if (res.code === 200) {
}); proxy.$modal.msgSuccess('病历已保存');
emits('save', true);
} }
}); });
} }
/**
* 病历模板 // 打开模板
*/
function handleEmrTemplate() { function handleEmrTemplate() {
emrTitle.value = '病历模板'; emrTitle.value = '病历模板';
showDialog.value = 'emrTemplate'; showDialog.value = 'emrTemplate';
openEmrTemplate.value = true; openEmrTemplate.value = true;
} }
/**
* 选择病历模板 // 打开历史
*/
function templateSelect(row) {
form.value = row;
}
function emrHistorySelect(row) {
form.value = row;
openEmrTemplate.value = false;
}
/**
* 历史病历
*/
function handleEmrHistory() { function handleEmrHistory() {
emrTitle.value = '历史病历'; emrTitle.value = '历史病历';
showDialog.value = 'emrHistory'; showDialog.value = 'emrHistory';
@@ -299,55 +239,93 @@ function handleEmrHistory() {
sessionStorage.setItem('patientId', props.patientInfo.patientId); sessionStorage.setItem('patientId', props.patientInfo.patientId);
} }
function getDetail(encounterId) { // 保存为模板
getEmrDetail(encounterId).then((res) => {
if (res.data) {
form.value = JSON.parse(res.data.contextJson);
// 提交父组件刷新保存装填
emits('save', true);
} else {
form.value = {};
}
});
}
/**
* 保存病历模板
*/
function handleSaveTemplate() { function handleSaveTemplate() {
emrTitle.value = '保存模板'; emrTitle.value = '保存模板';
showDialog.value = 'saveTemplate'; showDialog.value = 'saveTemplate';
openEmrTemplate.value = true; openEmrTemplate.value = true;
} }
/** // 选择模板/历史
* 弹窗确认操作,包括保存病历模板/选择病历模板/选择历史病历 function templateSelect(row) {
*/ form.value = { ...row };
function submit() { openEmrTemplate.value = false;
switch (showDialog.value) { }
case 'saveTemplate': function emrHistorySelect(row) {
saveEmrTemplate({ form.value = { ...row };
templateName: templateName.value,
useScopeCode: radio.value,
contextJson: form.value,
}).then((res) => {
if (res.code == 200) {
openEmrTemplate.value = false;
proxy.$modal.msgSuccess('保存成功');
}
});
break;
case 'emrTemplate':
openEmrTemplate.value = false;
break;
case 'emrHistory':
break;
}
}
function cancel() {
openEmrTemplate.value = false; openEmrTemplate.value = false;
// openDiagnosis.value = false;
} }
defineExpose({ getDetail, addEmr }); // 弹窗确认
</script> function submit() {
if (showDialog.value === 'saveTemplate') {
if (!templateName.value.trim()) {
proxy.$message.warning('请输入模板名称');
return;
}
saveEmrTemplate({
templateName: templateName.value,
useScopeCode: radio.value,
contextJson: form.value,
}).then((res) => {
if (res.code === 200) {
openEmrTemplate.value = false;
proxy.$modal.msgSuccess('保存成功');
}
});
} else {
openEmrTemplate.value = false;
}
}
function cancel() {
openEmrTemplate.value = false;
}
// 可选:打印功能
// function printEmr() {
// const printContent = proxy.$refs.printArea.innerHTML;
// const originalContent = document.body.innerHTML;
// document.body.innerHTML = printContent;
// window.print();
// document.body.innerHTML = originalContent;
// window.location.reload(); // 恢复组件状态
// }
// 暴露方法给父组件
defineExpose({
getDetail(encounterId) {
getEmrDetail(encounterId).then((res) => {
if (res.data) {
try {
form.value = JSON.parse(res.data.contextJson) || {};
} catch (e) {
form.value = {};
}
emits('save', true);
} else {
form.value = {};
}
});
},
addEmr
});
</script>
<style scoped>
/* 可选:增强打印样式 */
@media print {
body * {
visibility: hidden;
}
#printArea, #printArea * {
visibility: visible;
}
#printArea {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
}
</style>