|
|
|
@ -24,6 +24,7 @@ import digital.laboratory.platform.common.oss.service.OssFile; |
|
|
|
|
import digital.laboratory.platform.common.security.util.SecurityUtils; |
|
|
|
|
import digital.laboratory.platform.entrustment.dto.PrintDTO; |
|
|
|
|
import digital.laboratory.platform.entrustment.entity.*; |
|
|
|
|
import digital.laboratory.platform.entrustment.enums.AnalysisOptionEnums; |
|
|
|
|
import digital.laboratory.platform.entrustment.enums.EntrustmentStatusConstants; |
|
|
|
|
import digital.laboratory.platform.entrustment.handler.AppStartupRunner; |
|
|
|
|
import digital.laboratory.platform.entrustment.mapper.EntrustmentIdentificationMaterialMapper; |
|
|
|
@ -983,33 +984,9 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
entrustMaterialOfThirdSys.setPackageType(entrustmentMapper.getTypeForDictionary(identificationMaterial.getPack())); |
|
|
|
|
entrustMaterialOfThirdSys.setAmount(identificationMaterial.getQuantity()); |
|
|
|
|
List<DrugLite> candidateDrugs = identificationMaterial.getCandidateDrugs(); |
|
|
|
|
List<String> stringList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DrugLite candidateDrug : candidateDrugs) { |
|
|
|
|
String name = candidateDrug.getName(); |
|
|
|
|
stringList.add(name); |
|
|
|
|
} |
|
|
|
|
String listJSONString = JSON.toJSONString(stringList); |
|
|
|
|
entrustMaterialOfThirdSys.setTargetObjectTypeList(listJSONString); |
|
|
|
|
String analysisType = ""; |
|
|
|
|
switch (identificationMaterial.getAnalysisOption()) { |
|
|
|
|
case 1: |
|
|
|
|
analysisType = "qualitative"; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
analysisType = "ration"; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
analysisType = "qualitativeAndRation"; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
analysisType = "relevance"; |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
analysisType = "other"; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
entrustMaterialOfThirdSys.setAnalysisType(analysisType); |
|
|
|
|
entrustMaterialOfThirdSys.setTargetObjectTypeList(JSON.toJSONString(candidateDrugs.stream().map(DrugLite::getName).collect(Collectors.toList()))); |
|
|
|
|
entrustMaterialOfThirdSys.setAnalysisType(AnalysisOptionEnums.fromCode(identificationMaterial.getAnalysisOption()).getEnglishName()); |
|
|
|
|
synchronizeMaterialVoService.updateById(entrustMaterialOfThirdSys); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1269,74 +1246,15 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} else { |
|
|
|
|
String id = IdWorker.get32UUID().toUpperCase(); |
|
|
|
|
if (entrustment.getDataSources() == 1) { |
|
|
|
|
EntrustOfThirdSys entrustOfThirdSys = synchronizeDataService.getOne(new LambdaQueryWrapper<EntrustOfThirdSys>().eq(EntrustOfThirdSys::getEntrustMainId, entrustment.getId())); |
|
|
|
|
EntrustMaterialOfThirdSys entrustMaterialOfThirdSys = new EntrustMaterialOfThirdSys(); |
|
|
|
|
entrustMaterialOfThirdSys.setEntrustId(entrustOfThirdSys.getId()); |
|
|
|
|
entrustMaterialOfThirdSys.setId(id); |
|
|
|
|
List<EntrustMaterialOfThirdSys> list = synchronizeMaterialVoService.list(new LambdaQueryWrapper<EntrustMaterialOfThirdSys>().eq(EntrustMaterialOfThirdSys::getEntrustId, entrustOfThirdSys.getId())); |
|
|
|
|
entrustMaterialOfThirdSys.setOrder_index(((Integer) (list.size() + 1)).toString()); |
|
|
|
|
entrustMaterialOfThirdSys.setName(identificationMaterial.getName()); |
|
|
|
|
String unitByZhCn = ConvertUtils.getUnitByZhCn(identificationMaterial.getUnit()); |
|
|
|
|
entrustMaterialOfThirdSys.setUnit(unitByZhCn); |
|
|
|
|
entrustMaterialOfThirdSys.setSampleUnit(unitByZhCn); |
|
|
|
|
entrustMaterialOfThirdSys.setColorType(identificationMaterial.getColor()); |
|
|
|
|
entrustMaterialOfThirdSys.setShapeType(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType())); |
|
|
|
|
entrustMaterialOfThirdSys.setPackageType(identificationMaterial.getPackName()); |
|
|
|
|
entrustMaterialOfThirdSys.setAmount(identificationMaterial.getQuantity()); |
|
|
|
|
List<DrugLite> candidateDrugs = identificationMaterial.getCandidateDrugs(); |
|
|
|
|
List<String> stringList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (DrugLite candidateDrug : candidateDrugs) { |
|
|
|
|
String name = candidateDrug.getName(); |
|
|
|
|
stringList.add(name); |
|
|
|
|
} |
|
|
|
|
String listJSONString = JSON.toJSONString(stringList); |
|
|
|
|
entrustMaterialOfThirdSys.setTargetObjectTypeList(listJSONString); |
|
|
|
|
String analysisType = ""; |
|
|
|
|
switch (identificationMaterial.getAnalysisOption()) { |
|
|
|
|
case 1: |
|
|
|
|
analysisType = "qualitative"; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
analysisType = "ration"; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
analysisType = "qualitativeAndRation"; |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
analysisType = "relevance"; |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
analysisType = "other"; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
entrustMaterialOfThirdSys.setAnalysisType(analysisType); |
|
|
|
|
synchronizeMaterialVoService.save(entrustMaterialOfThirdSys); |
|
|
|
|
saveEntrustMaterialToThirdSys(identificationMaterial, entrustment, id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String entrustmentId = identificationMaterial.getEntrustmentId(); |
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getCaseId())) { |
|
|
|
|
throw new RuntimeException(String.format("检材必须与某个案件关联, 必须提供 caseId")); |
|
|
|
|
} |
|
|
|
|
CaseEvent cj = caseEventService.getById(identificationMaterial.getCaseId()); |
|
|
|
|
if (cj == null) { |
|
|
|
|
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", identificationMaterial.getCaseId())); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isBlank(cj.getCaseNo())) { |
|
|
|
|
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料")); |
|
|
|
|
} |
|
|
|
|
// 校验案件信息是否合法
|
|
|
|
|
CaseEvent cj = validateCaseInfo(identificationMaterial); |
|
|
|
|
|
|
|
|
|
////若提前创建好了物证,则关联通过物证编号关联检材编号即可;
|
|
|
|
|
if (StrUtil.isNotBlank(identificationMaterial.getEvidenceId())) { |
|
|
|
|
CaseEvidence caseEvidence = caseEvidenceService.getById(identificationMaterial.getEvidenceId()); |
|
|
|
|
identificationMaterial.setImNo(this.getNewIdentificationMaterialNo(caseEvidence.getEvidenceNo())); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
String newEvidenceCode = caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()); |
|
|
|
|
String materialNo = this.getNewIdentificationMaterialNo(newEvidenceCode); |
|
|
|
|
identificationMaterial.setImNo(materialNo); |
|
|
|
|
} |
|
|
|
|
setMaterialIdentificationNo(identificationMaterial, cj); |
|
|
|
|
Boolean copyAttachemnts = false; |
|
|
|
|
if (copyAttachemnts == null) { |
|
|
|
|
copyAttachemnts = false; |
|
|
|
@ -1398,10 +1316,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
//identificationMaterial.setSample1No(sampleService.getNewSampleNo(identificationMaterial.getImNo(),1));
|
|
|
|
|
// 初始化委托序号
|
|
|
|
|
currentEntrustMaterialCount++; |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getImEntrustNumber())) { |
|
|
|
|
// 如果为空则设置默认值
|
|
|
|
|
identificationMaterial.setImEntrustNumber(currentEntrustMaterialCount.toString()); |
|
|
|
|
} |
|
|
|
|
identificationMaterial.setImEntrustNumber(currentEntrustMaterialCount.toString()); |
|
|
|
|
identificationMaterial.setCreateBy(dlpUser.getId()); |
|
|
|
|
identificationMaterial.setCreateTime(LocalDateTime.now()); |
|
|
|
|
identificationMaterial.setAcceptNo(null); |
|
|
|
@ -1436,6 +1351,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
return identificationMaterialList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override//打印小标签模板的方法
|
|
|
|
|
public List<String> printLabel(List<PrintDTO> printDTOList) { |
|
|
|
|
|
|
|
|
@ -1592,13 +1508,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
if (materialList.size() < 18) {//这份文件的行数为18
|
|
|
|
|
index = 18 - materialList.size(); |
|
|
|
|
for (int i = 0; i < index; i++) { |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = new EntrustmentIdentificationMaterial(); |
|
|
|
|
entrustmentIdentificationMaterial.setPrintAcceptTime(""); |
|
|
|
|
entrustmentIdentificationMaterial.setAcceptNo(""); |
|
|
|
|
entrustmentIdentificationMaterial.setTypeName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setFormName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setPackName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setDescription(""); |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = getEntrustmentIdentificationMaterial(); |
|
|
|
|
materialList.add(entrustmentIdentificationMaterial); |
|
|
|
|
} |
|
|
|
|
//如果大于18条数据了 证明不止一页了,那我们看看剩下的是否填充满了一页,如果没有就构建数据
|
|
|
|
@ -1606,13 +1516,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
index = materialList.size() % 18; |
|
|
|
|
if (index != 0) { |
|
|
|
|
for (int i = 0; i < 18 - index; i++) { |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = new EntrustmentIdentificationMaterial(); |
|
|
|
|
entrustmentIdentificationMaterial.setPrintAcceptTime(""); |
|
|
|
|
entrustmentIdentificationMaterial.setAcceptNo(""); |
|
|
|
|
entrustmentIdentificationMaterial.setTypeName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setFormName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setPackName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setDescription(""); |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = getEntrustmentIdentificationMaterial(); |
|
|
|
|
materialList.add(entrustmentIdentificationMaterial); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1647,32 +1551,27 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//用作于处理一些打印委托书或鉴定事项确认书时的字段类型转换
|
|
|
|
|
|
|
|
|
|
private static EntrustmentIdentificationMaterial getEntrustmentIdentificationMaterial() { |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = new EntrustmentIdentificationMaterial(); |
|
|
|
|
entrustmentIdentificationMaterial.setPrintAcceptTime(""); |
|
|
|
|
entrustmentIdentificationMaterial.setAcceptNo(""); |
|
|
|
|
entrustmentIdentificationMaterial.setTypeName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setFormName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setPackName(""); |
|
|
|
|
entrustmentIdentificationMaterial.setDescription(""); |
|
|
|
|
return entrustmentIdentificationMaterial; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//用作于处理一些打印委托书或鉴定事项确认书时的字段类型转换
|
|
|
|
|
@Override |
|
|
|
|
public void conformityDrugs(List<EntrustmentIdentificationMaterial> list) { |
|
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
|
for (EntrustmentIdentificationMaterial material : list) { |
|
|
|
|
Integer analysisOption = material.getAnalysisOption(); |
|
|
|
|
material.setQuantity(material.getQuantity().setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
switch (analysisOption) { |
|
|
|
|
case 1: |
|
|
|
|
material.setAnalysisOptionValue("定性分析"); |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
material.setAnalysisOptionValue("定量分析"); |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
material.setAnalysisOptionValue("定性定量分析"); |
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
material.setAnalysisOptionValue("关联性判断"); |
|
|
|
|
break; |
|
|
|
|
case 5: |
|
|
|
|
material.setAnalysisOptionValue("其他"); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
material.setAnalysisOptionValue(AnalysisOptionEnums.fromCode(analysisOption).getChineseName()); |
|
|
|
|
material.setPrintDrawTime(LocalDateTimeUtil.format(material.getDrawTime(), "yyyy-MM-dd")); |
|
|
|
|
List<DrugLite> candidateDrugs = material.getCandidateDrugs(); |
|
|
|
|
String drugsValue = ""; |
|
|
|
@ -1692,4 +1591,70 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将委托鉴定材料保存到第三方系统 |
|
|
|
|
* |
|
|
|
|
* @param identificationMaterial 委托鉴定材料对象 |
|
|
|
|
* @param entrustment 委托对象 |
|
|
|
|
* @param id 材料唯一标识 |
|
|
|
|
*/ |
|
|
|
|
private void saveEntrustMaterialToThirdSys(EntrustmentIdentificationMaterial identificationMaterial, Entrustment entrustment, String id) { |
|
|
|
|
EntrustOfThirdSys entrustOfThirdSys = synchronizeDataService.getOne(new LambdaQueryWrapper<EntrustOfThirdSys>().eq(EntrustOfThirdSys::getEntrustMainId, entrustment.getId())); |
|
|
|
|
EntrustMaterialOfThirdSys entrustMaterialOfThirdSys = new EntrustMaterialOfThirdSys(); |
|
|
|
|
entrustMaterialOfThirdSys.setEntrustId(entrustOfThirdSys.getId()); |
|
|
|
|
entrustMaterialOfThirdSys.setId(id); |
|
|
|
|
List<EntrustMaterialOfThirdSys> list = synchronizeMaterialVoService.list(new LambdaQueryWrapper<EntrustMaterialOfThirdSys>().eq(EntrustMaterialOfThirdSys::getEntrustId, entrustOfThirdSys.getId())); |
|
|
|
|
entrustMaterialOfThirdSys.setOrder_index(((Integer) (list.size() + 1)).toString()); |
|
|
|
|
entrustMaterialOfThirdSys.setName(identificationMaterial.getName()); |
|
|
|
|
String unitByZhCn = ConvertUtils.getUnitByZhCn(identificationMaterial.getUnit()); |
|
|
|
|
entrustMaterialOfThirdSys.setUnit(unitByZhCn); |
|
|
|
|
entrustMaterialOfThirdSys.setSampleUnit(unitByZhCn); |
|
|
|
|
entrustMaterialOfThirdSys.setColorType(identificationMaterial.getColor()); |
|
|
|
|
entrustMaterialOfThirdSys.setShapeType(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType())); |
|
|
|
|
entrustMaterialOfThirdSys.setPackageType(identificationMaterial.getPackName()); |
|
|
|
|
entrustMaterialOfThirdSys.setAmount(identificationMaterial.getQuantity()); |
|
|
|
|
List<DrugLite> candidateDrugs = identificationMaterial.getCandidateDrugs(); |
|
|
|
|
|
|
|
|
|
entrustMaterialOfThirdSys.setTargetObjectTypeList(JSON.toJSONString(candidateDrugs.stream().map(DrugLite::getName).collect(Collectors.toList()))); |
|
|
|
|
entrustMaterialOfThirdSys.setAnalysisType(AnalysisOptionEnums.fromCode(identificationMaterial.getAnalysisOption()).getEnglishName()); |
|
|
|
|
synchronizeMaterialVoService.save(entrustMaterialOfThirdSys); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置委托鉴定材料的鉴定编号 |
|
|
|
|
* |
|
|
|
|
* @param identificationMaterial 委托鉴定材料对象 |
|
|
|
|
* @param cj 案件事件对象 |
|
|
|
|
*/ |
|
|
|
|
private void setMaterialIdentificationNo(EntrustmentIdentificationMaterial identificationMaterial, CaseEvent cj) { |
|
|
|
|
if (StrUtil.isNotBlank(identificationMaterial.getEvidenceId())) { |
|
|
|
|
CaseEvidence caseEvidence = caseEvidenceService.getById(identificationMaterial.getEvidenceId()); |
|
|
|
|
identificationMaterial.setImNo(this.getNewIdentificationMaterialNo(caseEvidence.getEvidenceNo())); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
String newEvidenceCode = caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()); |
|
|
|
|
String materialNo = this.getNewIdentificationMaterialNo(newEvidenceCode); |
|
|
|
|
identificationMaterial.setImNo(materialNo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 校验案件信息是否合法 |
|
|
|
|
* @param identificationMaterial |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private CaseEvent validateCaseInfo(EntrustmentIdentificationMaterial identificationMaterial) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getCaseId())) { |
|
|
|
|
throw new RuntimeException(String.format("检材必须与某个案件关联, 必须提供 caseId")); |
|
|
|
|
} |
|
|
|
|
CaseEvent cj = caseEventService.getById(identificationMaterial.getCaseId()); |
|
|
|
|
if (cj == null) { |
|
|
|
|
throw new RuntimeException(String.format("不存在 id 为 %s 的案件", identificationMaterial.getCaseId())); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isBlank(cj.getCaseNo())) { |
|
|
|
|
throw new RuntimeException(String.format("对应的案件资料不完整, 不存在案件编号。请先完善案件资料")); |
|
|
|
|
} |
|
|
|
|
return cj; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|