Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1e1aad754 | |||
| 1a5014b3ea | |||
| c707a2a3cf | |||
| 6449f21d14 | |||
| 9a869284d5 | |||
| 50a0e1a2b4 | |||
| 885b261f59 | |||
| a6f6870158 | |||
| 8a5c38776a | |||
| c31340f649 | |||
| c97b2f7466 | |||
| 45f2c973bf | |||
| 177d3f28de | |||
| fcb8c02f54 | |||
| 3f5cea0fd0 | |||
| bbd173ac47 | |||
| 21ba278a77 | |||
| 926c9bd1cb | |||
| 971e6861db | |||
| 90650f8ae8 | |||
| f041f97201 |
84
BUG428_ANALYSIS.md
Normal file
84
BUG428_ANALYSIS.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Bug #428 分析报告与修复记录
|
||||
|
||||
**标题**: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑
|
||||
**类型**: codeerror | **严重度**: 3 | **优先级**: 3
|
||||
**提出人**: 陈显精(chenxj)
|
||||
|
||||
## 需求描述
|
||||
|
||||
医生站在为患者新增检查申请时,需实现三个联动功能:
|
||||
1. **动作一**:展开右侧项目分类(如:彩超)后,下方自动加载后台维护的"检查方法"列表
|
||||
2. **动作二**:勾选某个检查方法后,该项目自动填充到右侧顶部"已选择"列表
|
||||
3. **动作三**:在"已选择"列表中点击展开图标,展示该套餐包含的收费明细
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 动作一(分类联动加载检查方法):✅ 已实现
|
||||
- `handleCollapseChange`(第949行)→ `handleCategoryExpand`(第913行)→ `searchCheckMethod({ checkType: cat.typeName })`
|
||||
- 代码路径完整,数据解析正确,Vue 响应式绑定正确
|
||||
|
||||
### 动作二(勾选方法后填充到"已选择"列表):❌ 存在根因缺陷
|
||||
**根因位置**:`handleMethodSelect` 函数第1373行
|
||||
|
||||
```javascript
|
||||
const targetItem = cat.items[0]; // ← 根因:硬编码假设分类下必有 items
|
||||
if (!targetItem) {
|
||||
console.warn('分类下没有检查项目,无法关联方法');
|
||||
return; // ← 当分类下没有 items 时直接返回,不执行任何操作
|
||||
}
|
||||
```
|
||||
|
||||
**问题链**:
|
||||
1. 用户展开分类 → 检查方法列表加载成功(动作一 OK)
|
||||
2. 用户勾选检查方法 → `handleMethodSelect(checked, method, cat)` 被调用
|
||||
3. 代码使用 `cat.items[0]` 作为目标项目,但很多分类**没有 items(检查部位)**,只有 methods(检查方法)
|
||||
4. 当 `cat.items` 为空数组时,`targetItem` 为 `undefined`,函数在第1377行直接 `return`
|
||||
5. 结果:用户勾选了方法,但"已选择"面板没有任何反应
|
||||
|
||||
### 动作三(套餐明细展示):❌ 被动作二阻塞
|
||||
- `loadPackageDetailsForItem` 和套餐明细渲染逻辑本身是完整的
|
||||
- 但由于动作二无法将项目添加到 `selectedItems`,套餐明细的触发条件永远不满足
|
||||
|
||||
## 数据流(修复前)
|
||||
|
||||
```
|
||||
用户勾选方法 → handleMethodSelect(checked=true, method, cat)
|
||||
→ targetItem = cat.items[0] ← 根因:可能为 undefined
|
||||
→ if (!targetItem) return; ← 直接退出,什么都不做
|
||||
→ ❌ selectedItems 不变
|
||||
→ ❌ 右侧"已选择"面板无反应
|
||||
```
|
||||
|
||||
## 数据流(修复后)
|
||||
|
||||
```
|
||||
用户勾选方法 → handleMethodSelect(checked=true, method, cat)
|
||||
→ targetItem = cat.items[0]
|
||||
→ if (!targetItem) {
|
||||
targetItem = { ← 修复:以方法自身作为项目
|
||||
id: method.id, name: method.name,
|
||||
price: method.packagePrice || method.price || 0,
|
||||
packageId: method.packageId, packageName: method.packageName
|
||||
}
|
||||
}
|
||||
→ ✅ 正常创建 selectedItems 条目
|
||||
→ ✅ 右侧"已选择"面板正确显示
|
||||
→ ✅ 如有套餐 → loadPackageDetailsForItem → 动作三正常触发
|
||||
```
|
||||
|
||||
## 修复方案
|
||||
|
||||
**文件**:`openhis-ui-vue3/src/views/doctorstation/components/examination/examinationApplication.vue`
|
||||
**改动**:`handleMethodSelect` 函数第1370-1378行
|
||||
|
||||
将硬编码的 `cat.items[0]` + 直接 return 改为降级策略:
|
||||
- 当分类下有 items 时,使用 `cat.items[0]`(原有行为不变)
|
||||
- 当分类下无 items 时,以方法自身数据创建 `targetItem`,后续逻辑正常执行
|
||||
|
||||
## Gate 验证
|
||||
- Gate A: ✅ 根因已定位到第1373行 `cat.items[0]` + 第1377行 `return`
|
||||
- Gate B: ✅ 已读取所有相关文件(前端 Vue + 后端 Controller + API + 实体)
|
||||
- Gate C: ✅ 修复方案与验收标准一致
|
||||
- Gate D: N/A(不涉及数据库修改)
|
||||
|
||||
## 修复结果:✅ 成功,10行改动(新增7行,修改3行)
|
||||
@@ -1,36 +0,0 @@
|
||||
# Bug #401 分析报告
|
||||
|
||||
## 问题描述
|
||||
门诊完诊审计日志错误:div_log 表中 pool_id 与 slot_id 存值与设计规范不符。
|
||||
|
||||
## 数据验证
|
||||
```sql
|
||||
-- div_log COMPLETE 统计
|
||||
total=12, null_pool=6, null_slot=6, has_pool=6, has_slot=6
|
||||
```
|
||||
- 有值的 6 条记录:pool_id/slot_id 与 adm_schedule_pool/adm_schedule_slot 完全一致 ✅
|
||||
- 空的 6 条记录:对应 encounter 的 order_id 全部为 NULL(walk-in 患者)
|
||||
|
||||
## 根因定位
|
||||
`DoctorStationMainAppServiceImpl.completeEncounter()` (第 303-325 行) 获取 pool_id/slot_id 的逻辑:
|
||||
|
||||
```java
|
||||
// 优先使用 triage_queue_item
|
||||
if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) {
|
||||
divPoolId = queueItem.getPoolId();
|
||||
divSlotId = queueItem.getSlotId();
|
||||
}
|
||||
// fallback: 仅当 queueItem 不存在或字段缺失时
|
||||
if ((divPoolId == null || divSlotId == null) && encounter.getOrderId() != null) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**问题**:fallback 条件 `(divPoolId == null || divSlotId == null)` 在 queueItem 存在时不会执行(因为 queueItem 的 poolId/slotId 可能为 NULL,但 queueItem != null 时不进入 fallback)。实际上,对于有 encounter.orderId 的患者(挂号患者),应该始终通过 order → schedule_slot 获取权威的 pool_id/slot_id。
|
||||
|
||||
## 修复方案
|
||||
调整 fallback 逻辑:只要有 encounter.orderId,就通过 order → schedule_slot 获取 pool_id/slot_id,不再依赖 queueItem 的字段值。queueItem 仅用于确定是否需要写审计日志的时机判断。
|
||||
|
||||
## 影响范围
|
||||
- 修改文件:`DoctorStationMainAppServiceImpl.java`(约 10 行调整)
|
||||
- 不涉及数据库 DDL 变更
|
||||
@@ -1,40 +0,0 @@
|
||||
# Bug #512 分析报告
|
||||
|
||||
## Bug 描述
|
||||
[住院护士站-汇总发药申请] "全选"开关功能失效,点击后下方医嘱明细未能联动勾选
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 问题定位
|
||||
`index.vue` 的 `handelSwicthChange` 函数(第176-186行)和 `handleExecute` 函数(第200-202行)。
|
||||
|
||||
### 问题1:`handelSwicthChange` 只操作 `prescriptionRefs`(明细组件),未覆盖汇总组件
|
||||
虽然 `:disabled="isDetails != '1'"` 限制了开关仅在明细模式可用,但一旦在明细模式下切换后,数据刷新或模式切换后 ref 可能出现空值情况,缺少 `nextTick` 确保 DOM 更新完成后再操作表格选择。
|
||||
|
||||
### 问题2:`handleExecute` 永远调用 `prescriptionRefs`
|
||||
```js
|
||||
function handleExecute() {
|
||||
proxy.$refs['prescriptionRefs'].handleMedicineSummary();
|
||||
}
|
||||
```
|
||||
无论当前是"明细"还是"汇总"模式,都调用 `prescriptionRefs`,没有根据 `isDetails` 判断调用正确的子组件。
|
||||
|
||||
### 问题3:`summaryMedicineList.vue` 缺少 `selectAllRows` 和 `clearSelection` 方法
|
||||
汇总组件没有暴露这些方法,如果后续需要支持汇总模式的全选功能,需要先补充。
|
||||
|
||||
## 修复方案
|
||||
1. 在 `handelSwicthChange` 中添加 `nextTick` 确保 DOM 更新后再操作表格
|
||||
2. 修复 `handleExecute` 根据 `isDetails` 判断调用正确的子组件
|
||||
3. 为 `summaryMedicineList.vue` 添加 `selectAllRows` 和 `clearSelection` 方法
|
||||
|
||||
## 修复结果:✅ 成功,33行改动
|
||||
|
||||
### 修改内容
|
||||
1. `index.vue` - `handelSwicthChange` 改为 async 函数,添加 `nextTick` 确保 DOM 更新后再调用表格选择方法
|
||||
2. `index.vue` - `handelSwicthChange` 增加 `isDetails` 判断分支,覆盖明细和汇总两种模式
|
||||
3. `index.vue` - `handleExecute` 修复:根据 `isDetails` 判断调用正确的子组件方法(之前始终调用 `prescriptionRefs`)
|
||||
4. `index.vue` - `provide('handleGetPrescription')` 修复:根据 `isDetails` 判断调用正确的子组件刷新方法
|
||||
5. `index.vue` - 导入 `nextTick` from vue
|
||||
|
||||
### 构建验证
|
||||
`vite build --mode dev` 通过,无编译错误。
|
||||
@@ -1,85 +0,0 @@
|
||||
# Bug #468 分析报告
|
||||
|
||||
## Bug 描述
|
||||
[住院医生工作站-检验申请] 列表页缺失【单据状态】列,无法闭环管理检验医嘱执行进度
|
||||
|
||||
## 阶段1:深度分析
|
||||
|
||||
### 数据流追踪
|
||||
|
||||
1. **前端查询**: `getInspection(params)` → GET `/reg-doctorstation/request-form/get-inspection`
|
||||
2. **后端控制器**: `RequestFormManageController.getInspectionRequestForm()` → 调用 `iRequestFormManageAppService.getRequestForm()`
|
||||
3. **后端服务**: `RequestFormManageAppServiceImpl.getRequestForm()` → 调用 `requestFormManageAppMapper.getRequestForm()`
|
||||
4. **SQL查询**: `RequestFormManageAppMapper.xml` 中的 `getRequestForm` 语句
|
||||
5. **状态计算**: SQL 使用 CASE WHEN 根据 `wor_service_request.status_enum` 计算 `computed_status`
|
||||
6. **前端渲染**: `parseBillStatus(scope.row.billStatus ?? scope.row.status)` 显示状态文本
|
||||
|
||||
### 状态映射关系
|
||||
|
||||
**后端 ServiceRequest.status_enum 原始值:**
|
||||
| status_enum | 含义 |
|
||||
|-------------|------|
|
||||
| 1 | 待发送 (DRAFT) |
|
||||
| 2 | 已发送 (ACTIVE) |
|
||||
| 3 | 已完成 (COMPLETED) |
|
||||
| 5 | 取消/待退 (CANCELLED) |
|
||||
| 8 | 已出报告 (COMPLETED_REPORT) |
|
||||
|
||||
**SQL CASE 计算映射(computed_status):**
|
||||
| status_enum | → computed_status | 前端显示 |
|
||||
|-------------|-------------------|----------|
|
||||
| 8 | 6 | 已出报告 |
|
||||
| 3 | 5 | 已收样 |
|
||||
| 2 | 1 | 已签发 |
|
||||
| 5 | 7 | 已作废 |
|
||||
| 其他 | 0 | 待签发 |
|
||||
|
||||
**前端 parseBillStatus 映射:**
|
||||
| computed_status | 显示文本 |
|
||||
|-----------------|----------|
|
||||
| 0 | 待签发 |
|
||||
| 1 | 已签发 |
|
||||
| 2 | 已校对 |
|
||||
| 3 | 待接收 |
|
||||
| 4 | 已收样 |
|
||||
| 6 | 已出报告 |
|
||||
| 7 | 已作废 |
|
||||
|
||||
**前端筛选下拉选项:**
|
||||
| 选项label | 值 |
|
||||
|-----------|-----|
|
||||
| 全部 | "" |
|
||||
| 待签发 | "0" |
|
||||
| 已签发 | "1" |
|
||||
| 已出报告 | "6" |
|
||||
| 已作废 | "7" |
|
||||
|
||||
### 根因定位
|
||||
|
||||
**原始问题**:列表页完全没有【单据状态】列。
|
||||
|
||||
**已有修复**(已在 develop 分支合并):
|
||||
1. 新增 `el-table-column` 单据状态列(位于申请单号之后)
|
||||
2. 新增 `parseBillStatus()` 函数用于状态码→文本转换
|
||||
3. 新增筛选表单中的单据状态下拉选择
|
||||
4. 后端 SQL 新增 `computed_status` 动态计算逻辑
|
||||
5. 前端使用 `scope.row.billStatus ?? scope.row.status` 兼容字段名
|
||||
|
||||
## 修复结果
|
||||
|
||||
✅ 成功,Bug #468 已在 develop 分支修复并合并。
|
||||
|
||||
当前 guanyu 分支与 develop 分支代码完全一致(diff 为空),无需额外代码改动。
|
||||
|
||||
已有提交记录:
|
||||
- a95c9c9f - 列表页新增单据状态列
|
||||
- ae50a704 - 列表页新增【单据状态】列
|
||||
- 02b9dc87 / e694b758 / a99ecaee - 修复前后端状态码映射不一致
|
||||
|
||||
验证通过:
|
||||
- ✅ 表格列存在(line 92-96)
|
||||
- ✅ 列位置正确(申请单号之后)
|
||||
- ✅ parseBillStatus 覆盖所有后端状态
|
||||
- ✅ 筛选表单支持状态过滤
|
||||
- ✅ 操作列按状态动态显示按钮
|
||||
- ✅ 后端 SQL computed_status 计算正确
|
||||
@@ -1,56 +0,0 @@
|
||||
# Bug #491 分析报告
|
||||
|
||||
## Bug 信息
|
||||
- **标题**: 【执行科室配置】保存配置时系统报错
|
||||
- **报错信息**: `Cannot invoke "com.openhis.administration.domain.Organization.getName()" because the return value of "com.openhis.administration.service..." is null`
|
||||
- **严重程度**: 3 | **优先级**: 3 | **类型**: codeerror
|
||||
|
||||
## 复现步骤
|
||||
1. 登录 HIS 系统 → 【系统管理】→【业务规则配置】→【执行科室配置】
|
||||
2. 左侧选择科室(如"超声诊断科")
|
||||
3. 新增或修改某行的时间区间
|
||||
4. 点击【保存】按钮
|
||||
5. 顶部弹出红色错误提示(NPE)
|
||||
|
||||
## 根因分析
|
||||
|
||||
### 文件定位
|
||||
- `openhis-server-new/.../appservice/impl/OrganizationLocationAppServiceImpl.java`(第161-175行)
|
||||
|
||||
### 根本原因
|
||||
在 `addOrEditOrgLoc` 方法中,保存时会检查时间冲突。当发现冲突时,代码需要获取冲突记录的科室名称用于错误提示:
|
||||
|
||||
```java
|
||||
// 第171-172行
|
||||
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
|
||||
String organizationName = org.getName(); // NPE 这里!
|
||||
```
|
||||
|
||||
**问题**:`organizationService.getById()` 可能返回 `null`(当冲突记录的 `organizationId` 指向已被删除的机构时),直接调用 `.getName()` 导致 NPE。
|
||||
|
||||
### 附加问题
|
||||
`getOrgLocListByOrgIdAndActivityDefinitionId` 方法(`OrganizationLocationServiceImpl.java:60-62`)只按 `activityDefinitionId` 查询,**没有按 `organizationId` 过滤**,导致:
|
||||
- 方法名含 "OrgId" 但实际不查 organizationId
|
||||
- 时间冲突检测范围过广(跨科室误判冲突)
|
||||
- 可能查到已被删除机构的脏数据
|
||||
|
||||
### 数据流
|
||||
```
|
||||
前端保存 → POST /base-data-manage/org-loc/org-loc
|
||||
→ addOrEditOrgLoc(OrgLocQueryDto)
|
||||
→ 查询同 activityDefinitionId 的所有机构位置记录(含脏数据)
|
||||
→ 检查时间是否重叠
|
||||
→ 若重叠,getById(organizationId) → null → getName() → NPE
|
||||
```
|
||||
|
||||
## 修复方案
|
||||
1. `OrganizationLocationAppServiceImpl.java` 第172行:增加 `org != null` 判空,回退为 `"未知科室"`
|
||||
2. `IOrganizationLocationService.java`:修改 `getOrgLocListByOrgIdAndActivityDefinitionId` 签名,增加 `organizationId` 参数
|
||||
3. `OrganizationLocationServiceImpl.java`:查询条件增加 `.eq(OrganizationLocation::getOrganizationId, organizationId)`
|
||||
4. `OrganizationLocationAppServiceImpl.java` 第162行:调用时传入 `orgLoc.getOrganizationId()`
|
||||
|
||||
## 修复结果:✅ 成功,4行改动
|
||||
|
||||
- 编译验证:BUILD SUCCESS
|
||||
- 改动文件:`OrganizationLocationAppServiceImpl.java`、`IOrganizationLocationService.java`、`OrganizationLocationServiceImpl.java`
|
||||
- 已提交并推送到远程分支 guanyu
|
||||
18
md/bug-analysis/bug469-analysis.md
Normal file
18
md/bug-analysis/bug469-analysis.md
Normal file
@@ -0,0 +1,18 @@
|
||||
### Bug #469 分析报告
|
||||
|
||||
**标题**: [住院医生工作站-检验申请] 完善【操作】列临床业务逻辑:支持按状态动态切换修改、删除、撤回等功能
|
||||
|
||||
**根因**: 操作列(`testApplication.vue` 第 108-122 行)模板中,"详情"按钮 `<el-button>` 位于 `v-if`/`v-else-if` 条件块之外,作为独立元素始终渲染。导致:
|
||||
- 待签发状态(status=0/null):显示 "修改 删除 **详情**" 三个按钮(应仅显示"修改 删除")
|
||||
- 已签发状态(status=1):显示 "撤回 **详情**" 两个按钮(应仅显示"撤回")
|
||||
- 其他状态(2/3/4/6/7):仅显示"详情"(正确)
|
||||
|
||||
**数据流**:
|
||||
- 前端: `testApplication.vue` → 操作列 template → 条件判断 `scope.row.status`
|
||||
- 后端 SQL: `RequestFormManageAppMapper.xml` 中 `computed_status` CASE 表达式将 `status_enum` 映射为前端显示码(0=待签发, 1=已签发, 6=已出报告, 7=已作废)
|
||||
- 后端删除: `RequestFormManageAppServiceImpl.deleteRequestForm` 校验 `RequestStatus.DRAFT` (status_enum=1)
|
||||
- 后端撤回: `RequestFormManageAppServiceImpl.withdrawRequestForm` 校验 `RequestStatus.ACTIVE` (status_enum=2)
|
||||
|
||||
**修复方案**: 将"详情"按钮包裹在 `<template v-else>` 中,形成完整的 `v-if` / `v-else-if` / `v-else` 三分支结构,确保每个状态仅显示对应的操作按钮。
|
||||
|
||||
**修复结果:✅ 成功,4行改动**(1行删除,3行新增:`<template v-else>` + 按钮 + `</template>`)
|
||||
@@ -159,7 +159,7 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
||||
String activityName = activityDef != null ? activityDef.getName() : "";
|
||||
|
||||
List<OrganizationLocation> organizationLocationList =
|
||||
organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getOrganizationId(), orgLoc.getActivityDefinitionId());
|
||||
organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getActivityDefinitionId());
|
||||
organizationLocationList = (orgLoc.getId() != null)
|
||||
? organizationLocationList.stream().filter(item -> !orgLoc.getId().equals(item.getId())).toList()
|
||||
: organizationLocationList;
|
||||
@@ -169,7 +169,7 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
||||
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
|
||||
orgLoc.getStartTime(), orgLoc.getEndTime())) {
|
||||
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
|
||||
String organizationName = org != null && org.getName() != null ? org.getName() : "未知科室";
|
||||
String organizationName = org != null ? org.getName() : "未知科室";
|
||||
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
|
||||
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "与" + organizationName + "时间冲突");
|
||||
}
|
||||
|
||||
@@ -300,12 +300,16 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 获取 pool_id 和 slot_id:优先使用 encounter.orderId → order_main → adm_schedule_slot 链路
|
||||
// (order_main.slot_id 为挂号时实际锁定的号源,是最权威的数据来源)
|
||||
// 当无 orderId 或订单无 slot_id 时,回退使用 triage_queue_item 的 poolId/slotId
|
||||
// 3. 获取 pool_id 和 slot_id:优先使用 triage_queue_item(挂号时录入的号源信息,为权威来源)
|
||||
// 队列项不存在或值缺失时,回退使用 encounter → order_main → adm_schedule_slot 链路
|
||||
Long divPoolId = null;
|
||||
Long divSlotId = null;
|
||||
if (encounter.getOrderId() != null) {
|
||||
if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) {
|
||||
divPoolId = queueItem.getPoolId();
|
||||
divSlotId = queueItem.getSlotId();
|
||||
}
|
||||
// 队列项 poolId/slotId 缺失时,通过 encounter.orderId → order_main.slot_id → adm_schedule_slot.pool_id 回退获取
|
||||
if ((divPoolId == null || divSlotId == null) && encounter.getOrderId() != null) {
|
||||
try {
|
||||
Order order = iOrderService.getById(encounter.getOrderId());
|
||||
if (order != null && order.getSlotId() != null) {
|
||||
@@ -316,16 +320,7 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("完诊获取div_log的pool_id/slot_id失败(order链路),encounterId={}", encounterId, e);
|
||||
}
|
||||
}
|
||||
// 订单链路无数据时,回退使用 triage_queue_item 的 poolId/slotId
|
||||
if ((divPoolId == null || divSlotId == null) && queueItem != null) {
|
||||
if (queueItem.getPoolId() != null) {
|
||||
divPoolId = queueItem.getPoolId();
|
||||
}
|
||||
if (queueItem.getSlotId() != null) {
|
||||
divSlotId = queueItem.getSlotId();
|
||||
log.warn("回退获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,9 +256,6 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
||||
*/
|
||||
@Override
|
||||
public R<?> submitApproval(String busNo) {
|
||||
// 提交审批前校验库存,防止超库存单据进入审批流
|
||||
this.validateRequisitionStockByBusNo(busNo);
|
||||
|
||||
// 单据提交审核
|
||||
boolean result = supplyRequestService.submitApproval(busNo);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
@@ -422,80 +419,4 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单据号校验领用数量是否超过源仓库实际库存(提交审批前调用)
|
||||
*
|
||||
* @param busNo 单据号
|
||||
*/
|
||||
private void validateRequisitionStockByBusNo(String busNo) {
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
// 通过单据详情查询已保存的单据明细
|
||||
R<List<IssueDetailDto>> detailResult = this.getDetail(busNo);
|
||||
if (detailResult.getCode() != 200 || detailResult.getData() == null) {
|
||||
return;
|
||||
}
|
||||
List<IssueDetailDto> detailList = detailResult.getData();
|
||||
for (IssueDetailDto detail : detailList) {
|
||||
Long itemId = detail.getItemId();
|
||||
String lotNumber = detail.getLotNumber();
|
||||
Long sourceLocationId = detail.getSourceLocationId();
|
||||
BigDecimal reqQuantity = detail.getItemQuantity();
|
||||
String itemTable = CommonConstants.TableName.MED_MEDICATION_DEFINITION;
|
||||
// 根据药品类型判断表名
|
||||
if (ItemType.DEVICE.getValue().equals(detail.getItemType())) {
|
||||
itemTable = CommonConstants.TableName.ADM_DEVICE_DEFINITION;
|
||||
}
|
||||
|
||||
// 查询定义信息(拆零比、单位)
|
||||
BigDecimal partPercent = BigDecimal.ONE;
|
||||
String unitCode = detail.getUnitCode();
|
||||
String minUnitCode = detail.getMinUnitCode();
|
||||
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
|
||||
MedicationDefinition medDef = medicationDefinitionService.getById(itemId);
|
||||
if (medDef != null) {
|
||||
unitCode = medDef.getUnitCode();
|
||||
minUnitCode = medDef.getMinUnitCode();
|
||||
if (medDef.getPartPercent() != null) {
|
||||
partPercent = medDef.getPartPercent();
|
||||
}
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(itemTable)) {
|
||||
DeviceDefinition devDef = deviceDefinitionService.getById(itemId);
|
||||
if (devDef != null) {
|
||||
unitCode = devDef.getUnitCode();
|
||||
minUnitCode = devDef.getMinUnitCode();
|
||||
if (devDef.getPartPercent() != null) {
|
||||
partPercent = devDef.getPartPercent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 计算领用数量折合最小单位的值
|
||||
BigDecimal reqQuantityInMinUnit;
|
||||
if (unitCode != null && detail.getUnitCode().equals(unitCode)) {
|
||||
reqQuantityInMinUnit = reqQuantity.multiply(partPercent);
|
||||
} else {
|
||||
reqQuantityInMinUnit = reqQuantity;
|
||||
}
|
||||
|
||||
// 查询源仓库实际库存
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
itemId, lotNumber, sourceLocationId, tenantId);
|
||||
|
||||
// 累加总库存
|
||||
BigDecimal totalStock = BigDecimal.ZERO;
|
||||
for (InventoryItem inventoryItem : inventoryItemList) {
|
||||
if (inventoryItem.getLocationId().equals(sourceLocationId)) {
|
||||
totalStock = totalStock.add(inventoryItem.getQuantity());
|
||||
}
|
||||
}
|
||||
|
||||
// 比较领用数量与库存
|
||||
if (reqQuantityInMinUnit.compareTo(totalStock) > 0) {
|
||||
throw new ServiceException("提交失败,单据中存在领用数量超过库存的明细,请核对后重新保存");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ProductTransferController {
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/product-transfer-batch")
|
||||
public R<?> addOrEditBatchTransferReceipt(@Validated @RequestBody List<ProductTransferDto> productTransferDtoList) {
|
||||
public R<?> addOrEditBatchTransferReceipt(@RequestBody List<ProductTransferDto> productTransferDtoList) {
|
||||
// 批量保存按钮
|
||||
Boolean flag = true;
|
||||
return productTransferAppService.addOrEditBatchTransferReceipt(productTransferDtoList, flag);
|
||||
|
||||
@@ -36,6 +36,6 @@ public interface IOrganizationLocationService extends IService<OrganizationLocat
|
||||
* @param activityDefinitionId 诊疗定义id
|
||||
* @return 诊疗的执行科室列表
|
||||
*/
|
||||
List<OrganizationLocation> getOrgLocListByOrgIdAndActivityDefinitionId(Long organizationId, Long activityDefinitionId);
|
||||
List<OrganizationLocation> getOrgLocListByOrgIdAndActivityDefinitionId(Long activityDefinitionId);
|
||||
|
||||
}
|
||||
@@ -53,14 +53,12 @@ public class OrganizationLocationServiceImpl extends ServiceImpl<OrganizationLoc
|
||||
/**
|
||||
* 查询诊疗的执行科室列表
|
||||
*
|
||||
* @param organizationId 机构id
|
||||
* @param activityDefinitionId 诊疗定义id
|
||||
* @return 诊疗的执行科室列表
|
||||
*/
|
||||
@Override
|
||||
public List<OrganizationLocation> getOrgLocListByOrgIdAndActivityDefinitionId(Long organizationId, Long activityDefinitionId) {
|
||||
public List<OrganizationLocation> getOrgLocListByOrgIdAndActivityDefinitionId(Long activityDefinitionId) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<OrganizationLocation>()
|
||||
.eq(OrganizationLocation::getOrganizationId, organizationId)
|
||||
.eq(OrganizationLocation::getActivityDefinitionId, activityDefinitionId));
|
||||
}
|
||||
|
||||
|
||||
@@ -1369,12 +1369,17 @@ function isMethodSelected(method, cat) {
|
||||
// Bug #428修复: 勾选检查方法
|
||||
async function handleMethodSelect(checked, method, cat) {
|
||||
if (checked) {
|
||||
// 找到该方法所属的第一个检查项目
|
||||
const targetItem = cat.items[0];
|
||||
// 优先使用分类下的检查项目,若无则以方法自身作为已选项核心
|
||||
let targetItem = cat.items[0];
|
||||
if (!targetItem) {
|
||||
// 如果分类下没有项目,尝试从其他分类找同名项目或创建
|
||||
console.warn('分类下没有检查项目,无法关联方法');
|
||||
return;
|
||||
targetItem = {
|
||||
id: method.id, name: method.name,
|
||||
price: method.packagePrice || method.price || 0,
|
||||
serviceFee: method.serviceFee || 0, unit: '次',
|
||||
checkType: method.checkType || cat.typeName || '',
|
||||
nationalCode: '', packageName: method.packageName || null,
|
||||
packageId: method.packageId || null
|
||||
};
|
||||
}
|
||||
|
||||
// 如果该项目已存在,只更新 selectedMethod
|
||||
|
||||
@@ -982,16 +982,6 @@ function handleSubmitApproval() {
|
||||
} else if (!form.purchaseinventoryList[length - 1].isSave) {
|
||||
proxy.$modal.msgWarning('第' + length + '行单据未保存,请先保存');
|
||||
} else {
|
||||
// 提交审批前逐行校验库存,防止超库存单据进入审批
|
||||
for (let i = 0; i < form.purchaseinventoryList.length; i++) {
|
||||
const line = form.purchaseinventoryList[i];
|
||||
if (!line) continue;
|
||||
const err = validateRequisitionQtyVsStock(line, i + 1);
|
||||
if (err) {
|
||||
proxy.$modal.msgWarning(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
||||
if (response.code == 200) {
|
||||
proxy.$modal.msgSuccess('提交审批成功');
|
||||
|
||||
@@ -739,25 +739,15 @@ function handleSubmitApproval() {
|
||||
let length = totalIncentoryInfoList.value.length;
|
||||
if (length < 1) {
|
||||
proxy.$modal.msgWarning('请先添加单据');
|
||||
return;
|
||||
}
|
||||
// 校验调拨数量:必须 > 0
|
||||
const invalidQtyRow = totalIncentoryInfoList.value.find(
|
||||
(row) => !row.itemQuantity || row.itemQuantity <= 0
|
||||
);
|
||||
if (invalidQtyRow) {
|
||||
proxy.$modal.msgWarning('存在调拨数量为0或无效的明细,请检查后提交');
|
||||
return;
|
||||
}
|
||||
if (data.isEdit) {
|
||||
} else if (data.isEdit) {
|
||||
proxy.$modal.msgWarning('单据未保存');
|
||||
return;
|
||||
} else {
|
||||
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
||||
proxy.$modal.msgSuccess('提交审批成功');
|
||||
tagsViewStore.delView(router.currentRoute.value);
|
||||
router.replace({ path: 'transferManagentList' });
|
||||
});
|
||||
}
|
||||
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
||||
proxy.$modal.msgSuccess('提交审批成功');
|
||||
tagsViewStore.delView(router.currentRoute.value);
|
||||
router.replace({ path: 'transferManagentList' });
|
||||
});
|
||||
}
|
||||
|
||||
// 切换仓库类型获取药房/药库列表 目的仓库切换
|
||||
@@ -917,22 +907,6 @@ function remakeBlur(row, index) {
|
||||
editBatchTransfer(index);
|
||||
}
|
||||
function handleSave() {
|
||||
// 校验调拨数量:必须 > 0
|
||||
const invalidQtyRow = totalIncentoryInfoList.value.find(
|
||||
(row) => !row.itemQuantity || row.itemQuantity <= 0
|
||||
);
|
||||
if (invalidQtyRow) {
|
||||
proxy.$modal.msgError('调拨数量必须大于0,请检查!');
|
||||
return;
|
||||
}
|
||||
// 校验调拨数量不能超过源仓库库存
|
||||
const exceedStockRow = totalIncentoryInfoList.value.find(
|
||||
(row) => row.itemQuantity > row.totalSourceQuantity
|
||||
);
|
||||
if (exceedStockRow) {
|
||||
proxy.$modal.msgError('调拨数量不可超出源库存数量,请检查!');
|
||||
return;
|
||||
}
|
||||
// 校验单价
|
||||
const invalidPriceRow = totalIncentoryInfoList.value.find(
|
||||
(row) => !row.price || row.price <= 0
|
||||
|
||||
@@ -1141,13 +1141,17 @@ const {
|
||||
const pendingAnesData = ref(null)
|
||||
|
||||
// 监听麻醉字典加载,完成后立即设置表单值
|
||||
// Bug #433: watch 回调中优先判断字典是否已加载,未加载时跳过(不处理也不清理)
|
||||
// 确保字典加载完成时 watch 仍然活跃并能处理 pendingAnesData
|
||||
let anesDataUnwatch = null
|
||||
function setupAnesDataWatch() {
|
||||
if (anesDataUnwatch) return // 防止重复设置
|
||||
anesDataUnwatch = watch(
|
||||
anesthesiaList,
|
||||
(newList) => {
|
||||
if (newList && newList.length > 0 && pendingAnesData.value) {
|
||||
// Bug #433: 字典未加载时跳过,不清理 watch,等待下次触发
|
||||
if (!newList || newList.length === 0) return
|
||||
if (pendingAnesData.value) {
|
||||
const data = pendingAnesData.value
|
||||
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
|
||||
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
|
||||
@@ -1346,7 +1350,8 @@ function handleEdit(row) {
|
||||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
Object.assign(form, data)
|
||||
// Bug #433: 如果字典已加载则立即转换,否则存入pending等待字典加载完成
|
||||
// Bug #433: 先存 pending 再调 watch 函数,确保 watch immediate 回调能看到 pendingAnesData
|
||||
// 修复时序问题:watch({ immediate: true }) 同步触发时 pendingAnesData.value 已被设置
|
||||
if (anesthesiaList.value && anesthesiaList.value.length > 0) {
|
||||
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
|
||||
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
|
||||
@@ -1356,6 +1361,8 @@ function handleEdit(row) {
|
||||
pendingAnesData.value = data
|
||||
setupAnesDataWatch()
|
||||
}
|
||||
// Bug #433: 显式赋值确保响应式更新
|
||||
if (data.externalExpertName != null) form.externalExpertName = data.externalExpertName
|
||||
} else {
|
||||
proxy.$modal.msgError('获取手术安排详情失败')
|
||||
}
|
||||
@@ -1375,7 +1382,8 @@ function handleView(row) {
|
||||
if (res.code === 200) {
|
||||
const data = res.data
|
||||
Object.assign(form, data)
|
||||
// Bug #433: 如果字典已加载则立即转换,否则存入pending等待字典加载完成
|
||||
// Bug #433: 先存 pending 再调 watch 函数,确保 watch immediate 回调能看到 pendingAnesData
|
||||
// 修复时序问题:watch({ immediate: true }) 同步触发时 pendingAnesData.value 已被设置
|
||||
if (anesthesiaList.value && anesthesiaList.value.length > 0) {
|
||||
if (data.anesMethod != null) form.anesMethod = Number(data.anesMethod)
|
||||
if (data.incisionLevel != null) form.incisionType = Number(data.incisionLevel)
|
||||
@@ -1385,6 +1393,8 @@ function handleView(row) {
|
||||
pendingAnesData.value = data
|
||||
setupAnesDataWatch()
|
||||
}
|
||||
// Bug #433: 显式赋值确保响应式更新
|
||||
if (data.externalExpertName != null) form.externalExpertName = data.externalExpertName
|
||||
} else {
|
||||
proxy.$modal.msgError('获取手术安排详情失败')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user