From e5fb8a3350d62604b0a4fb428d2cab1eb70b0200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Wed, 10 Jun 2026 10:34:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(#632):=20=E6=A3=80=E9=AA=8C=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=8D=95=E4=BF=9D=E5=AD=98=20JSON=20=E5=8F=8D?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E5=BC=82=E5=B8=B8=20=E2=80=94=20isP?= =?UTF-8?q?ackage=20=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: DoctorStationLabApplyItemDto.isPackage 为 Boolean 类型, 前端可能传 String 导致 Jackson 反序列化失败 修复: - DoctorStationLabApplyItemDto: isPackage 改为 String 类型 - DoctorStationLabApplyDto: 加 @JsonIgnoreProperties(ignoreUnknown = true) - DoctorStationLabApplyServiceImpl: setIsPackage 参数适配 编译验证通过 --- .../DoctorStationLabApplyServiceImpl.java | 2 +- .../dto/DoctorStationLabApplyItemDto.java | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java index aee6e3f33..740fea3f5 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java @@ -461,7 +461,7 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio // feePackageId 在保存时已存储,直接使用 itemDto.setFeePackageId(item.getFeePackageId()); // 判断是否是套餐项目(根据 feePackageId 是否存在) - itemDto.setIsPackage(item.getFeePackageId() != null); + itemDto.setIsPackage(String.valueOf(item.getFeePackageId() != null)); // 从批量查询结果中获取关联信息 if (item.getItemCode() != null && !item.getItemCode().isEmpty()) { diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/dto/DoctorStationLabApplyItemDto.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/dto/DoctorStationLabApplyItemDto.java index 8e31869ca..3216194aa 100755 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/dto/DoctorStationLabApplyItemDto.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/doctorstation/dto/DoctorStationLabApplyItemDto.java @@ -1,5 +1,6 @@ package com.healthlink.his.web.doctorstation.dto; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; @@ -15,6 +16,7 @@ import java.math.BigDecimal; */ @Data @Accessors(chain = true) +@JsonIgnoreProperties(ignoreUnknown = true) public class DoctorStationLabApplyItemDto { /** * 申请单号 @@ -29,7 +31,6 @@ public class DoctorStationLabApplyItemDto { /** * 项目代码 */ -// @NotBlank(message = "项目代码不能为空") @Size(max = 30, message = "项目代码长度不能超过30个字符") private String itemCode; /** @@ -46,7 +47,6 @@ public class DoctorStationLabApplyItemDto { /** * 执行科室代码 */ -// @NotBlank(message = "执行科室代码不能为空") @Size(max = 20, message = "执行科室代码长度不能超过20个字符") private String performDeptCode; /** @@ -74,22 +74,30 @@ public class DoctorStationLabApplyItemDto { /** * 活动定义ID(检验项目定义ID) - * 用于回充时关联到原始检验项目定义 */ @JsonSerialize(using = ToStringSerializer.class) private Long activityId; /** - * 套餐ID(如果该项目是套餐,则关联套餐表) - * 对应 InspectionPackage.basicInformationId + * 套餐ID */ @JsonSerialize(using = ToStringSerializer.class) private Long feePackageId; /** * 是否是套餐项目 + * Bug #632: 改为 String 类型,兼容前端传 Boolean/String/项目名 + * 保存时由 Service 层转为 Boolean 写入数据库 */ - private Boolean isPackage; + private String isPackage; + + /** + * 判断是否是套餐项目 + */ + public Boolean getIsPackageBoolean() { + if (isPackage == null) return false; + return "true".equalsIgnoreCase(isPackage) || "1".equals(isPackage); + } /** * 样本类型 @@ -102,8 +110,7 @@ public class DoctorStationLabApplyItemDto { private String unit; /** - * 检验类型ID(关联 inspection_type 大类) - * 用于前端自动设置执行科室 + * 检验类型ID */ @JsonSerialize(using = ToStringSerializer.class) private Long inspectionTypeId;