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 e828d18..12125c4 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 @@ -608,14 +608,14 @@ public class EntrustController extends BladeController { taskBlueprint.setTasks(eTaskList); } // 处理任务书回交人返回用户名称 - R userR = userClient.userInfoById(Long.valueOf(taskBlueprint.getBackCrossRecipientBy())); - User user = userR.getData(); - if (user != null) { - taskBlueprint.setBackCrossRecipientName(user.getName()); - } +// R userR = userClient.userInfoById(Long.valueOf(taskBlueprint.getBackCrossRecipientBy())); +// User user = userR.getData(); +// if (user != null) { +// taskBlueprint.setBackCrossRecipientName(user.getName()); +// } // 处理任务书回交人返回用户名称 R userTemp = userClient.userInfoById(Long.valueOf(taskBlueprint.getTaskIssuedBy())); - User user1 = userR.getData(); + User user1 = userTemp.getData(); if (user1 != null) { taskBlueprint.setTaskIssuedBy(user1.getName()); } @@ -1230,11 +1230,12 @@ public class EntrustController extends BladeController { // 修改当前部门的任务书主表的任务书回交日期和任务书回交接收人 QueryWrapper queryWrapper1 = new QueryWrapper(); - queryWrapper1.eq("", ""); + queryWrapper1.eq("entrust_id", examine.getEntrustId()); TaskBlueprint one = taskBlueprintService.getOne(queryWrapper1); Long entrustId = entrust.getId(); ETask eTask = new ETask(); + eTask.setId(examine.getId()); eTask.setTaskIssuedBy(one.getTaskIssuedBy()); eTask.setBackCrossTime(new Date()); eTask.setBackCrossRecipientBy(one.getTaskIssuedBy()); @@ -1244,6 +1245,7 @@ public class EntrustController extends BladeController { User user = userR.getData(); eTask.setBackCrossRecipientName(user.getName()); } + eTaskService.updateById(eTask); } } 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 762c885..dd62181 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 @@ -43,6 +43,8 @@ public class ExamineResultController extends BladeController { private final IExamineItemService examineItemService; + private final IReagentService reagentService; + /** * 分页 */ @@ -82,7 +84,7 @@ public class ExamineResultController extends BladeController { * 解析数据 */ @PostMapping("/excel") - public R excel(MultipartFile file, String examineId) throws Exception { + public R excel(MultipartFile file, String examineId, String reagentId) throws Exception { Examine examine = examineService.getById(examineId); ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); if ("2".equals(examineItem.getInputMode()) || "6".equals(examineItem.getInputMode())) { @@ -94,7 +96,7 @@ public class ExamineResultController extends BladeController { } else if ("5".equals(examineItem.getInputMode())) { return xnExcel(file, examineId); } else { - return ptExcel(file, examineId); + return ptExcel(file, examineId, reagentId); } } @@ -365,7 +367,12 @@ public class ExamineResultController extends BladeController { /** * 常规Excel解析数据 */ - private R>>>> ptExcel(MultipartFile file, String examineId) throws Exception { + private R>>>> ptExcel(MultipartFile file, String examineId, String reagentId) throws Exception { + // 判断试剂是否选了一个 + if (reagentId.split(",").length > 1) { + throw new Exception("该检验只能选择一个试剂!"); + } + List read = ExcelUtil.read(file, ExamineExcel.class); Map> map = new HashMap<>(); // 组数 @@ -395,384 +402,862 @@ public class ExamineResultController extends BladeController { // 按照公式计算实验数据并返回 Map>>> map1 = new HashMap<>(); - for (int i = 0; i < group; i++) { - List>> mapList = new ArrayList<>(); - 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++) { + // 不同试剂计算公式不同 + // 猪繁殖与呼吸综合征病毒抗体ELISA检测试剂盒 + if ("1564971031138115586".equals(reagentId)) { + for (int i = 0; i < group; i++) { + DecimalFormat df = new DecimalFormat("#0.000"); + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code3 = Double.parseDouble(excels.get(2).getCode1()); + double code4 = Double.parseDouble(excels.get(3).getCode1()); + String v1 = df.format((code3 + code4) / 2 * 0.3); + String v2 = df.format((code3 + code4) / 2 * 0.25); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (j + 65)); + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; - Map> map2 = new HashMap<>(); - int u = 1; - String SP = "0.00"; - if (j > 5) { - if (excels.get(j).getCode1() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode1()) - v1) / (v2 - v1)); + Map> map2 = new HashMap<>(); + + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode1()); - map3.put("value", SP); -// int b = (i * 90) + j - 6; - int b = (i * 96) + j; -// map3.put("num", split[b - ((i + 1) * 6)]); - map3.put("num", "1"); - map3.put("order", b + 1); - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtil.isNoneBlank(code)) { + if (j > 5 || n > 1) { + mapResult.put("originResult", code); + // 直接给原始数据值,因为没有SP值 + mapResult.put("value", code); + mapResult.put("num", "1"); + if (Double.parseDouble(code) > Double.parseDouble(v1)) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(code) >= Double.parseDouble(v2) && Double.parseDouble(code) <= Double.parseDouble(v1)) { + mapResult.put("result", "可疑"); + } else if (Double.parseDouble(code) < Double.parseDouble(v2)) { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } } else { - map3.put("result", "阴性"); + mapResult.put("originResult", ""); + mapResult.put("num", ""); } - map2.put(a + 1, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j; - map3.put("order", b + 1); - map3.put("num", ""); - map2.put(a + 1, map3); - list.add(map3); - } - } else { - if (excels.get(j).getCode1() != null) { - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode1()); - int b = (i * 96) + j; - map3.put("order", b + 1); - map2.put(a + 1, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j; - map3.put("order", b + 1); - map3.put("num", ""); - map2.put(a + 1, map3); - list.add(map3); - } - } - if (excels.get(j).getCode2() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode2()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode2()); - map3.put("value", SP); -// int b = (i * 90) + j + 2 + (u * 8); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 2, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 2, map3); - list.add(map3); - } - if (excels.get(j).getCode3() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode3()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode3()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 3, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 3, map3); - list.add(map3); - } - if (excels.get(j).getCode4() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode4()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode4()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 4, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 4, map3); - list.add(map3); - } - if (excels.get(j).getCode5() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode5()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode5()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 5, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 5, map3); - list.add(map3); - } - if (excels.get(j).getCode6() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode6()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode6()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 6, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 6, map3); - list.add(map3); - } - if (excels.get(j).getCode7() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode7()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode7()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 7, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 7, map3); - list.add(map3); - } - if (excels.get(j).getCode8() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode8()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode8()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 8, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 8, map3); - list.add(map3); - } - if (excels.get(j).getCode9() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode9()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode9()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); } - map2.put(a + 9, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 9, map3); - list.add(map3); + mapList.add(map2); } - if (excels.get(j).getCode10() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode10()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode10()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 10, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 10, map3); - list.add(map3); + map1.put("g" + (i + 1), mapList); + } + } + // 伪狂犬病毒gE蛋白lgG抗体ELISA检测试剂盒 + else if ("1564971031138115586".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(0).getCode1()); + double code2 = Double.parseDouble(excels.get(1).getCode1()); + if (code1 < 0.05) { + code1 = 0.05; } - if (excels.get(j).getCode11() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode11()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode11()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); - } - map2.put(a + 11, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 11, map3); - list.add(map3); + if (code2 < 0.05) { + code2 = 0.05; } - if (excels.get(j).getCode12() != null) { - if ((v2 - v1) != 0) { - SP = df.format((Double.parseDouble(excels.get(j).getCode12()) - v1) / (v2 - v1)); - } - Map map3 = new HashMap<>(); - map3.put("originResult", excels.get(j).getCode12()); - map3.put("value", SP); - int b = (i * 96) + j + (u * 8); - map3.put("num", "1"); - map3.put("order", b + 1); - u++; - if (Double.parseDouble(SP) >= 0.4) { - map3.put("result", "阳性"); - } else { - map3.put("result", "阴性"); + double v = (code1 + code2) / 2 + 0.18; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtil.isNoneBlank(code)) { + if (j > 5 || n > 1) { + mapResult.put("originResult", code); + mapResult.put("value", code); + mapResult.put("num", "1"); + if (Double.parseDouble(code) >= v) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); } - map2.put(a + 12, map3); - list.add(map3); - } else { - Map map3 = new HashMap<>(); - map3.put("originResult", ""); - int b = (i * 96) + j + (u * 8); - map3.put("num", ""); - map3.put("order", b + 1); - u++; - map2.put(a + 12, map3); - list.add(map3); + mapList.add(map2); } - mapList.add(map2); + map1.put("g" + (i + 1), mapList); } - map1.put("g" + (i + 1), mapList); } + // 非洲猪瘟病毒抗体检测试剂盒 + else if ("1564971031138115586".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + 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.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SP = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtil.isNoneBlank(code)) { + if (j > 5 || n > 1) { + if ((v2 - v1) != 0) { + SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1)); + } + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.2) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SP) < 0.1) { + mapResult.put("result", "阴性"); + } else { + mapResult.put("result", "疑似"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 小反刍兽疫病毒阻断ELISA抗体检测试剂盒 + else if ("1564971031138115586".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double code1 = Double.parseDouble(excels.get(4).getCode1()); + double code2 = Double.parseDouble(excels.get(5).getCode1()); + double v1 = (code1 + code2) / 2; + DecimalFormat df = new DecimalFormat("#0.000"); + for (int j = 0; j < excels.size(); j++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtil.isNoneBlank(code)) { + if (j > 5 || n > 1) { + String SP = df.format(100 - Double.parseDouble(code) / v1 * 100); + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) > 50) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // + else if ("1564971031138115586".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + 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.... + String a = String.valueOf((char) (j + 65)); + + ExamineExcel examineExcel = excels.get(j);//取到一行记录 + int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; + + Map> map2 = new HashMap<>(); + + String SP = "0.00"; + for (int n = 1; n <= filedsLength; n++) { + String code; + switch (n) { + case 1: + code = examineExcel.getCode1(); + break; + case 2: + code = examineExcel.getCode2(); + break; + case 3: + code = examineExcel.getCode3(); + break; + case 4: + code = examineExcel.getCode4(); + break; + case 5: + code = examineExcel.getCode5(); + break; + case 6: + code = examineExcel.getCode6(); + break; + case 7: + code = examineExcel.getCode7(); + break; + case 8: + code = examineExcel.getCode8(); + break; + case 9: + code = examineExcel.getCode9(); + break; + case 10: + code = examineExcel.getCode10(); + break; + case 11: + code = examineExcel.getCode11(); + break; + case 12: + code = examineExcel.getCode12(); + break; + default: + code = "0"; + } + + Map mapResult = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + if (StringUtil.isNoneBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SP = df.format((v2 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.5) { + mapResult.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult.put("num", ""); + } + mapResult.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + +// for (int i = 0; i < group; i++) { +// List>> mapList = new ArrayList<>(); +// 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.... +// String a = String.valueOf((char) (j + 65)); +// +// Map> map2 = new HashMap<>(); +// int u = 1; +// String SP = "0.00"; +// if (j > 5) { +// if (excels.get(j).getCode1() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode1()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode1()); +// map3.put("value", SP); +//// int b = (i * 90) + j - 6; +// int b = (i * 96) + j; +//// map3.put("num", split[b - ((i + 1) * 6)]); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 1, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j; +// map3.put("order", b + 1); +// map3.put("num", ""); +// map2.put(a + 1, map3); +// list.add(map3); +// } +// } else { +// if (excels.get(j).getCode1() != null) { +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode1()); +// int b = (i * 96) + j; +// map3.put("order", b + 1); +// map2.put(a + 1, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j; +// map3.put("order", b + 1); +// map3.put("num", ""); +// map2.put(a + 1, map3); +// list.add(map3); +// } +// } +// if (excels.get(j).getCode2() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode2()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode2()); +// map3.put("value", SP); +//// int b = (i * 90) + j + 2 + (u * 8); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 2, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 2, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode3() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode3()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode3()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 3, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 3, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode4() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode4()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode4()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 4, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 4, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode5() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode5()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode5()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 5, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 5, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode6() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode6()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode6()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 6, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 6, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode7() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode7()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode7()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 7, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 7, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode8() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode8()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode8()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 8, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 8, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode9() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode9()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode9()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 9, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 9, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode10() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode10()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode10()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 10, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 10, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode11() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode11()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode11()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 11, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 11, map3); +// list.add(map3); +// } +// if (excels.get(j).getCode12() != null) { +// if ((v2 - v1) != 0) { +// SP = df.format((Double.parseDouble(excels.get(j).getCode12()) - v1) / (v2 - v1)); +// } +// Map map3 = new HashMap<>(); +// map3.put("originResult", excels.get(j).getCode12()); +// map3.put("value", SP); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", "1"); +// map3.put("order", b + 1); +// u++; +// if (Double.parseDouble(SP) >= 0.4) { +// map3.put("result", "阳性"); +// } else { +// map3.put("result", "阴性"); +// } +// map2.put(a + 12, map3); +// list.add(map3); +// } else { +// Map map3 = new HashMap<>(); +// map3.put("originResult", ""); +// int b = (i * 96) + j + (u * 8); +// map3.put("num", ""); +// map3.put("order", b + 1); +// u++; +// map2.put(a + 12, map3); +// list.add(map3); +// } +// mapList.add(map2); +// } +// map1.put("g" + (i + 1), mapList); +// } Collections.sort(list, new Comparator>() { @Override @@ -961,7 +1446,7 @@ public class ExamineResultController extends BladeController { String value = FormulaTool.getResult(reg, params); System.out.println(value); String format = df.format(Double.parseDouble(value)); - mapResult.put("originResult", examineExcel.getCode1()); + mapResult.put("originResult", code); mapResult.put("value", "0E-10".equals(format) ? "0" : format); mapResult.put("num", "1"); if (Double.parseDouble(format) >= 0.4) { diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java index aa6471f..78de346 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ReagentController.java @@ -89,7 +89,15 @@ public class ReagentController extends BladeController { */ @PostMapping("/update") @ApiOperation(value = "更改", notes = "更改") - public R update(@RequestBody Reagent entry) { + public R update(@RequestBody Reagent entry) throws Exception { + List list = service.list(); + if (list != null && list.size() > 0) { + for (Reagent reagent : list) { + if (entry.getName().equals(reagent.getName()) && entry.getManufacturer().equals(reagent.getManufacturer())) { + throw new Exception("名称重复"); + } + } + } List operationList = entry.getOperationList(); if (operationList != null && operationList.size() > 0) { entry.setTypeAndOperation(JSON.toJSONString(operationList)); @@ -146,7 +154,7 @@ public class ReagentController extends BladeController { for (ReagentExcel reagentExcel : excelList) { // 重名校验 for (Reagent reagent : list) { - if (reagentExcel.getName().equals(reagent.getName())) { + if (reagentExcel.getName().equals(reagent.getName()) && reagentExcel.getManufacturer().equals(reagent.getManufacturer())) { throw new Exception("名称重复: " + reagentExcel.getName()); } } 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 e381ad4..7ce5102 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 @@ -3239,13 +3239,16 @@ public class EntrustServiceImpl extends BaseServiceImpl result.put("flowRecipient", "/"); } if (!"".equals(eTask.getFlowTime()) && eTask.getFlowTime() != null) { - result.put("flowTime", format.format(eTask.getFlowTime()));//接收日期 + //接收日期 + result.put("flowTime", format.format(eTask.getFlowTime())); } else { result.put("flowTime", "/"); } - result.put("backCrossTime", format.format(taskBlueprint.getBackCrossTime()));//检测任务书交回日期 - String name1 = userClient.userInfoById(Long.parseLong(taskBlueprint.getBackCrossRecipientBy())).getData().getName(); - result.put("backCrossRecipient", name1);//接收人 + //检测任务书交回日期 +// result.put("backCrossTime", format.format(eTask.getBackCrossTime())); +// String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName(); + //接收人 +// result.put("backCrossRecipient", name1); } }