Merge remote-tracking branch 'origin/master'
# Conflicts: # dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/IdentifyBookDataServiceImpl.java
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ public interface RemoteTestToIdentifyService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value="/identifyBookData/getIdentifyBookDataByBusinessId", headers = SecurityConstants.HEADER_FROM_IN)
|
@GetMapping(value="/identifyBookData/getIdentifyBookDataByBusinessId", headers = SecurityConstants.HEADER_FROM_IN)
|
||||||
public R getIdentifyBookDataByBusinessId(@RequestParam("businessId") String businessId);
|
public R<IdentificationBookDTO> getIdentifyBookDataByBusinessId(@RequestParam("businessId") String businessId);
|
||||||
|
|
||||||
@PostMapping(value="/identifyBookData/getTestFinishBusinessData", headers = SecurityConstants.HEADER_FROM_IN)
|
@PostMapping(value="/identifyBookData/getTestFinishBusinessData", headers = SecurityConstants.HEADER_FROM_IN)
|
||||||
public R getTestFinishBusinessData(@RequestBody List<String> synedIdList);
|
public R getTestFinishBusinessData(@RequestBody List<String> synedIdList);
|
||||||
|
|||||||
+9
-2
@@ -1,7 +1,9 @@
|
|||||||
package digital.laboratory.platform.inspection.controller;
|
package digital.laboratory.platform.inspection.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import digital.laboratory.platform.common.core.util.R;
|
import digital.laboratory.platform.common.core.util.R;
|
||||||
import digital.laboratory.platform.inspection.service.IdentifyBookDataService;
|
import digital.laboratory.platform.inspection.service.IdentifyBookDataService;
|
||||||
|
import digital.laboratory.platform.inspetion.api.entity.IdentificationBookDTO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -25,8 +27,13 @@ public class IdentifyBookController {
|
|||||||
//对文书系统提供获取实验数据
|
//对文书系统提供获取实验数据
|
||||||
@GetMapping("/getIdentifyBookDataByBusinessId")
|
@GetMapping("/getIdentifyBookDataByBusinessId")
|
||||||
@ApiOperation(value = "获取检验数据")
|
@ApiOperation(value = "获取检验数据")
|
||||||
public R getIdentifyBookDataByBusinessId(String businessId){
|
public R<IdentificationBookDTO> getIdentifyBookDataByBusinessId(String businessId){
|
||||||
return identifyBookDataService.getIdentifyBookDataByBusinessId(businessId);
|
try {
|
||||||
|
return R.ok(identifyBookDataService.getIdentifyBookDataByBusinessId(businessId),"构建数据成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return R.failed("获取检验数据失败!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@PostMapping("/getTestFinishBusinessData")
|
@PostMapping("/getTestFinishBusinessData")
|
||||||
@ApiOperation(value = "获取待制作文书列表")
|
@ApiOperation(value = "获取待制作文书列表")
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ package digital.laboratory.platform.inspection.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import digital.laboratory.platform.common.core.util.R;
|
import digital.laboratory.platform.common.core.util.R;
|
||||||
|
import digital.laboratory.platform.inspetion.api.entity.IdentificationBookDTO;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -20,7 +21,7 @@ public interface IdentifyBookDataService {
|
|||||||
* @param businessId
|
* @param businessId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
R getIdentifyBookDataByBusinessId(String businessId);
|
IdentificationBookDTO getIdentifyBookDataByBusinessId(String businessId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完成实验的数据
|
* 获取完成实验的数据
|
||||||
|
|||||||
+26
-38
@@ -69,25 +69,22 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
}
|
}
|
||||||
return R.ok(entrustInfoList,"获取数据成功");
|
return R.ok(entrustInfoList,"获取数据成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文书的数据
|
* 获取文书的数据
|
||||||
*
|
|
||||||
* @param businessId
|
* @param businessId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R getIdentifyBookDataByBusinessId(String businessId) {
|
public IdentificationBookDTO getIdentifyBookDataByBusinessId(String businessId) {
|
||||||
//一个委托案件,只能属于一个实验,不允许一个委托中的检材分配到2个实验中做实验,这个是前提
|
//一个委托案件,只能属于一个实验,不允许一个委托中的检材分配到2个实验中做实验,这个是前提
|
||||||
if(ObjectUtils.isNotEmpty(businessId)){
|
if(ObjectUtils.isNotEmpty(businessId)){
|
||||||
IdentificationBookDTO identificationBookDTO = buildBookDataDetail(businessId);
|
IdentificationBookDTO identificationBookDTO = buildBookDataDetail(businessId);
|
||||||
return R.ok(identificationBookDTO, "构建数据成功");
|
return identificationBookDTO;
|
||||||
}else {
|
}else {
|
||||||
log.info("参数业务id不能为空,请检查参数{}",businessId);
|
log.info("参数业务id不能为空,请检查参数{}",businessId);
|
||||||
return R.failed("参数业务id不能为空,请检查参数" + businessId);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//构建文书数据
|
//构建文书数据
|
||||||
private IdentificationBookDTO buildBookDataDetail(String businessId){
|
private IdentificationBookDTO buildBookDataDetail(String businessId){
|
||||||
IdentificationBookDTO bookData=new IdentificationBookDTO();
|
IdentificationBookDTO bookData=new IdentificationBookDTO();
|
||||||
@@ -100,11 +97,12 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
bookData.setSampleInfoList(sampleList);
|
bookData.setSampleInfoList(sampleList);
|
||||||
|
|
||||||
//设置检验结果
|
//设置检验结果
|
||||||
|
List<TestRecordSampleSolution> testRecordSampleSolutionList = getTestRecordSampleSolution(sampleList);//样本溶液
|
||||||
List<TestRecordSampleData> testRecordSampleDataList = getTestRecordSampleData(sampleList);//样本溶液对应的数据
|
List<TestRecordSampleData> testRecordSampleDataList = getTestRecordSampleData(sampleList);//样本溶液对应的数据
|
||||||
List<TestResult> testResultsList = buildTestResult(testRecordSampleDataList, sampleList);//构建检验结果
|
List<TestResult> testResultsList = buildTestResult(testRecordSampleDataList, testRecordSampleSolutionList, sampleList);//构建检验结果
|
||||||
TestRecord testRecordInfo = testRecordService.getById(testRecordSampleDataList.get(0).getTestId());
|
TestRecord testRecordInfo = getTestRecordInfo(testRecordSampleSolutionList);
|
||||||
//实验信息
|
//实验信息
|
||||||
bookData.setTestMethod(getTestMethods(testRecordInfo));//设置用到的实验方法
|
bookData.setTestMethod(getTestMethods(testRecordSampleSolutionList));//设置用到的实验方法
|
||||||
//设置检验过程
|
//设置检验过程
|
||||||
bookData.setTestProcessDes(testRecordInfo.getTestProcessDes());//设置检验过程
|
bookData.setTestProcessDes(testRecordInfo.getTestProcessDes());//设置检验过程
|
||||||
bookData.setTestResult(testRecordSampleDataService.generateQualitativeResults(businessId));
|
bookData.setTestResult(testRecordSampleDataService.generateQualitativeResults(businessId));
|
||||||
@@ -117,7 +115,6 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
bookData.setTestFinishDate(sdf.format(testRecordInfo.getUpdateTime()));
|
bookData.setTestFinishDate(sdf.format(testRecordInfo.getUpdateTime()));
|
||||||
return bookData;
|
return bookData;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取业务的实验对象
|
//获取业务的实验对象
|
||||||
private TestRecord getTestRecordInfo(List<TestRecordSampleSolution> testRecordSampleSolutionList){
|
private TestRecord getTestRecordInfo(List<TestRecordSampleSolution> testRecordSampleSolutionList){
|
||||||
List<String> testIdList= testRecordSampleSolutionList.stream().map(s -> s.getTestId()).collect(Collectors.toList());
|
List<String> testIdList= testRecordSampleSolutionList.stream().map(s -> s.getTestId()).collect(Collectors.toList());
|
||||||
@@ -129,18 +126,12 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
TestRecord testRecord= testRecordService.getById(testId);
|
TestRecord testRecord= testRecordService.getById(testId);
|
||||||
return testRecord;
|
return testRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取实验方法
|
//获取实验方法
|
||||||
private String getTestMethods(TestRecord testRecord) {
|
private String getTestMethods(List<TestRecordSampleSolution> testRecordSampleSolutionList){
|
||||||
List<String> testMethodList = testRecord.getTestMethodList();
|
TestRecord testRecordInfo= getTestRecordInfo(testRecordSampleSolutionList);
|
||||||
if (testMethodList == null || testMethodList.isEmpty()) {
|
List<String> testMethodList= testRecordInfo.getTestMethodList();
|
||||||
return String.format("没有对应的方法数据!"); // 直接返回空列表,避免 SQL 语法错误
|
List<TestRecordMethod> methodsList = testRecordMethodService.list(Wrappers.<TestRecordMethod>lambdaQuery()
|
||||||
}
|
.in(TestRecordMethod::getId, testMethodList));
|
||||||
|
|
||||||
List<TestRecordMethod> methodsList = testRecordMethodService.list(
|
|
||||||
Wrappers.<TestRecordMethod>lambdaQuery().in(TestRecordMethod::getId, testMethodList)
|
|
||||||
);
|
|
||||||
|
|
||||||
List<String> methodsName = methodsList.stream().map(s -> s.getMethodName()).collect(Collectors.toList());
|
List<String> methodsName = methodsList.stream().map(s -> s.getMethodName()).collect(Collectors.toList());
|
||||||
StringBuffer sbMethodNameStr=new StringBuffer();
|
StringBuffer sbMethodNameStr=new StringBuffer();
|
||||||
methodsName.forEach(item->{
|
methodsName.forEach(item->{
|
||||||
@@ -149,18 +140,18 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
sbMethodNameStr.delete(sbMethodNameStr.length()-1,sbMethodNameStr.length());
|
sbMethodNameStr.delete(sbMethodNameStr.length()-1,sbMethodNameStr.length());
|
||||||
return sbMethodNameStr.toString();
|
return sbMethodNameStr.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取sampleData
|
//获取sampleData
|
||||||
private List<TestRecordSampleData> getTestRecordSampleData(List<SampleInfo> sampleInfoList){
|
private List<TestRecordSampleData> getTestRecordSampleData(List<SampleInfo> sampleInfoList){
|
||||||
if (!sampleInfoList.isEmpty()) {
|
List<TestRecordSampleSolution> testRecordSampleSolution = getTestRecordSampleSolution(sampleInfoList);
|
||||||
List<String> sampleNoList = sampleInfoList.stream().map(m -> m.getAcceptNo()).collect(Collectors.toList());//得到样本溶液编号
|
if (CollUtil.isNotEmpty(testRecordSampleSolution)) {
|
||||||
|
List<String> sampleNoList= testRecordSampleSolution.stream().map(m -> m.getSampleNo()).collect(Collectors.toList());//得到样本溶液编号
|
||||||
//根据样本溶液编号查出对应的样本溶液检验数据
|
//根据样本溶液编号查出对应的样本溶液检验数据
|
||||||
List<TestRecordSampleData> sampleTestDataList= getTestRecordData(sampleNoList);
|
List<TestRecordSampleData> sampleTestDataList= getTestRecordData(sampleNoList);
|
||||||
return sampleTestDataList;
|
return sampleTestDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取样本溶液
|
//获取样本溶液
|
||||||
private List<TestRecordSampleSolution> getTestRecordSampleSolution( List<SampleInfo> sampleInfoList){
|
private List<TestRecordSampleSolution> getTestRecordSampleSolution( List<SampleInfo> sampleInfoList){
|
||||||
List<String> materialIdList= sampleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
List<String> materialIdList= sampleInfoList.stream().map(m -> m.getId()).collect(Collectors.toList());
|
||||||
@@ -173,20 +164,25 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
.in(TestRecordSampleSolution::getMaterialId, materialIdList));
|
.in(TestRecordSampleSolution::getMaterialId, materialIdList));
|
||||||
return sampleSolutionList;
|
return sampleSolutionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
//构建TestResult
|
//构建TestResult
|
||||||
private List<TestResult> buildTestResult(List<TestRecordSampleData> testRecordSampleDataList,
|
private List<TestResult> buildTestResult(List<TestRecordSampleData> testRecordSampleDataList,
|
||||||
List<SampleInfo> sampleInfoList) {
|
List<TestRecordSampleSolution> testRecordSampleSolutionList,List<SampleInfo> sampleInfoList){
|
||||||
//结果:应该是加入实验的检材的结果,目前暂定受理的检材我们按照受理顺序,全部定义为 1号检材,2号检材,3号检材等
|
//结果:应该是加入实验的检材的结果,目前暂定受理的检材我们按照受理顺序,全部定义为 1号检材,2号检材,3号检材等
|
||||||
//拿出实验数据中的所有实验样本编号,就是数据文件中的sampleId,也是溶液编号中的溶液编号,
|
//拿出实验数据中的所有实验样本编号,就是数据文件中的sampleId,也是溶液编号中的溶液编号,
|
||||||
List<String> sampleNoList= testRecordSampleDataList.stream().map(s -> s.getSampleNo()).collect(Collectors.toList());
|
List<String> sampleNoList= testRecordSampleDataList.stream().map(s -> s.getSampleNo()).collect(Collectors.toList());
|
||||||
//取出检材ID
|
//取出检材ID
|
||||||
Map<String, SampleInfo> map = sampleInfoList.stream().collect(Collectors.toMap(s -> s.getAcceptNo(), s -> s));
|
List<String> okTestRecordSampleSolutionIdList=new ArrayList<>();
|
||||||
|
testRecordSampleSolutionList.forEach(item->{
|
||||||
|
//如果溶液在提供的溶液编号中,则取出来
|
||||||
|
if(sampleNoList.contains(item.getSampleNo())){
|
||||||
|
okTestRecordSampleSolutionIdList.add(item.getMaterialId());
|
||||||
|
}
|
||||||
|
});
|
||||||
List<TestResult> retTestResult=new ArrayList<>();
|
List<TestResult> retTestResult=new ArrayList<>();
|
||||||
for (TestRecordSampleData testRecordSampleData : testRecordSampleDataList) {
|
for (TestRecordSampleData testRecordSampleData : testRecordSampleDataList) {
|
||||||
TestResult eg=new TestResult();
|
TestResult eg=new TestResult();
|
||||||
SampleInfo sampleInfo = map.get(testRecordSampleData.getSampleNo());
|
SampleInfo sampleInfo=getSampleInfoBySampleId(testRecordSampleSolutionList,
|
||||||
|
sampleInfoList,testRecordSampleData.getSampleNo());
|
||||||
eg.setCompoundName(testRecordSampleData.getCompoundName());
|
eg.setCompoundName(testRecordSampleData.getCompoundName());
|
||||||
eg.setMaterialNo(sampleInfo.getOrderNo()+"号");
|
eg.setMaterialNo(sampleInfo.getOrderNo()+"号");
|
||||||
eg.setOrderNo(sampleInfo.getOrderNo());
|
eg.setOrderNo(sampleInfo.getOrderNo());
|
||||||
@@ -196,7 +192,6 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
}
|
}
|
||||||
return retTestResult;
|
return retTestResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据sampleID获取对应的检材信息
|
//根据sampleID获取对应的检材信息
|
||||||
private SampleInfo getSampleInfoBySampleId(List<TestRecordSampleSolution> testRecordSampleSolutionList,
|
private SampleInfo getSampleInfoBySampleId(List<TestRecordSampleSolution> testRecordSampleSolutionList,
|
||||||
List<SampleInfo> sampleInfoList,String sampleId){
|
List<SampleInfo> sampleInfoList,String sampleId){
|
||||||
@@ -228,7 +223,6 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
return retObj.get(0);
|
return retObj.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//构建实验结果
|
//构建实验结果
|
||||||
private List<String> buildTestResultDes(List<TestResult> resultList){
|
private List<String> buildTestResultDes(List<TestResult> resultList){
|
||||||
//按照检材编号先分组,这样的话,如果有n个检材,m个化合物,那么就会分成n组,每组中就m条数据
|
//按照检材编号先分组,这样的话,如果有n个检材,m个化合物,那么就会分成n组,每组中就m条数据
|
||||||
@@ -254,7 +248,6 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
List<String> testResultDes= testResultSorted(temp2);
|
List<String> testResultDes= testResultSorted(temp2);
|
||||||
return testResultDes;
|
return testResultDes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//对第一个结果进行排序
|
//对第一个结果进行排序
|
||||||
private List<String> testResultSorted(Map<String, List<TestResultDetail>> tmpMap){
|
private List<String> testResultSorted(Map<String, List<TestResultDetail>> tmpMap){
|
||||||
List<Map.Entry<String, List<TestResultDetail>>> targetList=new ArrayList<Map.Entry<String, List<TestResultDetail>>>(tmpMap.entrySet());
|
List<Map.Entry<String, List<TestResultDetail>>> targetList=new ArrayList<Map.Entry<String, List<TestResultDetail>>>(tmpMap.entrySet());
|
||||||
@@ -279,10 +272,8 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
});
|
});
|
||||||
return testResultDes;
|
return testResultDes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造出一个检材一共检出了多少个化合物和未检出多少化合物
|
* 构造出一个检材一共检出了多少个化合物和未检出多少化合物
|
||||||
*
|
|
||||||
* @param mapCompound
|
* @param mapCompound
|
||||||
* @param materialNo
|
* @param materialNo
|
||||||
* @return
|
* @return
|
||||||
@@ -332,7 +323,6 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据编号获取排序值
|
* 根据编号获取排序值
|
||||||
*
|
|
||||||
* @param materialNo
|
* @param materialNo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -344,10 +334,8 @@ public class IdentifyBookDataServiceImpl implements IdentifyBookDataService {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据溶液编号(sampleNo)获取仪器检测数据
|
* 根据溶液编号(sampleNo)获取仪器检测数据
|
||||||
*
|
|
||||||
* @param sampleNoList
|
* @param sampleNoList
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -90,7 +90,7 @@ public class PushDataToLabsCareServiceImpl implements PushDataToLabsCareService
|
|||||||
private final static String BIOLOGY_QUALITATIVE_RECORD = "BiologyQualitativeRecord";
|
private final static String BIOLOGY_QUALITATIVE_RECORD = "BiologyQualitativeRecord";
|
||||||
|
|
||||||
// 普通检材定性记录非红外报告标识
|
// 普通检材定性记录非红外报告标识
|
||||||
private final static String NON_INFRARED_GENERAL_QUALITATIVE_RECORD = "nonInfraredGeneralQualitativeRecord";
|
private final static String NON_INFRARED_GENERAL_QUALITATIVE_RECORD = "NonInfraredGeneralQualitativeRecord";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送
|
* 做一个定时推送,对于推送失败的委托进行重新推送, 每天凌晨1点推送
|
||||||
|
|||||||
Reference in New Issue
Block a user