fix(#632): 检验申请单保存 JSON 反序列化异常 — isPackage 字段类型兼容
根因: DoctorStationLabApplyItemDto.isPackage 为 Boolean 类型, 前端可能传 String 导致 Jackson 反序列化失败 修复: - DoctorStationLabApplyItemDto: isPackage 改为 String 类型 - DoctorStationLabApplyDto: 加 @JsonIgnoreProperties(ignoreUnknown = true) - DoctorStationLabApplyServiceImpl: setIsPackage 参数适配 编译验证通过
This commit is contained in:
@@ -461,7 +461,7 @@ public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectio
|
|||||||
// feePackageId 在保存时已存储,直接使用
|
// feePackageId 在保存时已存储,直接使用
|
||||||
itemDto.setFeePackageId(item.getFeePackageId());
|
itemDto.setFeePackageId(item.getFeePackageId());
|
||||||
// 判断是否是套餐项目(根据 feePackageId 是否存在)
|
// 判断是否是套餐项目(根据 feePackageId 是否存在)
|
||||||
itemDto.setIsPackage(item.getFeePackageId() != null);
|
itemDto.setIsPackage(String.valueOf(item.getFeePackageId() != null));
|
||||||
|
|
||||||
// 从批量查询结果中获取关联信息
|
// 从批量查询结果中获取关联信息
|
||||||
if (item.getItemCode() != null && !item.getItemCode().isEmpty()) {
|
if (item.getItemCode() != null && !item.getItemCode().isEmpty()) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.healthlink.his.web.doctorstation.dto;
|
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.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -15,6 +16,7 @@ import java.math.BigDecimal;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class DoctorStationLabApplyItemDto {
|
public class DoctorStationLabApplyItemDto {
|
||||||
/**
|
/**
|
||||||
* 申请单号
|
* 申请单号
|
||||||
@@ -29,7 +31,6 @@ public class DoctorStationLabApplyItemDto {
|
|||||||
/**
|
/**
|
||||||
* 项目代码
|
* 项目代码
|
||||||
*/
|
*/
|
||||||
// @NotBlank(message = "项目代码不能为空")
|
|
||||||
@Size(max = 30, message = "项目代码长度不能超过30个字符")
|
@Size(max = 30, message = "项目代码长度不能超过30个字符")
|
||||||
private String itemCode;
|
private String itemCode;
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +47,6 @@ public class DoctorStationLabApplyItemDto {
|
|||||||
/**
|
/**
|
||||||
* 执行科室代码
|
* 执行科室代码
|
||||||
*/
|
*/
|
||||||
// @NotBlank(message = "执行科室代码不能为空")
|
|
||||||
@Size(max = 20, message = "执行科室代码长度不能超过20个字符")
|
@Size(max = 20, message = "执行科室代码长度不能超过20个字符")
|
||||||
private String performDeptCode;
|
private String performDeptCode;
|
||||||
/**
|
/**
|
||||||
@@ -74,22 +74,30 @@ public class DoctorStationLabApplyItemDto {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 活动定义ID(检验项目定义ID)
|
* 活动定义ID(检验项目定义ID)
|
||||||
* 用于回充时关联到原始检验项目定义
|
|
||||||
*/
|
*/
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long activityId;
|
private Long activityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 套餐ID(如果该项目是套餐,则关联套餐表)
|
* 套餐ID
|
||||||
* 对应 InspectionPackage.basicInformationId
|
|
||||||
*/
|
*/
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long feePackageId;
|
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;
|
private String unit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验类型ID(关联 inspection_type 大类)
|
* 检验类型ID
|
||||||
* 用于前端自动设置执行科室
|
|
||||||
*/
|
*/
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long inspectionTypeId;
|
private Long inspectionTypeId;
|
||||||
|
|||||||
Reference in New Issue
Block a user