|
|
|
@ -3,6 +3,7 @@ package digital.laboratory.platform.entrustment.service.impl; |
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
@ -609,122 +610,132 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public EntrustmentIdentificationMaterial bizAccept_Save(EntrustmentIdentificationMaterial identificationMaterial, DLPUser dlpUser) { |
|
|
|
|
public List<EntrustmentIdentificationMaterial> bizAccept_Save(List<EntrustmentIdentificationMaterial> materialList, DLPUser dlpUser) { |
|
|
|
|
|
|
|
|
|
// 检查委托原来的状态
|
|
|
|
|
EntrustmentIdentificationMaterial im = this.getById(identificationMaterial.getId()); |
|
|
|
|
if (im == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((im.getAcceptPassed() != null) && (im.getAcceptPassed() != 0)) { |
|
|
|
|
throw new RuntimeException(String.format("检材只能在未受理状态才能保存")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Entrustment entrustment = entrustmentService.getById(im.getEntrustmentId()); |
|
|
|
|
if (entrustment == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", im.getEntrustmentId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus()) { |
|
|
|
|
throw new RuntimeException("委托不在正在受理状态"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (!dlpUser.getId().equals(entrustment.getAcceptClaimUser())) {
|
|
|
|
|
// throw new RuntimeException(String.format("委托的受理任务是由其他人认领的。认领用户是: %s", entrustment.getAcceptClaimUser()));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------
|
|
|
|
|
// 更新数据库表数据
|
|
|
|
|
//-------------------
|
|
|
|
|
im.setFundQuantity(identificationMaterial.getFundQuantity()); |
|
|
|
|
im.setQuantity(identificationMaterial.getQuantity()); |
|
|
|
|
for (EntrustmentIdentificationMaterial identificationMaterial : materialList) { |
|
|
|
|
|
|
|
|
|
im.setProvidedSample1No(identificationMaterial.getProvidedSample1No()); |
|
|
|
|
im.setProvidedSample1FundQuantity(identificationMaterial.getProvidedSample1FundQuantity()); |
|
|
|
|
im.setProvidedSample1Quantity(identificationMaterial.getProvidedSample1Quantity()); |
|
|
|
|
|
|
|
|
|
im.setProvidedSample2Present(identificationMaterial.getProvidedSample2Present()); |
|
|
|
|
im.setProvidedSample2No(identificationMaterial.getProvidedSample2No()); |
|
|
|
|
im.setProvidedSample2FundQuantity(identificationMaterial.getProvidedSample2FundQuantity()); |
|
|
|
|
im.setProvidedSample2Quantity(identificationMaterial.getProvidedSample2Quantity()); |
|
|
|
|
|
|
|
|
|
im.setSplitedSample(identificationMaterial.getSplitedSample()); |
|
|
|
|
|
|
|
|
|
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
|
|
|
|
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No())) { |
|
|
|
|
im.setProvidedSample1No(sampleService.getNewProvidedSampleNo(im.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
//}
|
|
|
|
|
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) { |
|
|
|
|
im.setProvidedSample2No(sampleService.getNewProvidedSampleNo(im.getImNo(), 2)); |
|
|
|
|
// 检查委托原来的状态
|
|
|
|
|
EntrustmentIdentificationMaterial im = this.getById(identificationMaterial.getId()); |
|
|
|
|
if (im == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
im.setSample1No(identificationMaterial.getSample1No()); |
|
|
|
|
im.setSample1FundQuantity(identificationMaterial.getSample1FundQuantity()); |
|
|
|
|
im.setSample1Quantity(identificationMaterial.getSample1Quantity()); |
|
|
|
|
im.setSample1BoxId(identificationMaterial.getSample1BoxId()); |
|
|
|
|
|
|
|
|
|
im.setSample2Present(identificationMaterial.getSample2Present()); |
|
|
|
|
im.setSample2No(identificationMaterial.getSample2No()); |
|
|
|
|
im.setSample2FundQuantity(identificationMaterial.getSample2FundQuantity()); |
|
|
|
|
im.setSample2Quantity(identificationMaterial.getSample2Quantity()); |
|
|
|
|
im.setSample2BoxId(identificationMaterial.getSample2BoxId()); |
|
|
|
|
|
|
|
|
|
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
|
|
|
|
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getSample1No())) { |
|
|
|
|
im.setSample1No(sampleService.getNewSampleNo(im.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
//}
|
|
|
|
|
if ((identificationMaterial.getSample2Present() != null) && identificationMaterial.getSample2Present()) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getSample2No())) { |
|
|
|
|
im.setSample2No(sampleService.getNewSampleNo(im.getImNo(), 2)); |
|
|
|
|
if ((im.getAcceptPassed() != null) && (im.getAcceptPassed() != 0)) { |
|
|
|
|
throw new RuntimeException(String.format("检材只能在未受理状态才能保存")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>(); |
|
|
|
|
updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
|
|
|
|
|
|
|
|
|
updateWrapper.set("fund_quantity", im.getFundQuantity()); |
|
|
|
|
updateWrapper.set("quantity", im.getQuantity()); |
|
|
|
|
|
|
|
|
|
updateWrapper.set("provided_sample1_no", im.getProvidedSample1No()); |
|
|
|
|
updateWrapper.set("provided_sample1_fund_quantity", im.getProvidedSample1FundQuantity()); |
|
|
|
|
updateWrapper.set("provided_sample1_quantity", im.getProvidedSample1Quantity()); |
|
|
|
|
|
|
|
|
|
updateWrapper.set("provided_sample2_present", im.getProvidedSample2Present()); |
|
|
|
|
updateWrapper.set("provided_sample2_no", im.getProvidedSample2No()); |
|
|
|
|
updateWrapper.set("provided_sample2_fund_quantity", im.getProvidedSample2FundQuantity()); |
|
|
|
|
updateWrapper.set("provided_sample2_quantity", im.getProvidedSample2Quantity()); |
|
|
|
|
|
|
|
|
|
updateWrapper.set("splited_sample", im.getSplitedSample()); |
|
|
|
|
Entrustment entrustment = entrustmentService.getById(im.getEntrustmentId()); |
|
|
|
|
if (entrustment == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的委托", im.getEntrustmentId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//updateWrapper.set("sample1_present", im.getSample1Present());
|
|
|
|
|
updateWrapper.set("sample1_no", im.getSample1No()); |
|
|
|
|
updateWrapper.set("sample1_fund_quantity", im.getSample1FundQuantity()); |
|
|
|
|
updateWrapper.set("sample1_quantity", im.getSample1Quantity()); |
|
|
|
|
updateWrapper.set("sample1_box_id", im.getSample1BoxId()); |
|
|
|
|
updateWrapper.set("sample2_present", im.getSample2Present()); |
|
|
|
|
updateWrapper.set("sample2_no", im.getSample2No()); |
|
|
|
|
updateWrapper.set("sample2_fund_quantity", im.getSample2FundQuantity()); |
|
|
|
|
updateWrapper.set("sample2_quantity", im.getSample2Quantity()); |
|
|
|
|
updateWrapper.set("sample2_box_id", im.getSample2BoxId()); |
|
|
|
|
if (entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_WAITING_ACCEPT.getStatus()) { |
|
|
|
|
throw new RuntimeException("委托不在正在受理状态"); |
|
|
|
|
} |
|
|
|
|
if (identificationMaterial.getSample1RepeatWeigh() != null) { |
|
|
|
|
im.setSample1RepeatWeigh(identificationMaterial.getSample1RepeatWeigh()); |
|
|
|
|
im.setSample2RepeatWeigh(identificationMaterial.getSample2RepeatWeigh()); |
|
|
|
|
this.saveRepWeigh(im, im.getSample1RepeatWeigh().doubleValue(), im.getSample2RepeatWeigh().doubleValue(), false, ""); |
|
|
|
|
} |
|
|
|
|
// if (!dlpUser.getId().equals(entrustment.getAcceptClaimUser())) {
|
|
|
|
|
// throw new RuntimeException(String.format("委托的受理任务是由其他人认领的。认领用户是: %s", entrustment.getAcceptClaimUser()));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------
|
|
|
|
|
// 更新数据库表数据
|
|
|
|
|
//-------------------
|
|
|
|
|
// im.setFundQuantity(identificationMaterial.getFundQuantity());
|
|
|
|
|
// im.setQuantity(identificationMaterial.getQuantity());
|
|
|
|
|
//
|
|
|
|
|
// im.setProvidedSample1No(identificationMaterial.getProvidedSample1No());
|
|
|
|
|
// im.setProvidedSample1FundQuantity(identificationMaterial.getProvidedSample1FundQuantity());
|
|
|
|
|
// im.setProvidedSample1Quantity(identificationMaterial.getProvidedSample1Quantity());
|
|
|
|
|
//
|
|
|
|
|
// im.setProvidedSample2Present(identificationMaterial.getProvidedSample2Present());
|
|
|
|
|
// im.setProvidedSample2No(identificationMaterial.getProvidedSample2No());
|
|
|
|
|
// im.setProvidedSample2FundQuantity(identificationMaterial.getProvidedSample2FundQuantity());
|
|
|
|
|
// im.setProvidedSample2Quantity(identificationMaterial.getProvidedSample2Quantity());
|
|
|
|
|
// im.setSplitedSample(identificationMaterial.getSplitedSample());
|
|
|
|
|
// im.setRemark(identificationMaterial.getRemark());
|
|
|
|
|
im.setRemark(identificationMaterial.getRemark()); |
|
|
|
|
im.setPack(identificationMaterial.getPack()); |
|
|
|
|
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
|
|
|
|
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No())) { |
|
|
|
|
im.setProvidedSample1No(sampleService.getNewProvidedSampleNo(im.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
//}
|
|
|
|
|
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) { |
|
|
|
|
im.setProvidedSample2No(sampleService.getNewProvidedSampleNo(im.getImNo(), 2)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
|
|
|
|
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getSample1No())) { |
|
|
|
|
im.setSample1No(sampleService.getNewSampleNo(im.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
//}
|
|
|
|
|
if ((identificationMaterial.getSample2Present() != null) && identificationMaterial.getSample2Present()) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getSample2No())) { |
|
|
|
|
im.setSample2No(sampleService.getNewSampleNo(im.getImNo(), 2)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// im.setSample1No(identificationMaterial.getSample1No());
|
|
|
|
|
// im.setSample1FundQuantity(identificationMaterial.getSample1FundQuantity());
|
|
|
|
|
// im.setSample1Quantity(identificationMaterial.getSample1Quantity());
|
|
|
|
|
// im.setSample1BoxId(identificationMaterial.getSample1BoxId());
|
|
|
|
|
//
|
|
|
|
|
// im.setSample2Present(identificationMaterial.getSample2Present());
|
|
|
|
|
// im.setSample2No(identificationMaterial.getSample2No());
|
|
|
|
|
// im.setSample2FundQuantity(identificationMaterial.getSample2FundQuantity());
|
|
|
|
|
// im.setSample2Quantity(identificationMaterial.getSample2Quantity());
|
|
|
|
|
// im.setSample2BoxId(identificationMaterial.getSample2BoxId());
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// UpdateWrapper<EntrustmentIdentificationMaterial> updateWrapper = new UpdateWrapper<EntrustmentIdentificationMaterial>();
|
|
|
|
|
// updateWrapper.eq("id", im.getId()); // 查询条件是 id 相等
|
|
|
|
|
//
|
|
|
|
|
// updateWrapper.set("fund_quantity", im.getFundQuantity());
|
|
|
|
|
// updateWrapper.set("quantity", im.getQuantity());
|
|
|
|
|
//
|
|
|
|
|
// updateWrapper.set("provided_sample1_no", im.getProvidedSample1No());
|
|
|
|
|
// updateWrapper.set("provided_sample1_fund_quantity", im.getProvidedSample1FundQuantity());
|
|
|
|
|
// updateWrapper.set("provided_sample1_quantity", im.getProvidedSample1Quantity());
|
|
|
|
|
//
|
|
|
|
|
// updateWrapper.set("provided_sample2_present", im.getProvidedSample2Present());
|
|
|
|
|
// updateWrapper.set("provided_sample2_no", im.getProvidedSample2No());
|
|
|
|
|
// updateWrapper.set("provided_sample2_fund_quantity", im.getProvidedSample2FundQuantity());
|
|
|
|
|
// updateWrapper.set("provided_sample2_quantity", im.getProvidedSample2Quantity());
|
|
|
|
|
//
|
|
|
|
|
// updateWrapper.set("splited_sample", im.getSplitedSample());
|
|
|
|
|
//
|
|
|
|
|
// //updateWrapper.set("sample1_present", im.getSample1Present());
|
|
|
|
|
// updateWrapper.set("sample1_no", im.getSample1No());
|
|
|
|
|
// updateWrapper.set("sample1_fund_quantity", im.getSample1FundQuantity());
|
|
|
|
|
// updateWrapper.set("sample1_quantity", im.getSample1Quantity());
|
|
|
|
|
// updateWrapper.set("sample1_box_id", im.getSample1BoxId());
|
|
|
|
|
// updateWrapper.set("sample2_present", im.getSample2Present());
|
|
|
|
|
// updateWrapper.set("sample2_no", im.getSample2No());
|
|
|
|
|
// updateWrapper.set("sample2_fund_quantity", im.getSample2FundQuantity());
|
|
|
|
|
// updateWrapper.set("sample2_quantity", im.getSample2Quantity());
|
|
|
|
|
// updateWrapper.set("sample2_box_id", im.getSample2BoxId());
|
|
|
|
|
// updateWrapper.set("remark", im.getRemark());
|
|
|
|
|
// updateWrapper.set("pack", im.getPack());
|
|
|
|
|
|
|
|
|
|
if (!this.update(null, updateWrapper)) { |
|
|
|
|
throw new RuntimeException("保存检材信息失败"); |
|
|
|
|
} |
|
|
|
|
if (!this.updateById(im)) { |
|
|
|
|
throw new RuntimeException("保存检材信息失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
|
|
|
|
|
im = this.getById(identificationMaterial.getId()); |
|
|
|
|
if (im == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId())); |
|
|
|
|
// 从数据库表中取出保存的委托对象, 后续的操作我们以此为准
|
|
|
|
|
im = this.getById(identificationMaterial.getId()); |
|
|
|
|
if (im == null) { |
|
|
|
|
throw new RuntimeException(String.format("没有找到 id 为 %s 的检材", identificationMaterial.getId())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return im; |
|
|
|
|
return materialList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1155,11 +1166,10 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean saveRepWeigh(String id, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) { |
|
|
|
|
|
|
|
|
|
public boolean saveRepWeigh(EntrustmentIdentificationMaterial entrustmentIdentificationMaterial, double sample1RepeatWeigh, double sample2RepeatWeigh, boolean isUseBalance, String sampleFlag) { |
|
|
|
|
BigDecimal data1 = new BigDecimal(sample1RepeatWeigh); |
|
|
|
|
BigDecimal data2 = new BigDecimal(!Double.isNaN(sample2RepeatWeigh) ? sample2RepeatWeigh : 0); |
|
|
|
|
EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = this.getById(id); |
|
|
|
|
// EntrustmentIdentificationMaterial entrustmentIdentificationMaterial = this.getById(id);
|
|
|
|
|
entrustmentIdentificationMaterial.setSample1RepeatWeigh(data1); |
|
|
|
|
entrustmentIdentificationMaterial.setSample2RepeatWeigh(data2); |
|
|
|
|
//设置样本的重量
|
|
|
|
@ -1232,156 +1242,166 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
|
|
|
|
|
Entrustment entrustment = entrustmentService.getById(identificationMaterialList.get(0).getEntrustmentId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!dlpUser.isStaff() && entrustment.getStatus() != EntrustmentStatusConstants.ENTRUSTMENT_STATUS_CREATED.getStatus()) { |
|
|
|
|
throw new RuntimeException(String.format("你已提交过该委托,无法再添加检材信息!")); |
|
|
|
|
} |
|
|
|
|
for (EntrustmentIdentificationMaterial identificationMaterial : identificationMaterialList) { |
|
|
|
|
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; |
|
|
|
|
if (StringUtils.isNotBlank(identificationMaterial.getId()) && StringUtils.isNotBlank(identificationMaterial.getSample1No())) { |
|
|
|
|
identificationMaterial = this.putUpdateById(identificationMaterial, dlpUser); |
|
|
|
|
} 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); |
|
|
|
|
} |
|
|
|
|
entrustMaterialOfThirdSys.setAnalysisType(analysisType); |
|
|
|
|
synchronizeMaterialVoService.save(entrustMaterialOfThirdSys); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String entrustmentId = identificationMaterial.getEntrustmentId(); |
|
|
|
|
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("对应的案件资料不完整, 不存在案件编号。请先完善案件资料")); |
|
|
|
|
} |
|
|
|
|
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("对应的案件资料不完整, 不存在案件编号。请先完善案件资料")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
////若提前创建好了物证,则关联通过物证编号关联检材编号即可;
|
|
|
|
|
if (StrUtil.isNotBlank(identificationMaterial.getEvidenceId())) { |
|
|
|
|
CaseEvidence caseEvidence = caseEvidenceService.getById(identificationMaterial.getEvidenceId()); |
|
|
|
|
identificationMaterial.setImNo(this.getNewIdentificationMaterialNo(caseEvidence.getEvidenceNo())); |
|
|
|
|
////若提前创建好了物证,则关联通过物证编号关联检材编号即可;
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
Boolean copyAttachemnts = false; |
|
|
|
|
if (copyAttachemnts == null) { |
|
|
|
|
copyAttachemnts = false; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
String newEvidenceCode = caseEvidenceService.getNewEvidenceCode(cj.getCaseNo()); |
|
|
|
|
String materialNo = this.getNewIdentificationMaterialNo(newEvidenceCode); |
|
|
|
|
identificationMaterial.setImNo(materialNo); |
|
|
|
|
} |
|
|
|
|
Boolean copyAttachemnts = false; |
|
|
|
|
if (copyAttachemnts == null) { |
|
|
|
|
copyAttachemnts = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(entrustmentId)) { |
|
|
|
|
throw new RuntimeException(String.format("检材必须与某个委托关联, 必须提供 entrustmentId")); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isBlank(entrustmentId)) { |
|
|
|
|
throw new RuntimeException(String.format("检材必须与某个委托关联, 必须提供 entrustmentId")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
identificationMaterial.setId(id); |
|
|
|
|
//设置一些初始属性
|
|
|
|
|
identificationMaterial.setCheckPassed(0); |
|
|
|
|
identificationMaterial.setApprovePassed(0); |
|
|
|
|
identificationMaterial.setAcceptPassed(0); |
|
|
|
|
|
|
|
|
|
identificationMaterial.setPackName(identificationMaterial.getPack()); |
|
|
|
|
identificationMaterial.setTypeName(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType())); |
|
|
|
|
|
|
|
|
|
identificationMaterial.setFormName(identificationMaterial.getForm()); |
|
|
|
|
//设置序号,这里我们按先后顺序,给插入的检材排一个序号
|
|
|
|
|
identificationMaterial.setOrderNo(getWtOrderNo(identificationMaterial.getEntrustmentId())); |
|
|
|
|
//如果传来了样本1的质量,我们要将它赋给Sample1Quantity
|
|
|
|
|
if (identificationMaterial.getSample1Quantity() == null) { |
|
|
|
|
identificationMaterial.setSample1Quantity(identificationMaterial.getProvidedSample1Quantity()); |
|
|
|
|
} |
|
|
|
|
//保存采样人
|
|
|
|
|
saveCollectors(identificationMaterial, dlpUser); |
|
|
|
|
identificationMaterial.setId(id); |
|
|
|
|
//设置一些初始属性
|
|
|
|
|
identificationMaterial.setCheckPassed(0); |
|
|
|
|
identificationMaterial.setApprovePassed(0); |
|
|
|
|
identificationMaterial.setAcceptPassed(0); |
|
|
|
|
|
|
|
|
|
identificationMaterial.setPackName(identificationMaterial.getPack()); |
|
|
|
|
Integer entrustmentType = entrustment.getEntrustmentType(); |
|
|
|
|
//检材继承委托类型
|
|
|
|
|
if (entrustmentType == 0) { |
|
|
|
|
identificationMaterial.setTypeName("常规毒品"); |
|
|
|
|
} else if (entrustmentType == 1) { |
|
|
|
|
identificationMaterial.setTypeName("生物样本"); |
|
|
|
|
} |
|
|
|
|
// identificationMaterial.setTypeName(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType()));
|
|
|
|
|
identificationMaterial.setFormName(identificationMaterial.getForm()); |
|
|
|
|
//设置序号,这里我们按先后顺序,给插入的检材排一个序号
|
|
|
|
|
identificationMaterial.setOrderNo(getWtOrderNo(identificationMaterial.getEntrustmentId())); |
|
|
|
|
//如果传来了样本1的质量,我们要将它赋给Sample1Quantity
|
|
|
|
|
if (identificationMaterial.getSample1Quantity() == null) { |
|
|
|
|
identificationMaterial.setSample1Quantity(identificationMaterial.getProvidedSample1Quantity()); |
|
|
|
|
} |
|
|
|
|
//保存采样人
|
|
|
|
|
saveCollectors(identificationMaterial, dlpUser); |
|
|
|
|
|
|
|
|
|
List<EntrustmentIdentificationMaterial> list = this.list(new LambdaQueryWrapper<EntrustmentIdentificationMaterial>().eq(EntrustmentIdentificationMaterial::getProvidedSample1No, identificationMaterial.getProvidedSample1No())); |
|
|
|
|
//如果在创建检材这
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) && list != null && list.size() > 0) { |
|
|
|
|
identificationMaterial.setProvidedSample1No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) { |
|
|
|
|
//如果委托单位分样了
|
|
|
|
|
//如果委托单位分样了
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) { |
|
|
|
|
identificationMaterial.setProvidedSample2No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 2)); |
|
|
|
|
List<EntrustmentIdentificationMaterial> list = this.list(new LambdaQueryWrapper<EntrustmentIdentificationMaterial>().eq(EntrustmentIdentificationMaterial::getProvidedSample1No, identificationMaterial.getProvidedSample1No())); |
|
|
|
|
//如果在创建检材这
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) || (list != null && list.size() > 0)) { |
|
|
|
|
identificationMaterial.setProvidedSample1No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
//受理的时候应该有2个样
|
|
|
|
|
identificationMaterial = settingAcceptSampleInfoDivide(identificationMaterial); |
|
|
|
|
//如果分样了,并且传入了样本2的值,那么我们将这个值要赋给sample2Quantity,以便受理的时候使用
|
|
|
|
|
if (identificationMaterial.getProvidedSample2Quantity() != null) { |
|
|
|
|
identificationMaterial.setSample2Quantity(identificationMaterial.getProvidedSample2Quantity()); |
|
|
|
|
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) { |
|
|
|
|
//如果委托单位分样了
|
|
|
|
|
//如果委托单位分样了
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample2No())) { |
|
|
|
|
identificationMaterial.setProvidedSample2No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 2)); |
|
|
|
|
} |
|
|
|
|
//受理的时候应该有2个样
|
|
|
|
|
identificationMaterial = settingAcceptSampleInfoDivide(identificationMaterial); |
|
|
|
|
//如果分样了,并且传入了样本2的值,那么我们将这个值要赋给sample2Quantity,以便受理的时候使用
|
|
|
|
|
if (identificationMaterial.getProvidedSample2Quantity() != null) { |
|
|
|
|
identificationMaterial.setSample2Quantity(identificationMaterial.getProvidedSample2Quantity()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//委托单位没分样
|
|
|
|
|
identificationMaterial = settingAcceptSampleInfoNoDivide(identificationMaterial); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//委托单位没分样
|
|
|
|
|
identificationMaterial = settingAcceptSampleInfoNoDivide(identificationMaterial); |
|
|
|
|
} |
|
|
|
|
//默认肯定有一个是分析样是永远存在的,添加的时候,先将这个样本生成出来,所以受理时候的分样信息有一个是存在的,同理如果送检时候的分样信息,也是默认有一个存在的,这个在分样的时候,通过接口调用产生
|
|
|
|
|
//这里判断委托单位是否分样
|
|
|
|
|
//identificationMaterial.setSample1No(sampleService.getNewSampleNo(identificationMaterial.getImNo(),1));
|
|
|
|
|
|
|
|
|
|
identificationMaterial.setCreateBy(dlpUser.getId()); |
|
|
|
|
identificationMaterial.setCreateTime(LocalDateTime.now()); |
|
|
|
|
identificationMaterial.setAcceptNo(null); |
|
|
|
|
identificationMaterial.setSample1RepeatWeigh(null); |
|
|
|
|
identificationMaterial.setSample2RepeatWeigh(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断检材的重量不能大于物证的重量 暂不判断,因为可能单位不统一
|
|
|
|
|
if (this.save(identificationMaterial)) { |
|
|
|
|
// 新增检材记录成功
|
|
|
|
|
try { |
|
|
|
|
if (copyAttachemnts) { |
|
|
|
|
List<String> fileList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId()); |
|
|
|
|
for (String fileName : fileList) { |
|
|
|
|
String srcFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId() + "/" + fileName; |
|
|
|
|
String destFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getEntrustmentId() + "/" + identificationMaterial.getId() + "/" + fileName; |
|
|
|
|
ossFile.fileCopy(srcFileName, destFileName); |
|
|
|
|
//默认肯定有一个是分析样是永远存在的,添加的时候,先将这个样本生成出来,所以受理时候的分样信息有一个是存在的,同理如果送检时候的分样信息,也是默认有一个存在的,这个在分样的时候,通过接口调用产生
|
|
|
|
|
//这里判断委托单位是否分样
|
|
|
|
|
//identificationMaterial.setSample1No(sampleService.getNewSampleNo(identificationMaterial.getImNo(),1));
|
|
|
|
|
|
|
|
|
|
identificationMaterial.setCreateBy(dlpUser.getId()); |
|
|
|
|
identificationMaterial.setCreateTime(LocalDateTime.now()); |
|
|
|
|
identificationMaterial.setAcceptNo(null); |
|
|
|
|
identificationMaterial.setSample1RepeatWeigh(null); |
|
|
|
|
identificationMaterial.setSample2RepeatWeigh(null); |
|
|
|
|
identificationMaterial.setColor(""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断检材的重量不能大于物证的重量 暂不判断,因为可能单位不统一
|
|
|
|
|
if (this.save(identificationMaterial)) { |
|
|
|
|
// 新增检材记录成功
|
|
|
|
|
try { |
|
|
|
|
if (copyAttachemnts) { |
|
|
|
|
List<String> fileList = ossFile.fileList(OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId()); |
|
|
|
|
for (String fileName : fileList) { |
|
|
|
|
String srcFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getCaseId() + "/" + identificationMaterial.getEvidenceId() + "/" + fileName; |
|
|
|
|
String destFileName = OSSDirectoryConstants.ENTRUSTMENT_DIRECTORY + "/" + identificationMaterial.getEntrustmentId() + "/" + identificationMaterial.getId() + "/" + fileName; |
|
|
|
|
ossFile.fileCopy(srcFileName, destFileName); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println(String.format("复制物证附件到新建的检材附件目录出错: %s", e.getMessage())); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println(String.format("复制物证附件到新建的检材附件目录出错: %s", e.getMessage())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1598,12 +1618,14 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//用作于处理一些打印委托书或鉴定事项确认书时的字段类型转换
|
|
|
|
|
|
|
|
|
|
@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("定性分析"); |
|
|
|
@ -1622,14 +1644,15 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
material.setPrintExtractionTime(LocalDateTimeUtil.format(material.getExtractionTime(), "yyyy-MM-dd")); |
|
|
|
|
material.setPrintDrawTime(LocalDateTimeUtil.format(material.getDrawTime(), "yyyy-MM-dd")); |
|
|
|
|
List<DrugLite> candidateDrugs = material.getCandidateDrugs(); |
|
|
|
|
String drugsValue = ""; |
|
|
|
|
if (candidateDrugs == null || candidateDrugs.size() == 0) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < candidateDrugs.size(); i++) { |
|
|
|
|
DrugLite drugLite = candidateDrugs.get(i); |
|
|
|
|
String toJSONString = JSONObject.toJSONString(candidateDrugs.get(i)); |
|
|
|
|
DrugLite drugLite = JSONObject.parseObject(toJSONString, DrugLite.class); |
|
|
|
|
if (i == 0) { |
|
|
|
|
drugsValue = drugLite.getName(); |
|
|
|
|
} else { |
|
|
|
@ -1640,5 +1663,4 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|