From 3100b478a210989c35b735316ce2f634854d9b04 Mon Sep 17 00:00:00 2001 From: litao Date: Sun, 4 Sep 2022 22:47:35 +0800 Subject: [PATCH] =?UTF-8?q?2022=E5=B9=B49=E6=9C=884=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springblade/lims/entry/ExamineBasis.java | 2 +- .../lims/entry/ExamineDataArrVO.java | 2 + .../controller/ExamineResultController.java | 80 ++-- .../lims/controller/SimpleRelController.java | 2 +- .../lims/service/impl/EntrustServiceImpl.java | 451 +++++++++++++----- 5 files changed, 375 insertions(+), 162 deletions(-) diff --git a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineBasis.java b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineBasis.java index 68f8de8..1177bb2 100644 --- a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineBasis.java +++ b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineBasis.java @@ -44,7 +44,7 @@ public class ExamineBasis extends BaseEntity implements Serializable { /** * 质量文件 */ - private Long qualityFileId; + private String qualityFileId; private String qualityFileName; } \ No newline at end of file diff --git a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineDataArrVO.java b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineDataArrVO.java index 0c8d7db..32080a5 100644 --- a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineDataArrVO.java +++ b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineDataArrVO.java @@ -16,4 +16,6 @@ public class ExamineDataArrVO { private String value; private String num; + + private String log2; } 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 c27de16..b8061a8 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 @@ -516,10 +516,10 @@ public class ExamineResultController extends BladeController { String[] experieNum = examine.getExperieNum().split(","); // 获取4个抗原对照值 List list = new ArrayList<>(); - list.add(Double.parseDouble(read.get(4).getCode12())); - list.add(Double.parseDouble(read.get(5).getCode12())); - list.add(Double.parseDouble(read.get(6).getCode12())); - list.add(Double.parseDouble(read.get(7).getCode12())); + list.add(Double.parseDouble(originRowDatas.get(4).getCode12())); + list.add(Double.parseDouble(originRowDatas.get(5).getCode12())); + list.add(Double.parseDouble(originRowDatas.get(6).getCode12())); + list.add(Double.parseDouble(originRowDatas.get(7).getCode12())); List list1 = list.stream().sorted().collect(Collectors.toList()); DecimalFormat df = new DecimalFormat("#0.000"); // 对照平均值 @@ -606,7 +606,6 @@ public class ExamineResultController extends BladeController { } return R.data(mapList); } - // 兰所多板---------------------------------------------------------------------------------------------------- else if ("2".equals(split[1])) { Map>>> resultMap = new HashMap<>(); @@ -621,6 +620,7 @@ public class ExamineResultController extends BladeController { String[] experieNum = examine.getExperieNum().split(","); // 用于存放每个格子的值,有顺序,无规则 List> allDatas = new ArrayList<>(); + List> allData = new ArrayList<>(); // 按照公式计算实验数据并返回;两板对照:取偶数组去循环做参照,+1组做对照 // 参照组:2n 、对照组:2n + 1 for (int group = 0; group < groupCount / 2; group++) { @@ -640,7 +640,8 @@ public class ExamineResultController extends BladeController { int u = 1; // 计算每一列 for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 1); + Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 1, 1); + allData.add(cPosData); allPosDatasInAGroup.put(a + i, cPosData); if (i != 1) { u++; @@ -648,7 +649,7 @@ public class ExamineResultController extends BladeController { } allDataInCurrGroup1.add(allPosDatasInAGroup); } - resultMap.put("g" + (group + 1), allDataInCurrGroup1); + resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); // 2.对照组 // 存这一组的所有数据 @@ -665,7 +666,8 @@ public class ExamineResultController extends BladeController { int u = 1; // 计算每一列 for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 1); + Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 1, 2); + allData.add(cPosData); allPosDatasInAGroup.put(a + i, cPosData); if (i != 1) { u++; @@ -673,7 +675,7 @@ public class ExamineResultController extends BladeController { } allDataInCurrGroup2.add(allPosDatasInAGroup); } - resultMap.put("g" + (group + 1), allDataInCurrGroup2); + resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); // 3.两相比较取结果 for (int i = 0; i < allDataInCurrGroup1.size(); i++) { @@ -685,6 +687,10 @@ public class ExamineResultController extends BladeController { Map data1 = layer1.get(key); Map data2 = layer2.get(key); boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); + if (data1.get("result") == null || data2.get("result") == null) { + allDatas.add(data1); + continue; + } if (data1.get("result").equals("阳性") || data2.get("result").equals("阳性")) { data1.put("log2", isPig ? "≥1:64" : "≥1:128"); data1.put("result", "阳性"); @@ -703,7 +709,7 @@ public class ExamineResultController extends BladeController { wrapper.eq(ExamineResult::getExamineId, examine.getId()); ExamineResult result = service.getOne(wrapper); if (result != null) { - result.setOriginRecordData(JSON.toJSONString(groupsMap)); + result.setOriginRecordData(JSON.toJSONString(allData)); result.setOriginRecordResult(JSON.toJSONString(resultMap)); result.setExamineDataArr(JSON.toJSONString(allDatas)); service.updateById(result); @@ -711,7 +717,7 @@ public class ExamineResultController extends BladeController { else { ExamineResult examineResult = new ExamineResult(); examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(groupsMap)); + examineResult.setOriginRecordData(JSON.toJSONString(allData)); examineResult.setOriginRecordResult(JSON.toJSONString(resultMap)); examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); service.save(examineResult); @@ -733,16 +739,16 @@ public class ExamineResultController extends BladeController { String[] experieNum = examine.getExperieNum().split(","); // 用于存放每个格子的值,有顺序,无规则 List> allDatas = new ArrayList<>(); - + List> allData = new ArrayList<>(); // 按照公式计算实验数据并返回 // 参照组:2n 、对照组:2n + 1 - for (int group = 0; group < groupCount; group++) { + for (int group = 0; group < groupCount / 2; group++) { // 1.参照组 // 存这一组的所有数据 List>> allDataInCurrGroup1 = new ArrayList<>(); // i = 0时,是取1组的那8行 - List rowInGroup1 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); + List rowInGroup1 = groupsMap.get(String.valueOf((2 * group) + 1)); // 计算该组的[对照平均值] Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); for (int row = 0; row < rowInGroup1.size(); row++) { @@ -753,7 +759,8 @@ public class ExamineResultController extends BladeController { int u = 1; // 计算每一列 for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 2); + Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 2, 1); + allData.add(cPosData); allPosDatasInAGroup.put(a + i, cPosData); if (i != 1) { u++; @@ -761,9 +768,9 @@ public class ExamineResultController extends BladeController { } allDataInCurrGroup1.add(allPosDatasInAGroup); } - resultMap.put("g" + (group + 1), allDataInCurrGroup1); + resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); - // 1.参照组 + // 1.对照组 // 存这一组的所有数据 List>> allDataInCurrGroup2 = new ArrayList<>(); // i = 0时,是取1组的那8行 @@ -778,7 +785,8 @@ public class ExamineResultController extends BladeController { int u = 1; // 计算每一列 for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 2); + Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 2, 2); + allData.add(cPosData); allPosDatasInAGroup.put(a + i, cPosData); if (i != 1) { u++; @@ -786,7 +794,7 @@ public class ExamineResultController extends BladeController { } allDataInCurrGroup2.add(allPosDatasInAGroup); } - resultMap.put("g" + (group + 1), allDataInCurrGroup2); + resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); // 3.两相比较取结果 for (int i = 0; i < allDataInCurrGroup1.size(); i++) { @@ -798,6 +806,10 @@ public class ExamineResultController extends BladeController { Map data1 = layer1.get(key); Map data2 = layer2.get(key); boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); + if (data1.get("result") == null || data2.get("result") == null) { + allDatas.add(data1); + continue; + } if (data1.get("result").equals("阳性") || data2.get("result").equals("阳性")) { data1.put("log2", isPig ? "≥1:64" : "≥1:128"); data1.put("result", "阳性"); @@ -814,7 +826,7 @@ public class ExamineResultController extends BladeController { wrapper.eq(ExamineResult::getExamineId, examine.getId()); ExamineResult result = service.getOne(wrapper); if (result != null) { - result.setOriginRecordData(JSON.toJSONString(groupsMap)); + result.setOriginRecordData(JSON.toJSONString(allData)); result.setOriginRecordResult(JSON.toJSONString(resultMap)); result.setExamineDataArr(JSON.toJSONString(allDatas)); service.updateById(result); @@ -822,7 +834,7 @@ public class ExamineResultController extends BladeController { else { ExamineResult examineResult = new ExamineResult(); examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(groupsMap)); + examineResult.setOriginRecordData(JSON.toJSONString(allData)); examineResult.setOriginRecordResult(JSON.toJSONString(resultMap)); examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); service.save(examineResult); @@ -836,7 +848,7 @@ public class ExamineResultController extends BladeController { * b:从一个顺序排的检测编号里获取G1这个位置的值 * examineType: 1:多版, 2:非兰所 */ - private Map calcAndPutcPosData(List excels, Double avg, String[] experieNum, int group, int row, int col, int u, int examineType) { + private Map calcAndPutcPosData(List excels, Double avg, String[] experieNum, int group, int row, int col, int u, int examineType, int a) { String value = null; // 待抽 ↓ if (col == 1) { @@ -883,13 +895,23 @@ public class ExamineResultController extends BladeController { boolean isIncludeCurr = col == 12 ? false : (examineType == 1 && col == 11 ? false : true); if (value != null && isIncludeCurr) { cPosData.put("value", value); - cPosData.put("order", b + 1); + // 如果是参照组 + if (a == 1) { + cPosData.put("order", b + 1); + } else { + cPosData.put("order", b + 1 + 96); + } cPosData.put("num", experieNum[b - ((group + 1) * 6 + (group * 16))]); cPosData.put("result", Double.parseDouble(value) > avg ? "阳性" : "阴性"); return cPosData; } - cPosData.put("value", " "); - cPosData.put("order", b + 1); + cPosData.put("value", value != null ? value : " "); + // 如果是参照组 + if (a == 1) { + cPosData.put("order", b + 1); + } else { + cPosData.put("order", b + 1 + 96); + } return cPosData; } @@ -932,15 +954,15 @@ public class ExamineResultController extends BladeController { if (read != null && read.size() > 0) { for (int i = 0; i < read.size(); i++) { if (i == (read.size() - 1)) { - read.get(i).setCtValue(" " + read.get(i)); - read.get(i).setValue(" 阳性"); + read.get(i).setCtValue(" " + read.get(i).getCtValue()); + read.get(i).setValue(" 阳性"); } else { if ("".equals(read.get(i).getCtValue()) || read.get(i).getCtValue() == null) { read.get(i).setCtValue("/"); read.get(i).setValue("阴性"); } else { - read.get(i).setCtValue(" " + read.get(i)); - read.get(i).setValue(" 阳性"); + read.get(i).setCtValue(" " + read.get(i).getCtValue()); + read.get(i).setValue(" 阳性"); } } } diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/SimpleRelController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/SimpleRelController.java index 17356f5..058f0f7 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/SimpleRelController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/SimpleRelController.java @@ -63,7 +63,7 @@ public class SimpleRelController extends BladeController { // 3.开始计算 int num = 1; Map> collect = rels.stream().collect(Collectors.groupingBy(SimpleRel::getSort)); - for (int i = 1; i <= collect.size(); i++) { + for (int i = 0; i < collect.size(); i++) { List currSimpleRels = collect.get(i); // 实验的 for (SimpleRel currRel : currSimpleRels) { 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 601f9cf..935e4b6 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 @@ -165,6 +165,7 @@ public class EntrustServiceImpl extends BaseServiceImpl Entrust entrust = this.getById(id); List> resultList = new ArrayList<>(); + List> resultList1 = new ArrayList<>(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(Examine::getEntrustId, id); List examineList = examineService.list(wrapper); @@ -210,9 +211,17 @@ public class EntrustServiceImpl extends BaseServiceImpl result.put("reportSendType", value1); result.put("simpleTransRequire", entrust.getSimpleTransRequire()); result.put("simpleState", entrust.getSimpleState()); - result.put("simpleName", entrust.getSimpleName()); - result.put("simpleCount", entrust.getSimpleCount()); - result.put("originalNum", entrust.getOriginalNum()); + String simpleJson = entrust.getSimpleJson(); + List mapList = JSON.parseArray(simpleJson, Map.class); + if (mapList != null && mapList.size() > 0) { + for (Map map : mapList) { + Map map1 = new HashMap<>(); + map1.put("simpleName", map.get("simpleName")); + map1.put("simpleCount", map.get("simpleCount")); + map1.put("originalNum", map.get("originalNum")); + resultList1.add(map1); + } + } result.put("breedingSituation", entrust.getBreedingSituation()); result.put("clinicalOrTreatment", entrust.getClinicalOrTreatment()); result.put("immuneSituation", entrust.getImmuneSituation()); @@ -220,12 +229,29 @@ public class EntrustServiceImpl extends BaseServiceImpl result.put("samplingDate", sdf.format(entrust.getSamplingDate())); result.put("expectFinishedTime", sdf.format(entrust.getExpectFinishedTime())); result.put("submittedBy", entrust.getSubmittedBy()); - result.put("sampleReceiverName", entrust.getSampleReceiverName()); + + String path = sysClient.getParamValue("electronic_signature_real_path").getData(); + User user = userClient.userInfoById(Long.parseLong(entrust.getSampleReceiverId())).getData(); + ImageEntity farView = new ImageEntity(); + farView.setHeight(50);//设置高度 + farView.setWidth(90);//设置宽度 + farView.setType(ImageEntity.Data);//类型 + String s1 = path + user.getElectronicSignature(); + FileInputStream fis = null; + try { + fis = new FileInputStream(new File(s1)); + byte[] bytes = readInputStream(fis); + farView.setData(bytes); + } catch (Exception e) { + e.printStackTrace(); + } + result.put("sampleReceiverName", farView); result.put("company", entrust.getTakeCompany()); result.put("person", entrust.getTakePerson()); result.put("address", entrust.getTakeCompanyAddress()); result.put("phone", entrust.getTakePhone()); result.put("resultList", resultList); + result.put("list", resultList1); //模板地址 // String handleUrl = "C://Users//AAA//Desktop//烁今//打印模板//委托单(模板).docx"; @@ -849,29 +875,111 @@ public class EntrustServiceImpl extends BaseServiceImpl } result.put("list1", resultList1); } + for (int i = 0; i < (list.size() / 96); i++) { + int start = i * 96; + if (i == 0) { + start = 0; + } + for (int j = 0; j < 9; j++) { + int x = 0; + Map map = new HashMap<>(); + if (j == 0) { + map.put("0", " "); + map.put("1", "1"); + map.put("2", "2"); + map.put("3", "3"); + map.put("4", "4"); + map.put("5", "5"); + map.put("6", "6"); + map.put("7", "7"); + map.put("8", "8"); + map.put("9", "9"); + map.put("10", "10"); + map.put("11", "11"); + map.put("12", "12"); + } + else { + if (j == 1) { + map.put("0", "A"); + } + if (j == 2) { + map.put("0", "B"); + } + if (j == 3) { + map.put("0", "C"); + } + if (j == 4) { + map.put("0", "D"); + } + if (j == 5) { + map.put("0", "E"); + } + if (j == 6) { + map.put("0", "F"); + } + if (j == 7) { + map.put("0", "G"); + } + if (j == 8) { + map.put("0", "H"); + } + map.put("1", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("2", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("3", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("4", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("5", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("6", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("7", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("8", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("9", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("10", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("11", list.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("12", list.get(start + (8 * x + j) - 1).getValue()); + } + resultList2.add(map); + } + } + result.put("list2", resultList2); url = LDanreportPrint; } - // position1 // 口蹄疫兰所多板 else if ("2".equals(examine.getTemplateType())) { + List arrVOList = JSON.parseArray(examineResult.getOriginRecordData(), ExamineDataArrVO.class); + Collections.sort(arrVOList, new Comparator() { + @Override + public int compare(ExamineDataArrVO o1, ExamineDataArrVO o2) { + return o1.getOrder() - o2.getOrder(); + } + }); if (list.size() > 0) { for (int i = 0; i < list.size() / 96; i++) { - List doubles = new ArrayList<>(); - double a1 = Double.parseDouble(list.get((i + 1) * 96 - 1).getValue()); - double a2 = Double.parseDouble(list.get((i + 1) * 96 - 2).getValue()); - double a3 = Double.parseDouble(list.get((i + 1) * 96 - 3).getValue()); - double a4 = Double.parseDouble(list.get((i + 1) * 96 - 4).getValue()); - doubles.add(a1); - doubles.add(a2); - doubles.add(a3); - doubles.add(a4); - List collect = doubles.stream().sorted().collect(Collectors.toList()); - String format2 = df.format((collect.get(1) + collect.get(2)) / 4); - ExamineDataArrVO examineDataArrVO = new ExamineDataArrVO(); - examineDataArrVO.setNum("临界值"); - examineDataArrVO.setValue(""); - examineDataArrVO.setResult(format2); - list1.add(examineDataArrVO); +// List doubles = new ArrayList<>(); +// double a1 = Double.parseDouble(list.get((i + 1) * 96 - 1).getValue()); +// double a2 = Double.parseDouble(list.get((i + 1) * 96 - 2).getValue()); +// double a3 = Double.parseDouble(list.get((i + 1) * 96 - 3).getValue()); +// double a4 = Double.parseDouble(list.get((i + 1) * 96 - 4).getValue()); +// doubles.add(a1); +// doubles.add(a2); +// doubles.add(a3); +// doubles.add(a4); +// List collect = doubles.stream().sorted().collect(Collectors.toList()); +// String format2 = df.format((collect.get(1) + collect.get(2)) / 4); +// ExamineDataArrVO examineDataArrVO = new ExamineDataArrVO(); +// examineDataArrVO.setNum("临界值"); +// examineDataArrVO.setValue(""); +// examineDataArrVO.setResult(format2); +// list1.add(examineDataArrVO); for (int j = 0; j < 96; j++) { ExamineDataArrVO vo = list.get((i * 96) + j); if (vo.getNum() != null) { @@ -886,47 +994,46 @@ public class EntrustServiceImpl extends BaseServiceImpl for (int i = 0; i < list1.size() / 3; i++) { Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); map.put("num2", list1.get(list1.size() / 3 + i).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i).getValue()); map.put("result2", list1.get(list1.size() / 3 + i).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i).getLog2()); map.put("num3", list1.get(list1.size() / 3 * 2 + i).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i).getLog2()); resultList1.add(map); } } else { for (int i = 0; i < list1.size() / 3 + 1; i++) { if (list1.size() % 3 == 1) { - Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); if (i < list1.size() / 3) { map.put("num2", list1.get(list1.size() / 3 + i + 1).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i + 1).getValue()); map.put("result2", list1.get(list1.size() / 3 + i + 1).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i + 1).getLog2()); map.put("num3", list1.get(list1.size() / 3 * 2 + i + 1).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i + 1).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i + 1).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i + 1).getLog2()); } resultList1.add(map); } else if (list1.size() % 3 == 2) { Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); map.put("num2", list1.get(list1.size() / 3 + i + 1).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i + 1).getValue()); map.put("result2", list1.get(list1.size() / 3 + i + 1).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i + 1).getLog2()); if (i < list1.size() / 3) { map.put("num3", list1.get(list1.size() / 3 * 2 + i + 2).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i + 2).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i + 2).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i + 2).getLog2()); } resultList1.add(map); } @@ -934,28 +1041,111 @@ public class EntrustServiceImpl extends BaseServiceImpl } result.put("list1", resultList1); } + for (int i = 0; i < (arrVOList.size() / 96); i++) { + int start = i * 96; + if (i == 0) { + start = 0; + } + for (int j = 0; j < 9; j++) { + int x = 0; + Map map = new HashMap<>(); + if (j == 0) { + map.put("0", " "); + map.put("1", "1"); + map.put("2", "2"); + map.put("3", "3"); + map.put("4", "4"); + map.put("5", "5"); + map.put("6", "6"); + map.put("7", "7"); + map.put("8", "8"); + map.put("9", "9"); + map.put("10", "10"); + map.put("11", "11"); + map.put("12", "12"); + } + else { + if (j == 1) { + map.put("0", "A"); + } + if (j == 2) { + map.put("0", "B"); + } + if (j == 3) { + map.put("0", "C"); + } + if (j == 4) { + map.put("0", "D"); + } + if (j == 5) { + map.put("0", "E"); + } + if (j == 6) { + map.put("0", "F"); + } + if (j == 7) { + map.put("0", "G"); + } + if (j == 8) { + map.put("0", "H"); + } + map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue()); + } + resultList2.add(map); + } + } + result.put("list2", resultList2); url = LDuoreportPrint; } // 口蹄疫非兰所 else { + List arrVOList = JSON.parseArray(examineResult.getOriginRecordData(), ExamineDataArrVO.class); + Collections.sort(arrVOList, new Comparator() { + @Override + public int compare(ExamineDataArrVO o1, ExamineDataArrVO o2) { + return o1.getOrder() - o2.getOrder(); + } + }); if (list.size() > 0) { for (int i = 0; i < list.size() / 96; i++) { - List doubles = new ArrayList<>(); - double a1 = Double.parseDouble(list.get((i + 1) * 96 - 1).getValue()); - double a2 = Double.parseDouble(list.get((i + 1) * 96 - 2).getValue()); - double a3 = Double.parseDouble(list.get((i + 1) * 96 - 3).getValue()); - double a4 = Double.parseDouble(list.get((i + 1) * 96 - 4).getValue()); - doubles.add(a1); - doubles.add(a2); - doubles.add(a3); - doubles.add(a4); - List collect = doubles.stream().sorted().collect(Collectors.toList()); - String format2 = df.format((collect.get(1) + collect.get(2)) / 4); - ExamineDataArrVO examineDataArrVO = new ExamineDataArrVO(); - examineDataArrVO.setNum("临界值"); - examineDataArrVO.setValue(""); - examineDataArrVO.setResult(format2); - list1.add(examineDataArrVO); +// List doubles = new ArrayList<>(); +// double a1 = Double.parseDouble(list.get((i + 1) * 96 - 1).getValue()); +// double a2 = Double.parseDouble(list.get((i + 1) * 96 - 2).getValue()); +// double a3 = Double.parseDouble(list.get((i + 1) * 96 - 3).getValue()); +// double a4 = Double.parseDouble(list.get((i + 1) * 96 - 4).getValue()); +// doubles.add(a1); +// doubles.add(a2); +// doubles.add(a3); +// doubles.add(a4); +// List collect = doubles.stream().sorted().collect(Collectors.toList()); +// String format2 = df.format((collect.get(1) + collect.get(2)) / 4); +// ExamineDataArrVO examineDataArrVO = new ExamineDataArrVO(); +// examineDataArrVO.setNum("临界值"); +// examineDataArrVO.setValue(""); +// examineDataArrVO.setResult(format2); +// list1.add(examineDataArrVO); for (int j = 0; j < 96; j++) { ExamineDataArrVO vo = list.get((i * 96) + j); if (vo.getNum() != null) { @@ -970,47 +1160,46 @@ public class EntrustServiceImpl extends BaseServiceImpl for (int i = 0; i < list1.size() / 3; i++) { Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); map.put("num2", list1.get(list1.size() / 3 + i).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i).getValue()); map.put("result2", list1.get(list1.size() / 3 + i).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i).getLog2()); map.put("num3", list1.get(list1.size() / 3 * 2 + i).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i).getLog2()); resultList1.add(map); } } else { for (int i = 0; i < list1.size() / 3 + 1; i++) { if (list1.size() % 3 == 1) { - Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); if (i < list1.size() / 3) { map.put("num2", list1.get(list1.size() / 3 + i + 1).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i + 1).getValue()); map.put("result2", list1.get(list1.size() / 3 + i + 1).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i + 1).getLog2()); map.put("num3", list1.get(list1.size() / 3 * 2 + i + 1).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i + 1).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i + 1).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i + 1).getLog2()); } resultList1.add(map); } else if (list1.size() % 3 == 2) { Map map = new HashMap<>(); map.put("num1", list1.get(i).getNum()); - map.put("value1", list1.get(i).getValue()); map.put("result1", list1.get(i).getResult()); + map.put("log1", list1.get(i).getLog2()); map.put("num2", list1.get(list1.size() / 3 + i + 1).getNum()); - map.put("value2", list1.get(list1.size() / 3 + i + 1).getValue()); map.put("result2", list1.get(list1.size() / 3 + i + 1).getResult()); + map.put("log2", list1.get(list1.size() / 3 + i + 1).getLog2()); if (i < list1.size() / 3) { map.put("num3", list1.get(list1.size() / 3 * 2 + i + 2).getNum()); - map.put("value3", list1.get(list1.size() / 3 * 2 + i + 2).getValue()); map.put("result3", list1.get(list1.size() / 3 * 2 + i + 2).getResult()); + map.put("log3", list1.get(list1.size() / 3 * 2 + i + 2).getLog2()); } resultList1.add(map); } @@ -1018,84 +1207,84 @@ public class EntrustServiceImpl extends BaseServiceImpl } result.put("list1", resultList1); } - url = LDuoreportPrint; - } - - for (int i = 0; i < (list.size() / 96); i++) { - int start = i * 96; - if (i == 0) { - start = 0; - } - for (int j = 0; j < 9; j++) { - int x = 0; - Map map = new HashMap<>(); - if (j == 0) { - map.put("0", " "); - map.put("1", "1"); - map.put("2", "2"); - map.put("3", "3"); - map.put("4", "4"); - map.put("5", "5"); - map.put("6", "6"); - map.put("7", "7"); - map.put("8", "8"); - map.put("9", "9"); - map.put("10", "10"); - map.put("11", "11"); - map.put("12", "12"); - } else { - if (j == 1) { - map.put("0", "A"); - } - if (j == 2) { - map.put("0", "B"); - } - if (j == 3) { - map.put("0", "C"); - } - if (j == 4) { - map.put("0", "D"); - } - if (j == 5) { - map.put("0", "E"); - } - if (j == 6) { - map.put("0", "F"); - } - if (j == 7) { - map.put("0", "G"); + for (int i = 0; i < (arrVOList.size() / 96); i++) { + int start = i * 96; + if (i == 0) { + start = 0; + } + for (int j = 0; j < 9; j++) { + int x = 0; + Map map = new HashMap<>(); + if (j == 0) { + map.put("0", " "); + map.put("1", "1"); + map.put("2", "2"); + map.put("3", "3"); + map.put("4", "4"); + map.put("5", "5"); + map.put("6", "6"); + map.put("7", "7"); + map.put("8", "8"); + map.put("9", "9"); + map.put("10", "10"); + map.put("11", "11"); + map.put("12", "12"); } - if (j == 8) { - map.put("0", "H"); + else { + if (j == 1) { + map.put("0", "A"); + } + if (j == 2) { + map.put("0", "B"); + } + if (j == 3) { + map.put("0", "C"); + } + if (j == 4) { + map.put("0", "D"); + } + if (j == 5) { + map.put("0", "E"); + } + if (j == 6) { + map.put("0", "F"); + } + if (j == 7) { + map.put("0", "G"); + } + if (j == 8) { + map.put("0", "H"); + } + map.put("1", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("2", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("3", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("4", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("5", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("6", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("7", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("8", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("9", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("10", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("11", arrVOList.get(start + (8 * x + j) - 1).getValue()); + x++; + map.put("12", arrVOList.get(start + (8 * x + j) - 1).getValue()); } - map.put("1", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("2", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("3", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("4", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("5", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("6", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("7", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("8", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("9", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("10", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("11", list.get(start + (8 * x + j) - 1).getValue()); - x++; - map.put("12", list.get(start + (8 * x + j) - 1).getValue()); + resultList2.add(map); } - resultList2.add(map); } + result.put("list2", resultList2); + url = LDuoreportPrint; } - result.put("list2", resultList2); } // 普通检测 else { @@ -2299,7 +2488,7 @@ public class EntrustServiceImpl extends BaseServiceImpl List> list = entrust.getSimpleNames(); // 样品排序 - for (int sort = 1; sort < list.size(); sort++) { + for (int sort = 0; sort < list.size(); sort++) { Map map = list.get(sort); // 样品名称 String name = (String) map.get("simpleName");