增加了一些适配贵阳市局的新字段,现在我们不需要导入数据,通过手动录入数据的方式来进行检验分析以及生成检验记录了
This commit is contained in:
@@ -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("修改失败!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,13 +50,16 @@ 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())) {
|
||||
testRecordReagent.setId(IdWorker.get32UUID());
|
||||
log.info("保存对象testRecordReagent的ID为空,由系统生成一个给它使用 {}", testRecordReagent.getId());
|
||||
}
|
||||
if (!testRecordReagent.getCategory().equals("试剂")){
|
||||
if (!testRecordReagent.getCategory().equals("试剂")) {
|
||||
testRecordReagent.setPurityGrade("/");
|
||||
}
|
||||
boolean ret = this.save(testRecordReagent);
|
||||
@@ -83,6 +88,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
|
||||
/**
|
||||
* 删除试剂耗材
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@@ -106,11 +112,12 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
|
||||
/**
|
||||
* 实验分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param testId
|
||||
* @param keywords 标准物质编号、名称查询参数
|
||||
* @param category 类别查询参数
|
||||
* @param opCode 1:查询所有的试剂耗材 -1:查询这个实验下的试剂耗材
|
||||
* @param opCode 1:查询所有的试剂耗材 -1:查询这个实验下的试剂耗材
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@@ -151,11 +158,12 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
|
||||
/**
|
||||
* 模板分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param testId
|
||||
* @param keywords 标准物质编号、名称查询参数
|
||||
* @param category 类别查询参数
|
||||
* @param opCode 1:查询所有的试剂耗材 -1:查询这个模板下的试剂耗材
|
||||
* @param opCode 1:查询所有的试剂耗材 -1:查询这个模板下的试剂耗材
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@@ -195,6 +203,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
|
||||
/**
|
||||
* 实验列表查询
|
||||
*
|
||||
* @param testId
|
||||
* @param category 类别查询参数
|
||||
* @return
|
||||
@@ -210,7 +219,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl<TestRecordReagentM
|
||||
categoryList.add("标准储备溶液");
|
||||
}
|
||||
TestRecordVo testRecordVo = testRecordMapper.getTestRecordMapById(testId);
|
||||
List<String> reagentConsumablesList = testRecordVo.getReagentConsumablesList();
|
||||
List<String> reagentConsumablesList = testRecordVo.getReagentConsumablesList();
|
||||
if (reagentConsumablesList == null || reagentConsumablesList.size() == 0) {
|
||||
//下面两步是为了能使参数正常查询
|
||||
reagentConsumablesList = new ArrayList<>();
|
||||
@@ -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;
|
||||
@@ -720,13 +719,13 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
// .append(index.getAndIncrement())
|
||||
// .append("、")
|
||||
.append(first.getOrderNo()).append("号");
|
||||
if (value.size() > 1) {
|
||||
stringBuilder.append("至").append(value.get(value.size() - 1).getOrderNo()).append("号");
|
||||
}
|
||||
stringBuilder.append("检材")
|
||||
.append(first.getIsDetected() == 1 ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT)
|
||||
.append(first.getCompoundName())
|
||||
.append("\n");
|
||||
if (value.size() > 1) {
|
||||
stringBuilder.append("至").append(value.get(value.size() - 1).getOrderNo()).append("号");
|
||||
}
|
||||
stringBuilder.append("检材")
|
||||
.append(first.getIsDetected() == 1 ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT)
|
||||
.append(first.getCompoundName())
|
||||
.append("\n");
|
||||
});
|
||||
} else {
|
||||
dataMap.forEach((key, value) -> {
|
||||
@@ -927,7 +926,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
// try {
|
||||
List<TestRecordSampleData> testRecordSampleDataList = buildSampleDataFromNps(npsDataFileStructList, testId);//构造实验数据
|
||||
testRecordService.update(Wrappers.<TestRecord>lambdaUpdate().eq(TestRecord::getId, testId).set(TestRecord::getStatus, 2));
|
||||
return true;
|
||||
return true;
|
||||
// } catch (Exception err) {
|
||||
// log.info("程序执行异常{}", err.getMessage());
|
||||
// err.printStackTrace();
|
||||
@@ -1562,6 +1561,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
||||
|
||||
@Resource
|
||||
private RemoteDictDataService remoteDictDataService;
|
||||
|
||||
/**
|
||||
* 根据化合物名称找出基峰的对应的数据
|
||||
*
|
||||
@@ -1912,4 +1912,99 @@ 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() != 0.0 &&
|
||||
data.getMinorArea() != 0.0 &&
|
||||
data.getTargetRtTime() != 0.0 &&
|
||||
std.getMainArea() != 0.0 &&
|
||||
std.getMinorArea() != 0.0 &&
|
||||
std.getTargetRtTime() != 0.0) {
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user