20250318 更新
1.贵阳禁毒常规毒品检验记录部分实现
This commit is contained in:
@@ -212,6 +212,7 @@ public class TestRecordController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("生成检验记录-贵阳禁毒")
|
||||||
@GetMapping("/inspectionRecord")
|
@GetMapping("/inspectionRecord")
|
||||||
public R inspectionRecord(String entrustId) throws Exception {
|
public R inspectionRecord(String entrustId) throws Exception {
|
||||||
return testRecordService.inspectionRecord(entrustId);
|
return testRecordService.inspectionRecord(entrustId);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import digital.laboratory.platform.common.core.util.R;
|
|||||||
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
import digital.laboratory.platform.common.mybatis.security.service.DLPUser;
|
||||||
import digital.laboratory.platform.inspection.dto.DeleteTestAtlasDTO;
|
import digital.laboratory.platform.inspection.dto.DeleteTestAtlasDTO;
|
||||||
import digital.laboratory.platform.inspection.dto.TestRecordDto;
|
import digital.laboratory.platform.inspection.dto.TestRecordDto;
|
||||||
|
import digital.laboratory.platform.inspetion.api.entity.EntrustInfo;
|
||||||
import digital.laboratory.platform.inspetion.api.entity.TestRecord;
|
import digital.laboratory.platform.inspetion.api.entity.TestRecord;
|
||||||
import digital.laboratory.platform.inspection.vo.ProcedureVo;
|
import digital.laboratory.platform.inspection.vo.ProcedureVo;
|
||||||
import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
|
import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
|
||||||
@@ -90,5 +91,18 @@ public interface TestRecordService extends IService<TestRecord> {
|
|||||||
*/
|
*/
|
||||||
R<Map<String, TestRecordVo>> queryTestRecordInfoByBusinessId(List<String> businessIds);
|
R<Map<String, TestRecordVo>> queryTestRecordInfoByBusinessId(List<String> businessIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成检验记录-贵阳禁毒
|
||||||
|
* @param entrustId 委托id
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
R inspectionRecord(String entrustId) throws Exception;
|
R inspectionRecord(String entrustId) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据业务id获取实验检验记录
|
||||||
|
* @param businessId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TestRecord getTestRecordByBusinessId(String businessId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,20 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
@Resource
|
@Resource
|
||||||
private TestRecordSampleDataMapper testRecordSampleDataMapper;
|
private TestRecordSampleDataMapper testRecordSampleDataMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据业务id获取实验检验记录
|
||||||
|
* @param businessId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TestRecord getTestRecordByBusinessId(String businessId) {
|
||||||
|
List<DataSolutionSampleDTO> dataSolutionSampleDTOS = testRecordSampleDataMapper
|
||||||
|
.queryDataSolutionSampleDTOList(Wrappers.<DataSolutionSampleDTO>query()
|
||||||
|
.eq("si.business_id", businessId));
|
||||||
|
TestRecord testRecord = super.getById(dataSolutionSampleDTOS.get(0).getTestId());
|
||||||
|
return testRecord;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个实验
|
* 创建一个实验
|
||||||
*
|
*
|
||||||
@@ -1527,6 +1541,12 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
return R.ok(map);
|
return R.ok(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成检验记录-贵阳禁毒
|
||||||
|
* @param entrustId 委托id
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R inspectionRecord(String entrustId) throws Exception {
|
public R inspectionRecord(String entrustId) throws Exception {
|
||||||
EntrustInfo entrustInfo = entrustInfoService.getById(entrustId);
|
EntrustInfo entrustInfo = entrustInfoService.getById(entrustId);
|
||||||
@@ -1545,30 +1565,16 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
|
|
||||||
public Map<String, Object> invivoRecord(EntrustInfo entrustInfo) throws Exception {
|
public Map<String, Object> invivoRecord(EntrustInfo entrustInfo) throws Exception {
|
||||||
|
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
// 这里因为检验记录实体并未关联业务id, 只能先查询实验数据,在通过实验数据获取到检验记录信息
|
||||||
|
TestRecord testRecord = getTestRecordByBusinessId(entrustInfo.getId());
|
||||||
|
|
||||||
data.put("entrustDepartment", entrustInfo.getEntrustDepartment());
|
HashMap<String, Object> data = buildCommonInspectRecordDocMap(entrustInfo, testRecord);
|
||||||
data.put("deliver1Name", entrustInfo.getDeliver1Name());
|
|
||||||
data.put("deliver2Name", entrustInfo.getDeliver2Name());
|
|
||||||
data.put("year", entrustInfo.getAcceptDate().getYear());
|
|
||||||
data.put("month", entrustInfo.getAcceptDate().getMonthValue());
|
|
||||||
data.put("day", entrustInfo.getAcceptDate().getDayOfMonth());
|
|
||||||
|
|
||||||
List<String> sampleIdList = sampleInfoService.list(Wrappers.<SampleInfo>lambdaQuery()
|
List<String> sampleIdList = sampleInfoService.list(Wrappers.<SampleInfo>lambdaQuery()
|
||||||
.eq(SampleInfo::getBusinessId, entrustInfo.getId()))
|
.eq(SampleInfo::getBusinessId, entrustInfo.getId()))
|
||||||
.stream().map(SampleInfo::getId)
|
.stream().map(SampleInfo::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
TestRecord testRecord = new TestRecord();
|
|
||||||
|
|
||||||
for (String sampleId : sampleIdList) {
|
|
||||||
TestRecord record = this.getOne(Wrappers.<TestRecord>lambdaQuery()
|
|
||||||
.like(TestRecord::getSampleTestList, sampleId));
|
|
||||||
if (record != null) {
|
|
||||||
testRecord = record;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<TestRecordInstrument> instruments = testRecordInstrumentService.list(Wrappers.<TestRecordInstrument>lambdaQuery()
|
List<TestRecordInstrument> instruments = testRecordInstrumentService.list(Wrappers.<TestRecordInstrument>lambdaQuery()
|
||||||
.in(TestRecordInstrument::getId, testRecord.getDeviceIdList()));
|
.in(TestRecordInstrument::getId, testRecord.getDeviceIdList()));
|
||||||
|
|
||||||
@@ -1583,36 +1589,6 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
data.put("instrumentName", instrumentName);
|
data.put("instrumentName", instrumentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TestRecordReagent> references = testRecordReagentService.list(Wrappers.<TestRecordReagent>lambdaQuery()
|
|
||||||
.in(TestRecordReagent::getId, testRecord.getReagentConsumablesList())
|
|
||||||
.eq(TestRecordReagent::getCategory, "标准物质"));
|
|
||||||
|
|
||||||
if (references == null || references.size() == 0) {
|
|
||||||
data.put("referenceMaterialName", "未找到试剂耗材数据!");
|
|
||||||
}else {
|
|
||||||
|
|
||||||
String referenceMaterialName = references.stream()
|
|
||||||
.map(reagent -> "\u2611" + " " + reagent.getReagentConsumableName())
|
|
||||||
.collect(Collectors.joining("\n"));
|
|
||||||
|
|
||||||
data.put("referenceMaterialName", referenceMaterialName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
List<TestRecordReagent> reagents = testRecordReagentService.list(Wrappers.<TestRecordReagent>lambdaQuery()
|
|
||||||
.in(TestRecordReagent::getId, testRecord.getReagentConsumablesList())
|
|
||||||
.eq(TestRecordReagent::getCategory, "试剂"));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (reagents == null || reagents.size() == 0) {
|
|
||||||
data.put("reagentConsumableName", "未找到试剂耗材数据!");
|
|
||||||
} else {
|
|
||||||
String reagentConsumableName = reagents.stream()
|
|
||||||
.map(TestRecordReagent::getReagentConsumableName)
|
|
||||||
.collect(Collectors.joining("、"));
|
|
||||||
data.put("reagentConsumableName", reagentConsumableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<HairSewageDataDto> hairDataDtos = (List<HairSewageDataDto>) testRecordSampleDataService.getSampleTestDataByBusiness(entrustInfo.getId());
|
List<HairSewageDataDto> hairDataDtos = (List<HairSewageDataDto>) testRecordSampleDataService.getSampleTestDataByBusiness(entrustInfo.getId());
|
||||||
|
|
||||||
@@ -1759,4 +1735,82 @@ public class TestRecordServiceImpl extends ServiceImpl<TestRecordMapper, TestRec
|
|||||||
return comparator;
|
return comparator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成常规毒品的检验记录(贵阳禁毒)
|
||||||
|
*/
|
||||||
|
public void generateCommonDrugInpectRecord(String entrustId) {
|
||||||
|
Map<String, Object> docMap = buildCommonDrugDocMap(entrustId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建常规毒品的检验记录数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, Object> buildCommonDrugDocMap(String entrustId) {
|
||||||
|
EntrustInfo entrustInfo = entrustInfoService.getById(entrustId);
|
||||||
|
|
||||||
|
// 这里因为检验记录实体并未关联业务id, 只能先查询实验数据,在通过实验数据获取到检验记录信息
|
||||||
|
TestRecord testRecord = getTestRecordByBusinessId(entrustInfo.getId());
|
||||||
|
|
||||||
|
// 封装数据到map中
|
||||||
|
Map<String, Object> docMap = buildCommonInspectRecordDocMap(entrustInfo, testRecord);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建通用的检验记录文档映射
|
||||||
|
*
|
||||||
|
* @param entrustInfo 委托信息对象
|
||||||
|
* @return 包含委托信息和检验记录信息的HashMap对象
|
||||||
|
*/
|
||||||
|
private HashMap<String, Object> buildCommonInspectRecordDocMap(EntrustInfo entrustInfo, TestRecord testRecord) {
|
||||||
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
|
|
||||||
|
data.put("entrustDepartment", entrustInfo.getEntrustDepartment());
|
||||||
|
data.put("deliver1Name", entrustInfo.getDeliver1Name());
|
||||||
|
data.put("deliver2Name", entrustInfo.getDeliver2Name());
|
||||||
|
// 受理日期
|
||||||
|
data.put("acceptYear", entrustInfo.getAcceptDate().getYear());
|
||||||
|
data.put("acceptMonth", entrustInfo.getAcceptDate().getMonthValue());
|
||||||
|
data.put("acceptDay", entrustInfo.getAcceptDate().getDayOfMonth());
|
||||||
|
|
||||||
|
// 检验日期
|
||||||
|
data.put("inspectYear", testRecord.getTestStartDate().getYear());
|
||||||
|
data.put("inspectMonth", testRecord.getTestStartDate().getMonthValue());
|
||||||
|
data.put("inspectDay", testRecord.getTestStartDate().getDayOfMonth());
|
||||||
|
|
||||||
|
// 设置使用的标准物质和试剂
|
||||||
|
List<TestRecordReagent> references = testRecordReagentService.list(Wrappers.<TestRecordReagent>lambdaQuery()
|
||||||
|
.in(TestRecordReagent::getId, testRecord.getReagentConsumablesList())
|
||||||
|
.eq(TestRecordReagent::getCategory, "标准物质"));
|
||||||
|
|
||||||
|
if (references == null || references.size() == 0) {
|
||||||
|
data.put("referenceMaterialName", "未找到试剂耗材数据!");
|
||||||
|
}else {
|
||||||
|
|
||||||
|
String referenceMaterialName = references.stream()
|
||||||
|
.map(reagent -> "\u2611" + " " + reagent.getReagentConsumableName())
|
||||||
|
.collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
|
data.put("referenceMaterialName", referenceMaterialName);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TestRecordReagent> reagents = testRecordReagentService.list(Wrappers.<TestRecordReagent>lambdaQuery()
|
||||||
|
.in(TestRecordReagent::getId, testRecord.getReagentConsumablesList())
|
||||||
|
.eq(TestRecordReagent::getCategory, "试剂"));
|
||||||
|
|
||||||
|
if (reagents == null || reagents.size() == 0) {
|
||||||
|
data.put("reagentConsumableName", "未找到试剂耗材数据!");
|
||||||
|
} else {
|
||||||
|
String reagentConsumableName = reagents.stream()
|
||||||
|
.map(TestRecordReagent::getReagentConsumableName)
|
||||||
|
.collect(Collectors.joining("、"));
|
||||||
|
data.put("reagentConsumableName", reagentConsumableName);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user