Fix Bug #443: 手术计费:点击"签发"耗材时异常报错

**根因分析**:
前端 handleSave 签发时,仅从 contentJson 解析数据后发送,缺少 encounterId、patientId、locationId 等关键字段。这些字段在 API 响应顶层(不在 contentJson 中),导致后端签发时字段为空。

**修复方案**:
- 前端:在 handleSave 的 saveList 映射中补充 encounterId、patientId、locationId(对应 positionId)、adviceType 等顶层关键字段
- 后端:handDevice 中 locationId 为空时,优先查询已有 DeviceRequest 的 performLocation 作为回退,避免覆盖为默认科室
This commit is contained in:
关羽
2026-05-14 00:10:53 +08:00
committed by 荀彧
parent 1525740ab5
commit 55eba1a0b1
2 changed files with 22 additions and 3 deletions

View File

@@ -1539,11 +1539,22 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生
deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
// 发放耗材房若前端未传locationId使用登录用户科室作为默认值
// 发放耗材房若前端未传locationId优先沿用已有DeviceRequest的performLocation否则使用登录用户科室)
Long locId = adviceSaveDto.getLocationId();
if (locId == null) {
locId = SecurityUtils.getLoginUser().getOrgId();
log.info("耗材locationId为空使用登录用户科室作为默认值: locationId={}", locId);
// 尝试从已有DeviceRequest获取原始的performLocation
if (adviceSaveDto.getRequestId() != null) {
DeviceRequest existingDevice = iDeviceRequestService.getById(adviceSaveDto.getRequestId());
if (existingDevice != null && existingDevice.getPerformLocation() != null) {
locId = existingDevice.getPerformLocation();
log.info("耗材locationId为空使用已有DeviceRequest的performLocation: locationId={}", locId);
}
}
// 如果已有记录也没有performLocation则使用登录用户科室作为兜底
if (locId == null) {
locId = SecurityUtils.getLoginUser().getOrgId();
log.info("耗材locationId为空且无已有记录使用登录用户科室作为默认值: locationId={}", locId);
}
}
deviceRequest.setPerformLocation(locId);
deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id

View File

@@ -1036,6 +1036,14 @@ function handleSave() {
requestId: item.requestId,
dbOpType: '1',
groupId: item.groupId,
// 🔧 Bug #443: 补充顶层关键字段(这些不在 contentJson 中,需从 API 响应顶层提取)
encounterId: item.encounterId,
patientId: item.patientId,
locationId: item.positionId,
adviceType: item.adviceType,
adviceTableName: item.adviceTableName,
adviceDefinitionId: item.adviceDefinitionId,
chargeItemId: item.chargeItemId,
};
});
savePrescriptionSign({