fix(#763): 【验证失败反馈】Bug #763 上次修复未通过全链路验证,请根据以下失败原因重新修复:

失败原因:
- 数据库验证 : 数据库验证失败: 表 med_medication_request 查询失败: psql: error: connection to server at "192.168.110.252", port 15432 failed: FATAL:  database "hisdev" does not exist

总耗时: 137737ms

请针对上述失败项重新修复,确保:
1. 编译通过(vite build / mvn compile)
2. 单元测试通过(vitest / mvn test)
3. Playwright 回归测试通过
4. 数据库表可访问
5. 后端服务可达

由 AI Agent (guanyu) 自动修复,请查看 diff 确认变更内容。
This commit is contained in:
2026-06-15 15:46:22 +08:00
parent 31519033d9
commit 4b76e8078b

View File

@@ -53,7 +53,9 @@ import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
@@ -182,6 +184,9 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
// 提取requestStatus手动处理支持COMPLETED(3)和CHECK_VERIFIED(10)同时查询
Integer requestStatus = inpatientAdviceParam.getRequestStatus();
inpatientAdviceParam.setRequestStatus(null);
// 提取deadline手动处理需要做NULL-safe的end_time比较Bug #763修复
String deadline = inpatientAdviceParam.getDeadline();
inpatientAdviceParam.setDeadline(null);
// 构建查询条件
QueryWrapper<InpatientAdviceParam> queryWrapper
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
@@ -204,6 +209,18 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
= Arrays.stream(encounterIds.split(CommonConstants.Common.COMMA)).map(Long::parseLong).toList();
queryWrapper.in(CommonConstants.FieldName.EncounterId, encounterIdList);
}
// 手动拼接deadline条件end_time IS NULL OR end_time <= deadlineBug #763修复
// 住院医嘱的effective_dose_end可能为NULL签发临时医嘱时未设置结束时间
// PostgreSQL中 NULL <= anything 结果为FALSE需要先判断IS NULL
if (deadline != null && !deadline.isEmpty()) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date deadlineTime = sdf.parse(deadline);
queryWrapper.and(w -> w.isNull("end_time").or().le("end_time", deadlineTime));
} catch (java.text.ParseException e) {
// deadline解析失败忽略此条件
}
}
// 患者医嘱分页列表
Page<InpatientAdviceDto> inpatientAdvicePage
= adviceProcessAppMapper.selectInpatientAdvicePage(new Page<>(pageNo, pageSize), queryWrapper,