From fccf211c4c4dcec7dad6b127c5850f20d620968c Mon Sep 17 00:00:00 2001 From: litao Date: Wed, 19 Oct 2022 19:46:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A7=94=E6=89=98=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=BE=85=E7=BC=96=E5=88=B6=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=8A=8A=E5=BE=85=E7=94=9F=E6=88=90=E6=8A=A5=E5=91=8A=E5=92=8C?= =?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90=E6=95=B0=E6=8D=AE=E7=BB=93=E5=90=88?= =?UTF-8?q?=202.=E8=A7=A3=E5=86=B3=E6=89=93=E5=8D=B0=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E4=BB=AA=E5=99=A8=E5=92=8C=E6=93=8D=E4=BD=9C=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E9=97=AE=E9=A2=98=203.=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E9=A9=B3=E5=9B=9E=E5=8A=9F=E8=83=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lims/controller/EntrustController.java | 38 ++-- .../controller/ExamineResultController.java | 14 +- .../lims/service/impl/EntrustServiceImpl.java | 161 ++++++++-------- .../impl/TaskBlueprintServiceImpl.java | 178 +++++++++++------- 4 files changed, 220 insertions(+), 171 deletions(-) diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java index 4bc25ba..07b1a7a 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java @@ -473,12 +473,11 @@ public class EntrustController extends BladeController { } return R.data(page); } - // 待编制报告状态 - if (entry != null && entry.getEntrustStatus() != null && "5".equals(entry.getEntrustStatus())) { + // 已完成状态 + if (entry != null && entry.getEntrustStatus() != null && "8".equals(entry.getEntrustStatus())) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("entrust_status", "4").or(); - queryWrapper.eq("entrust_status", "5").or(); - queryWrapper.eq("entrust_status", "6"); + queryWrapper.eq("entrust_status", "7").or() + .eq("entrust_status", "8"); query.setDescs("create_time"); IPage page = service.page(Condition.getPage(query), queryWrapper); return R.data(page); @@ -855,19 +854,8 @@ public class EntrustController extends BladeController { map.put("jcz", service.count(queryWrapper)); queryWrapper.clear(); -// queryWrapper.eq("entrust_status", "3"); -// map.put("jcwc", service.count(queryWrapper)); -// queryWrapper.clear(); - - queryWrapper.eq("entrust_status", "4"); - map.put("shtg", service.count(queryWrapper)); - queryWrapper.clear(); - -// queryWrapper.eq("entrust_status", "5"); -// map.put("shbh", service.count(queryWrapper)); -// queryWrapper.clear(); - - queryWrapper.eq("entrust_status", "8"); + queryWrapper.eq("entrust_status", "7").or() + .eq("entrust_status", "8"); map.put("ywc", service.count(queryWrapper)); queryWrapper.clear(); @@ -875,12 +863,16 @@ public class EntrustController extends BladeController { map.put("yzf", service.count(queryWrapper)); queryWrapper.clear(); - queryWrapper.eq("entrust_status", "4").or(); - queryWrapper.eq("entrust_status", "5").or(); - queryWrapper.eq("entrust_status", "6"); - map.put("dbz", service.count(queryWrapper)); + queryWrapper.eq("entrust_status", "-0.5"); + map.put("djc", service.count(queryWrapper)); queryWrapper.clear(); +// queryWrapper.eq("entrust_status", "4").or(); +// queryWrapper.eq("entrust_status", "5").or(); +// queryWrapper.eq("entrust_status", "6"); +// map.put("dbz", service.count(queryWrapper)); +// queryWrapper.clear(); + // queryWrapper.eq("entrust_status", "-1"); // map.put("sb", service.count(queryWrapper)); // } @@ -1224,7 +1216,7 @@ public class EntrustController extends BladeController { if ("0".equals(entrust.getIsGenreport())) { entrust.setEntrustStatus("8"); } else { - entrust.setEntrustStatus("4"); + entrust.setEntrustStatus("7"); } service.updateById(entrust); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java index 3cf36d9..5a5ddd7 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java @@ -790,10 +790,7 @@ public class ExamineResultController extends BladeController { List excels = map.get(i + 1 + ""); double code1 = Double.parseDouble(excels.get(0).getCode1()); double code2 = Double.parseDouble(excels.get(1).getCode1()); - double code3 = Double.parseDouble(excels.get(2).getCode1()); - double code4 = Double.parseDouble(excels.get(3).getCode1()); double v1 = (code1 + code2) / 2; - double v2 = (code3 + code4) / 2; DecimalFormat df = new DecimalFormat("#0.000"); for (int j = 0; j < excels.size(); j++) { // 行标头:前端渲染需要A、B、C.... @@ -853,7 +850,7 @@ public class ExamineResultController extends BladeController { if (StringUtil.isNoneBlank(code)) { if (j > 5 || n > 1) { if (v1 != 0) { - SP = df.format((v2 - Double.parseDouble(code)) / v1); + SP = df.format((v1 - Double.parseDouble(code)) / v1); } mapResult.put("originResult", code); mapResult.put("value", SP); @@ -1278,6 +1275,8 @@ public class ExamineResultController extends BladeController { numIndex++; } } + System.out.println("split.length: " + split.length); + System.out.println("numIndex: " + numIndex); // 判断分配样品数量与检测样品数量是否一致 if (split.length != numIndex) { throw new Exception("分配样品数量与检测样品数量不一致!"); @@ -3015,7 +3014,7 @@ public class ExamineResultController extends BladeController { String ctValue = read.get(i).getCtValue(); String length = ""; if (ctValue != null && !"".equals(ctValue)) { - int length1 = 15 - ctValue.length(); + int length1 = 10 - ctValue.length(); for (int i1 = 0; i1 < length1; i1++) { length += " "; } @@ -3023,7 +3022,10 @@ public class ExamineResultController extends BladeController { if (i == (read.size() - 1)) { read.get(i).setCtValue(length + ctValue); - read.get(i).setResult(" 阳性"); + read.get(i).setResult(" 阳 性"); + } else if (i == (read.size() - 2)) { + read.get(i).setCtValue("/"); + read.get(i).setResult("阴 性"); } else { if ("".equals(read.get(i).getCtValue()) || read.get(i).getCtValue() == null) { read.get(i).setCtValue("/"); diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java index b200632..a280b1d 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java @@ -1007,11 +1007,9 @@ public class EntrustServiceImpl extends BaseServiceImpl // 获取该仪器对象 Instrument instrument = instrumentService.getById(s); // 拼接仪器编号及名称 - instrumentName += instrument.getName() + " " + instrument.getCode() + ","; + instrumentName += instrument.getName() + "" + instrument.getCode() + ","; } - - String replace = instrumentName.replace(",", "\r"); - result1.put("code", instrumentName); + result1.put("code", instrumentName.replace(",", "\r\n")); result1.put("experieDate", format3.format(taskBlueprint.getCreateTime())); result1.put("remark", entrust.getRemark()); result1.put("resultList1", ItemAndAllList); @@ -1191,76 +1189,86 @@ public class EntrustServiceImpl extends BaseServiceImpl // 诊断试剂 String[] split1 = examineResult.getReagentId().split(","); String regentName = ""; - Set set = new HashSet(); for (int i = 0; i < split1.length; i++) { Reagent reagent = reagentService.getById(split1[i]); if (i == (split1.length - 1)) { - regentName += reagent.getName(); + regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer(); } else { - regentName += reagent.getName() + ","; + regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer() + "\r\n"; } - set.add(reagent.getManufacturer()); } result.put("7", regentName); - // 生产厂家及批号 - String manufacturer = ""; - List strList = new ArrayList<>(); - for (String m : set) { - strList.add(m); - } - for (int i = 0; i < strList.size(); i++) { - if (i == (strList.size() - 1)) { - manufacturer += strList.get(i); - } else { - manufacturer += strList.get(i) + ","; - } - } - - // 1.先拿到批次号 - String batchNos = examineResult.getBatchNos(); - String[] split3 = batchNos.split(","); - Map> tempListMap = new HashMap(); - for (String batch : split3) { - String[] reagentIdAndBatchArr = batch.split("-"); - String reagentId = reagentIdAndBatchArr[0]; - // 试剂中会有中线的情况,如:1101-3,-3也要带着;原以为只有1101 - String realBatch = ""; - if (reagentIdAndBatchArr.length > 2) { - for (int i = 1; i < reagentIdAndBatchArr.length; i++) { - realBatch += reagentIdAndBatchArr[i] + "-"; - } - } else { - realBatch = reagentIdAndBatchArr[1]; - } - List list = tempListMap.get(reagentId); - if (CollectionUtils.isNotEmpty(list)) { - list.add(realBatch); - } else { - List temp = new ArrayList<>(); - temp.add(realBatch); - tempListMap.put(reagentId, temp); - } - } - String resultBatchStr = ""; - // 遍历处理批号 - Set strings = tempListMap.keySet(); - for (String reagentId : strings) { - // 根据试剂名称查询厂家名称 - Reagent reagent = reagentService.getById(reagentId); - String manufacturerName = reagent.getManufacturer(); - List list = tempListMap.get(reagentId); - resultBatchStr += manufacturerName + ":批号("; - for (int i = 0; i < list.size(); i++) { - String realBatch = list.get(i); - resultBatchStr += realBatch; - if (i != list.size() - 1) { - resultBatchStr += "、"; - } - } - resultBatchStr += ")"; - } - result.put("8", resultBatchStr); +// Set set = new HashSet(); +// for (int i = 0; i < split1.length; i++) { +// Reagent reagent = reagentService.getById(split1[i]); +// if (i == (split1.length - 1)) { +// regentName += reagent.getName(); +// } else { +// regentName += reagent.getName() + ","; +// } +// set.add(reagent.getManufacturer()); +// } +// result.put("7", regentName); +// +// // 生产厂家及批号 +// String manufacturer = ""; +// List strList = new ArrayList<>(); +// for (String m : set) { +// strList.add(m); +// } +// for (int i = 0; i < strList.size(); i++) { +// if (i == (strList.size() - 1)) { +// manufacturer += strList.get(i); +// } else { +// manufacturer += strList.get(i) + ","; +// } +// } +// +// // 1.先拿到批次号 +// String batchNos = examineResult.getBatchNos(); +// String[] split3 = batchNos.split(","); +// Map> tempListMap = new HashMap(); +// for (String batch : split3) { +// String[] reagentIdAndBatchArr = batch.split("-"); +// String reagentId = reagentIdAndBatchArr[0]; +// // 试剂中会有中线的情况,如:1101-3,-3也要带着;原以为只有1101 +// String realBatch = ""; +// if (reagentIdAndBatchArr.length > 2) { +// for (int i = 1; i < reagentIdAndBatchArr.length; i++) { +// realBatch += reagentIdAndBatchArr[i] + "-"; +// } +// } else { +// realBatch = reagentIdAndBatchArr[1]; +// } +// List list = tempListMap.get(reagentId); +// if (CollectionUtils.isNotEmpty(list)) { +// list.add(realBatch); +// } else { +// List temp = new ArrayList<>(); +// temp.add(realBatch); +// tempListMap.put(reagentId, temp); +// } +// } +// String resultBatchStr = ""; +// // 遍历处理批号 +// Set strings = tempListMap.keySet(); +// for (String reagentId : strings) { +// // 根据试剂名称查询厂家名称 +// Reagent reagent = reagentService.getById(reagentId); +// String manufacturerName = reagent.getManufacturer(); +// List list = tempListMap.get(reagentId); +// resultBatchStr += manufacturerName + ":批号("; +// for (int i = 0; i < list.size(); i++) { +// String realBatch = list.get(i); +// resultBatchStr += realBatch; +// if (i != list.size() - 1) { +// resultBatchStr += "、"; +// } +// } +// resultBatchStr += ")"; +// } +// result.put("8", resultBatchStr); // 使用仪器名称及编号 String[] split2 = examineResult.getInstrumentId().split(","); @@ -1274,17 +1282,14 @@ public class EntrustServiceImpl extends BaseServiceImpl instrumentName += s2 + ","; } } - result.put("9", instrumentName.replace(",", "\r")); + result.put("9", instrumentName.replace(",", "\r\n")); // String value = DictBizCache.getValue(DictBizEnum.SIMPLE_STATUS, examineResult.getSimpleStatus()); result.put("10", examineResult.getSimpleStatus()); result.put("11", "温度" + examineResult.getTemperature() + "℃; " + "湿度" + examineResult.getHumidity() + "%RH"); // 操作程序内容 - result.put("12", examineResult.getOperateContent().replace("#", "\r")); -// if (examineBasis != null) { -// result.put("13", examineBasis.getContent().replace("$", "(char)11")); -// } + result.put("12", examineResult.getOperateContent().replace("\n", "\r\n")); // 结果判定方法和依据 - result.put("13", examineResult.getExamineBasisContent().replace("#", "\r")); + result.put("13", examineResult.getExamineBasisContent().replace("\n", "\r\n")); String path = sysClient.getParamValue("electronic_signature_real_path").getData(); // 检测人 if (!"".equals(examine.getExamineBy()) && examine.getExamineBy() != null) { @@ -3347,10 +3352,14 @@ public class EntrustServiceImpl extends BaseServiceImpl result.put("flowTime", "/"); } //检测任务书交回日期 - result.put("backCrossTime", format.format(eTask.getBackCrossTime())); - String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName(); - //接收人 - result.put("backCrossRecipient", name1); + if (eTask.getBackCrossTime() != null) { + result.put("backCrossTime", format.format(eTask.getBackCrossTime())); + } + if (eTask.getBackCrossRecipientBy() != null) { + String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName(); + //接收人 + result.put("backCrossRecipient", name1); + } } } diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java index 378ed2a..044e697 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java @@ -70,9 +70,29 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl simples = simpleService.list(wrapper1); // 如果是追加检验计划提交 + Random random = new Random(); if (taskBlueprint.getIsContinue() != null && taskBlueprint.getIsContinue() == 1) { List eTasks = taskBlueprint.getTasks(); for (ETask eTask : eTasks) { + // 如果是新分配的子任务 + if (eTask.getId() == null) { + eTask.setId(random.nextLong()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(TaskBlueprint::getEntrustId, taskBlueprint.getEntrustId()); + TaskBlueprint one = this.getOne(wrapper); + eTask.setTaskBlueprintId(one.getId()); + taskBlueprint.setId(one.getId()); + if (eTask.getDeptId() != null) { + Integer sort = sysClient.getDept(eTask.getDeptId()).getData().getSort(); + eTask.setWeight(sort); + } + eTask.setDemandCompletionTime(taskBlueprint.getDemandCompletionTime()); + eTask.setStatus(0); + eTask.setIsDeleted(0); + eTask.setCreateTime(new Date()); + eTask.setUpdateTime(new Date()); + ieTaskService.save(eTask); + } // 发送提示消息 sendMessage(String.valueOf(eTask.getDeptId())); @@ -80,71 +100,71 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl examines = eTask.getExamines(); // 库里的检验 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("dept_id", eTask.getDeptId()); - queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId()); - List examinesInDB = examineService.list(queryWrapper); - - // 要加的检验 - List examinesWillAdd = new ArrayList<>(); - // 要去掉的检验 - List examinesWillSub = new ArrayList<>(); - // 不变的检验 - List examinesWillKeep = new ArrayList<>(); - - // 计算出要保持的 - for (Examine dbExamine : examinesInDB) { - // 判断对象是都在该集合中包含 - if (isContain(examines, dbExamine)) { - // 如果在,添加到不变的检验接集合中 - examinesWillKeep.add(dbExamine); - // 最新检验集合中删除包含的 - for (Examine examine : examines) { - if (examine.getId().equals(dbExamine.getId())) { - examine.setIsDeleted(1); - } - } -// examines.remove(dbExamine); - // 之前检验集合中删除包含的 - dbExamine.setIsDeleted(1); -// examinesInDB.remove(dbExamine); - } - } - // 要加的 - for (Examine examine : examines) { - if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) { - examinesWillAdd.add(examine); - } - } - // 要去掉的 - for (Examine examine : examinesInDB) { - if (examine.getIsDeleted() == 0) { - examinesWillSub.add(examine); - } - } - - // 找样品当前位置? - String simpleCurrPlace = ""; - for (Examine examine : examines) { - if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) { - simpleCurrPlace = examine.getSimpleCurrPlace(); - break; - } - } - - // 获取委托单所有样品 - LambdaQueryWrapper wrapperTemp = new LambdaQueryWrapper<>(); - wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId()); - wrapperTemp.orderByAsc(Simple::getSort); - List simplesTemp = simpleService.list(wrapperTemp); - for (int i = 0; i < simplesTemp.size(); i++) { - simplesTemp.get(i).setIsDistribution(0); - } - simpleService.updateBatchById(simplesTemp); +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("dept_id", eTask.getDeptId()); +// queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId()); +// List examinesInDB = examineService.list(queryWrapper); +// +// // 要加的检验 +// List examinesWillAdd = new ArrayList<>(); +// // 要去掉的检验 +// List examinesWillSub = new ArrayList<>(); +// // 不变的检验 +// List examinesWillKeep = new ArrayList<>(); +// +// // 计算出要保持的 +// for (Examine dbExamine : examinesInDB) { +// // 判断对象是都在该集合中包含 +// if (isContain(examines, dbExamine)) { +// // 如果在,添加到不变的检验接集合中 +// examinesWillKeep.add(dbExamine); +// // 最新检验集合中删除包含的 +// for (Examine examine : examines) { +// if (examine.getId().equals(dbExamine.getId())) { +// examine.setIsDeleted(1); +// } +// } +//// examines.remove(dbExamine); +// // 之前检验集合中删除包含的 +// dbExamine.setIsDeleted(1); +//// examinesInDB.remove(dbExamine); +// } +// } +// // 要加的 +// for (Examine examine : examines) { +// if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) { +// examinesWillAdd.add(examine); +// } +// } +// // 要去掉的 +// for (Examine examine : examinesInDB) { +// if (examine.getIsDeleted() == 0) { +// examinesWillSub.add(examine); +// } +// } +// +// // 找样品当前位置? +// String simpleCurrPlace = ""; +// for (Examine examine : examines) { +// if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) { +// simpleCurrPlace = examine.getSimpleCurrPlace(); +// break; +// } +// } +// +// // 获取委托单所有样品 +// LambdaQueryWrapper wrapperTemp = new LambdaQueryWrapper<>(); +// wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId()); +// wrapperTemp.orderByAsc(Simple::getSort); +// List simplesTemp = simpleService.list(wrapperTemp); +// for (int i = 0; i < simplesTemp.size(); i++) { +// simplesTemp.get(i).setIsDistribution(0); +// } +// simpleService.updateBatchById(simplesTemp); // 遍历检验 List examinesWillAddTemp = new ArrayList<>(); - for (Examine examine : examinesWillAdd) { + for (Examine examine : examines) { if (!"".equals(examine.getExperieNum())) { continue; } @@ -171,7 +191,7 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList()); - examineService.removeByIds(collect); +// List collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList()); +// examineService.removeByIds(collect); + } + // 筛选出驳回的检测数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(Examine::getEntrustId, taskBlueprint.getEntrustId()); + wrapper.eq(Examine::getStatus, -1); + List examines = examineService.list(wrapper); + // 拿到需要删除的检测id集合,批量删除 + List collect = examines.stream().map(Examine::getId).collect(Collectors.toList()); + examineService.removeByIds(collect); + // 删除没有对应检测的子任务 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ETask::getTaskBlueprintId, taskBlueprint.getId()); + // 查询任务书下所有子任务 + List eTaskList = ieTaskService.list(queryWrapper); + // 如果不为空 + if (CollectionUtils.isNotEmpty(eTaskList)) { + // 循环 + for (ETask eTask : eTaskList) { + // 查询该子任务下所有的检测 + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.eq(Examine::getETaskId, eTask.getId()); + List examineList = examineService.list(wrapper2); + // 如果没有数据,删除该子任务 + if (examineList == null || examineList.size() == 0) { + ieTaskService.removeById(eTask.getId()); + } + } } } // 第一次计划提交 else { - Random random = new Random(); long taskBlueprintId = random.nextLong(); taskBlueprint.setId(taskBlueprintId); List eTasks = taskBlueprint.getTasks();