diff --git a/dlp-drugtesting-biz/pom.xml b/dlp-drugtesting-biz/pom.xml index 6609121..9219e81 100644 --- a/dlp-drugtesting-biz/pom.xml +++ b/dlp-drugtesting-biz/pom.xml @@ -6,14 +6,17 @@ dlp-drugtesting 2022.10.11-snapshots + dlp-drugtesting-biz jar dlp-drugtesting-biz + UTF-8 1.8 1.8 5.7.1 + 2022.10.11-snapshots @@ -33,22 +36,23 @@ digital.laboratory.platform dlp-common-swagger - - - - - + + + com.lcsoft.dlp + dlp-common-aop + 2.0 + digital.laboratory.platform dlp-common-feign - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-common-security - 2022.10.11-snapshots + ${dlp.version} @@ -64,7 +68,7 @@ digital.laboratory.platform dlp-common-core - 2022.10.11-snapshots + ${dlp.version} @@ -81,34 +85,34 @@ digital.laboratory.platform dlp-common-log - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-common-seata - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-admin-api - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-drugtesting-api - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-sewage-api - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-common-oss - 2022.10.11-snapshots + ${dlp.version} @@ -120,13 +124,13 @@ digital.laboratory.platform dlp-upload-api - 2022.10.11-snapshots + ${dlp.version} digital.laboratory.platform dlp-basic-commonservice-api - 2022.10.11-snapshots + ${dlp.version} @@ -159,7 +163,7 @@ digital.laboratory.platform dlp-common-remote-word2pdf - 2022.10.11-snapshots + ${dlp.version} org.apache.poi diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordReagentConvert.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordReagentConvert.java new file mode 100644 index 0000000..2fbc231 --- /dev/null +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestRecordReagentConvert.java @@ -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 entityToVOPage(IPage entityPage) { + // 创建 VO 的分页对象 + IPage voPage = new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal()); + + // 将实体列表转换为 VO 列表 + List voList = entityPage.getRecords().stream() + .map(TestRecordReagentConvert::entityToVOPage) + .collect(Collectors.toList()); + + // 设置转换后的记录 + voPage.setRecords(voList); + return voPage; + } +} diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordReagent.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordReagent.java index 6d63e31..b21bfd6 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordReagent.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordReagent.java @@ -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;//数据来源 } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleDataExpand.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleDataExpand.java index 4a33f64..6a63bb9 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleDataExpand.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleDataExpand.java @@ -50,4 +50,9 @@ public class TestRecordSampleDataExpand extends BaseEntity { */ private String ionAbundanceRatioWithinError; + /** + * 碎片保留时间,目前该字段仅对nps实验有用,求具体样本保留时间 = 碎片保留时间的平均值 + */ + private BigDecimal fragmentRetTime; + } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampledataExpandMapper.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataExpandMapper.java similarity index 89% rename from dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampledataExpandMapper.java rename to dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataExpandMapper.java index 48d47e5..b312ca9 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampledataExpandMapper.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataExpandMapper.java @@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Mapper; * @Entity generator.entity.TestRecordSampledataExpand */ @Mapper -public interface TestRecordSampledataExpandMapper extends BaseMapper { +public interface TestRecordSampleDataExpandMapper extends BaseMapper { } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java index 52c1e67..4b61792 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java @@ -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 categoryList = new ArrayList<>(); - if (category.equals("试剂耗材")) { - categoryList.add("试剂"); - categoryList.add("耗材"); - } else { - categoryList.add("标准物质"); - categoryList.add("标准储备溶液"); - } + List categoryList = getCategoryList(category); TestRecordVo testRecordVo = testRecordMapper.getTestRecordMapById(testId); - List reagentConsumablesList = testRecordVo.getReagentConsumablesList(); - LambdaQueryWrapper 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 categoryList = new ArrayList<>(); - if (category.equals("试剂耗材")) { - categoryList.add("试剂"); - categoryList.add("耗材"); - } else { - categoryList.add("标准物质"); - categoryList.add("标准储备溶液"); - } + List categoryList = getCategoryList(category); TestTemplateVo templateVo = testTemplateMapper.getTestTemplateMapById(templateId); - List 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 testRecordReagentPage(Page page, String keywords, Integer opCode, List categoryList, List reagentConsumablesList) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.and(StringUtils.isNotBlank(keywords), qw -> qw .like(TestRecordReagent::getNumber, keywords) @@ -198,7 +178,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl getTestRecordReagentList(String testId, String category) { - ArrayList categoryList = new ArrayList<>(); - if (category.equals("试剂耗材")) { - categoryList.add("试剂"); - categoryList.add("耗材"); - } else { - categoryList.add("标准物质"); - categoryList.add("标准储备溶液"); - } + List categoryList = getCategoryList(category); TestRecordVo testRecordVo = testRecordMapper.getTestRecordMapById(testId); List reagentConsumablesList = testRecordVo.getReagentConsumablesList(); if (reagentConsumablesList == null || reagentConsumablesList.size() == 0) { @@ -280,4 +253,25 @@ public class TestRecordReagentServiceImpl extends ServiceImpl getCategoryList(String category) { + List categoryList = new ArrayList<>(); + if (category.equals("试剂耗材")) { + categoryList.add("试剂"); + categoryList.add("耗材"); + } else { + categoryList.add("标准物质"); + categoryList.add("标准储备溶液"); + } + return categoryList; + } } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java index 1255487..7a000af 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java @@ -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 +public class TestRecordSampledataExpandServiceImpl extends ServiceImpl implements TestRecordSampledataExpandService{ /** diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordReagentVO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordReagentVO.java new file mode 100644 index 0000000..a896fb7 --- /dev/null +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordReagentVO.java @@ -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; +} + diff --git a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampledataExpandMapper.xml b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml similarity index 62% rename from dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampledataExpandMapper.xml rename to dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml index a5eef77..c54359d 100644 --- a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampledataExpandMapper.xml +++ b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml @@ -2,7 +2,7 @@ - + @@ -12,6 +12,7 @@ + @@ -19,9 +20,25 @@ - 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 + + + SELECT + + FROM b_test_record_sampledata_expand exp + LEFT JOIN b_test_record_sampledata test ON exp.test_data_id = test.id + + diff --git a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml index 04213c2..32b8872 100644 --- a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml +++ b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml @@ -28,13 +28,27 @@ - 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