20250319 更新
1.添加检验数据扩展实体
This commit is contained in:
@@ -59,4 +59,12 @@ public interface TestRecordSampleDataConstant {
|
||||
|
||||
String COMPOUND_BASIC_PEAK = "compound_basic_peak";
|
||||
|
||||
/*************************************************** 无效值的常量 ******************************************************************************************/
|
||||
|
||||
Double INVALID_VALUE = -999d;
|
||||
|
||||
// 判断当前值是否是无效值
|
||||
static boolean isInvalidValue(Double value) {
|
||||
return value != null && INVALID_VALUE.equals(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.exceptions.TooManyResultsException;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -48,6 +49,7 @@ public class TestRecordSampleDataController {
|
||||
|
||||
//解析数据文件
|
||||
@PostMapping("/parseTestData")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ApiOperation(value = "上传检验数据文件", notes = "上传检验数据文件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "fileTypeCode", value = "上传的文件格式,10001 岛津 | 10002 沃特斯毛发案件 | 20002 沃特斯任务 | 20001 沃特斯毛发任务", required = true),
|
||||
@@ -58,35 +60,29 @@ public class TestRecordSampleDataController {
|
||||
@RequestParam("testId") String testId) {
|
||||
try {
|
||||
testRecordSampleDataService.validateTestStatus(testId);
|
||||
// 先删除这个实验id有关的数据在插入下新数据
|
||||
testRecordSampleDataService.delete(testId);
|
||||
switch (BusinessType.getBusinessTypeByType(fileTypeCode)) {
|
||||
case SCREENING_EVENT:
|
||||
case NPS_CASE: {
|
||||
List<NPSDataFileStruct> retDataList = TestDataFileUtil.analysisNpsDataFile(file);//NPS文件解析
|
||||
// 先删除这个实验id有关的数据在插入下新数据
|
||||
testRecordSampleDataService.remove(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId));
|
||||
Boolean saveTestDataFromNps = testRecordSampleDataService.saveTestDataFromNps(retDataList, testId);
|
||||
return saveTestDataFromNps ? R.ok(true, "上传数据成功") : R.failed(false, "上传数据失败!");
|
||||
}
|
||||
case BOINT_CASE: {
|
||||
Map<String, List<HairSewageCompoundData>> hairCompoundDataMap = TestDataFileUtil.analysisWtsDataFile(file, 1);//毛发案件文件解析 /毛发任务文件解析
|
||||
// 先删除这个实验id有关的数据在插入下新数据
|
||||
testRecordSampleDataService.remove(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId));
|
||||
Boolean saveTestDataHairCase = testRecordSampleDataService.saveTestDataHairCase(hairCompoundDataMap, testId);
|
||||
return saveTestDataHairCase ? R.ok(true, "上传数据成功") : R.failed(false, "上传数据失败!");
|
||||
}
|
||||
case SEWAGE_JOB: {
|
||||
// /污水任务文件解析
|
||||
Map<String, List<HairSewageCompoundData>> sewageCompoundDataMap = TestDataFileUtil.analysisWtsDataFile(file, 2);//毛发案件文件解析 /毛发任务文件解析
|
||||
// 先删除这个实验id有关的数据在插入下新数据
|
||||
testRecordSampleDataService.remove(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId));
|
||||
Boolean saveTestDataHairCase = testRecordSampleDataService.saveTestDataHairSewageTask(sewageCompoundDataMap, testId, fileTypeCode);
|
||||
return saveTestDataHairCase ? R.ok(true, "上传数据成功") : R.failed(false, "上传数据失败!");
|
||||
}
|
||||
case BOINT_JOB: {
|
||||
// /毛发任务文件解析
|
||||
Map<String, List<HairSewageCompoundData>> hairCompoundDataMap = TestDataFileUtil.analysisWtsDataFile(file, 1);//毛发案件文件解析 /毛发任务文件解析
|
||||
// 先删除这个实验id有关的数据在插入下新数据
|
||||
testRecordSampleDataService.remove(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId));
|
||||
Boolean saveTestDataHairCase = testRecordSampleDataService.saveTestDataHairSewageTask(hairCompoundDataMap, testId, fileTypeCode);
|
||||
return saveTestDataHairCase ? R.ok(true, "上传数据成功") : R.failed(false, "上传数据失败!");
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class HairSewageDataDto extends BaseCaseDataDto<HairSewageCompoundData> {
|
||||
private double rtTimeError;//保留时间相对偏差
|
||||
|
||||
@ApiModelProperty("模板保留时间相对误差(%)")
|
||||
private String tmpRtTimeError;//保留时间相对偏差
|
||||
private String tmpRtTimeError;//
|
||||
|
||||
@ApiModelProperty("保留时间是否在误差范围内, 是否符合")
|
||||
private String rtTimeWithinError;//保留时间是否在误差范围内
|
||||
@@ -62,25 +62,25 @@ public class HairSewageDataDto extends BaseCaseDataDto<HairSewageCompoundData> {
|
||||
private String qualitativeIonPairDown;
|
||||
|
||||
@ApiModelProperty("峰面积-上")
|
||||
private double peakAreaUp;
|
||||
private Double peakAreaUp;
|
||||
|
||||
@ApiModelProperty("模板峰面积-上")
|
||||
private String tmpPeakAreaUp;
|
||||
|
||||
@ApiModelProperty("峰面积-下")
|
||||
private double peakAreaDown;
|
||||
private Double peakAreaDown;
|
||||
|
||||
@ApiModelProperty("模板峰面积-下")
|
||||
private String tmpPeakAreaDown;
|
||||
|
||||
@ApiModelProperty("离子丰度比")
|
||||
private double ionAbundanceRatio;
|
||||
private Double ionAbundanceRatio;
|
||||
|
||||
@ApiModelProperty("模板离子丰度比")
|
||||
private String tmpIonAbundanceRatio;
|
||||
|
||||
@ApiModelProperty("离子丰度比相对偏差(%)")
|
||||
private double ionAbundanceRatioWithinError;
|
||||
private Double ionAbundanceRatioWithinError;
|
||||
|
||||
@ApiModelProperty("模板离子丰度比相对偏差(%)")
|
||||
private String tmpIonAbundanceRatioWithinError;
|
||||
|
||||
@@ -1,73 +1,109 @@
|
||||
package digital.laboratory.platform.inspection.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @version 1.0
|
||||
* @title TestRecordSampleSolution
|
||||
* @description 实验结果数据
|
||||
* @create 2023/12/20 11:36
|
||||
* 样本检验数据
|
||||
* @TableName b_test_record_sampledata
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "b_test_record_sampledata", autoResultMap = true)
|
||||
@TableName(value ="b_test_record_sampledata", autoResultMap = true)
|
||||
@ApiModel(value = "实验中样本检测结果数据", description = "实验中样本检测结果数据")
|
||||
public class TestRecordSampleData extends BaseEntity {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(value = "ID", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
private String testId;//实验ID,记录是哪次实验做的这个检材
|
||||
/**
|
||||
* 数据从机器中导出的唯一标识
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数据从机器中导出的唯一标识, 目前只有生物样本案件需要")
|
||||
private String name;//数据从机器中导出的唯一标识
|
||||
/**
|
||||
* 样本编号
|
||||
*/
|
||||
private String sampleNo;
|
||||
|
||||
private String sampleNo;//样本编号
|
||||
/**
|
||||
* 实验ID
|
||||
*/
|
||||
private String testId;
|
||||
|
||||
private String compoundName;//检测的化合物(目标化合物)
|
||||
/**
|
||||
* 标准品浓度
|
||||
*/
|
||||
private String stdConcentration;
|
||||
|
||||
private String stdConcentration;//标准品的浓度
|
||||
/**
|
||||
* 样品浓度
|
||||
*/
|
||||
private String sampleConcentration;
|
||||
|
||||
private String sampleConcentration;//样本的浓度 ng/mL
|
||||
/**
|
||||
* 化合物名称
|
||||
*/
|
||||
private String compoundName;
|
||||
|
||||
private String rtTimeWithinError;//保留时间是否在误差范围 ±1 以内
|
||||
/**
|
||||
* 保留时间是否在误差范围内,缴获物(-1~1), 生物样本(-2.5~2.5)
|
||||
*/
|
||||
private String rtTimeWithinError;
|
||||
|
||||
private Double targetRtTime;//目标物保留时间
|
||||
/**
|
||||
* 保留时间相对误差(%)
|
||||
*/
|
||||
private Double rtTimeError;
|
||||
|
||||
private Double stdRtTime;//标准物保留时间
|
||||
/**
|
||||
* 检材保留时间(min)
|
||||
*/
|
||||
private Double targetRtTime;
|
||||
|
||||
private int isDetected;//是否检出目标化合物
|
||||
/**
|
||||
* 标准品保留时间(min)
|
||||
*/
|
||||
private Double stdRtTime;
|
||||
|
||||
private String sampleType;//样本类型- QC(质控) STD(标准品) Analyte(待测样品)
|
||||
/**
|
||||
* 是否检出该物质 1检出 0 未检出
|
||||
*/
|
||||
private Integer isDetected;
|
||||
|
||||
private String dataJson;//实验数据-原始数据,以JSON的形式来存储该样本的实验数据
|
||||
/**
|
||||
* 样本类型- QC(质控) STD(标准品) Analyte(待测样品)
|
||||
*/
|
||||
private String sampleType;
|
||||
|
||||
private String dataResultJson;//检验数据结果
|
||||
/**
|
||||
* 检验数据json
|
||||
*/
|
||||
private String dataJson;
|
||||
|
||||
private String compoundCnName;//检测的化合物的中文名字
|
||||
/**
|
||||
* 检验结果数据json
|
||||
*/
|
||||
private String dataResultJson;
|
||||
|
||||
private Double mainArea;//主要产物峰面积
|
||||
|
||||
private Double minorArea;//次要产物峰面积
|
||||
|
||||
@ApiModelProperty("任务数据审核状态, 状态:\n" +
|
||||
"0 待审核,\n" +
|
||||
"1 已审核,\n" +
|
||||
"2 已审批, \n" +
|
||||
"3 已上传 \n" +
|
||||
"上传到大数据平台(仅针对任务数据, 其他业务类型的数据默认0)")
|
||||
/**
|
||||
* 状态:
|
||||
* 0 待审核,
|
||||
* 1 已审核,
|
||||
* 2 已审批,
|
||||
* 3 已上传
|
||||
* 上传到大数据平台(仅针对任务数据, 其他业务类型的数据默认0)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private String getDetectedResult() {
|
||||
if (isDetected == 1) {
|
||||
return "检出" + compoundName;
|
||||
} else {
|
||||
return "未检出" + compoundName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测的化合物的中文名字
|
||||
*/
|
||||
private String compoundCnName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package digital.laboratory.platform.inspection.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 样本检验数据的扩展信息
|
||||
* @TableName b_test_record_sampledata_expand
|
||||
*/
|
||||
@Data
|
||||
@TableName(value ="b_test_record_sampledata_expand")
|
||||
public class TestRecordSampleDataExpand extends BaseEntity {
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(value = "exp_id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 关联的实验数据id(一个实验数据可能关联着多个扩展数据)
|
||||
*/
|
||||
private String testDataId;
|
||||
|
||||
/**
|
||||
* 峰面积
|
||||
*/
|
||||
private BigDecimal peakArea;
|
||||
|
||||
/**
|
||||
* 是否是基峰, 1 是 | 0 不是
|
||||
*/
|
||||
private Boolean basePeak;
|
||||
|
||||
/**
|
||||
* 离子丰度比 | 峰面积之比
|
||||
*/
|
||||
private BigDecimal ionAbundanceRatio;
|
||||
|
||||
/**
|
||||
* 离子丰度比相对偏差(%)| 计算离子丰度比 相对偏差 (目标物离子丰度比 - 标准物离子丰度比) / 标准物质离子丰度比 * 100
|
||||
*/
|
||||
private BigDecimal ionAbundanceRatioError;
|
||||
|
||||
/**
|
||||
* 离子丰度比偏差是否在误差范围内
|
||||
*/
|
||||
private String ionAbundanceRatioWithinError;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package digital.laboratory.platform.inspection.mapper;
|
||||
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @description 针对表【b_test_record_sampledata_expand(样本检验数据的扩展信息)】的数据库操作Mapper
|
||||
* @createDate 2025-03-19 14:58:17
|
||||
* @Entity generator.entity.TestRecordSampledataExpand
|
||||
*/
|
||||
@Mapper
|
||||
public interface TestRecordSampledataExpandMapper extends BaseMapper<TestRecordSampleDataExpand> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ public interface TestRecordSampleDataService extends IService<TestRecordSampleD
|
||||
*/
|
||||
void validateTestStatus(String testId);
|
||||
|
||||
//保存检验数据结果
|
||||
Boolean saveTestData(List<TestRecordSampleData> testRecordSampleDataList);
|
||||
|
||||
Boolean saveTestDataFromNps(List<NPSDataFileStruct> npsDataFileStructList,String testId);
|
||||
|
||||
@@ -163,6 +161,12 @@ public interface TestRecordSampleDataService extends IService<TestRecordSampleD
|
||||
|
||||
TestRecordSampleData updateData(TestRecordSampleData data);
|
||||
|
||||
/**
|
||||
* 删除检验数据
|
||||
* @param testId
|
||||
*/
|
||||
void delete(String testId);
|
||||
|
||||
|
||||
//获取标准品样品信息数据
|
||||
// List<NPSCaseTestDataDto> getStdSampleTestDataByTestId(String testId);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package digital.laboratory.platform.inspection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import digital.laboratory.platform.inspection.dto.HairSewageDataDto;
|
||||
import digital.laboratory.platform.inspection.dto.NPSCaseTestDataDto;
|
||||
import digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @description 针对表【b_test_record_sampledata_expand(样本检验数据的扩展信息)】的数据库操作Service
|
||||
* @createDate 2025-03-19 14:58:17
|
||||
*/
|
||||
public interface TestRecordSampledataExpandService extends IService<TestRecordSampleDataExpand> {
|
||||
|
||||
/**
|
||||
* 封装处理毛发案件、任务等检验扩展数据信息
|
||||
* @param hairSewageDataDto
|
||||
* @param testDataId
|
||||
* @return
|
||||
*/
|
||||
Collection<? extends TestRecordSampleDataExpand> saveHairSewageInspectExpData(HairSewageDataDto hairSewageDataDto, String testDataId);
|
||||
|
||||
/**
|
||||
* 封装处理nps案件检验扩展数据信息
|
||||
*
|
||||
* @param npsCaseTestDataDto
|
||||
* @param testDataId
|
||||
* @return
|
||||
*/
|
||||
Collection<? extends TestRecordSampleDataExpand> saveNPSInspectExpData(NPSCaseTestDataDto npsCaseTestDataDto, String testDataId);
|
||||
}
|
||||
@@ -90,6 +90,9 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
@Resource
|
||||
private TaskInfoService taskInfoService;
|
||||
|
||||
@Resource
|
||||
private TestRecordSampledataExpandService testRecordSampledataExpandService;
|
||||
|
||||
@Resource
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -111,10 +114,19 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除检验数据
|
||||
* @param testId
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveTestData(List<TestRecordSampleData> testRecordSampleDataList) {
|
||||
return super.saveBatch(testRecordSampleDataList);
|
||||
public void delete(String testId) {
|
||||
// 删除检验数据前,先删除扩展数据
|
||||
boolean remove = testRecordSampledataExpandService.remove(Wrappers.<TestRecordSampleDataExpand>lambdaQuery()
|
||||
.inSql(TestRecordSampleDataExpand::getTestDataId, String.format("SELECT id FROM b_test_record_sampledata WHERE test_id = %s", testId))
|
||||
);
|
||||
if (remove) {
|
||||
super.remove(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId));
|
||||
}
|
||||
}
|
||||
|
||||
//获取检验记录中的样品信息数据
|
||||
@@ -291,56 +303,6 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
|
||||
JSONArray headerArray = generateHeaderArray(dataGroupBySampleNoMap);
|
||||
JSONArray dataArray = generateDataArray(dataGroupBySampleNoMap);
|
||||
/*// 标记表头是否添加完成
|
||||
AtomicReference<Boolean> finish = new AtomicReference<>(false); // 为了能在lambda中使用
|
||||
dataGroupBySampleNoMap.forEach((k, v) -> {
|
||||
// 组装列表数据
|
||||
JSONObject dataObject = new JSONObject();
|
||||
dataObject.put("sampleNo", k);
|
||||
int size = v.size(); // 防止频繁调用方法
|
||||
for (int i = 0; i < size; i++) {
|
||||
TaskTestDataDTO taskTestDataDTO = v.get(i);
|
||||
String compoundKey = "compound" + (i + 1);
|
||||
if (!finish.get()) {
|
||||
// 组装自定义列表头部
|
||||
JSONObject object = new JSONObject();
|
||||
if (i == 0) {
|
||||
JSONObject sampleNoObject = new JSONObject();
|
||||
sampleNoObject.put(TestRecordSampleDataConstant.LABEL, "溶液编号");
|
||||
sampleNoObject.put(TestRecordSampleDataConstant.PROP, "sampleNo");
|
||||
sampleNoObject.put("fixed", true);
|
||||
JSONObject name = new JSONObject();
|
||||
name.put(TestRecordSampleDataConstant.PROP, "taskName");
|
||||
name.put(TestRecordSampleDataConstant.LABEL, "案件/任务名称");
|
||||
JSONObject business = new JSONObject();
|
||||
business.put(TestRecordSampleDataConstant.PROP, "businessTypeName");
|
||||
business.put(TestRecordSampleDataConstant.LABEL, "业务类型");
|
||||
JSONObject status = new JSONObject();
|
||||
status.put(TestRecordSampleDataConstant.PROP, "statusName");
|
||||
status.put(TestRecordSampleDataConstant.LABEL, "状态");
|
||||
|
||||
headerArray.add(name);
|
||||
headerArray.add(business);
|
||||
headerArray.add(status);
|
||||
headerArray.add(sampleNoObject);
|
||||
}
|
||||
object.put(TestRecordSampleDataConstant.PROP, compoundKey);
|
||||
object.put(TestRecordSampleDataConstant.LABEL, "化合物" + (i + 1) + "(" + taskTestDataDTO.getCompoundName() + ")");
|
||||
headerArray.add(object);
|
||||
}
|
||||
// 把化合物组装导对象里
|
||||
dataObject.put("taskName", taskTestDataDTO.getTaskName());
|
||||
dataObject.put("businessTypeName", BusinessType.getBusinessTypeName(taskTestDataDTO.getBusinessType()));
|
||||
dataObject.put("status", taskTestDataDTO.getStatus());
|
||||
dataObject.put("statusName", TaskTestDataStatus.getStatusNameByCode(taskTestDataDTO.getStatus()));
|
||||
dataObject.put(compoundKey, taskTestDataDTO.getSampleConcentration());
|
||||
if (i == size - 1) {
|
||||
finish.set(true);
|
||||
}
|
||||
}
|
||||
dataArray.add(dataObject);
|
||||
});
|
||||
*/
|
||||
// 手动分页
|
||||
map.put("header", headerArray);
|
||||
map.put("page", getPageData(dataArray, pageDTO.getCurrent(), pageDTO.getSize()));
|
||||
@@ -861,7 +823,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveTestDataFromNps(List<NPSDataFileStruct> npsDataFileStructList, String testId) {
|
||||
// try {
|
||||
List<TestRecordSampleData> testRecordSampleDataList = buildSampleDataFromNps(npsDataFileStructList, testId);//构造实验数据
|
||||
buildSampleDataFromNps(npsDataFileStructList, testId);//构造实验数据
|
||||
testRecordService.update(Wrappers.<TestRecord>lambdaUpdate().eq(TestRecord::getId, testId).set(TestRecord::getStatus, 2));
|
||||
return true;
|
||||
// } catch (Exception err) {
|
||||
@@ -941,9 +903,9 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
hairSewageDataDto.setBusinessType(BusinessType.BOINT_CASE.getBusinessType());
|
||||
completeHairDataInfo(hairCompoundData, hairSewageDataDto);
|
||||
if (idName.contains(TestRecordSampleDataConstant.SAMPLE_TYPE_STD)) {
|
||||
hairSewageDataDto.setRtTimeError(-999); // 标准溶液的相对误差为 /
|
||||
hairSewageDataDto.setRtTimeError(TestRecordSampleDataConstant.INVALID_VALUE); // 标准溶液的相对误差为 /
|
||||
hairSewageDataDto.setRtTimeWithinError(TestRecordSampleDataConstant.IS);
|
||||
hairSewageDataDto.setIonAbundanceRatioWithinError(-999); // 离子丰度比相对误差
|
||||
hairSewageDataDto.setIonAbundanceRatioWithinError(TestRecordSampleDataConstant.INVALID_VALUE); // 离子丰度比相对误差
|
||||
hairSewageDataDto.setWhetherCheckOut(TestRecordSampleDataConstant.IS);
|
||||
hairSewageDataDto.setStdRtTime(hairSewageDataDto.getTargetRtTime());
|
||||
hairSewageDataDto.setSampleType(TestRecordSampleDataConstant.SAMPLE_TYPE_STD);
|
||||
@@ -983,8 +945,8 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
private void completeHairDataInfo(HairSewageCompoundData hairCompoundData, HairSewageDataDto hairSewageDataDto) {
|
||||
hairSewageDataDto.setQualitativeIonPairUp(hairCompoundData.getQuanTrace()); // 定性离子对
|
||||
hairSewageDataDto.setQualitativeIonPairDown(hairCompoundData.getTrace1());
|
||||
hairSewageDataDto.setPeakAreaUp(hairCompoundData.getArea() == null ? -999 : hairCompoundData.getArea()); // 峰面积
|
||||
hairSewageDataDto.setPeakAreaDown(hairCompoundData.getArea1() == null ? -999 : hairCompoundData.getArea1());
|
||||
hairSewageDataDto.setPeakAreaUp(hairCompoundData.getArea() == null ? TestRecordSampleDataConstant.INVALID_VALUE : hairCompoundData.getArea()); // 峰面积
|
||||
hairSewageDataDto.setPeakAreaDown(hairCompoundData.getArea1() == null ? TestRecordSampleDataConstant.INVALID_VALUE : hairCompoundData.getArea1());
|
||||
|
||||
// 封装定性离子对和峰面积
|
||||
Map<String, Object> upMap = new HashMap<>();
|
||||
@@ -999,43 +961,15 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
if (hairCompoundData.getArea() != null && hairCompoundData.getArea1() != null) {
|
||||
hairSewageDataDto.setIonAbundanceRatio(hairCompoundData.getArea1() / hairCompoundData.getArea());
|
||||
} else {
|
||||
hairSewageDataDto.setIonAbundanceRatio(-999);
|
||||
hairSewageDataDto.setIonAbundanceRatio(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
}
|
||||
} else {
|
||||
hairSewageDataDto.setIonAbundanceRatio(hairCompoundData.getRatioActual());
|
||||
}
|
||||
Double rtTime = hairCompoundData.getRtTime() == null ? -999 : hairCompoundData.getRtTime(); // 取文件的保留时间
|
||||
Double rtTime = hairCompoundData.getRtTime() == null ? TestRecordSampleDataConstant.INVALID_VALUE : hairCompoundData.getRtTime(); // 取文件的保留时间
|
||||
hairSewageDataDto.setTargetRtTime(rtTime); // 目标物保留时间, 标准物质的保留时间同时存在 TargetRtTime 和 StdRtTime
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 生成持久化到数据库的实体类
|
||||
// * @param hairCaseDataDtoList
|
||||
// * @return
|
||||
// */
|
||||
// private List<TestRecordSampleData> generateTestRecordSampleData(List<HairCaseDataDto> hairCaseDataDtoList) {
|
||||
//
|
||||
// List<TestRecordSampleData> persistenceSampleDataList = new ArrayList<>();
|
||||
// hairCaseDataDtoList.forEach(item->{
|
||||
// TestRecordSampleData testRecordSampleData = new TestRecordSampleData();
|
||||
// testRecordSampleData.setId(IdWorker.get32UUID());
|
||||
// testRecordSampleData.setTestId(item.getTestId());
|
||||
// testRecordSampleData.setSampleNo(item.getSampleNo());
|
||||
// testRecordSampleData.setSampleConcentration(item.getTargetConcentration());
|
||||
// testRecordSampleData.setStdConcentration(item.getStdConcentration());
|
||||
// testRecordSampleData.setCompoundName(item.getCompoundName());
|
||||
// testRecordSampleData.setTargetRtTime(item.getTargetRtTime());//检材保留时间
|
||||
// testRecordSampleData.setStdRtTime(item.getStdRtTime());//标准品保留时间
|
||||
// testRecordSampleData.setRtTimeWithinError(item.getRtTimeWithinError());
|
||||
// String dataJsonStr=JSONUtil.toJsonStr(item.getTestSampleDataList());
|
||||
// String dataResultJsonStr=JSONUtil.toJsonStr(item);
|
||||
// testRecordSampleData.setDataJson(dataJsonStr);
|
||||
// testRecordSampleData.setDataResultJson(dataResultJsonStr);
|
||||
// persistenceSampleDataList.add(testRecordSampleData);
|
||||
// });
|
||||
// return persistenceSampleDataList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 计算相对误差喝离子丰度比相对误差,并判断是否符合
|
||||
*
|
||||
@@ -1076,7 +1010,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
// else {
|
||||
// log.info("没有找到该标准溶液,化合物 {} 样本ID {}", hairSewageDataDto.getCompoundName(), hairSewageDataDto.getSampleNo());
|
||||
// hairSewageDataDto.setStdConcentration("-1");
|
||||
// hairSewageDataDto.setStdRtTime(-999);
|
||||
// hairSewageDataDto.setStdRtTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
// }
|
||||
});
|
||||
return testRecordSampleDataListAnalyte;
|
||||
@@ -1089,7 +1023,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
* @param hairSewageDataDtoStd
|
||||
*/
|
||||
private void calculateHairCaseIonAbundanceRatioWithinError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) {
|
||||
if (hairSewageDataDto.getIonAbundanceRatio() != -999) {
|
||||
if ( !TestRecordSampleDataConstant.isInvalidValue(hairSewageDataDto.getIonAbundanceRatio()) ) {
|
||||
double ionAbundanceRatioWithinError = getAbundanceRatioErrorValue(hairSewageDataDto.getIonAbundanceRatio(), hairSewageDataDtoStd.getIonAbundanceRatio());
|
||||
hairSewageDataDto.setIonAbundanceRatioWithinError(ionAbundanceRatioWithinError);
|
||||
double stdIonAbundanceRatio = hairSewageDataDtoStd.getIonAbundanceRatio();
|
||||
@@ -1123,7 +1057,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
TestRecordSampleDataConstant.HAIR_CASE_NEGATIVE_MAX_ALLOW_ERROR_4);
|
||||
}
|
||||
} else {
|
||||
hairSewageDataDto.setIonAbundanceRatioWithinError(-999);
|
||||
hairSewageDataDto.setIonAbundanceRatioWithinError(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
hairSewageDataDto.setWhetherCheckOut("/");
|
||||
}
|
||||
}
|
||||
@@ -1153,14 +1087,14 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
* @param hairSewageDataDtoStd
|
||||
*/
|
||||
private void calculateHairCaseRtTimeError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) {
|
||||
if (hairSewageDataDto.getTargetRtTime() != -999) {
|
||||
if ( !TestRecordSampleDataConstant.isInvalidValue(hairSewageDataDto.getTargetRtTime()) ) {
|
||||
// 计算保留时间的相对误差
|
||||
double rtTimeError = getHairCaseRtTimeError(hairSewageDataDto.getTargetRtTime(), hairSewageDataDtoStd.getStdRtTime());
|
||||
hairSewageDataDto.setRtTimeError(rtTimeError);
|
||||
// 判断保留时间相对误差是否符合误差范围
|
||||
hairSewageDataDto.setRtTimeWithinError(setHairCaseRtTimeWithinError(hairSewageDataDto.getRtTimeError()));
|
||||
} else {
|
||||
hairSewageDataDto.setRtTimeError(-999);
|
||||
hairSewageDataDto.setRtTimeError(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
hairSewageDataDto.setRtTimeWithinError("/");
|
||||
}
|
||||
}
|
||||
@@ -1286,21 +1220,25 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
* @param npsCaseTestDataDtoList
|
||||
* @return
|
||||
*/
|
||||
private List<TestRecordSampleData> genPersistenceSampleData(List<? extends BaseCaseDataDto> npsCaseTestDataDtoList) {
|
||||
public List<TestRecordSampleData> genPersistenceSampleData(List<? extends BaseCaseDataDto> npsCaseTestDataDtoList) {
|
||||
List<TestRecordSampleData> persistenceSampleDataList = Collections.synchronizedList(new ArrayList<>());
|
||||
List<TestRecordSampleDataExpand> dataExpandList = Collections.synchronizedList(new ArrayList<>());
|
||||
npsCaseTestDataDtoList.parallelStream().forEach(item -> {
|
||||
|
||||
TestRecordSampleData testRecordSampleData = new TestRecordSampleData();
|
||||
testRecordSampleData.setId(IdWorker.get32UUID());
|
||||
testRecordSampleData.setId(IdWorker.getIdStr());
|
||||
testRecordSampleData.setTestId(item.getTestId());
|
||||
// testRecordSampleData.setSampleNo(item.getSampleId());
|
||||
if (item instanceof HairSewageDataDto) {
|
||||
testRecordSampleData.setName(((HairSewageDataDto) item).getSampleName());
|
||||
testRecordSampleData.setSampleNo(((HairSewageDataDto) item).getSampleNo());
|
||||
HairSewageDataDto hairSewageDataDto = (HairSewageDataDto) item;
|
||||
testRecordSampleData.setName(hairSewageDataDto.getSampleName());
|
||||
testRecordSampleData.setSampleNo(hairSewageDataDto.getSampleNo());
|
||||
dataExpandList.addAll(testRecordSampledataExpandService.saveHairSewageInspectExpData(hairSewageDataDto, testRecordSampleData.getId()));
|
||||
} else if (item instanceof NPSCaseTestDataDto) {
|
||||
NPSCaseTestDataDto npsCaseTestDataDto = (NPSCaseTestDataDto) item;
|
||||
testRecordSampleData.setName(npsCaseTestDataDto.getSampleName());
|
||||
testRecordSampleData.setSampleNo(npsCaseTestDataDto.getSampleNo());
|
||||
dataExpandList.addAll(testRecordSampledataExpandService.saveNPSInspectExpData(npsCaseTestDataDto, testRecordSampleData.getId()));
|
||||
}
|
||||
testRecordSampleData.setSampleConcentration(item.getTargetConcentration());
|
||||
testRecordSampleData.setStdConcentration(item.getStdConcentration());
|
||||
@@ -1326,6 +1264,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
testRecordSampleData.setDataResultJson(dataResultJsonStr);
|
||||
persistenceSampleDataList.add(testRecordSampleData);
|
||||
});
|
||||
testRecordSampledataExpandService.saveBatch(dataExpandList);
|
||||
return persistenceSampleDataList;
|
||||
}
|
||||
|
||||
@@ -1366,7 +1305,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
double mzValue = npsTestDetailDataStruct.getArea() / npsTestDetailDataStruct_Base.getArea() * 100;
|
||||
npsTestDetailDataStruct.setAbundanceRatio(mzValue);
|
||||
} else {
|
||||
npsTestDetailDataStruct.setAbundanceRatio(-999);
|
||||
npsTestDetailDataStruct.setAbundanceRatio(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsTestDetailDataStruct.setIsBasePeak(1);
|
||||
}
|
||||
|
||||
@@ -1443,10 +1382,10 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
npsTestDetailDataStruct.setWithinError(withinErrorText);
|
||||
otherList.add(npsTestDetailDataStruct);
|
||||
} else {
|
||||
npsTestDetailDataStruct.setAbundanceRatio(-999);//设置检材丰度比
|
||||
npsTestDetailDataStruct.setAbundanceRatio_std(-999);//设置标准物质丰度比
|
||||
npsTestDetailDataStruct.setErrorRange(-999);//设置丰度比偏差
|
||||
npsTestDetailDataStruct.setAbundanceRatioError(-999);//设置偏差范围
|
||||
npsTestDetailDataStruct.setAbundanceRatio(TestRecordSampleDataConstant.INVALID_VALUE);//设置检材丰度比
|
||||
npsTestDetailDataStruct.setAbundanceRatio_std(TestRecordSampleDataConstant.INVALID_VALUE);//设置标准物质丰度比
|
||||
npsTestDetailDataStruct.setErrorRange(TestRecordSampleDataConstant.INVALID_VALUE);//设置丰度比偏差
|
||||
npsTestDetailDataStruct.setAbundanceRatioError(TestRecordSampleDataConstant.INVALID_VALUE);//设置偏差范围
|
||||
npsTestDetailDataStruct.setWithinError("/");//设置是否在误差范围内
|
||||
npsTestDetailDataStruct.setIsBasePeak(1);//设置他是基峰
|
||||
}
|
||||
@@ -1471,9 +1410,9 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
TestRecordSampleDataConstant.NOT_CHECK_OUT + npsCaseTestDataDto.getCompoundName());
|
||||
npsCaseTestDataDto.setSampleType(TestRecordSampleDataConstant.SAMPLE_TYPE_ANALYTE);
|
||||
} else {
|
||||
npsCaseTestDataDto.setTargetRtTime(-999);//设置样品的保留时间
|
||||
npsCaseTestDataDto.setStdRtTime(-999);
|
||||
npsCaseTestDataDto.setRtTimeError(-999);
|
||||
npsCaseTestDataDto.setTargetRtTime(TestRecordSampleDataConstant.INVALID_VALUE);//设置样品的保留时间
|
||||
npsCaseTestDataDto.setStdRtTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsCaseTestDataDto.setRtTimeError(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsCaseTestDataDto.setRtTimeWithinError("/");
|
||||
npsCaseTestDataDto.setIsDetected(0);//1是检出,0是未检出
|
||||
npsCaseTestDataDto.setWhetherCheckOut(TestRecordSampleDataConstant.NOT_CHECK_OUT + npsCaseTestDataDto.getCompoundName());
|
||||
@@ -1922,12 +1861,9 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
.eq(TestRecordSampleData::getTestId, data.getTestId())
|
||||
.eq(TestRecordSampleData::getSampleType, "STD"));
|
||||
|
||||
if (data.getMainArea() != null &&
|
||||
data.getMinorArea() != null &&
|
||||
data.getTargetRtTime() != null &&
|
||||
std.getMainArea() != null &&
|
||||
std.getMinorArea() != null &&
|
||||
std.getTargetRtTime() != null) {
|
||||
if (
|
||||
data.getTargetRtTime() != null && std.getTargetRtTime() != null
|
||||
) {
|
||||
TestRecord testRecord = testRecordService.getById(data.getTestId());
|
||||
if (testRecord.getBusinessType().equals(BusinessType.BOINT_CASE.getBusinessType())) {
|
||||
data.setRtTimeWithinError(
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package digital.laboratory.platform.inspection.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConstant;
|
||||
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.service.TestRecordSampledataExpandService;
|
||||
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSTestDetailDataStruct;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ChenJiangBao
|
||||
* @description 针对表【b_test_record_sampledata_expand(样本检验数据的扩展信息)】的数据库操作Service实现
|
||||
* @createDate 2025-03-19 14:58:17
|
||||
*/
|
||||
@Service
|
||||
public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecordSampledataExpandMapper, TestRecordSampleDataExpand>
|
||||
implements TestRecordSampledataExpandService{
|
||||
|
||||
/**
|
||||
* 封装处理毛发案件、任务等检验扩展数据信息
|
||||
* @param hairSewageDataDto
|
||||
* @param testDataId
|
||||
* @return
|
||||
*/
|
||||
public Collection<? extends TestRecordSampleDataExpand> saveHairSewageInspectExpData(HairSewageDataDto hairSewageDataDto, String testDataId) {
|
||||
List<TestRecordSampleDataExpand> hairSewageInspectExpDataList = new ArrayList<>();
|
||||
|
||||
// 设置基峰的扩展数据
|
||||
if (!TestRecordSampleDataConstant.isInvalidValue(hairSewageDataDto.getPeakAreaUp())) {
|
||||
hairSewageInspectExpDataList.add(createTestRecordSampleDataExpand(testDataId, Boolean.TRUE,
|
||||
hairSewageDataDto.getPeakAreaUp(), null, null, null, null));
|
||||
}
|
||||
|
||||
if (!TestRecordSampleDataConstant.isInvalidValue(hairSewageDataDto.getPeakAreaDown())) {
|
||||
hairSewageInspectExpDataList.add(createTestRecordSampleDataExpand(testDataId, Boolean.FALSE,
|
||||
hairSewageDataDto.getPeakAreaDown(), hairSewageDataDto.getIonAbundanceRatio(),
|
||||
hairSewageDataDto.getIonAbundanceRatioWithinError(), hairSewageDataDto.getWhetherCheckOut(), null));
|
||||
}
|
||||
|
||||
return hairSewageInspectExpDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装处理nps案件检验扩展数据信息
|
||||
*
|
||||
* @param npsCaseTestDataDto
|
||||
* @param testDataId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Collection<? extends TestRecordSampleDataExpand> saveNPSInspectExpData(NPSCaseTestDataDto npsCaseTestDataDto, String testDataId) {
|
||||
// 检验数据
|
||||
List<NPSTestDetailDataStruct> npsTestSampleDataList = npsCaseTestDataDto.getTestSampleDataList();
|
||||
|
||||
List<TestRecordSampleDataExpand> testRecordSampleDataExpandList = npsTestSampleDataList.stream().map(item -> {
|
||||
return createTestRecordSampleDataExpand(
|
||||
testDataId,
|
||||
item.getIsBasePeak() == 1 ? Boolean.TRUE : Boolean.FALSE,
|
||||
item.getArea(),
|
||||
item.getAbundanceRatio(),
|
||||
item.getAbundanceRatioError(),
|
||||
item.getWithinError(),
|
||||
null
|
||||
);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return testRecordSampleDataExpandList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据提供的参数创建一个TestRecordSampleDataExpand对象。
|
||||
*
|
||||
* @param testDataId 测试数据ID
|
||||
* @param isBasePeak 是否为基本峰
|
||||
* @param peakArea 峰面积
|
||||
* @param ionAbundanceRatio 离子丰度比
|
||||
* @param ionAbundanceRatioError 离子丰度比误差
|
||||
* @param ionAbundanceRatioWithinError 离子丰度比是否在误差范围内
|
||||
* @param someOtherValue 其他值
|
||||
* @return 创建的TestRecordSampleDataExpand对象
|
||||
*/
|
||||
private TestRecordSampleDataExpand createTestRecordSampleDataExpand(
|
||||
String testDataId,
|
||||
Boolean isBasePeak,
|
||||
Double peakArea,
|
||||
Double ionAbundanceRatio,
|
||||
Double ionAbundanceRatioError,
|
||||
String ionAbundanceRatioWithinError,
|
||||
Double someOtherValue
|
||||
) {
|
||||
TestRecordSampleDataExpand testRecordSampleDataExpand = new TestRecordSampleDataExpand();
|
||||
testRecordSampleDataExpand.setTestDataId(testDataId);
|
||||
testRecordSampleDataExpand.setId(IdWorker.getIdStr());
|
||||
testRecordSampleDataExpand.setBasePeak(isBasePeak);
|
||||
testRecordSampleDataExpand.setPeakArea(BigDecimal.valueOf(peakArea)); // 注意: BigDecimal.valueOf(double)
|
||||
|
||||
if (ionAbundanceRatio != null) {
|
||||
testRecordSampleDataExpand.setIonAbundanceRatio(BigDecimal.valueOf(ionAbundanceRatio));
|
||||
}
|
||||
|
||||
if (ionAbundanceRatioError != null) {
|
||||
testRecordSampleDataExpand.setIonAbundanceRatioError(BigDecimal.valueOf(ionAbundanceRatioError));
|
||||
}
|
||||
|
||||
if (ionAbundanceRatioWithinError != null) {
|
||||
testRecordSampleDataExpand.setIonAbundanceRatioWithinError(ionAbundanceRatioWithinError);
|
||||
}
|
||||
|
||||
// 如果有其他需要设置的值,可以继续扩展
|
||||
if (someOtherValue != null) {
|
||||
// 处理其他值的设置逻辑
|
||||
}
|
||||
|
||||
return testRecordSampleDataExpand;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -852,17 +852,17 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
||||
break;
|
||||
}
|
||||
if (!item.getSampleType().startsWith("空")) {
|
||||
if (item.getTargetRtTime() == -999.0 || item.getTargetRtTime() == 0.00) {
|
||||
if (TestRecordSampleDataConstant.isInvalidValue(item.getTargetRtTime()) || item.getTargetRtTime() == 0.00) {
|
||||
item.setTmpTargetRtTime("/");
|
||||
} else {
|
||||
item.setTmpTargetRtTime(String.format("%.02f", item.getTargetRtTime()));
|
||||
}
|
||||
if (item.getRtTimeError() == -999.0 || item.getRtTimeError() == -100 || item.getRtTimeError() == 0.00) {
|
||||
if (TestRecordSampleDataConstant.isInvalidValue(item.getRtTimeError()) || item.getRtTimeError() == -100 || item.getRtTimeError() == 0.00) {
|
||||
item.setTmpRtTimeError("/");
|
||||
} else {
|
||||
item.setTmpRtTimeError(String.format("%.02f", item.getRtTimeError()));
|
||||
}
|
||||
if (item.getIonAbundanceRatioWithinError() == -999.0 || item.getIonAbundanceRatioWithinError() == -100) {
|
||||
if (TestRecordSampleDataConstant.isInvalidValue(item.getIonAbundanceRatioWithinError()) || item.getIonAbundanceRatioWithinError() == -100) {
|
||||
item.setTmpIonAbundanceRatioWithinError("/");
|
||||
} else {
|
||||
item.setTmpIonAbundanceRatioWithinError(String.format("%.02f", item.getIonAbundanceRatioWithinError()));
|
||||
@@ -1080,7 +1080,7 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
||||
}
|
||||
row3.getCell(1).setText(String.format("%.02f", struct.getSn()));
|
||||
row3.getCell(2).setText(String.valueOf((int) struct.getArea()));
|
||||
if (Double.compare(struct.getAbundanceRatio(), -999) == 0) {
|
||||
if (Double.compare(struct.getAbundanceRatio(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
row3.getCell(3).setText("/");
|
||||
} else {
|
||||
row3.getCell(3).setText(String.format("%.02f", struct.getAbundanceRatio()) + "%");
|
||||
@@ -1149,19 +1149,19 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
||||
sampleData.setSampleNo(caseTest.getSampleNo());
|
||||
sampleData.setTargetConcentration(caseTest.getTargetConcentration());
|
||||
|
||||
if (Double.compare(caseTest.getStdRtTime(), -999) == 0) {
|
||||
if (Double.compare(caseTest.getStdRtTime(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setStdRtTime("/");
|
||||
} else {
|
||||
sampleData.setStdRtTime(String.format("%.02f", caseTest.getStdRtTime()) + "%");
|
||||
}
|
||||
|
||||
if (Double.compare(caseTest.getRtTimeError(), -999) == 0) {
|
||||
if (Double.compare(caseTest.getRtTimeError(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setRtTimeError("/");
|
||||
} else {
|
||||
sampleData.setRtTimeError(String.format("%.02f", caseTest.getRtTimeError()) + "%");
|
||||
}
|
||||
|
||||
if (Double.compare(caseTest.getTargetRtTime(), -999) == 0) {
|
||||
if (Double.compare(caseTest.getTargetRtTime(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setTargetRtTime("/");
|
||||
} else {
|
||||
sampleData.setTargetRtTime(String.format("%.02f", caseTest.getTargetRtTime()) + "%");
|
||||
@@ -1174,25 +1174,25 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
||||
sampleData.setMass(String.valueOf((int) Double.parseDouble(dataStruct.getMass())));
|
||||
}
|
||||
|
||||
if (Double.compare(dataStruct.getAbundanceRatio(), -999) == 0) {
|
||||
if (Double.compare(dataStruct.getAbundanceRatio(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setAbundanceRatio("/");
|
||||
} else {
|
||||
sampleData.setAbundanceRatio(String.format("%.02f", dataStruct.getAbundanceRatio()) + "%");
|
||||
}
|
||||
|
||||
if (Double.compare(dataStruct.getAbundanceRatio_std(), -999) == 0) {
|
||||
if (Double.compare(dataStruct.getAbundanceRatio_std(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setAbundanceRatio_std("/");
|
||||
} else {
|
||||
sampleData.setAbundanceRatio_std(String.format("%.02f", dataStruct.getAbundanceRatio_std()) + "%");
|
||||
}
|
||||
|
||||
if (Double.compare(dataStruct.getAbundanceRatioError(), -999) == 0) {
|
||||
if (Double.compare(dataStruct.getAbundanceRatioError(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setAbundanceRatioError("/");
|
||||
} else {
|
||||
sampleData.setAbundanceRatioError(String.format("%.02f", dataStruct.getAbundanceRatioError()) + "%");
|
||||
}
|
||||
|
||||
if (Double.compare(dataStruct.getErrorRange(), -999) == 0) {
|
||||
if (Double.compare(dataStruct.getErrorRange(), TestRecordSampleDataConstant.INVALID_VALUE) == 0) {
|
||||
sampleData.setErrorRange("/");
|
||||
} else {
|
||||
sampleData.setErrorRange("±" + (int) dataStruct.getErrorRange() + "%");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package digital.laboratory.platform.inspection.utils.datafile;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConstant;
|
||||
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSDataFileStruct;
|
||||
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSTestDetailDataStruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -204,16 +205,16 @@ public class NPSDataFileUtil {
|
||||
if (rowData[5].equals("Not Identified")) {
|
||||
// 如果文件中存在这个信息,则证明这条数据是未检出的, 下面的值都默认设置为0
|
||||
npsDataFileStructChild.setNotIdentified(true);
|
||||
npsDataFileStructChild.setRetTime(-999);
|
||||
npsDataFileStructChild.setStartTime(-999);
|
||||
npsDataFileStructChild.setEndTime(-999);
|
||||
npsDataFileStructChild.setArea(-999);
|
||||
npsDataFileStructChild.setStdRetTime(-999);
|
||||
npsDataFileStructChild.setSn(-999);
|
||||
npsDataFileStructChild.setAbundanceRatio(-999);//设置检材丰度比
|
||||
npsDataFileStructChild.setAbundanceRatio_std(-999);//设置标准物质丰度比
|
||||
npsDataFileStructChild.setErrorRange(-999);//设置丰度比偏差
|
||||
npsDataFileStructChild.setAbundanceRatioError(-999);//设置偏差范围
|
||||
npsDataFileStructChild.setRetTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setStartTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setEndTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setArea(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setStdRetTime(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setSn(TestRecordSampleDataConstant.INVALID_VALUE);
|
||||
npsDataFileStructChild.setAbundanceRatio(TestRecordSampleDataConstant.INVALID_VALUE);//设置检材丰度比
|
||||
npsDataFileStructChild.setAbundanceRatio_std(TestRecordSampleDataConstant.INVALID_VALUE);//设置标准物质丰度比
|
||||
npsDataFileStructChild.setErrorRange(TestRecordSampleDataConstant.INVALID_VALUE);//设置丰度比偏差
|
||||
npsDataFileStructChild.setAbundanceRatioError(TestRecordSampleDataConstant.INVALID_VALUE);//设置偏差范围
|
||||
npsDataFileStructChild.setWithinError("/");//设置是否在误差范围内
|
||||
npsDataFileStructChild.setIsBasePeak(1);//设置他是基峰
|
||||
} else {
|
||||
|
||||
@@ -3,19 +3,39 @@
|
||||
<!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.TestRecordSampleDataMapper">
|
||||
<resultMap id="testRecordMap" type="digital.laboratory.platform.inspection.vo.TestResultBusinessVO">
|
||||
<id property="id" column="id"/>
|
||||
<result property="id" column="id"/>
|
||||
<result property="businessType" column="business_type"/>
|
||||
<result property="materialType" column="material_type"/>
|
||||
<result property="reportConfig" column="report_config" typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
|
||||
<result property="caseName" column="case_name" />
|
||||
<result property="type" column="type"/>
|
||||
<result property="compounds" column="compounds"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="status" column="device_use_condition" />
|
||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.inspection.entity.TestRecordSampleData">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="sampleNo" column="sample_no" jdbcType="VARCHAR"/>
|
||||
<result property="testId" column="test_id" jdbcType="VARCHAR"/>
|
||||
<result property="stdConcentration" column="std_concentration" jdbcType="VARCHAR"/>
|
||||
<result property="sampleConcentration" column="sample_concentration" jdbcType="VARCHAR"/>
|
||||
<result property="compoundName" column="compound_name" jdbcType="VARCHAR"/>
|
||||
<result property="rtTimeWithinError" column="rt_time_within_error" jdbcType="VARCHAR"/>
|
||||
<result property="rtTimeError" column="rt_time_error" jdbcType="DOUBLE"/>
|
||||
<result property="targetRtTime" column="target_rt_time" jdbcType="DOUBLE"/>
|
||||
<result property="stdRtTime" column="std_rt_time" jdbcType="DOUBLE"/>
|
||||
<result property="isDetected" column="is_detected" jdbcType="INTEGER"/>
|
||||
<result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
|
||||
<result property="dataJson" column="data_json" jdbcType="VARCHAR"/>
|
||||
<result property="dataResultJson" column="data_result_json" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="TINYINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="compoundCnName" column="compound_cn_name" jdbcType="VARCHAR"/>
|
||||
</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
|
||||
</sql>
|
||||
<!-- 合并委托、任务、筛查表-->
|
||||
<sql id="queryCommoneBusinessSql">
|
||||
SELECT T.id,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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">
|
||||
|
||||
<resultMap id="BaseResultMap" type="digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand">
|
||||
<id property="id" column="exp_id" jdbcType="VARCHAR"/>
|
||||
<result property="testDataId" column="test_data_id" jdbcType="VARCHAR"/>
|
||||
<result property="peakArea" column="peak_area" jdbcType="DECIMAL"/>
|
||||
<result property="basePeak" column="base_peak" jdbcType="TINYINT"/>
|
||||
<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="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</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
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user