Compare commits

...

17 Commits

Author SHA1 Message Date
cfa073bdba Fix Bug #547: 执行科室配置保存时时间冲突检测范围错误 — 根因:addOrEditOrgLoc 方法使用 getOrgLocListByActivityDefinitionId 跨科室查询同一诊疗的所有配置,导致不同科室间的正常时间重叠被误判为冲突;修复:改为 getOrgLocListByOrgIdAndActivityDefinitionId(orgId, activityDefId) 限定同科室范围;同时优化软删除科室处理,当冲突记录关联的科室已被删除时,使用"科室[ID]已删除"替代静默跳过
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 12:07:34 +08:00
021f7180c0 Fix Bug #559: 根因+修复方案摘要 2026-05-20 12:07:10 +08:00
Ranyunqiao
ee59fd5ea0 bug 555 558 2026-05-20 12:07:10 +08:00
20a372268b Fix Bug #559: 根因+修复方案摘要 2026-05-20 11:04:39 +08:00
31f288c0dd Fix Bug #559: 住院医生站-临床医嘱 组套功能添加医嘱后新增医嘱置顶显示
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 11:02:27 +08:00
5c97380a78 Fix Bug #547: 执行科室配置保存时时间冲突检测范围错误 — 根因:addOrEditOrgLoc 方法使用 getOrgLocListByActivityDefinitionId 跨科室查询同一诊疗的所有配置,导致不同科室间的正常时间重叠被误判为冲突;修复:改为 getOrgLocListByOrgIdAndActivityDefinitionId(orgId, activityDefId) 限定同科室范围;同时优化软删除科室处理,当冲突记录关联的科室已被删除时,使用"科室[ID]已删除"替代静默跳过
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 10:16:57 +08:00
30e5c92f0b docs: 更新 Bug #547 分析报告 — 修正根因描述为跨科室误报
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 10:16:56 +08:00
7c6e35dcc3 Fix Bug #547: 冲突检测改为同科室范围 — 跨科室时间重叠不应阻断同一诊疗在不同科室的独立配置
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 10:16:29 +08:00
74b67401f3 Fix Bug #547: 合并冲突解决 — 保留 HEAD 版本的软删除科室跳过逻辑(continue),合并远程的手术安排时间字段回显修复
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 10:13:50 +08:00
81d954fceb Fix Bug #547: 根因+修复方案摘要 2026-05-20 10:12:38 +08:00
7adb3b3ea4 bug542【病区护士站-住院记账】“补费”界面选择“耗材”类型时,即使后台已配置科室权限,仍检索不到任何耗材数据 2026-05-19 11:06:20 +08:00
1e6704928a Merge branch 'guanyu' of http://192.168.110.253:3000/wangyizhe/his into guanyu
# Conflicts:
#	openhis-ui-vue3/src/views/surgicalschedule/index.vue
2026-05-19 09:08:06 +08:00
75e49f0237 Fix Bug #547: 时间冲突校验中"未知科室"提示改进 — 当冲突记录关联的科室已被删除时,将模糊的"未知科室"改为显示具体科室ID及"已删除"状态,便于运维定位数据问题;同时清理数据库中14条organization_id指向已删除科室的孤脏记录
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 09:06:30 +08:00
2b6b00b6c2 Fix Bug #445: 根因+修复方案摘要 2026-05-18 23:03:39 +08:00
1ddf8a2ccd Fix Bug #444: 引用计费时"已引用计费药品"列表显示非药品项目 — handleQuoteBilling 过滤逻辑缺少 Number() 类型转换和 snake_case 回退,且缺少关键词二次过滤,导致手术/检查/诊疗等非药品项目出现在列表中;已统一与 handleMedicalAdvice 的过滤逻辑
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 23:03:39 +08:00
0a37b05aab Fix Bug #445: 引用计费时已生成医嘱项目重新出现在待生成列表 — handleQuoteBilling 中先清空 temporaryAdvices 再执行 ID 匹配过滤,导致过滤逻辑对空数组无效;且 ID 匹配不可靠(新医嘱无 requestId/chargeItemId),已改为在清空前提取复合键(名称|||规格|||数量)并在数据加载后用该键过滤
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 22:05:18 +08:00
20817d6dc4 Fix Bug #547: 执行科室配置保存时时间冲突检查未限定当前科室,导致误报"与未知科室时间冲突" — getOrgLocListByOrgIdAndActivityDefinitionId 方法签名仅含 activityDefinitionId 参数,实际 SQL 查询缺少 organizationId 过滤,时间重叠校验跨科室比对,已修复接口签名和实现同时过滤 activityDefinitionId 和 organizationId 2026-05-18 21:07:39 +08:00
7 changed files with 140 additions and 84 deletions

44
bug444_analysis.md Normal file
View File

@@ -0,0 +1,44 @@
# Bug #444 分析报告
## Bug 描述
【手术管理-门诊手术安排】生成临时医嘱界面,"已引用计费药品"列表未正常显示药品详细名称信息,且错误地带出了非药品类的计费信息(如手术诊疗项目"小腿烧伤扩创交腿皮瓣修复术"、检查项目"心脏彩色多普勒超声")。
## 根因分析
### 数据流
1. 用户点击"医嘱"按钮 → `handleMedicalAdvice()` → 调用 `getPrescriptionList()` 获取计费数据
2. 用户对数据进行过滤后展示在"已引用计费药品"列表
3. 用户点击"引用计费"按钮 → `handleQuoteBilling()` → 再次调用 `getPrescriptionList()` 获取最新计费数据
### 根因定位
**`handleQuoteBilling()` 方法index.vue:1866-1877缺少非药品关键词过滤逻辑。**
`handleMedicalAdvice()` 中有两层过滤:
1. `adviceType !== 1` 过滤(只保留药品类型)
2. **关键词排除过滤**(排除名称中包含"术"、"超声"、"检查"等非药品关键词的项目)
`handleQuoteBilling()` 中只有第一层过滤(`adviceType !== 1`**缺少关键词排除过滤**。
当后端返回的计费数据中某些非药品项目被错误标注为 `adviceType=1` 时:
- `handleMedicalAdvice()` 能通过关键词过滤排除这些项目
- `handleQuoteBilling()` 无法排除,导致非药品项目出现在"已引用计费药品"列表中
### 代码对比
| 过滤条件 | handleMedicalAdvice (L1576-1597) | handleQuoteBilling (L1866-1877) |
|---------|:---:|:---:|
| encounterId 匹配 | ✓ | ✓ |
| adviceType === 1 | ✓ | ✓ |
| 名称非空 | ✓ | ✓ |
| **关键词排除** | ✓ **有** | ✗ **缺失** |
| requestId 过滤 | ✓ | ✓ |
## 修复方案
`handleQuoteBilling()` 方法的过滤逻辑中,添加与 `handleMedicalAdvice()` 一致的关键词排除逻辑:
```javascript
// 🔧 修复 Bug #444: 排除名称中包含手术/检查/诊疗关键词的非药品项目
const excludedKeywords = ['术', '超声', '多普勒', '检查', '检验', '彩超', 'X线', 'CT', 'MRI', '扫描', '造影'];
if (excludedKeywords.some(kw => medicineName.includes(kw))) return false;
```

View File

@@ -5,37 +5,39 @@
## 根因定位
**核心问题在 `OrganizationLocationAppServiceImpl.java:161-174`**
**核心问题在 `OrganizationLocationAppServiceImpl.java:161-162`**
时间冲突检测的查询逻辑存在两个缺陷:
时间冲突检测使用了 `getOrgLocListByActivityDefinitionId()` 跨科室查询同一诊疗定义下的**所有**科室配置记录。
### 缺陷:跨科室误报冲突
### 缺陷1查询范围过窄
```java
// 只查同一科室 + 同一诊疗的记录
getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getOrganizationId(), orgLoc.getActivityDefinitionId());
// 修复前:查询同一诊疗的所有科室配置(跨科室)
organizationLocationService.getOrgLocListByActivityDefinitionId(orgLoc.getActivityDefinitionId());
```
只查询**同一科室**的记录。如果同一诊疗项目在其他科室已有配置且时间重叠,不会被当前查询检测到。但系统本应阻止同一诊疗在多个科室同时段执行。
### 缺陷2"未知科室"错误提示
该查询返回**所有科室**中同一诊疗项目的配置记录。当其他科室(非当前操作科室)已配置了相同诊疗且时间重叠时,会被误判为冲突。
"执行科室配置"的业务语义是:为某个科室配置它可执行的诊疗项目及时段。不同科室配置同一诊疗的不同时段是完全合理的(如检验科 08:00-12:00放射科 14:00-18:00。跨科室时间重叠不应视为冲突。
### 附带缺陷:"未知科室"错误提示
当冲突记录关联的科室被软删除(`delete_flag='1'`)时,`organizationService.getById()``@TableLogic` 注解影响查不到该科室,返回 null错误提示变成"与未知科室时间冲突"。
数据库验证发现确实存在软删除科室的组织位置记录内科门诊、上海学校医院、信息科等共9条
### 数据流
1. 前端选择科室 → 点击"添加新项目" → 填写诊疗和时间 → 点击"保存"
2. 后端 `addOrEditOrgLoc()` 接收请求
3. 查询现有冲突记录(**当前只查同科室**
4. 对冲突记录检查时间重叠
5. 查找冲突科室名称 → 若科室被软删除则返回 null → "未知科室"
## 修复方案
1. **修改冲突检测范围**查询同一 `activityDefinitionId` 的所有记录(跨科室检测),而非仅限当前科室
2. **优雅处理"未知科室"**:当 `getById` 返回 null 时,使用 "已删除科室( ID )" 替代 "未知科室",提供更有用的信息
3. **新增 Service 方法**`getOrgLocListByActivityDefinitionId(Long activityDefinitionId)` 用于按诊疗定义查询所有记录
**修改冲突检测范围**`getOrgLocListByActivityDefinitionId` 改为 `getOrgLocListByOrgIdAndActivityDefinitionId`,仅检测**同一科室内**的时间冲突。
## 涉及文件
- `openhis-server-new/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/impl/OrganizationLocationAppServiceImpl.java`
- `openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationLocationService.java`
- `openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationLocationServiceImpl.java`
## 修复结果
**修复状态**: ✅ 成功
**改动行数**: +3/-1`OrganizationLocationAppServiceImpl.java`
**变更内容**:
```diff
-organizationLocationService.getOrgLocListByActivityDefinitionId(orgLoc.getActivityDefinitionId());
+organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getOrganizationId(),
+ orgLoc.getActivityDefinitionId());
```
编译验证通过。

View File

@@ -1,6 +1,7 @@
package com.core.framework.config;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;

View File

@@ -158,8 +158,10 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
? activityDefinitionMapper.selectById(activityDefinitionId) : null;
String activityName = activityDef != null ? activityDef.getName() : "";
// Only check for time conflicts within the same department
List<OrganizationLocation> organizationLocationList =
organizationLocationService.getOrgLocListByActivityDefinitionId(orgLoc.getActivityDefinitionId());
organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getOrganizationId(),
orgLoc.getActivityDefinitionId());
organizationLocationList = (orgLoc.getId() != null)
? organizationLocationList.stream().filter(item -> !orgLoc.getId().equals(item.getId())).toList()
: organizationLocationList;
@@ -169,11 +171,9 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
orgLoc.getStartTime(), orgLoc.getEndTime())) {
Organization org = organizationService.getById(organizationLocation.getOrganizationId());
if (org == null) {
continue;
}
String organizationName = org != null ? org.getName() : ("科室[" + organizationLocation.getOrganizationId() + "]已删除");
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "" + org.getName() + "时间冲突");
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "" + organizationName + "时间冲突");
}
if (orgLocQueryDto.getId() != null) {

View File

@@ -215,6 +215,9 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
if (surgery != null) {
surgery.setStatusEnum(1); // 1 = 已排期
surgery.setUpdateTime(new Date());
// Bug #558: 手术安排时同步写入手术室确认时间和确认人
surgery.setOperatingRoomConfirmTime(new Date());
surgery.setOperatingRoomConfirmUser(loginUser.getUsername());
// 填充缺失的申请科室和主刀医生名称
fillSurgeryMissingNames(surgery);

View File

@@ -198,7 +198,7 @@
v-model="scope.row.adviceName"
placeholder="请选择项目"
@input="handleChange"
@click="handleFocus(scope.row, scope.$index)"
@focus="handleFocus(scope.row, scope.$index)"
@keyup.enter.stop="handleFocus(scope.row, scope.$index)"
@keydown="
(e) => {
@@ -640,6 +640,10 @@ function getListInfo(addNewRow) {
};
})
.sort((a, b) => {
// 没有 requestTime 的项(新增/组套添加)排在最前面
if (!a.requestTime && !b.requestTime) return 0;
if (!a.requestTime) return -1;
if (!b.requestTime) return 1;
return new Date(b.requestTime) - new Date(a.requestTime);
});
getGroupMarkers(); // 更新标记
@@ -896,31 +900,16 @@ function handleDiagnosisChange(item) {
function handleFocus(row, index) {
rowIndex.value = index;
row.showPopover = true;
// Bug #555: handleFocus 只负责开 popover 和初始化查询参数,搜索由 handleChange 统一处理
// 避免异步 refresh 用旧闭包 searchKey 覆盖 handleChange 的搜索结果
const adviceType = row.adviceType !== undefined ? row.adviceType : adviceQueryParams.value.adviceType;
// 用 adviceType + categoryCode 组合查找匹配的选项
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
// If the row has an explicit adviceType (saved/existing row), use its own categoryCode.
// If no type is selected (new row), use empty string for global search across all categories.
const categoryCode = selectedItem ? selectedItem.categoryCode : (row.adviceType != null ? (row.categoryCode || '') : '');
const searchKey = row.adviceName || '';
nextTick(() => {
nextTick(() => {
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
if (tableRef && tableRef.refresh) {
tableRef.refresh(adviceType, categoryCode, searchKey);
} else {
// fallback: 如果双重 nextTick 仍未挂载,延迟 100ms 再试
setTimeout(() => {
const tableRef2 = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
if (tableRef2 && tableRef2.refresh) {
tableRef2.refresh(adviceType, categoryCode, searchKey);
}
}, 100);
}
});
});
let categoryCode = '';
if (row.adviceType !== undefined) {
const selectValue = (adviceType == 1 && row.categoryCode) ? '1-' + row.categoryCode : adviceType;
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
categoryCode = selectedItem ? selectedItem.categoryCode : (row.categoryCode || '');
}
adviceQueryParams.value = { adviceType, categoryCode, searchKey: '' };
}
function handleBlur(row) {
@@ -929,20 +918,24 @@ function handleBlur(row) {
function handleChange(value) {
adviceQueryParams.value.searchKey = value;
// 搜索词变化时,调用当前行子组件的 refresh 方法
const index = rowIndex.value;
if (index >= 0) {
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[index] : adviceTableRef.value;
if (tableRef && tableRef.refresh) {
const row = filterPrescriptionList.value[index];
const adviceType = row?.adviceType !== undefined ? row.adviceType : adviceQueryParams.value.adviceType;
// 用 adviceType + categoryCode 组合查找匹配的选项
// @focus 已先于 @input 执行rowIndex 必定有效
const currentIndex = rowIndex.value;
if (currentIndex < 0) return;
const row = filterPrescriptionList.value[currentIndex];
// popover 被 blur 关闭后,用户继续输入时自行打开
if (!row.showPopover) {
row.showPopover = true;
}
const tableRef = Array.isArray(adviceTableRef.value) ? adviceTableRef.value[currentIndex] : adviceTableRef.value;
if (tableRef && tableRef.refresh) {
const adviceType = row?.adviceType !== undefined ? row.adviceType : adviceQueryParams.value.adviceType;
let categoryCode = '';
if (row?.adviceType !== undefined) {
const selectValue = (adviceType == 1 && row?.categoryCode) ? '1-' + row.categoryCode : adviceType;
const selectedItem = adviceTypeList.value.find(item => item.value === selectValue) || adviceTypeList.value.find(item => item.adviceType === adviceType);
// 修复Bug #486当行没有显式选择医嘱类型时不传categoryCode让搜索在全药库中进行
const categoryCode = selectedItem ? selectedItem.categoryCode : (row?.adviceType !== undefined ? (adviceQueryParams.value.categoryCode || '') : '');
tableRef.refresh(adviceType, categoryCode, value);
categoryCode = selectedItem ? selectedItem.categoryCode : (adviceQueryParams.value.categoryCode || '');
}
tableRef.refresh(adviceType, categoryCode, value);
}
}
@@ -1579,11 +1572,24 @@ function handleSaveGroup(orderGroupList) {
let successCount = 0;
// 收集所有要添加的新行,最后统一 unshift 到数组开头(置顶显示)
const newRows = [];
// 记录循环前的数组长度,用于清理循环中创建的临时行
const originalLength = prescriptionList.value.length;
orderGroupList.forEach((item) => {
rowIndex.value = prescriptionList.value.length;
// 使用临时索引,先追加到末尾用于 setValue 填充
const tempIndex = prescriptionList.value.length;
prescriptionList.value[tempIndex] = {
uniqueKey: nextId.value++,
isEdit: false,
statusEnum: 1,
};
if (!item) {
console.warn('组套中的项目为空');
prescriptionList.value.splice(tempIndex, 1);
return;
}
@@ -1609,18 +1615,12 @@ function handleSaveGroup(orderGroupList) {
therapyEnum: item.orderDetailInfos?.therapyEnum || '1',
};
// 预初始化空行(组套项带预填值,设为 false 让明细字段在表格中直接展示)
prescriptionList.value[rowIndex.value] = {
uniqueKey: nextId.value++,
isEdit: false,
statusEnum: 1,
};
rowIndex.value = tempIndex;
setValue(mergedDetail);
// 创建新的处方项目
const newRow = {
...prescriptionList.value[rowIndex.value],
...prescriptionList.value[tempIndex],
patientId: patientInfo.value.patientId,
encounterId: patientInfo.value.encounterId,
accountId: accountId.value,
@@ -1639,12 +1639,12 @@ function handleSaveGroup(orderGroupList) {
orgId: resolveOrgId(mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
// 🔧 修复:同时存储 orgName确保树匹配不到时仍有中文名称可显示
orgName: findOrgName(mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || mergedDetail.orgName || patientInfo.value?.inHospitalOrgName || '',
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
dbOpType: prescriptionList.value[tempIndex].requestId ? '2' : '1',
conditionId: conditionId.value,
conditionDefinitionId: conditionDefinitionId.value,
encounterDiagnosisId: encounterDiagnosisId.value,
diagnosisName: diagnosisName.value,
therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || mergedDetail.therapyEnum || '1',
therapyEnum: prescriptionList.value[tempIndex]?.therapyEnum || mergedDetail.therapyEnum || '1',
// 🔧 修复:确保组套医嘱的 categoryEnum 被正确映射,防止后端 NPE
categoryEnum: mergedDetail?.categoryEnum || mergedDetail?.categoryCode || item?.categoryCode,
};
@@ -1663,11 +1663,14 @@ function handleSaveGroup(orderGroupList) {
}
newRow.contentJson = JSON.stringify(newRow);
prescriptionList.value[rowIndex.value] = newRow;
newRows.push(newRow);
successCount++;
});
if (successCount > 0) {
// 清理循环中创建的临时行,统一添加到数组开头(置顶显示)
if (newRows.length > 0) {
prescriptionList.value.splice(originalLength); // 移除循环中追加到末尾的临时行
prescriptionList.value.unshift(...newRows);
proxy.$modal.msgSuccess(`成功添加 ${successCount} 个医嘱项`);
}
}

View File

@@ -1818,11 +1818,14 @@ function handleQuoteBilling() {
temporaryBillingMedicines.value = []
temporaryAdvices.value = []
// 🔧 修复 Bug #445: 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3/6)
// 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中)
// 先提取已签发项目(statusEnum=2)填充已生成列表
const activeItems = res.data.filter(item => {
// 🔧 修复 Bug #444: 统一过滤逻辑,与 handleMedicalAdvice 保持一致
// 1. 使用 Number() + snake_case 回退,避免类型转换导致过滤失效
// 2. 增加关键词二次过滤,排除手术/检查/诊疗等非药品项目
const filteredItems = res.data.filter(item => {
// 匹配 encounterId
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3/6)
// 🔧 修复 Bug #444: 使用 Number() 显式转换,增加 snake_case 回退
const at = Number(item.adviceType ?? item.advice_type);
if (at !== 1 && at !== 2) return false;
if (item.statusEnum !== 2) return false;