Merge remote-tracking branch 'origin/master'

master
陈江保 2 weeks ago
commit 31eebdf728
  1. 10
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataController.java
  2. 8
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java
  3. 7
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampleDataService.java
  4. 19
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java
  5. 98
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java
  6. 12
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java

@ -299,4 +299,14 @@ public class TestRecordSampleDataController {
});
return R.ok("更新成功!");
}
@PutMapping("/updateData")
public R updateData(@RequestBody TestRecordSampleData data) {
TestRecordSampleData sampleData = testRecordSampleDataService.updateData(data);
return sampleData != null ? R.ok(sampleData, "修改成功!") : R.failed("修改失败!");
}
}

@ -34,9 +34,9 @@ public class TestRecordSampleData extends BaseEntity {
private String rtTimeWithinError;//保留时间是否在误差范围 ±1 以内
private double targetRtTime;//目标物保留时间
private Double targetRtTime;//目标物保留时间
private double stdRtTime;//标准物保留时间
private Double stdRtTime;//标准物保留时间
private int isDetected;//是否检出目标化合物
@ -48,6 +48,10 @@ public class TestRecordSampleData extends BaseEntity {
private String compoundCnName;//检测的化合物的中文名字
private Double mainArea;//主要产物峰面积
private Double minorArea;//次要产物峰面积
@ApiModelProperty("任务数据审核状态, 状态:\n" +
"0 待审核,\n" +
"1 已审核,\n" +

@ -11,6 +11,7 @@ import digital.laboratory.platform.inspection.entity.TestRecordSampleData;
import digital.laboratory.platform.inspection.utils.datafile.hair.HairSewageCompoundData;
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSDataFileStruct;
import digital.laboratory.platform.inspection.vo.TestResultBusinessVO;
import digital.laboratory.platform.inspetion.api.entity.TestRecord;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@ -156,6 +157,12 @@ public interface TestRecordSampleDataService extends IService<TestRecordSampleD
*/
R auditTaskTestData(AuditDataDTO auditDataDTO, HttpServletRequest httpServletRequest);
void autoCreateData(String testId, String compoundName);
boolean autoDelData(String testId, String compoundName);
TestRecordSampleData updateData(TestRecordSampleData data);
//获取标准品样品信息数据
// List<NPSCaseTestDataDto> getStdSampleTestDataByTestId(String testId);

@ -9,10 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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;
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.inspetion.api.vo.TestRecordVo;
@ -48,6 +50,9 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
@Resource
private TestTemplateMapper testTemplateMapper;
@Resource
private TestRecordSampleDataService testRecordSampleDataService;
@Override
public TestRecordReagent addTestRecordReagent(TestRecordReagent testRecordReagent) {
if (StringUtils.isBlank(testRecordReagent.getId())) {
@ -83,6 +88,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
/**
* 删除试剂耗材
*
* @param id
* @return
*/
@ -106,6 +112,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
/**
* 实验分页查询
*
* @param page
* @param testId
* @param keywords 标准物质编号名称查询参数
@ -151,6 +158,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
/**
* 模板分页查询
*
* @param page
* @param testId
* @param keywords 标准物质编号名称查询参数
@ -195,6 +203,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
/**
* 实验列表查询
*
* @param testId
* @param category 类别查询参数
* @return
@ -237,6 +246,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
/**
* 向实验添加或移除试剂耗材
*
* @param testRecordArgumentDto
* @return
*/
@ -244,12 +254,21 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
@Transactional(rollbackFor = Exception.class)
public boolean useTestRecordReagent(TestRecordArgumentDto testRecordArgumentDto) {
TestRecordReagent testRecordReagent = this.getById(testRecordArgumentDto.getArgumentId());
if (testRecordReagent.getCategory().equals("标准物质")) {
Integer opCode = testRecordArgumentDto.getOpCode();
if (opCode == 1) {
testRecordSampleDataService.autoCreateData(testRecordArgumentDto.getTestRecordId(), testRecordArgumentDto.getArgumentId());
}else if (opCode == -1) {
testRecordSampleDataService.autoDelData(testRecordArgumentDto.getTestRecordId(), testRecordArgumentDto.getArgumentId());
}
}
testRecordReagent.setUpdateTime(LocalDateTime.now());
return this.updateById(testRecordReagent) && testRecordService.updateTestRecordArgument(testRecordArgumentDto.getTestRecordId(), testRecordArgumentDto.getArgumentId(), TestRecordArgumentType.TEST_RECORD_ARGUMENT_REAGENT.getType(), testRecordArgumentDto.getOpCode());
}
/**
* 向模板添加或移除试剂耗材
*
* @param testRecordArgumentDto
* @return
*/

@ -51,7 +51,6 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -1562,6 +1561,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
@Resource
private RemoteDictDataService remoteDictDataService;
/**
* 根据化合物名称找出基峰的对应的数据
*
@ -1912,4 +1912,100 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
return StrUtil.isBlank(existingResult) ? newResult : existingResult + "、" + newResult;
}
/**
* 自动创建测试记录样本数据
*
* @param testId 测试记录的ID
* @param compoundName 化合物名称
*/
@Override
public void autoCreateData(String testId, String compoundName) {
// 根据测试记录ID获取测试记录对象
TestRecord testRecord = testRecordService.getById(testId);
// 从测试记录中获取样本测试ID列表
List<String> sampleIdList = testRecord.getSampleTestList();
// 根据样本ID列表查询样本信息列表
List<SampleInfo> sampleInfos = sampleInfoService.list(Wrappers.<SampleInfo>lambdaQuery()
.in(SampleInfo::getId, sampleIdList));
// 用于存储生成的测试记录样本数据的列表
ArrayList<TestRecordSampleData> sampleDataList = new ArrayList<>();
// 创建一个标准样本数据对象
TestRecordSampleData data = new TestRecordSampleData();
// 设置化合物名称
data.setCompoundName(compoundName);
// 设置样本编号,格式为 "STD-" 加上化合物名称
data.setSampleNo("STD-" + compoundName);
// 设置样本类型为 "STD"
data.setSampleType("STD");
// 设置样本名称,格式为 "STD-" 加上化合物名称
data.setName("STD-" + compoundName);
// 设置样本状态为 0
data.setStatus(0);
// 生成一个32位的大写UUID作为样本数据ID
data.setId(IdWorker.get32UUID().toUpperCase());
// 将标准样本数据添加到样本数据列表中
sampleDataList.add(data);
// 遍历样本信息列表,为每个样本创建对应的测试记录样本数据
sampleInfos.forEach(item -> {
TestRecordSampleData sampleData = new TestRecordSampleData();
// 设置化合物名称
data.setCompoundName(compoundName);
// 设置样本编号为样本的受理编号
data.setSampleNo(item.getAcceptNo());
// 设置样本类型为 "Analyte"
data.setSampleType("Analyte");
// 设置样本名称为样本的受理编号
data.setName(item.getAcceptNo());
// 设置样本状态为 0
data.setStatus(0);
// 生成一个32位的大写UUID作为样本数据ID
data.setId(IdWorker.get32UUID().toUpperCase());
// 将样本数据添加到样本数据列表中
sampleDataList.add(data);
});
}
/**
* 自动删除指定测试记录和化合物名称对应的测试记录样本数据
*
* @param testId 测试记录的ID
* @param compoundName 化合物名称
* @return 如果删除成功返回 true否则返回 false
*/
@Override
public boolean autoDelData(String testId, String compoundName) {
// 根据测试记录ID和化合物名称删除对应的测试记录样本数据
return this.remove(Wrappers.<TestRecordSampleData>lambdaQuery()
.eq(TestRecordSampleData::getTestId, testId)
.eq(TestRecordSampleData::getCompoundName, compoundName));
}
@Override
public TestRecordSampleData updateData(TestRecordSampleData data) {
if (this.getById(data.getId()) == null) {
throw new RuntimeException("数据不存在");
}
String compoundName = data.getCompoundName();
TestRecordSampleData std = this.getOne(Wrappers.<TestRecordSampleData>lambdaQuery()
.eq(TestRecordSampleData::getCompoundName, compoundName)
.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) {
System.out.println("所有属性都不为 null");
}
return this.updateById(data) ? data : null;
}
}

@ -1336,12 +1336,12 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
resultData.put("path", commonPath);
return R.failed(resultData, "上传实验图谱失败");
}
if (testAtlas.size() > 0) {
// 删除之前上传的
JSONObject oldObject = testAtlas.getJSONObject(0);
ossFile.fileDelete(oldObject.getString("path"));
testAtlas = new JSONArray();
}
// if (testAtlas.size() > 0) {
// // 删除之前上传的
// JSONObject oldObject = testAtlas.getJSONObject(0);
// ossFile.fileDelete(oldObject.getString("path"));
// testAtlas = new JSONArray();
// }
JSONObject jsonObject = new JSONObject();
jsonObject.put("fileId", fileId);
jsonObject.put("fileName", fileName);

Loading…
Cancel
Save