Compare commits

...

10 Commits

Author SHA1 Message Date
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
798c5e19e2 Fix Bug #548: 发往科室字段未能正确回显 — 编辑初始化时 transferValue 变化触发 projectWithDepartment 清空 form.targetDepartment,已加 isInitializing 标志拦截
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 09:00:15 +08:00
fa18e94cd9 Fix Bug #444: 引用计费时"已引用计费药品"列表混入非药品项目 — handleQuoteBilling 过滤逻辑仅用 item.adviceType !== 1 严格相等判断且缺少二次关键词过滤,导致后端错误标注 adviceType=1 的手术/检查项目被放行;已对齐 handleMedicalAdvice 的双重过滤策略(Number() 类型转换 + snake_case 回退 + 关键词排除)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:05:23 +08:00
69bb887d19 Fix Bug #547: 根因+修复方案摘要 2026-05-19 00:04:04 +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
b89f41048b Fix Bug #445: 引用计费时已生成医嘱项目重新出现在待生成列表 — handleQuoteBilling 中先清空 temporaryAdvices 再执行 ID 匹配过滤,导致过滤逻辑对空数组无效;且 ID 匹配不可靠(新医嘱无 requestId/chargeItemId),已改为在清空前提取复合键(名称|||规格|||数量)并在数据加载后用该键过滤
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 22:05:38 +08:00
e13e328627 Fix Bug #547: 执行科室配置保存时时间冲突检查未限定当前科室,导致误报"与未知科室时间冲突" — getOrgLocListByOrgIdAndActivityDefinitionId 方法签名仅含 activityDefinitionId 参数,实际 SQL 查询缺少 organizationId 过滤,时间重叠校验跨科室比对,已修复接口签名和实现同时过滤 activityDefinitionId 和 organizationId 2026-05-18 21:08:14 +08:00
5 changed files with 140 additions and 27 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

@@ -169,7 +169,7 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(), if (DateTimeUtils.isOverlap(organizationLocation.getStartTime(), organizationLocation.getEndTime(),
orgLoc.getStartTime(), orgLoc.getEndTime())) { orgLoc.getStartTime(), orgLoc.getEndTime())) {
Organization org = organizationService.getById(organizationLocation.getOrganizationId()); Organization org = organizationService.getById(organizationLocation.getOrganizationId());
String organizationName = org != null ? org.getName() : "未知科室"; String organizationName = org != null ? org.getName() : ("科室[" + organizationLocation.getOrganizationId() + "]已删除");
return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime() return R.fail("当前诊疗:" + activityName + CommonConstants.Common.DASH + orgLoc.getStartTime()
+ CommonConstants.Common.DASH + orgLoc.getEndTime() + "" + organizationName + "时间冲突"); + CommonConstants.Common.DASH + orgLoc.getEndTime() + "" + organizationName + "时间冲突");
} }

View File

@@ -244,6 +244,8 @@ const getList = async () => {
const handleSearch = () => { const handleSearch = () => {
// 搜索时保持已选中的项目不受影响 // 搜索时保持已选中的项目不受影响
}; };
// 编辑初始化标志:避免 applyEditTransferSelection 设置 transferValue 时触发 projectWithDepartment 覆盖 descJson 中的科室值
const isInitializing = ref(false);
const transferValue = ref([]); const transferValue = ref([]);
const form = reactive({ const form = reactive({
// categoryType: '', // 项目类别 // categoryType: '', // 项目类别
@@ -341,6 +343,7 @@ const projectWithDepartment = (selectProjectIds, type) => {
watch( watch(
() => transferValue.value, () => transferValue.value,
(newValue) => { (newValue) => {
if (isInitializing.value) return;
projectWithDepartment(newValue, 1); projectWithDepartment(newValue, 1);
} }
); );
@@ -377,7 +380,10 @@ const applyEditTransferSelection = () => {
} }
} }
const uniq = [...new Set(selectedIds)] const uniq = [...new Set(selectedIds)]
// 设置初始化标志,防止 transferValue 变化触发 projectWithDepartment 覆盖 descJson 中的科室值
isInitializing.value = true
transferValue.value = uniq transferValue.value = uniq
isInitializing.value = false
if (newData.requestFormDetailList.length && uniq.length === 0) { if (newData.requestFormDetailList.length && uniq.length === 0) {
console.warn( console.warn(
'[LaboratoryTests] 申请单明细未能在项目字典中匹配到项,请核对 activityId / 项目名称', '[LaboratoryTests] 申请单明细未能在项目字典中匹配到项,请核对 activityId / 项目名称',
@@ -427,7 +433,9 @@ watch(
selectedIds.push(matched.adviceDefinitionId); selectedIds.push(matched.adviceDefinitionId);
} }
}); });
isInitializing.value = true;
transferValue.value = selectedIds; transferValue.value = selectedIds;
isInitializing.value = false;
} }
); );

View File

@@ -348,7 +348,8 @@ const adviceTypeList = computed(() => {
return val === 3 || val === 4; return val === 3 || val === 4;
}).map(item => ({ }).map(item => ({
label: item.label, label: item.label,
value: parseInt(item.value) // drord_doctor_type 中耗材是 4但 /advice-base-info 后端耗材类型是 2
value: parseInt(item.value) === 4 ? 2 : parseInt(item.value)
})); }));
return [...filtered, { label: '全部', value: '' }]; return [...filtered, { label: '全部', value: '' }];
} }
@@ -483,8 +484,9 @@ watch(
(visible) => { (visible) => {
if (visible) { if (visible) {
executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss'); executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss');
// 弹窗打开时重新加载科室和位置选项,确保数据最新 // 弹窗打开时按当前患者科室重新加载,避免复用上一次患者/登录科室的结果
loadDepartmentOptions(); loadDepartmentOptions();
getAdviceBaseInfos();
getDiseaseInitLoc(16); getDiseaseInitLoc(16);
} else { } else {
resetData(); resetData();
@@ -565,6 +567,8 @@ function getAdviceBaseInfos() {
queryParams.value.adviceTypes = [1, 2, 3]; queryParams.value.adviceTypes = [1, 2, 3];
} }
queryParams.value.organizationId = orgId.value; queryParams.value.organizationId = orgId.value;
queryParams.value.adviceTypes = normalizeAdviceTypesForQuery(adviceType.value);
queryParams.value.organizationId = props.patientInfo.organizationId || orgId.value;
queryParams.value.pricingFlag = 1; // 划价标记 queryParams.value.pricingFlag = 1; // 划价标记
getAdviceBaseInfo(queryParams.value) getAdviceBaseInfo(queryParams.value)
.then((res) => { .then((res) => {
@@ -620,6 +624,12 @@ function getItemType_Text(type) {
const map = { 2: '耗材', 3: '诊疗' }; const map = { 2: '耗材', 3: '诊疗' };
return map[type] || '其他'; return map[type] || '其他';
} }
function normalizeAdviceTypesForQuery(type) {
if (type === '' || type === undefined || type === null) {
return '2,3';
}
return Number(type) === 4 ? 2 : type;
}
function getUnitCodeOptions(row) { function getUnitCodeOptions(row) {
const unitCodes = []; const unitCodes = [];
// 大单位:优先用 codecode 缺失时用字典文本兜底 // 大单位:优先用 codecode 缺失时用字典文本兜底

View File

@@ -1854,6 +1854,21 @@ function handleTemporaryMedicalRefresh() {
function handleQuoteBilling() { function handleQuoteBilling() {
// 重新拉取计费药品数据 // 重新拉取计费药品数据
if (temporaryPatientInfo.value.visitId) { if (temporaryPatientInfo.value.visitId) {
// 🔧 修复 Bug #445: 在清空之前提取已提交项目的复合匹配键
// 原因:后续的 ID 匹配过滤依赖 temporaryAdvices但 temporaryAdvices 会被先清空
// 新医嘱没有 requestId/chargeItemId需用名称+规格+数量的复合键匹配
const submittedKeys = new Set(
(temporaryAdvices.value || [])
.map(a => {
const om = a.originalMedicine || {}
const name = om.medicineName || om.adviceName || a.adviceName || ''
const spec = om.specification || om.volume || ''
const qty = om.quantity ?? 0
return `${name}|||${spec}|||${qty}`
})
.filter(k => k !== '|||0')
)
temporaryMedicalLoading.value = true // 🔧 新增:开始加载 temporaryMedicalLoading.value = true // 🔧 新增:开始加载
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => { getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => {
if (res.code === 200 && res.data) { if (res.code === 200 && res.data) {
@@ -1861,16 +1876,22 @@ function handleQuoteBilling() {
temporaryBillingMedicines.value = [] temporaryBillingMedicines.value = []
temporaryAdvices.value = [] temporaryAdvices.value = []
// 🔧 修复 Bug #445: 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3) // 🔧 修复 Bug #444: 统一过滤逻辑,与 handleMedicalAdvice 保持一致
// 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中) // 1. 使用 Number() + snake_case 回退,避免类型转换导致过滤失效
// 2. 增加关键词二次过滤,排除手术/检查/诊疗等非药品项目
const filteredItems = res.data.filter(item => { const filteredItems = res.data.filter(item => {
// 匹配 encounterId // 匹配 encounterId
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false; if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
// 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3) // 只保留药品类型adviceType=1过滤掉耗材(2)和诊疗项目(3/6)
if (item.adviceType !== 1) return false; // 🔧 修复 Bug #444: 使用 Number() 显式转换,增加 snake_case 回退
const at = Number(item.adviceType ?? item.advice_type);
if (at !== 1) return false;
// 过滤掉名称为空的项目 // 过滤掉名称为空的项目
const medicineName = item.adviceName || item.advice_name; const medicineName = item.adviceName || item.advice_name;
if (!medicineName || medicineName.trim() === '') return false; if (!medicineName || medicineName.trim() === '') return false;
// 🔧 修复 Bug #444: 二次过滤,排除名称中包含手术/检查/诊疗关键词的非药品项目
const excludedKeywords = ['术', '超声', '多普勒', '检查', '检验', '彩超', 'X线', 'CT', 'MRI', '扫描', '造影'];
if (excludedKeywords.some(kw => medicineName.includes(kw))) return false;
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId // 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId
if (item.requestId) return false; if (item.requestId) return false;
return true; return true;
@@ -1987,27 +2008,57 @@ function handleQuoteBilling() {
}) })
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表 // 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目,避免"引用计费"后已提交项目重新出现在"待生成"列表
// 原因:后端返回的计费数据中,已生成医嘱的项目可能没有 requestId 字段 // 使用清空前提取的 submittedKeys名称|||规格|||数量复合键)进行匹配
// 方案:用 chargeItemId/requestId/id 与已有的 temporaryAdvices 做匹配,排除已生成项目 if (submittedKeys.size > 0) {
if (temporaryAdvices.value.length > 0) { temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
const existingAdviceIds = new Set() const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity ?? 0}`
temporaryAdvices.value.forEach(a => { return !submittedKeys.has(key)
const om = a.originalMedicine || {} })
if (om.requestId) existingAdviceIds.add(String(om.requestId)) // 同步更新 temporaryAdvices保持两份数据一致
if (om.chargeItemId) existingAdviceIds.add(String(om.chargeItemId)) temporaryAdvices.value = temporaryBillingMedicines.value.map((medicine, index) => {
if (om.id) existingAdviceIds.add(String(om.id)) const specMatch = medicine.specification ? medicine.specification.match(/(\d+)(\D+)/) : null
const specValue = specMatch ? parseInt(specMatch[1]) : 1
const specUnit = specMatch ? specMatch[2] : 'ml'
const dosage = specValue * (medicine.quantity || 1)
let usageCode = 'iv'
let usageLabel = '静脉注射'
try {
const jsonContent = medicine.contentJson || medicine.content_json;
if (jsonContent) {
const contentData = JSON.parse(jsonContent);
if (contentData.methodCode) {
usageCode = contentData.methodCode;
usageLabel = getUsageLabel(contentData.methodCode);
}
}
} catch (e) {}
if (!usageCode || usageCode === 'iv') {
if (medicine.medicineName && medicine.medicineName.includes('注射液')) {
usageCode = 'iv'; usageLabel = '静脉注射';
} else if (medicine.medicineName && medicine.medicineName.includes('片')) {
usageCode = 'po'; usageLabel = '口服';
} else if (medicine.medicineName && medicine.medicineName.includes('胶囊')) {
usageCode = 'po'; usageLabel = '口服';
}
}
return {
id: index + 1,
adviceName: medicine.medicineName || '',
dosage,
unit: specUnit,
usage: usageCode,
usageLabel,
frequency: '临时',
executeTime: new Date().toLocaleString('zh-CN'),
originalMedicine: {
...medicine,
medicineName: medicine.medicineName,
specification: medicine.specification,
quantity: medicine.quantity,
encounterId: temporaryPatientInfo.value.visitId
}
}
}) })
if (existingAdviceIds.size > 0) {
temporaryBillingMedicines.value = temporaryBillingMedicines.value.filter(m => {
const mRequestId = m.requestId != null ? String(m.requestId) : null
const mChargeItemId = m.chargeItemId != null ? String(m.chargeItemId) : null
const mId = m.id != null ? String(m.id) : null
if (mRequestId && existingAdviceIds.has(mRequestId)) return false
if (mChargeItemId && existingAdviceIds.has(mChargeItemId)) return false
if (mId && existingAdviceIds.has(mId)) return false
return true
})
}
} }
temporaryMedicalLoading.value = false // 🔧 新增:加载完成 temporaryMedicalLoading.value = false // 🔧 新增:加载完成