|
|
|
@ -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,7 +610,9 @@ 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) { |
|
|
|
|
|
|
|
|
|
for (EntrustmentIdentificationMaterial identificationMaterial : materialList) { |
|
|
|
|
|
|
|
|
|
// 检查委托原来的状态
|
|
|
|
|
EntrustmentIdentificationMaterial im = this.getById(identificationMaterial.getId()); |
|
|
|
@ -629,7 +632,11 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
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()));
|
|
|
|
|
// }
|
|
|
|
@ -638,20 +645,21 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
//-------------------
|
|
|
|
|
// 更新数据库表数据
|
|
|
|
|
//-------------------
|
|
|
|
|
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.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())) { |
|
|
|
@ -663,18 +671,6 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
im.setProvidedSample2No(sampleService.getNewProvidedSampleNo(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()); |
|
|
|
|
|
|
|
|
|
// 如果之前没有生成过样本编号, 现在填写样本重量了, 那么就生成样本编号
|
|
|
|
|
//if ((identificationMaterial.getSample1Present() != null) && identificationMaterial.getSample1Present()) {
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getSample1No())) { |
|
|
|
@ -686,36 +682,50 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
|
|
if (!this.update(null, updateWrapper)) { |
|
|
|
|
if (!this.updateById(im)) { |
|
|
|
|
throw new RuntimeException("保存检材信息失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -724,7 +734,8 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
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,11 +1242,13 @@ 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) { |
|
|
|
|
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())); |
|
|
|
@ -1324,8 +1336,14 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
identificationMaterial.setAcceptPassed(0); |
|
|
|
|
|
|
|
|
|
identificationMaterial.setPackName(identificationMaterial.getPack()); |
|
|
|
|
identificationMaterial.setTypeName(entrustmentMapper.getTypeForDictionary(identificationMaterial.getType())); |
|
|
|
|
|
|
|
|
|
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())); |
|
|
|
@ -1338,7 +1356,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
|
|
|
|
|
List<EntrustmentIdentificationMaterial> list = this.list(new LambdaQueryWrapper<EntrustmentIdentificationMaterial>().eq(EntrustmentIdentificationMaterial::getProvidedSample1No, identificationMaterial.getProvidedSample1No())); |
|
|
|
|
//如果在创建检材这
|
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) && list != null && list.size() > 0) { |
|
|
|
|
if (StrUtil.isBlank(identificationMaterial.getProvidedSample1No()) || (list != null && list.size() > 0)) { |
|
|
|
|
identificationMaterial.setProvidedSample1No(sampleService.getNewProvidedSampleNo(identificationMaterial.getImNo(), 1)); |
|
|
|
|
} |
|
|
|
|
if ((identificationMaterial.getProvidedSample2Present() != null) && identificationMaterial.getProvidedSample2Present()) { |
|
|
|
@ -1366,6 +1384,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
identificationMaterial.setAcceptNo(null); |
|
|
|
|
identificationMaterial.setSample1RepeatWeigh(null); |
|
|
|
|
identificationMaterial.setSample2RepeatWeigh(null); |
|
|
|
|
identificationMaterial.setColor(""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断检材的重量不能大于物证的重量 暂不判断,因为可能单位不统一
|
|
|
|
@ -1385,6 +1404,7 @@ public class EntrustmentIdentificationMaterialServiceImpl extends ServiceImpl<En |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return identificationMaterialList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -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 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|