update
This commit is contained in:
@@ -1540,7 +1540,6 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
|
|||||||
.in(SampleInfo::getId, sampleIdList));
|
.in(SampleInfo::getId, sampleIdList));
|
||||||
|
|
||||||
List<TestRecordSampleData> sampleDataList = new ArrayList<>();
|
List<TestRecordSampleData> sampleDataList = new ArrayList<>();
|
||||||
|
|
||||||
TestRecordSampleData stdSampleData = createSampleData(compoundName, TestRecordSampleDataConstant.SAMPLE_TYPE_STD, TestRecordSampleDataConstant.SAMPLE_TYPE_STD + "-" + compoundName, testId, cnName);
|
TestRecordSampleData stdSampleData = createSampleData(compoundName, TestRecordSampleDataConstant.SAMPLE_TYPE_STD, TestRecordSampleDataConstant.SAMPLE_TYPE_STD + "-" + compoundName, testId, cnName);
|
||||||
sampleDataList.add(stdSampleData);
|
sampleDataList.add(stdSampleData);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package digital.laboratory.platform.inspection.service.impl;
|
package digital.laboratory.platform.inspection.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@@ -23,6 +24,7 @@ import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConst
|
|||||||
import digital.laboratory.platform.inspection.dto.*;
|
import digital.laboratory.platform.inspection.dto.*;
|
||||||
import digital.laboratory.platform.inspection.entity.*;
|
import digital.laboratory.platform.inspection.entity.*;
|
||||||
import digital.laboratory.platform.inspection.mapper.TestRecordMapper;
|
import digital.laboratory.platform.inspection.mapper.TestRecordMapper;
|
||||||
|
import digital.laboratory.platform.inspection.mapper.TestRecordSampleDataExpandMapper;
|
||||||
import digital.laboratory.platform.inspection.mapper.TestRecordSampleDataMapper;
|
import digital.laboratory.platform.inspection.mapper.TestRecordSampleDataMapper;
|
||||||
import digital.laboratory.platform.inspection.mapper.TestTemplateMapper;
|
import digital.laboratory.platform.inspection.mapper.TestTemplateMapper;
|
||||||
import digital.laboratory.platform.inspection.service.*;
|
import digital.laboratory.platform.inspection.service.*;
|
||||||
@@ -37,6 +39,7 @@ import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
|
|||||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||||
import org.apache.poi.xwpf.usermodel.*;
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -91,6 +94,8 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TestRecordSampleDataMapper testRecordSampleDataMapper;
|
private TestRecordSampleDataMapper testRecordSampleDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private TestRecordSampleDataExpandMapper testRecordSampleDataExpandMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据业务id获取实验检验记录
|
* 根据业务id获取实验检验记录
|
||||||
@@ -161,7 +166,7 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
|
|
||||||
//通过业务ID创建实验
|
//通过业务ID创建实验
|
||||||
} else if (testRecord.getBusinessDtoList() != null && testRecord.getBusinessDtoList().size() > 0) {
|
} else if (testRecord.getBusinessDtoList() != null && testRecord.getBusinessDtoList().size() > 0) {
|
||||||
if (testRecord.getBusinessDtoList().size()>1){
|
if (testRecord.getBusinessDtoList().size() > 1) {
|
||||||
throw new RuntimeException("一次只能选择一个业务!");
|
throw new RuntimeException("一次只能选择一个业务!");
|
||||||
}
|
}
|
||||||
List<BusinessDto> businessDtoList = testRecord.getBusinessDtoList();
|
List<BusinessDto> businessDtoList = testRecord.getBusinessDtoList();
|
||||||
@@ -280,14 +285,25 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
}
|
}
|
||||||
//复制试剂耗材
|
//复制试剂耗材
|
||||||
if (testTemplateVo.getReagentConsumables() != null && testTemplateVo.getReagentConsumables().size() > 0) {
|
if (testTemplateVo.getReagentConsumables() != null && testTemplateVo.getReagentConsumables().size() > 0) {
|
||||||
|
|
||||||
|
List<TestRecordReagent> reagents = testRecordReagentService.lambdaQuery()
|
||||||
|
.in(TestRecordReagent::getId, testTemplateVo.getReagentConsumables())
|
||||||
|
.eq(TestRecordReagent::getCategory, "标准物质")
|
||||||
|
.list();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(reagents)) {
|
||||||
|
reagents.forEach(reagent -> {
|
||||||
|
testRecordSampleDataService.autoCreateData(testRecord.getId(), reagent.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
testRecord.setReagentConsumablesList(testTemplateVo.getReagentConsumables());
|
testRecord.setReagentConsumablesList(testTemplateVo.getReagentConsumables());
|
||||||
}
|
}
|
||||||
//复制仪器条件Word
|
// //复制仪器条件Word
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
ossFile.fileGet(TestRecordFileUrl.TEST_TEMPLATE_CATALOGUE.getFileUrl() + "/" + templateId + "/" + "仪器条件.docx", bos);
|
// ossFile.fileGet(TestRecordFileUrl.TEST_TEMPLATE_CATALOGUE.getFileUrl() + "/" + templateId + "/" + "仪器条件.docx", bos);
|
||||||
byte[] templateArray = bos.toByteArray();
|
// byte[] templateArray = bos.toByteArray();
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(templateArray);
|
// ByteArrayInputStream bis = new ByteArrayInputStream(templateArray);
|
||||||
ossFile.fileSave(TestRecordFileUrl.TEST_RECORD_CATALOGUE.getFileUrl() + "/" + testRecord.getId() + "/" + "仪器条件.docx", bis);
|
// ossFile.fileSave(TestRecordFileUrl.TEST_RECORD_CATALOGUE.getFileUrl() + "/" + testRecord.getId() + "/" + "仪器条件.docx", bis);
|
||||||
testRecord.setTemplateName(testTemplateVo.getName());
|
testRecord.setTemplateName(testTemplateVo.getName());
|
||||||
testTemplateMapper.updateById(testTemplateVo);
|
testTemplateMapper.updateById(testTemplateVo);
|
||||||
this.updateById(testRecord);
|
this.updateById(testRecord);
|
||||||
@@ -576,6 +592,16 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
@Override
|
@Override
|
||||||
public TestRecord useTemplate(String testId, String templateId) throws Exception {
|
public TestRecord useTemplate(String testId, String templateId) throws Exception {
|
||||||
TestRecord testRecord = this.getById(testId);
|
TestRecord testRecord = this.getById(testId);
|
||||||
|
List<TestRecordSampleData> dataList = testRecordSampleDataService.lambdaQuery()
|
||||||
|
.eq(TestRecordSampleData::getTestId, testId)
|
||||||
|
.list();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(dataList)) {
|
||||||
|
testRecordSampleDataExpandMapper.delete(Wrappers.<TestRecordSampleDataExpand>lambdaQuery()
|
||||||
|
.in(TestRecordSampleDataExpand::getTestDataId, dataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList())));
|
||||||
|
|
||||||
|
testRecordSampleDataService.removeBatchByIds(dataList);
|
||||||
|
}
|
||||||
this.copyFromTemplate(testRecord, templateId);
|
this.copyFromTemplate(testRecord, templateId);
|
||||||
return testRecord;
|
return testRecord;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user