Fix Bug #442: 手术计费:点击"删除"待签发耗材时异常报错,导致操作失败

根因:手术计费场景中"待签发"耗材的 requestId 来自 adm_charge_item.service_id,
当 service_id 为 null 或对应的 wor_device_request 记录不存在时,
后端 removeById(null) 或 removeById(不存在ID) 会抛出异常导致删除失败。

修复策略:
- 前端(prescriptionlist.vue): handleDelete 中增加 requestId 有效性校验,
  过滤掉 requestId 为 null/undefined/空的项,避免发送无效删除请求
- 后端(DoctorStationAdviceAppServiceImpl.java): handMedication/handDevice/handService
  三个删除路径增加 requestId null check,跳过无效记录而非抛出异常

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
关羽
2026-05-13 15:16:20 +08:00
parent 3f41f897c5
commit 51dcc8eabf
3 changed files with 31 additions and 5 deletions

View File

@@ -880,19 +880,23 @@ function handleDelete() {
proxy.$modal.msgWarning('请选择要删除的项目');
return;
}
let deleteList = groupIndexList.value.map((index) => {
const item = prescriptionList.value[index];
// 只删除待签发且未收费的项目
if (item.statusEnum != 1 || item.chargeStatus == 5) {
return null;
}
// 🔧 Bug #442: 已保存的行必须有有效的 requestId否则跳过避免后端删除不存在的记录
if (item.requestId == null || item.requestId === undefined || item.requestId === '') {
return null;
}
return {
requestId: item.requestId,
dbOpType: '3',
adviceType: item.adviceType,
};
}).filter(item => item !== null); // 过滤掉已签发已收费的项目
}).filter(item => item !== null); // 过滤掉已签发已收费或无 requestId 的项目
if (deleteList.length == 0) {
proxy.$modal.msgWarning('只能删除待签发且未收费的项目');