diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java index 51b6f5f..1ad5e95 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java @@ -1540,7 +1540,6 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl sampleDataList = new ArrayList<>(); - TestRecordSampleData stdSampleData = createSampleData(compoundName, TestRecordSampleDataConstant.SAMPLE_TYPE_STD, TestRecordSampleDataConstant.SAMPLE_TYPE_STD + "-" + compoundName, testId, cnName); sampleDataList.add(stdSampleData); diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java index 6497be5..449dabc 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java @@ -1,5 +1,6 @@ package digital.laboratory.platform.inspection.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.StrUtil; 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.entity.*; 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.TestTemplateMapper; 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.poi.xwpf.usermodel.*; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -91,6 +94,8 @@ public class TestRecordServiceImpl extends ServiceImpl 0) { - if (testRecord.getBusinessDtoList().size()>1){ + if (testRecord.getBusinessDtoList().size() > 1) { throw new RuntimeException("一次只能选择一个业务!"); } List businessDtoList = testRecord.getBusinessDtoList(); @@ -280,14 +285,25 @@ public class TestRecordServiceImpl extends ServiceImpl 0) { + + List 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()); } - //复制仪器条件Word - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ossFile.fileGet(TestRecordFileUrl.TEST_TEMPLATE_CATALOGUE.getFileUrl() + "/" + templateId + "/" + "仪器条件.docx", bos); - byte[] templateArray = bos.toByteArray(); - ByteArrayInputStream bis = new ByteArrayInputStream(templateArray); - ossFile.fileSave(TestRecordFileUrl.TEST_RECORD_CATALOGUE.getFileUrl() + "/" + testRecord.getId() + "/" + "仪器条件.docx", bis); +// //复制仪器条件Word +// ByteArrayOutputStream bos = new ByteArrayOutputStream(); +// ossFile.fileGet(TestRecordFileUrl.TEST_TEMPLATE_CATALOGUE.getFileUrl() + "/" + templateId + "/" + "仪器条件.docx", bos); +// byte[] templateArray = bos.toByteArray(); +// ByteArrayInputStream bis = new ByteArrayInputStream(templateArray); +// ossFile.fileSave(TestRecordFileUrl.TEST_RECORD_CATALOGUE.getFileUrl() + "/" + testRecord.getId() + "/" + "仪器条件.docx", bis); testRecord.setTemplateName(testTemplateVo.getName()); testTemplateMapper.updateById(testTemplateVo); this.updateById(testRecord); @@ -576,6 +592,16 @@ public class TestRecordServiceImpl extends ServiceImpl dataList = testRecordSampleDataService.lambdaQuery() + .eq(TestRecordSampleData::getTestId, testId) + .list(); + + if (CollUtil.isNotEmpty(dataList)) { + testRecordSampleDataExpandMapper.delete(Wrappers.lambdaQuery() + .in(TestRecordSampleDataExpand::getTestDataId, dataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()))); + + testRecordSampleDataService.removeBatchByIds(dataList); + } this.copyFromTemplate(testRecord, templateId); return testRecord; }