fix(doctorstation): 修复诊断组件和住院办理功能的数据处理问题
- 修复诊断组件中el-popover模板语法错误,添加template标签 - 优化患者历史数据处理逻辑,确保数组类型安全并正确构建树形结构 - 完善住院办理流程中的组织机构数据获取和筛选逻辑 - 添加详细的控制台日志用于调试住院办理功能 - 修复办理住院按钮的禁用状态计算逻辑 - 优化患者卡片点击事件处理,确保就诊ID正确传递 - 添加诊断信息完整性检查并提供用户引导 - 修复检验申请组件中的监听器和暴露方法逻辑
This commit is contained in:
@@ -110,10 +110,10 @@
|
||||
<el-button type="primary" plain @click.stop="handleRefund(patientInfo.encounterId)">
|
||||
退费
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click.stop="getEnPrescription(patientInfo.encounterId)">
|
||||
<el-button type="primary" plain class="top-layer-btn" @click.stop="getEnPrescription(patientInfo.encounterId)">
|
||||
处方单
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click.stop="onHospitalization"> 办理住院 </el-button>
|
||||
<el-button type="primary" plain class="top-layer-btn" :disabled="isHospitalizationButtonDisabled" @click.stop="handleHospitalizationClick()" @mouseenter="console.log('办理住院按钮状态:', { patientInfo: patientInfo?.value, hasEncounterId: patientInfo?.value?.encounterId, isDisabled: isHospitalizationButtonDisabled })"> 办理住院 </el-button>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
@@ -174,7 +174,7 @@
|
||||
<ReportQuery :patientInfo="patientInfo" ref="reportQueryRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div class="overlay" v-if="disabled"></div>
|
||||
<div class="overlay" :class="{ 'overlay-disabled': disabled }" v-if="disabled"></div>
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer v-model="drawer" title="患者队列" direction="ltr" @open="handleOpen">
|
||||
@@ -264,6 +264,16 @@ const patientList = ref([]);
|
||||
const patientInfo = ref({});
|
||||
const visitTypeDisabled = ref(false);
|
||||
|
||||
// 计算属性:确定办理住院按钮是否应被禁用
|
||||
const isHospitalizationButtonDisabled = computed(() => {
|
||||
return !patientInfo.value ||
|
||||
typeof patientInfo.value !== 'object' ||
|
||||
!patientInfo.value.encounterId ||
|
||||
patientInfo.value.encounterId === '' ||
|
||||
patientInfo.value.encounterId === null ||
|
||||
patientInfo.value.encounterId === undefined;
|
||||
});
|
||||
|
||||
const prescriptionInfo = ref([]);
|
||||
const registerTime = ref(formatDate(new Date()));
|
||||
const patientDrawerRef = ref();
|
||||
@@ -279,6 +289,8 @@ const { proxy } = getCurrentInstance();
|
||||
const visitType = ref('');
|
||||
const firstVisitDate = ref('');
|
||||
const disabled = computed(() => {
|
||||
// 只有在有患者信息但某些条件不满足时才启用覆盖层
|
||||
// 当前逻辑保持不变,但我们将在按钮级别处理禁用状态
|
||||
return Object.keys(patientInfo.value).length === 0;
|
||||
});
|
||||
const shortcuts = [
|
||||
@@ -461,13 +473,45 @@ function handleOpen() {
|
||||
}
|
||||
|
||||
function handleCardClick(item, index) {
|
||||
currentEncounterId.value = '';
|
||||
console.log('handleCardClick 被调用');
|
||||
console.log('点击的患者项目:', item);
|
||||
console.log('患者项目中的encounterId:', item.encounterId);
|
||||
|
||||
// 设置当前就诊ID,确保住院功能能获取到正确的ID
|
||||
currentEncounterId.value = item.encounterId;
|
||||
console.log('currentEncounterId.value 设置为:', currentEncounterId.value);
|
||||
|
||||
loading.value = true;
|
||||
patientList.value.forEach((patient) => {
|
||||
patient.active = patient.encounterId === item.encounterId;
|
||||
});
|
||||
patientInfo.value = item;
|
||||
// console.log('patientInfo.value.cardNo:', patientInfo.value.cardNo)
|
||||
console.log('patientInfo.value 设置为:', patientInfo.value);
|
||||
console.log('patientInfo.value.encounterId:', patientInfo.value?.encounterId);
|
||||
|
||||
// 确保患者信息包含必要的字段
|
||||
if (!patientInfo.value.encounterId) {
|
||||
console.error('患者信息缺少encounterId字段:', patientInfo.value);
|
||||
// 可能需要从其他字段获取encounterId
|
||||
if (item.id) {
|
||||
patientInfo.value.encounterId = item.id;
|
||||
console.log('使用item.id作为encounterId:', item.id);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加安全检查,确保item不为undefined或null
|
||||
if (!item) {
|
||||
console.error('handleCardClick: 传入的item为null或undefined');
|
||||
return;
|
||||
}
|
||||
|
||||
// 记录patientInfo内容到控制台
|
||||
setTimeout(() => {
|
||||
const patientInfoStr = JSON.stringify(patientInfo.value, null, 2);
|
||||
console.log('当前patientInfo内容:', patientInfo.value);
|
||||
console.log('patientInfo.encounterId值:', patientInfo.value?.encounterId);
|
||||
}, 100);
|
||||
|
||||
// 将患者信息保存到store中,供hospitalizationEmr组件使用
|
||||
updatePatientInfo(item);
|
||||
activeTab.value = 'hospitalizationEmr';
|
||||
@@ -513,6 +557,21 @@ function handleTimeChange(value) {
|
||||
getPatientList();
|
||||
}
|
||||
|
||||
// 处理办理住院点击事件
|
||||
function handleHospitalizationClick() {
|
||||
console.log('handleHospitalizationClick 被调用');
|
||||
console.log('当前patientInfo:', patientInfo.value);
|
||||
console.log('当前patientInfo.encounterId:', patientInfo.value?.encounterId);
|
||||
|
||||
if (!patientInfo.value || !patientInfo.value.encounterId) {
|
||||
console.log('患者信息不完整,无法办理住院');
|
||||
ElMessage.warning('请先选择患者');
|
||||
} else {
|
||||
console.log('调用onHospitalization函数');
|
||||
onHospitalization();
|
||||
}
|
||||
}
|
||||
|
||||
// 接诊回调
|
||||
function handleReceive(row) {
|
||||
handleCardClick(row);
|
||||
@@ -532,8 +591,13 @@ function openDrawer() {
|
||||
}
|
||||
// 判断是否已经入院登记
|
||||
const onHospitalization = async () => {
|
||||
console.log('onHospitalization 被调用');
|
||||
console.log('patientInfo.value:', patientInfo.value);
|
||||
console.log('patientInfo.value.encounterId:', patientInfo.value?.encounterId);
|
||||
|
||||
// 检查是否有有效的就诊ID
|
||||
if (!patientInfo.value?.encounterId) {
|
||||
console.log('缺少有效的就诊ID,无法办理住院');
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '患者就诊信息不完整,无法办理住院!',
|
||||
@@ -542,10 +606,13 @@ const onHospitalization = async () => {
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('开始获取诊断信息,encounterId:', patientInfo.value.encounterId);
|
||||
const diagnosisRes = await getEncounterDiagnosis(patientInfo.value.encounterId);
|
||||
console.log('诊断信息获取结果:', diagnosisRes);
|
||||
|
||||
// 检查API调用是否成功
|
||||
if (diagnosisRes.code !== 200) {
|
||||
console.log('获取诊断信息失败:', diagnosisRes.msg);
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: diagnosisRes.msg || '获取诊断信息失败,无法办理住院!',
|
||||
@@ -554,31 +621,67 @@ const onHospitalization = async () => {
|
||||
}
|
||||
|
||||
const hasDiagnosis = diagnosisRes.data?.length > 0;
|
||||
console.log('是否有诊断信息:', hasDiagnosis);
|
||||
if (!hasDiagnosis) {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '该患者暂无诊断信息,无法办理住院!',
|
||||
console.log('该患者暂无诊断信息');
|
||||
const confirmResult = await ElMessageBox.confirm(
|
||||
'该患者暂无诊断信息,是否前往添加诊断?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '前往添加',
|
||||
cancelButtonText: '暂不办理',
|
||||
type: 'warning',
|
||||
}
|
||||
).catch(() => {
|
||||
// 用户取消操作
|
||||
console.log('用户取消前往添加诊断');
|
||||
return false;
|
||||
});
|
||||
|
||||
if (confirmResult === true) {
|
||||
// 自动切换到诊断标签页以便用户添加诊断
|
||||
activeTab.value = 'diagnosis';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const mainDiag = diagnosisRes.data.find((item) => item.maindiseFlag === 1);
|
||||
console.log('主诊断信息:', mainDiag);
|
||||
if (!mainDiag) {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '该患者暂无主诊断信息,无法办理住院!'
|
||||
console.log('该患者暂无主诊断信息');
|
||||
const confirmResult = await ElMessageBox.confirm(
|
||||
'该患者暂无主诊断信息,是否前往设置主诊断?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '前往设置',
|
||||
cancelButtonText: '暂不办理',
|
||||
type: 'warning',
|
||||
}
|
||||
).catch(() => {
|
||||
// 用户取消操作
|
||||
console.log('用户取消前往设置主诊断');
|
||||
return false;
|
||||
});
|
||||
|
||||
if (confirmResult === true) {
|
||||
// 自动切换到诊断标签页以便用户设置主诊断
|
||||
activeTab.value = 'diagnosis';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mainDiagnosis.value = mainDiag;
|
||||
console.log('主诊断设置成功:', mainDiagnosis.value);
|
||||
|
||||
console.log('检查住院状态,encounterId:', patientInfo.value.encounterId);
|
||||
const res = await isHospitalization({
|
||||
encounterId: patientInfo.value.encounterId,
|
||||
});
|
||||
console.log('住院状态检查结果:', res);
|
||||
|
||||
// 检查API调用是否成功
|
||||
if (res.code !== 200) {
|
||||
console.log('检查住院状态失败:', res.msg);
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.msg || '检查住院状态失败!',
|
||||
@@ -586,9 +689,17 @@ const onHospitalization = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('住院状态检查API响应:', res);
|
||||
console.log('res.data值:', res.data);
|
||||
console.log('res.data类型:', typeof res.data);
|
||||
|
||||
if (!res.data) {
|
||||
console.log('患者未办理过住院,打开住院登记对话框');
|
||||
console.log('当前openDialog值:', openDialog.value);
|
||||
openDialog.value = true;
|
||||
console.log('设置openDialog为true后,值为:', openDialog.value);
|
||||
} else {
|
||||
console.log('患者已办理过住院');
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '该患者,已办理入院,不允许重复办理',
|
||||
@@ -792,10 +903,20 @@ const onHospitalization = async () => {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: calc(100% - 50px);
|
||||
z-index: 999;
|
||||
z-index: 998; /* 降低z-index,避免覆盖按钮 */
|
||||
/* 确保覆盖在内容上方,但不覆盖顶部按钮区域 */
|
||||
cursor: not-allowed;
|
||||
background-color: rgba(255, 255, 255, 0.01);
|
||||
pointer-events: auto;
|
||||
pointer-events: none; /* 默认不捕获鼠标事件,只在真正需要禁用时才启用 */
|
||||
}
|
||||
|
||||
.disabled-wrapper .overlay.overlay-disabled {
|
||||
pointer-events: auto; /* 当需要真正禁用时启用指针事件 */
|
||||
}
|
||||
|
||||
/* 顶层按钮样式,确保按钮始终在最上层 */
|
||||
.top-layer-btn {
|
||||
position: relative !important;
|
||||
z-index: 1000 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user