20250319 更新
1.补充检验数据扩展信息 2.对实验中用到的试剂耗材进行重构,并关联毒品清单
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package digital.laboratory.platform.inspection.convert;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordReagent;
|
||||
import digital.laboratory.platform.inspection.vo.TestRecordReagentVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @version 1.0
|
||||
* @description: 实验中用到的试剂耗材 的转换类
|
||||
* @date 2025/3/20 14:59
|
||||
*/
|
||||
public class TestRecordReagentConvert {
|
||||
|
||||
/**
|
||||
* 实体类转vo类
|
||||
*/
|
||||
public static TestRecordReagentVO entityToVOPage(TestRecordReagent entity) {
|
||||
if (entity == null) return null;
|
||||
TestRecordReagentVO testRecordReagentVO = new TestRecordReagentVO();
|
||||
testRecordReagentVO.setId(entity.getId());
|
||||
testRecordReagentVO.setDrugId(entity.getDrugId());
|
||||
testRecordReagentVO.setReagentConsumableName(entity.getReagentConsumableName());
|
||||
testRecordReagentVO.setCategory(entity.getCategory());
|
||||
testRecordReagentVO.setSpecifications(entity.getSpecifications());
|
||||
testRecordReagentVO.setPurityGrade(entity.getPurityGrade());
|
||||
testRecordReagentVO.setNumber(entity.getNumber());
|
||||
testRecordReagentVO.setSortIndex(entity.getSortIndex());
|
||||
testRecordReagentVO.setSource(entity.getSource());
|
||||
return testRecordReagentVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体分页对象转 VO 分页对象
|
||||
*/
|
||||
public static IPage<TestRecordReagentVO> entityToVOPage(IPage<TestRecordReagent> entityPage) {
|
||||
// 创建 VO 的分页对象
|
||||
IPage<TestRecordReagentVO> voPage = new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal());
|
||||
|
||||
// 将实体列表转换为 VO 列表
|
||||
List<TestRecordReagentVO> voList = entityPage.getRecords().stream()
|
||||
.map(TestRecordReagentConvert::entityToVOPage)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 设置转换后的记录
|
||||
voPage.setRecords(voList);
|
||||
return voPage;
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,23 @@ import lombok.Data;
|
||||
@TableName("b_test_record_reagent_consumables")
|
||||
@ApiModel(value = "实验中用到的试剂耗材", description = "实验中用到的试剂耗材")
|
||||
public class TestRecordReagent extends BaseEntity {
|
||||
|
||||
private String id;
|
||||
|
||||
private String drugId; // 标准品的成分,关联的时是毒品清单中的毒品id
|
||||
|
||||
private String reagentConsumableName;//试剂耗材标准物质名称
|
||||
|
||||
private String category;// 类别,表示是 试剂 还是 耗材 ,还是标准物质
|
||||
|
||||
private String specifications; //型号规格
|
||||
|
||||
private String purityGrade;//纯度等级,只有试剂有这个属性,当为耗材时为空
|
||||
|
||||
private String number;//标准物质的编号,只有类型是标准物质的时候才设置
|
||||
|
||||
private Integer sortIndex;// 排序
|
||||
|
||||
private Integer source;//数据来源
|
||||
|
||||
}
|
||||
|
||||
@@ -50,4 +50,9 @@ public class TestRecordSampleDataExpand extends BaseEntity {
|
||||
*/
|
||||
private String ionAbundanceRatioWithinError;
|
||||
|
||||
/**
|
||||
* 碎片保留时间,目前该字段仅对nps实验有用,求具体样本保留时间 = 碎片保留时间的平均值
|
||||
*/
|
||||
private BigDecimal fragmentRetTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @Entity generator.entity.TestRecordSampledataExpand
|
||||
*/
|
||||
@Mapper
|
||||
public interface TestRecordSampledataExpandMapper extends BaseMapper<TestRecordSampleDataExpand> {
|
||||
public interface TestRecordSampleDataExpandMapper extends BaseMapper<TestRecordSampleDataExpand> {
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lcsoft.dlp.common.aop.annotation.DlpResultProc;
|
||||
import digital.laboratory.platform.inspection.convert.TestRecordReagentConvert;
|
||||
import digital.laboratory.platform.inspection.dto.TestRecordArgumentDto;
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordReagent;
|
||||
import digital.laboratory.platform.inspection.constant.TestRecordArgumentType;
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordSampleData;
|
||||
import digital.laboratory.platform.inspection.mapper.TestRecordMapper;
|
||||
import digital.laboratory.platform.inspection.mapper.TestRecordReagentMapper;
|
||||
import digital.laboratory.platform.inspection.mapper.TestTemplateMapper;
|
||||
@@ -17,6 +18,7 @@ import digital.laboratory.platform.inspection.service.TestRecordReagentService;
|
||||
import digital.laboratory.platform.inspection.service.TestRecordSampleDataService;
|
||||
import digital.laboratory.platform.inspection.service.TestRecordService;
|
||||
import digital.laboratory.platform.inspection.service.TestTemplateService;
|
||||
import digital.laboratory.platform.inspection.vo.TestRecordReagentVO;
|
||||
import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
|
||||
import digital.laboratory.platform.inspection.vo.TestTemplateVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -122,45 +124,16 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
*/
|
||||
@Override
|
||||
public IPage getTestRecordReagentPageList(Page page, String testId, String keywords, String category, Integer opCode) {
|
||||
ArrayList<String> categoryList = new ArrayList<>();
|
||||
if (category.equals("试剂耗材")) {
|
||||
categoryList.add("试剂");
|
||||
categoryList.add("耗材");
|
||||
} else {
|
||||
categoryList.add("标准物质");
|
||||
categoryList.add("标准储备溶液");
|
||||
}
|
||||
List<String> categoryList = getCategoryList(category);
|
||||
TestRecordVo testRecordVo = testRecordMapper.getTestRecordMapById(testId);
|
||||
List<String> reagentConsumablesList = testRecordVo.getReagentConsumablesList();
|
||||
LambdaQueryWrapper<TestRecordReagent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.and(StringUtils.isNotBlank(keywords), qw -> qw
|
||||
.like(TestRecordReagent::getNumber, keywords)
|
||||
.or()
|
||||
.like(TestRecordReagent::getReagentConsumableName, keywords))
|
||||
.in(TestRecordReagent::getCategory, categoryList);
|
||||
if (opCode == 1) {
|
||||
queryWrapper.orderByDesc(TestRecordReagent::getCreateTime);
|
||||
if (reagentConsumablesList != null && reagentConsumablesList.size() > 0) {
|
||||
queryWrapper.notIn(TestRecordReagent::getId, reagentConsumablesList);
|
||||
}
|
||||
} else {
|
||||
if (reagentConsumablesList == null || reagentConsumablesList.size() == 0) {
|
||||
//下面两步是为了能使参数正常查询
|
||||
reagentConsumablesList = new ArrayList<>();
|
||||
reagentConsumablesList.add("");
|
||||
}
|
||||
queryWrapper.in(TestRecordReagent::getId, reagentConsumablesList)
|
||||
.orderByDesc(TestRecordReagent::getUpdateTime);
|
||||
}
|
||||
//给了实验ID,查询这个实验下的试剂耗材、标准物质
|
||||
return this.page(page, queryWrapper);
|
||||
return testRecordReagentPage(page, keywords, opCode, categoryList, testRecordVo.getReagentConsumablesList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param testId
|
||||
* @param templateId
|
||||
* @param keywords 标准物质编号、名称查询参数
|
||||
* @param category 类别查询参数
|
||||
* @param opCode 1:查询所有的试剂耗材 -1:查询这个模板下的试剂耗材
|
||||
@@ -168,16 +141,23 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
*/
|
||||
@Override
|
||||
public IPage getTestTemplateReagentPageList(Page page, String templateId, String keywords, String category, Integer opCode) {
|
||||
ArrayList<String> categoryList = new ArrayList<>();
|
||||
if (category.equals("试剂耗材")) {
|
||||
categoryList.add("试剂");
|
||||
categoryList.add("耗材");
|
||||
} else {
|
||||
categoryList.add("标准物质");
|
||||
categoryList.add("标准储备溶液");
|
||||
}
|
||||
List<String> categoryList = getCategoryList(category);
|
||||
TestTemplateVo templateVo = testTemplateMapper.getTestTemplateMapById(templateId);
|
||||
List<String> reagentConsumablesList = templateVo.getReagentConsumables();
|
||||
return testRecordReagentPage(page, keywords, opCode, categoryList, templateVo.getReagentConsumables());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询试剂耗材记录
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param keywords 关键词,用于模糊查询试剂耗材编号或名称
|
||||
* @param opCode 操作码,用于区分查询类型
|
||||
* @param categoryList 试剂耗材类别列表,用于筛选符合条件的记录
|
||||
* @param reagentConsumablesList 试剂耗材ID列表,用于筛选符合条件的记录
|
||||
* @return 分页结果
|
||||
*/
|
||||
@DlpResultProc
|
||||
public IPage<TestRecordReagentVO> testRecordReagentPage(Page page, String keywords, Integer opCode, List<String> categoryList, List<String> reagentConsumablesList) {
|
||||
LambdaQueryWrapper<TestRecordReagent> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.and(StringUtils.isNotBlank(keywords), qw -> qw
|
||||
.like(TestRecordReagent::getNumber, keywords)
|
||||
@@ -198,7 +178,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
queryWrapper.in(TestRecordReagent::getId, reagentConsumablesList)
|
||||
.orderByDesc(TestRecordReagent::getUpdateTime);
|
||||
}
|
||||
return this.page(page, queryWrapper);
|
||||
return TestRecordReagentConvert.entityToVOPage(this.page(page, queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,14 +190,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
*/
|
||||
@Override
|
||||
public List<TestRecordReagent> getTestRecordReagentList(String testId, String category) {
|
||||
ArrayList<String> categoryList = new ArrayList<>();
|
||||
if (category.equals("试剂耗材")) {
|
||||
categoryList.add("试剂");
|
||||
categoryList.add("耗材");
|
||||
} else {
|
||||
categoryList.add("标准物质");
|
||||
categoryList.add("标准储备溶液");
|
||||
}
|
||||
List<String> categoryList = getCategoryList(category);
|
||||
TestRecordVo testRecordVo = testRecordMapper.getTestRecordMapById(testId);
|
||||
List<String> reagentConsumablesList = testRecordVo.getReagentConsumablesList();
|
||||
if (reagentConsumablesList == null || reagentConsumablesList.size() == 0) {
|
||||
@@ -280,4 +253,25 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
boolean ret = testTemplateService.updateTestTemplate(testRecordArgumentDto.getTemplateId(), testRecordArgumentDto.getArgumentId(), TestRecordArgumentType.TEST_RECORD_ARGUMENT_REAGENT.getType(), testRecordArgumentDto.getOpCode());
|
||||
return this.updateById(testRecordReagent) && ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据传入的类别名称返回相应的类别列表
|
||||
*
|
||||
* @param category 类别名称,只能是"试剂耗材"或其他字符串
|
||||
* @return 返回一个包含两个字符串的列表,具体内容取决于传入的类别名称
|
||||
* 如果类别名称为"试剂耗材",则列表包含"试剂"和"耗材"
|
||||
* 否则,列表包含"标准物质"和"标准储备溶液"
|
||||
*/
|
||||
private List<String> getCategoryList(String category) {
|
||||
List<String> categoryList = new ArrayList<>();
|
||||
if (category.equals("试剂耗材")) {
|
||||
categoryList.add("试剂");
|
||||
categoryList.add("耗材");
|
||||
} else {
|
||||
categoryList.add("标准物质");
|
||||
categoryList.add("标准储备溶液");
|
||||
}
|
||||
return categoryList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConst
|
||||
import digital.laboratory.platform.inspection.dto.HairSewageDataDto;
|
||||
import digital.laboratory.platform.inspection.dto.NPSCaseTestDataDto;
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand;
|
||||
import digital.laboratory.platform.inspection.mapper.TestRecordSampledataExpandMapper;
|
||||
import digital.laboratory.platform.inspection.mapper.TestRecordSampleDataExpandMapper;
|
||||
import digital.laboratory.platform.inspection.service.TestRecordSampledataExpandService;
|
||||
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSTestDetailDataStruct;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
|
||||
* @createDate 2025-03-19 14:58:17
|
||||
*/
|
||||
@Service
|
||||
public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecordSampledataExpandMapper, TestRecordSampleDataExpand>
|
||||
public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecordSampleDataExpandMapper, TestRecordSampleDataExpand>
|
||||
implements TestRecordSampledataExpandService{
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package digital.laboratory.platform.inspection.vo;
|
||||
|
||||
import com.lcsoft.dlp.common.aop.annotation.DlpFeign;
|
||||
import digital.laboratory.platform.sys.entity.Drug;
|
||||
import digital.laboratory.platform.sys.feign.RemoteCommDrugService;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @version 1.0
|
||||
* @title TestRecordReagent
|
||||
* @description 实验中用到的试剂耗材VO
|
||||
* @create 2023/12/20 11:02
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "实验中用到的试剂耗材VO", description = "实验中用到的试剂耗材VO")
|
||||
public class TestRecordReagentVO {
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "标准品的成分,关联的毒品清单中的毒品ID")
|
||||
private String drugId;
|
||||
|
||||
@ApiModelProperty(value = "试剂耗材或标准物质名称")
|
||||
private String reagentConsumableName;
|
||||
|
||||
@ApiModelProperty(value = "类别,表示是试剂、耗材,还是标准物质")
|
||||
private String category;
|
||||
|
||||
@ApiModelProperty(value = "型号规格")
|
||||
private String specifications;
|
||||
|
||||
@ApiModelProperty(value = "纯度等级,仅适用于试剂,耗材时为空")
|
||||
private String purityGrade;
|
||||
|
||||
@ApiModelProperty(value = "标准物质编号,仅当类别为标准物质时设置")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(value = "排序索引")
|
||||
private Integer sortIndex;
|
||||
|
||||
@ApiModelProperty(value = "数据来源")
|
||||
private Integer source;
|
||||
|
||||
@ApiModelProperty(value = "关联的毒品实体信息")
|
||||
@DlpFeign(feignClient = RemoteCommDrugService.class, methodName = "getById", params = {"drugId"})
|
||||
private Drug drug;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="digital.laboratory.platform.inspection.mapper.TestRecordSampledataExpandMapper">
|
||||
<mapper namespace="digital.laboratory.platform.inspection.mapper.TestRecordSampleDataExpandMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand">
|
||||
<id property="id" column="exp_id" jdbcType="VARCHAR"/>
|
||||
@@ -12,6 +12,7 @@
|
||||
<result property="ionAbundanceRatio" column="ion_abundance_ratio" jdbcType="DECIMAL"/>
|
||||
<result property="ionAbundanceRatioError" column="ion_abundance_ratio_error" jdbcType="DECIMAL"/>
|
||||
<result property="ionAbundanceRatioWithinError" column="ion_abundance_ratio_within_error" jdbcType="VARCHAR"/>
|
||||
<result property="fragmentRetTime" column="fragment_ret_time" jdbcType="DECIMAL"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
@@ -19,9 +20,25 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
exp_id,test_data_id,peak_area,
|
||||
base_peak,ion_abundance_ratio,ion_abundance_ratio_error,
|
||||
ion_abundance_ratio_within_error,create_by,create_time,
|
||||
update_by,update_time
|
||||
exp.exp_id,
|
||||
exp.test_data_id,
|
||||
exp.peak_area,
|
||||
exp.base_peak,
|
||||
exp.ion_abundance_ratio,
|
||||
exp.ion_abundance_ratio_error,
|
||||
exp.fragment_ret_time
|
||||
exp.ion_abundance_ratio_within_error,
|
||||
exp.create_by,
|
||||
exp.create_time,
|
||||
exp.update_by,
|
||||
exp.update_time
|
||||
</sql>
|
||||
<!-- 连表查询,主表b_test_record_sampledata -->
|
||||
<sql id="joinMasterTable">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM b_test_record_sampledata_expand exp
|
||||
LEFT JOIN b_test_record_sampledata test ON exp.test_data_id = test.id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -28,13 +28,27 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,name,sample_no,
|
||||
test_id,std_concentration,sample_concentration,
|
||||
compound_name,rt_time_within_error,rt_time_error,
|
||||
target_rt_time,std_rt_time,is_detected,
|
||||
sample_type,data_json,data_result_json,
|
||||
status,create_time,create_by,
|
||||
update_time,update_by,compound_cn_name
|
||||
id,
|
||||
name,
|
||||
sample_no,
|
||||
test_id,
|
||||
std_concentration,
|
||||
sample_concentration,
|
||||
compound_name,
|
||||
rt_time_within_error,
|
||||
rt_time_error,
|
||||
target_rt_time,
|
||||
std_rt_time,
|
||||
is_detected,
|
||||
sample_type,
|
||||
data_json,
|
||||
data_result_json,
|
||||
status,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
compound_cn_name
|
||||
</sql>
|
||||
<!-- 合并委托、任务、筛查表-->
|
||||
<sql id="queryCommoneBusinessSql">
|
||||
|
||||
Reference in New Issue
Block a user