Files
his/MD/bugs/BUG_759_ANALYSIS.md

150 lines
6.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Bug #759 诸葛亮分析报告
> **文档类型**: Bug分析
> **分析时间**: 2026-06-12 14:36:23
> **分析模型**: mimo-v2.5 (LLM深度分析)
---
## 基本信息
- **Bug #**: 759
- **标题**: 【门诊医生工作站】电子处方点击新增处方报卡在100%卡出屏幕且诊断等下拉框无数据回显
- **模块**: 门诊医生工作站
- **提出人**: 王栩坤
---
I now have a thorough understanding of both issues. Let me output the analysis.
---
### 一、Bug 理解
用户在门诊医生工作站点击"新增处方"时遇到两个问题:**报卡(处方弹窗)宽度超出屏幕**,在 100% 缩放下内容溢出无法完整显示;**诊断和慢病诊断下拉框没有数据**,无法选择。
### 二、根因分析
#### 问题1弹窗宽度超出屏幕
- **文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue:3`
- **根因**`el-dialog``width="1840px"` 是固定像素值。在 100% 缩放的标准 1920px 屏幕上,减去浏览器边框和滚动条后,弹窗右侧内容会超出视口。在 1440px 等更小的屏幕上问题更严重。
- 弹窗内部使用了多个 `<el-col :span="12">` 并排布局(诊断字段在第二行第三个 col进一步放大了宽度需求。
#### 问题2诊断下拉框无数据
- **文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue:713-720`
- **根因**:诊断下拉框使用 `remote` + `:remote-method="getInit"` 模式,`getInit` 函数有条件守卫 `if(searchKey)` ——只有用户输入关键词后才调用 API。弹窗打开时`open()` 函数)**从未调用 `getInit` 初始化选项列表**,导致 `diagnosisListOption` 为空。
- 对比父组件 `prescriptionlist.vue`:它的诊断下拉使用 `diagnosisList`(由 `getDiagnosisInfo()``getEncounterDiagnosis()` 直接填充),所以有数据。但 `eprescriptiondialog` 用了不同的变量 `diagnosisListOption`,需要通过 `getDiagnosisListEle` API 搜索填充。
#### 问题3慢病诊断下拉无数据附加分析
- **文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue``getChronicDisease` 调用)
- **根因**`getChronicDisease` 调用后端 `/yb-request/getConditionDefinition``YbController.java:159`),该接口要求:
1. 医保系统YB已连接
2. 患者有医保信息(`InfoPerson` 不为空)
3. 患者有当前有效的慢性病记录(日期在 `begndate` ~ `enddate` 范围内)
- 如果患者未参保或医保未连接,后端直接抛 `ServiceException`,前端 catch 后 `speDiagnosisList` 为空。这是**业务约束**而非代码 bug但前端缺少无数据时的友好提示。
### 三、修复方案
#### 修复1弹窗宽度改为响应式
**文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue:3`
```diff
- <el-dialog v-model="props.openPrescription" :title="title" width="1840px" teleported destroy-on-close @open="open" @close="close">
+ <el-dialog v-model="props.openPrescription" :title="title" width="calc(100vw - 80px)" teleported destroy-on-close @open="open" @close="close">
```
同时添加样式限制最大宽度,防止超大屏幕上过宽:
```diff
<style scoped>
+ :deep(.el-dialog) {
+ max-width: 1800px;
+ }
```
#### 修复2诊断下拉框初始加载数据
**文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue`
**方案A推荐**:在 `open()` 中将已有的 `diagnosisList`(从 `getEncounterDiagnosis` 获取)同步到 `diagnosisListOption`,同时保留远程搜索能力:
```diff
function open() {
conditionId.value = props.prescriptionData.conditionId;
getDiagnosisInfo();
+ // 初始化诊断下拉选项(从已有就诊诊断填充)
+ getDiagnosisInfo().then(() => {
+ diagnosisListOption.value = [...diagnosisList.value];
+ });
}
```
`getDiagnosisInfo` 目前没有返回 Promise`.then()` 后没有 `return`),需要微调:
修改 `getDiagnosisInfo` 函数,让它返回 Promise
```diff
function getDiagnosisInfo() {
- getEncounterDiagnosis(props.patient.encounterId).then((res) => {
+ return getEncounterDiagnosis(props.patient.encounterId).then((res) => {
diagnosisList.value = res.data;
+ diagnosisListOption.value = [...(res.data || [])];
// ... existing filtering logic ...
}).catch((error) => {
console.error('获取诊断信息失败:', error);
});
}
```
**方案B可选增强**:修改 `getInit` 让空搜索词也能返回全量结果:
```diff
function getInit(searchKey) {
- if(searchKey) {
- getDiagnosisListEle(searchKey,infoForm.encounterId).then(res => {
- diagnosisListOption.value = res.data
- })
- }
+ getDiagnosisListEle(searchKey || '', infoForm.encounterId).then(res => {
+ diagnosisListOption.value = res.data || []
+ })
}
```
后端 `getEncounterDiagnosisByEncounterId` 已处理空 `searchKey`(直接返回全部),所以这是安全的。
**推荐方案A + B 组合**A 确保弹窗打开时立即有数据B 确保用户输入空字符时也能刷新。
#### 修复3慢病诊断无数据时显示提示
**文件**`healthlink-his-ui/src/views/doctorstation/components/eprescriptiondialog.vue`
`getChronicDisease` 的 catch 中添加用户提示:
```diff
getChronicDisease({ encounterId: props.patient.encounterId }).then((res) => {
speDiagnosisList.value = res.data || [];
+ if (!res.data || res.data.length === 0) {
+ // 静默:患者可能无慢病,不弹警告
+ }
}).catch((error) => {
+ console.warn('获取慢病诊断失败,可能未连接医保:', error);
speDiagnosisList.value = [];
});
```
### 四、路由决策
**FIXER: zhaoyun前端开发**
**REASON**: 两个问题都在 `eprescriptiondialog.vue` 前端组件中,修复仅涉及 Vue 模板宽度修改和 JS 数据加载逻辑调整,无后端变更。属于纯前端 UI 修复,适合前端开发角色处理。
---
## 路由决策
- **修复 Agent**: zhaoyun
- **原因**: LLM 分析决策