From 4257ac2f49276e67a953d75f3289076c95f1ad96 Mon Sep 17 00:00:00 2001 From: litao Date: Mon, 28 Aug 2023 15:18:26 +0800 Subject: [PATCH] =?UTF-8?q?2023=E5=B9=B48=E6=9C=8828=E6=97=A515:17:47?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/springblade/lims/entry/Examine.java | 6 - lab-service/lab-lims/pom.xml | 52 +- .../lims/controller/EntrustController.java | 31 +- .../controller/ExamineResultController.java | 5560 +---------------- .../controller/HandleSampleController.java | 2 +- .../springblade/lims/mapper/EntrustMapper.xml | 4 +- .../lims/service/IExamineResultService.java | 10 + .../lims/service/impl/EntrustServiceImpl.java | 1000 +-- .../impl/ExamineResultServiceImpl.java | 5501 +++++++++++++++- .../service/impl/HandleSampleServiceImpl.java | 22 +- 10 files changed, 5808 insertions(+), 6380 deletions(-) diff --git a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Examine.java b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Examine.java index 1211fe6..78c14af 100644 --- a/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Examine.java +++ b/lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/Examine.java @@ -20,12 +20,6 @@ import java.util.Date; @TableName("f_examine") public class Examine extends BaseEntity implements Serializable { - /** - * 业务主键 - */ -// @Id -// private Long id; - /** * 部门id(科室一、科室二.....) */ diff --git a/lab-service/lab-lims/pom.xml b/lab-service/lab-lims/pom.xml index 2c9d215..69cc6af 100644 --- a/lab-service/lab-lims/pom.xml +++ b/lab-service/lab-lims/pom.xml @@ -121,47 +121,12 @@ pax-logging-api 2.0.6 - - - io.minio minio - - com.alibaba - QLExpress - 3.2.0 - - - com.alibaba - QLExpress - 3.2.0 - - - com.alibaba - QLExpress - 3.2.0 - - - com.alibaba - QLExpress - 3.2.0 - - - - - - - - - - org.apache.pdfbox - pdfbox - 2.0.6 - google zxing <--> @@ -204,6 +169,23 @@ netdevice 2.2.2 + + + + org.apache.pdfbox + fontbox + 2.0.9 + + + org.apache.pdfbox + pdfbox + 2.0.9 + + + commons-logging + commons-logging + 1.2 + 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 6dec880..d81d892 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 @@ -1,33 +1,19 @@ - package org.springblade.lims.controller; import cn.afterturn.easypoi.entity.ImageEntity; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.word.WordExportUtil; import com.alibaba.fastjson.JSON; import com.alibaba.nacos.common.utils.CollectionUtils; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.fasterxml.jackson.annotation.JsonFormat; import com.github.binarywang.utils.qrcode.QrcodeUtils; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.spire.doc.Document; -import com.spire.doc.FieldType; -import com.spire.doc.FileFormat; -import com.spire.doc.HeaderFooter; -import com.spire.doc.documents.HorizontalAlignment; -import com.spire.doc.documents.Paragraph; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import oracle.jdbc.proxy.annotation.Post; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.RandomUtils; -import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xwpf.usermodel.XWPFDocument; -import org.springblade.common.utils.ZipCompressUtil; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.lims.entry.*; @@ -41,33 +27,24 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.lims.service.impl.EntrustCustomerServiceImpl; -import org.springblade.resource.enums.SysTypeEnum; import org.springblade.resource.feign.IMessageClient; -import org.springblade.system.cache.DictBizCache; -import org.springblade.system.enums.DictBizEnum; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; -import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; -import java.nio.file.Files; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; import java.util.List; -import java.util.stream.Collectors; /** * 委托单 - * * @author swj * @since 2022年5月28日14:33:30 */ @@ -732,21 +709,21 @@ public class EntrustController extends BladeController { * 8.校核通过 */ @PostMapping("/check") - public void check(String id) { + public void check(@RequestBody ExamineResult result) { // 修改检测状态为通过 - Examine examine = examineService.getById(id); + Examine examine = examineService.getById(result.getId()); examine.setStatus(1); examine.setFinishTime(new Date()); examineService.updateById(examine); // 添加检测结果的校核人和校核时间 LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, id); + wrapper.eq(ExamineResult::getExamineId, result.getId()); // wrapper.eq(ExamineResult::getStatus, 1); List examineResults = examineResultService.list(wrapper); for (ExamineResult examineResult : examineResults) { examineResult.setVerificationUser(AuthUtil.getUserId()); - examineResult.setVerificationTime(new Date()); + examineResult.setVerificationTime(result.getVerificationTime()); } examineResultService.updateBatchById(examineResults); 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 a370115..37bf144 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 @@ -1,5257 +1,87 @@ +package org.springblade.lims.controller; -package org.springblade.lims.controller; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.alibaba.nacos.common.utils.CollectionUtils; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.excel.util.ExcelUtil; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; -import org.springblade.lims.entry.*; -import org.springblade.lims.excel.*; -import org.springblade.lims.service.*; -import org.springblade.lims.utils.FormulaTool; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.http.HttpServletResponse; -import java.text.DecimalFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static java.util.stream.Collectors.toList; - -@RestController -@AllArgsConstructor -@RequestMapping("/examineResult") -public class ExamineResultController extends BladeController { - - private final IExamineService examineService; - - private final IExamineResultService service; - - private final ISimpleDoExamineLogService simpleDoExamineLogService; - - private final IExamineItemService examineItemService; - - private final IExamineWayService examineWayService; - - private final IReagentService reagentService; - - /** - * 分页 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - public R> list(ExamineResult entry, Query query) { - IPage page = service.page(Condition.getPage(query), Condition.getQueryWrapper(entry)); - return R.data(page); - } - - /** - * 检验修改 - */ - @PostMapping("/update") - @ApiOperation(value = "更改", notes = "更改") - public R update(@RequestBody ExamineResult entry) { - return R.data(service.updateById(entry)); - } - - /** - * 普通检验提交 - */ - @PostMapping("/insert") - public boolean insertExamineResult(@RequestBody ExamineResult entry) throws Exception { - return service.doExamine(entry); - } - - /** - * 布鲁氏杆菌检验提交 - */ - @PostMapping("/resultCommit") - public void resultCommit(@RequestBody ExamineResult examineResult) throws Exception { - service.resultCommit(examineResult); - } - - /** - * 解析数据 - */ - @PostMapping("/excel") - public R excel(MultipartFile file, String examineId, String reagentId) throws Exception { - Examine examine = examineService.getById(examineId); - ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); - ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); - if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { - return blsExcel(file, examineId); - } else if ("3".equals(examineWay.getInputMode())) { - return ktyExcel(file, examineId); - } - else if ("8".equals(examineWay.getInputMode())) { - return shjdExcel(file, examineId); - } - else if ("5".equals(examineWay.getInputMode())) { - return xnExcel(file, examineId); - } else { - return ptExcel(file, examineId, reagentId); - } - } - - private R shjdExcel(MultipartFile file, String examineId) throws Exception { - List read = ExcelUtil.read(file, BiochemicalIdentificationExcel.class); - if (read != null && read.size() > 0) { - for (BiochemicalIdentificationExcel excel : read) { - if ("+".equals(excel.getValue())) { - excel.setResult("阳性"); - } else if ("-".equals(excel.getValue())) { - excel.setResult("阴性"); - } else if (excel.getValue() == null || "".equals(excel.getValue())) { - throw new Exception("有样品未填写的对应的结果!"); - } - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(read)); - result.setOriginRecordResult(JSON.toJSONString(read)); - result.setExamineDataArr(JSON.toJSONString(read)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(read)); - examineResult.setOriginRecordResult(JSON.toJSONString(read)); - examineResult.setExamineDataArr(JSON.toJSONString(read)); - service.save(examineResult); - } - } - return R.data(read); - } - - /** - * 普通Excel解析数据 review start - **/ - //获取单元格的值 - private String getCode(List list, Integer order) { - String result; - ExamineExcel examineExcel = (order % 8 - 1 >= 0) ? list.get(order % 8 - 1) : list.get(list.size() - 1); - Integer re = order / 8 + 1; - switch (re) { - case 1: - result = examineExcel.getCode1(); - break; - case 2: - result = examineExcel.getCode2(); - break; - case 3: - result = examineExcel.getCode3(); - break; - case 4: - result = examineExcel.getCode4(); - break; - case 5: - result = examineExcel.getCode5(); - break; - case 6: - result = examineExcel.getCode6(); - break; - case 7: - result = examineExcel.getCode7(); - break; - case 8: - result = examineExcel.getCode8(); - break; - case 9: - result = examineExcel.getCode9(); - break; - case 10: - result = examineExcel.getCode10(); - break; - case 11: - result = examineExcel.getCode11(); - break; - case 12: - result = examineExcel.getCode12(); - break; - default: - result = "0"; - } - return result; - } - - private R>>>> ptExcelReview( - MultipartFile file, - String examineId, - Map info, //变量对应的标版的孔位,一行行的逐渐递增 - String reg //计算公式 - ) throws Exception { - try { - List read = ExcelUtil.read(file, ExamineExcel.class); - Map> map = new HashMap<>(); -// int index = 0; - // 组数 - int group = 0; - // 除9是否有余数 - int size = (read.size() + 1) % 9; - - if (size == 0) { - group = (read.size() + 1) / 9; - } else { - group = (read.size() + 1) / 9 + 1; - } - - //将读取到的excel按照每一版分组 - for (int i = 0; i < group; i++) { - List excels = new ArrayList<>(); - for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { - ExamineExcel excel = read.get(j); - excels.add(excel); - } - map.put((i + 1) + "", excels); - } - - Examine examine = examineService.getById(examineId); - String experieNum = examine.getExperieNum(); - String[] split = experieNum.split(","); - - List> list = new ArrayList<>(); - // 按照公式计算实验数据并返回 - Map>>> map1 = new HashMap<>(); - - for (int i = 0; i < group; i++) { - List>> mapList = new ArrayList<>(); - List excels = map.get(i + 1 + ""); - //解析info,确定参数x的值和其它相对不变的参数 - Map params = new HashMap<>(); //存放解析出的参数 - - Integer xStart = 0; - Integer xEnd = 0; - //解析参数 - Set strings = info.keySet(); - String x = ""; - for (String s : strings) { - String para = info.get(s); - if (para.split("-").length > 1) {//可变参数 - String[] xs = para.split("-"); - xStart = Integer.parseInt(xs[0]); - xEnd = Integer.parseInt(xs[1]); - x = s; - } else {//相对固定的参数 - Integer order = Integer.valueOf(para); - params.put(s, StringUtil.isBlank(getCode(excels, order)) ? "0" : getCode(excels, order)); - } - } - - //按照列循环每一版的数据 - for (int m = 0; m < excels.size(); m++) { - String a = ""; - if (m == 0) { - a = "A"; - } - if (m == 1) { - a = "B"; - } - if (m == 2) { - a = "C"; - } - if (m == 3) { - a = "D"; - } - if (m == 4) { - a = "E"; - } - if (m == 5) { - a = "F"; - } - if (m == 6) { - a = "G"; - } - if (m == 7) { - a = "H"; - } - ExamineExcel examineExcel = excels.get(m);//取到一行记录 - int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; - - Map> map2 = new HashMap<>(); - for (int n = 1; n <= filedsLength; n++) { - System.out.println(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 + m + 1; //n是列,m是行 ,我们定义index是一列列的定义 - System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + m); - System.out.println("-------------------"); - if (StringUtils.isNotBlank(code)) { - if (xStart <= index && index <= xEnd) { - params.put(x, code); - String value = FormulaTool.getResult(reg, params); - mapResult.put("originResult", examineExcel.getCode1()); - mapResult.put("value", "0E-10".equals(value) ? "0" : value); - if (Double.parseDouble(value) >= 0.4) { - mapResult.put("result", "阳性"); - } else { - mapResult.put("result", "阴性"); - } - } - } else { - if (xStart <= index && index <= xEnd) { - 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); - } - } - - Collections.sort(list, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - int numIndex = 0; - for (Map stringObjectMap : list) { - String num = (String) stringObjectMap.get("num"); - if (num != null && !"".equals(num)) { - num = split[numIndex]; - stringObjectMap.put("num", num); - numIndex++; - } - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(map)); - result.setOriginRecordResult(JSON.toJSONString(map1)); - result.setExamineDataArr(JSON.toJSONString(list)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(map)); - examineResult.setOriginRecordResult(JSON.toJSONString(map1)); - examineResult.setExamineDataArr(JSON.toJSONString(list)); - service.save(examineResult); - } - return R.data(map1); - } catch (ArrayIndexOutOfBoundsException e) { - throw new RuntimeException("分配样品数量与检测样品数量不一致!"); - } catch (Exception e1) { - throw new RuntimeException("算术异常,请检查实验数据!"); - } - } - /** 普通Excel解析数据 review stop **/ - - /** - * 常规Excel解析数据 - */ - 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<>(); - // 组数 - int group = 0; - // 除9是否有余数 - int size = (read.size() + 1) % 9; - if (size == 0) { - group = (read.size() + 1) / 9; - } else { - group = (read.size() + 1) / 9 + 1; - } - - for (int i = 0; i < group; i++) { - List excels = new ArrayList<>(); - for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { - ExamineExcel excel = read.get(j); - excels.add(excel); - } - map.put((i + 1) + "", excels); - } - - Examine examine = examineService.getById(examineId); - String experieNum = examine.getExperieNum(); - String[] split = experieNum.split(","); - - List> list = new ArrayList<>(); - // 按照公式计算实验数据并返回 - Map>>> map1 = new HashMap<>(); - - // 不同试剂计算公式不同 - // 猪繁殖与呼吸综合征病毒抗体ELISA检测试剂盒---山东百邦世纪科技有限公司 - if ("1580030700969861121".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)); - - 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 (StringUtils.isNotBlank(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 { - 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); - } - } - // 伪狂犬病毒gE蛋白lgG抗体ELISA检测试剂盒---山东百邦世纪科技有限公司 - else if ("1580733683995009026".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 (code2 < 0.05) { - code2 = 0.05; - } - 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 (StringUtils.isNotBlank(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); - } - mapList.add(map2); - } - map1.put("g" + (i + 1), mapList); - } - } - // 非洲猪瘟病毒ELISA抗体检测试剂盒(哈尔滨维科生物技术有限公司) - else if ("1580730163250188290".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 (StringUtils.isNotBlank(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 ("1589877000410296322".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 (StringUtils.isNotBlank(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 { - 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 ("1570666183341043714".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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - String PB = df.format(100 - Double.parseDouble(code) / v1 * 100); - mapResult.put("originResult", code); - mapResult.put("value", PB); - mapResult.put("num", "1"); - if (Double.parseDouble(PB) > 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); - } - } - // 非洲猪瘟病毒cELISA抗体检测试剂盒---百沃特(天津)生物技术有限公司 - else if ("1580815808211578882".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 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<>(); - - String PI = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - PI = df.format((v1 - Double.parseDouble(code)) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", PI); - mapResult.put("num", "1"); - if (Double.parseDouble(PI) >= 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); - } - } - // 非洲猪瘟病毒cELISA抗体检测试剂盒---北京金诺百泰生物技术有限公司 - else if ("1570667398619656194".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 SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format((Double.parseDouble(code) - v2) / (v1 - v2)); - } - mapResult.put("originResult", code); - mapResult.put("value", SN); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) >= 0.5) { - mapResult.put("result", "阴性"); - } else if (Double.parseDouble(SN) <= 0.4) { - 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 ("1570667729797705730".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 (StringUtils.isNotBlank(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.4) { - mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SP) <= 0.3) { - 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); - } - } - // 猪繁殖与呼吸综合征病毒抗体检测试剂盒(爱德士IDEXX) - else if ("1659464963116519426".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 (StringUtils.isNotBlank(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.4) { - 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 ("1582988982068027393".equals(reagentId)) { - for (int i = 0; i < group; i++) { - 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()); - 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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v2 != 0) { - SP = df.format((Double.parseDouble(code) / v2)); - } - mapResult.put("originResult", code); - mapResult.put("value", SP); - mapResult.put("num", "1"); - if (Double.parseDouble(SP) >= 0.4) { - 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 ("1570283733628678145".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 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<>(); - - 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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SP = df.format(1 - (Double.parseDouble(code) / v1)); - } - mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(SP) >= 0.4) { - mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SP) <= 0.3) { - 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); - } - } - // 猪伪狂犬病病毒gE蛋白ELISA抗体检测试剂盒(武汉科前生物股份有限公司) - else if ("1570296117147660290".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 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<>(); - - String SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) <= 0.35) { - mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SN) > 0.4) { - 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 ("1570671477110534145".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 (StringUtils.isNotBlank(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.45) { - mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SP) < 0.35) { - 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 ("1570295395605737473".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 KQ = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v2 != 0) { - KQ = df.format((Double.parseDouble(code) - v1) / (v2 - v1) * 100); - } - mapResult.put("originResult", code); - mapResult.put("value", KQ); - mapResult.put("num", "1"); - if (Double.parseDouble(KQ) >= 40) { - 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 ("1570295846749270017".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 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<>(); - - String SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) <= 0.6) { - mapResult.put("result", "阳性"); - } else if (Double.parseDouble(SN) > 0.7) { - 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 ("1570297916894146562".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(2).getCode1()); - double code2 = Double.parseDouble(excels.get(3).getCode1()); - double v2 = (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<>(); - - 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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v2 != 0) { - SP = df.format(Double.parseDouble(code) / v2); - } - mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(SP) >= 0.2) { - 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 ("1570664922961080322".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 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<>(); - - String SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) < 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); - } - } - // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(羊)---洛阳莱普生信息科技有限公司 - else if ("1570666622551781378".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 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<>(); - - String SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) < 0.3) { - 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); - } - } - // 口蹄疫病毒非结构蛋白3ABC阻断ELISA抗体检测试剂盒---兰州兽研生物科技有限公司 - else if ("1533624738296389636".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 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<>(); - - String PI = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - PI = df.format((v1 - Double.parseDouble(code)) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(PI) >= 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); - } - } - // 布鲁氏菌 CELISA 抗体检测试剂盒---青岛立见生物科技有限公司 - else if ("1665968083879366657".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 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<>(); - - String PI = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - PI = df.format((v1 - Double.parseDouble(code)) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(PI) > 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); - } - } - // 布鲁氏菌 CELISA 抗体检测试剂盒---科前生物 - else if ("1665964229817307138".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 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<>(); - - String PI = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - PI = df.format((v1 - Double.parseDouble(code)) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); - mapResult.put("num", "1"); - if (Double.parseDouble(PI) >= 0.3) { - 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 ("1631222146321997826".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 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<>(); - - // 一行有四组数据,一组数据对应一个样品,一个样品做三次实验,有三个结果(牛型PPD,禽型PPD,PBS抗原) - for (int n = 1; n <= filedsLength; n++) { - int num; - String code; - String code1; - String code2; - String code3; - switch (n) { - case 1: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode1(); - num = 0; - break; - case 2: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode2(); - num = 0; - break; - case 3: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode3(); - num = 0; - break; - case 4: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode4(); - num = 1; - break; - case 5: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode5(); - num = 1; - break; - case 6: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode6(); - num = 1; - break; - case 7: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode7(); - num = 2; - break; - case 8: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode8(); - num = 2; - break; - case 9: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode9(); - num = 2; - break; - case 10: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode10(); - num = 3; - break; - case 11: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode11(); - num = 3; - break; - case 12: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode12(); - num = 3; - break; - default: - code1 = "0"; - code2 = "0"; - code3 = "0"; - code = "0"; - num = 0; - } - - Map mapResult = new HashMap<>(); - Map mapResult1 = new HashMap<>(); - int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - double v1 = 0; - double v2 = 0; - if (StringUtils.isNotBlank(code1) && StringUtils.isNotBlank(code2) && StringUtils.isNotBlank(code3)) { - if (j > 1 || n > 3) { - v1 = Double.parseDouble(code1) - Double.parseDouble(code3); - v2 = Double.parseDouble(code1) - Double.parseDouble(code2); - mapResult.put("originResult", code); - mapResult1.put("originResult", code); - mapResult.put("value", code); - mapResult1.put("value", df.format(v1) + "," + df.format(v2)); - int indexNum = (i * 32) + (num * 8 + j) - ((i + 1) * 2); - mapResult.put("num", split[indexNum]); - mapResult1.put("num", split[indexNum]); - if (v1 >= 0.2 && v2 >= 0.2) { - mapResult.put("result", "阳性"); - mapResult1.put("result", "阳性"); - } else { - mapResult.put("result", "阴性"); - mapResult1.put("result", "阴性"); - } - } else { - mapResult.put("originResult", code); - mapResult1.put("originResult", code); - mapResult.put("num", ""); - mapResult1.put("num", ""); - } - } else { - mapResult.put("originResult", ""); - mapResult1.put("originResult", ""); - mapResult.put("num", ""); - mapResult1.put("num", ""); - } - mapResult.put("order", index + i * 96); - mapResult1.put("order", index + i * 96); - map2.put(a + n, mapResult); - list.add(mapResult1); - } - mapList.add(map2); - } - map1.put("g" + (i + 1), mapList); - } - } - // 牛结核病γ-干扰素ELISA检测试剂盒---武汉科前生物股份有限公司 - else if ("1570297053211455490".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 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<>(); - - // 一行有四组数据,一组数据对应一个样品,一个样品做三次实验,有三个结果(牛型PPD,禽型PPD,PBS抗原) - for (int n = 1; n <= filedsLength; n++) { - int num; - String code; - String code1; - String code2; - String code3; - switch (n) { - case 1: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode1(); - num = 0; - break; - case 2: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode2(); - num = 0; - break; - case 3: - code1 = examineExcel.getCode1(); - code2 = examineExcel.getCode2(); - code3 = examineExcel.getCode3(); - code = examineExcel.getCode3(); - num = 0; - break; - case 4: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode4(); - num = 1; - break; - case 5: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode5(); - num = 1; - break; - case 6: - code1 = examineExcel.getCode4(); - code2 = examineExcel.getCode5(); - code3 = examineExcel.getCode6(); - code = examineExcel.getCode6(); - num = 1; - break; - case 7: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode7(); - num = 2; - break; - case 8: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode8(); - num = 2; - break; - case 9: - code1 = examineExcel.getCode7(); - code2 = examineExcel.getCode8(); - code3 = examineExcel.getCode9(); - code = examineExcel.getCode9(); - num = 2; - break; - case 10: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode10(); - num = 3; - break; - case 11: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode11(); - num = 3; - break; - case 12: - code1 = examineExcel.getCode10(); - code2 = examineExcel.getCode11(); - code3 = examineExcel.getCode12(); - code = examineExcel.getCode12(); - num = 3; - break; - default: - code1 = "0"; - code2 = "0"; - code3 = "0"; - code = "0"; - num = 0; - } - - Map mapResult = new HashMap<>(); - Map mapResult1 = new HashMap<>(); - int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 - double v1 = 0; - double v2 = 0; - if (StringUtils.isNotBlank(code1) && StringUtils.isNotBlank(code2) && StringUtils.isNotBlank(code3)) { - if (j < 6 || n < 10) { - v1 = Double.parseDouble(code1) - Double.parseDouble(code3); - v2 = Double.parseDouble(code1) - Double.parseDouble(code2); - mapResult.put("originResult", code); - mapResult1.put("originResult", code); - mapResult.put("value", code); - mapResult1.put("value", df.format(v1) + "," + df.format(v2)); - int indexNum = (i * 30) + (num * 8 + j); - mapResult.put("num", split[indexNum]); - mapResult1.put("num", split[indexNum]); - if (v1 >= 0.2 && v2 >= 0.2) { - mapResult.put("result", "阳性"); - mapResult1.put("result", "阳性"); - } else { - mapResult.put("result", "阴性"); - mapResult1.put("result", "阴性"); - } - } - } else { - if (StringUtils.isNotBlank(code)) { - mapResult.put("originResult", code); - mapResult1.put("originResult", code); - mapResult.put("num", ""); - mapResult1.put("num", ""); - } else { - mapResult.put("originResult", ""); - mapResult1.put("originResult", ""); - mapResult.put("num", ""); - mapResult1.put("num", ""); - } - } - mapResult.put("order", index + i * 96); - mapResult1.put("order", index + i * 96); - map2.put(a + n, mapResult); - list.add(mapResult1); - } - mapList.add(map2); - } - map1.put("g" + (i + 1), mapList); - } - } - // 羊小反刍兽疫病毒 ELISA抗体检测试剂盒---真瑞生物 - else if ("1656852607882579970".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 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<>(); - - String SN = "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 (StringUtils.isNotBlank(code)) { - if (j > 5 || n > 1) { - if (v1 != 0) { - SN = df.format(Double.parseDouble(code) / v1); - } - mapResult.put("originResult", code); - mapResult.put("value", Double.parseDouble(SN)); - mapResult.put("num", "1"); - if (Double.parseDouble(SN) > 0.7) { - 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抗体检测试剂盒---百沃特(ID.VET) - else if ("1677607364850900993".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 (StringUtils.isNotBlank(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.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); - } - } - // 禽滑液囊支原体ELISA抗体检测试剂盒---百沃特(ID.VET) - else if ("1677607364859289601".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 (StringUtils.isNotBlank(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.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); - } - } - // 无该试剂公式提示 - else { - throw new Exception("该试剂未维护公式计算,请联系相关开发人员!"); - } - -// 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); -// } - // 不是该试剂的才去赋值检测编号 - if (!"1570297053211455490".equals(reagentId) && !"1631222146321997826".equals(reagentId)) { - Collections.sort(list, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - int numIndex = 0; - for (Map stringObjectMap : list) { - String num = (String) stringObjectMap.get("num"); - if (num != null && !"".equals(num)) { - num = split[numIndex]; - stringObjectMap.put("num", num); - numIndex++; - } - } -// System.out.println("split.length: " + split.length); -// System.out.println("numIndex: " + numIndex); - // 判断分配样品数量与检测样品数量是否一致 - if (split.length != numIndex) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(map)); - result.setOriginRecordResult(JSON.toJSONString(map1)); - result.setExamineDataArr(JSON.toJSONString(list)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(map)); - examineResult.setOriginRecordResult(JSON.toJSONString(map1)); - examineResult.setExamineDataArr(JSON.toJSONString(list)); - service.save(examineResult); - } - return R.data(map1); - } - - /** - * 常规Excel解析数据 - */ - private R>>>> ptExcel1( - MultipartFile file, - String examineId, - String infoStr, //变量对应的标版的孔位,一行行的逐渐递增 - String reg //计算公式 - ) throws Exception { - List read = ExcelUtil.read(file, ExamineExcel.class); - Map> map = new HashMap<>(); - // 组数 - int group = 0; - // 除9是否有余数 - int size = (read.size() + 1) % 9; - if (size == 0) { - group = (read.size() + 1) / 9; - } else { - group = (read.size() + 1) / 9 + 1; - } - - for (int i = 0; i < group; i++) { - List excels = new ArrayList<>(); - for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { - ExamineExcel excel = read.get(j); - excels.add(excel); - } - map.put((i + 1) + "", excels); - } - - Examine examine = examineService.getById(examineId); - String experieNum = examine.getExperieNum(); - String[] split = experieNum.split(","); - - List> list = new ArrayList<>(); - // 按照公式计算实验数据并返回 - 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"); - //解析info,确定参数x的值和其它相对不变的参数 - Map params = new HashMap<>(); //存放解析出的参数 - Integer xStart = 0; - Integer xEnd = 0; - //解析参数 - - Map info = JSON.parseObject(infoStr, new TypeReference>() { - }); - // 测试假数据 -// reg = "(x-((x1+x2)/2))/(((x3+x4)/2)-(((x1+x2)/2)))"; -// Map info = new HashMap<>(); -// info.put("x1", "1"); -// info.put("x2", "2"); -// info.put("x3", "3"); -// info.put("x4", "4"); -// info.put("x", "7-96"); - - Set strings = info.keySet(); - String x = ""; - for (String s : strings) { - String para = info.get(s); - if (para.split("-").length > 1) {//可变参数 - String[] xs = para.split("-"); - xStart = Integer.parseInt(xs[0]); - xEnd = Integer.parseInt(xs[1]); - x = s; - } else {//相对固定的参数 - Integer order = Integer.valueOf(para); - params.put(s, StringUtil.isBlank(getCode(excels, order)) ? "0" : getCode(excels, order)); - } - } - - 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++) { - System.out.println(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是一列列的定义 - System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + j); - System.out.println("-------------------"); - if (StringUtils.isNotBlank(code)) { - if (xStart <= index && index <= xEnd) { - params.put(x, code); - String value = FormulaTool.getResult(reg, params); - System.out.println(value); - String format = df.format(Double.parseDouble(value)); - mapResult.put("originResult", code); - mapResult.put("value", "0E-10".equals(format) ? "0" : format); - mapResult.put("num", "1"); - if (Double.parseDouble(format) >= 0.4) { - mapResult.put("result", "阳性"); - } else { - mapResult.put("result", "阴性"); - } - } - } else { - if (xStart <= index && index <= xEnd) { - mapResult.put("originResult", ""); - mapResult.put("num", ""); - } - } - mapResult.put("order", index + i * 96); - map2.put(a + n, mapResult); - list.add(mapResult); - } -// 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 - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - int numIndex = 0; - for (Map stringObjectMap : list) { - String num = (String) stringObjectMap.get("num"); - if (num != null && !"".equals(num)) { - num = split[numIndex]; - stringObjectMap.put("num", num); - numIndex++; - } - } - // 判断分配样品数量与检测样品数量是否一致 - if (split.length != numIndex) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(map)); - result.setOriginRecordResult(JSON.toJSONString(map1)); - result.setExamineDataArr(JSON.toJSONString(list)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(map)); - examineResult.setOriginRecordResult(JSON.toJSONString(map1)); - examineResult.setExamineDataArr(JSON.toJSONString(list)); - service.save(examineResult); - } - return R.data(map1); - } - - - /** - * 计算常规检验的阴或阳性对照平均值 - */ - private double getConventionalAvg(String i, String j) { - double v1 = Double.parseDouble(i); - double v2 = Double.parseDouble(j); - return (v1 + v2) / 2; - } - - /** - * 布鲁氏杆菌Excel解析数据 - */ - private R blsExcel(MultipartFile file, String examineId) throws Exception { - Examine examine = examineService.getById(examineId); -// ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); - ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); - List read = ExcelUtil.read(file, ExamineTemplate2Excel.class); - if (read != null && read.size() > 0) { - // 布鲁氏杆菌抗体检测(虎红平板凝集) - if ("2".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { - for (ExamineTemplate2Excel excel : read) { - if ("+".equals(excel.getValue())) { - excel.setResult("阳性"); - } else if ("-".equals(excel.getValue())) { - excel.setResult("阴性"); - } else if (excel.getValue() == null || "".equals(excel.getValue())) { - throw new Exception("有样品未填写的对应的结果!"); - } - } - } - // 布鲁氏杆菌抗体检测(试管凝集微量法) - else if ("6".equals(examineWay.getInputMode())) { - for (ExamineTemplate2Excel excel : read) { - if ("++++".equals(excel.getValue()) || "+++".equals(excel.getValue()) || "++".equals(excel.getValue())) { - excel.setResult("阳性"); - } else if ("+".equals(excel.getValue())) { - excel.setResult("可疑"); - } else if ("-".equals(excel.getValue())) { - excel.setResult("阴性"); - } else if (excel.getValue() == null || "".equals(excel.getValue())) { - throw new Exception("有样品未填写的对应的结果!"); - } - } - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(read)); - result.setOriginRecordResult(JSON.toJSONString(read)); - result.setExamineDataArr(JSON.toJSONString(read)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(read)); - examineResult.setOriginRecordResult(JSON.toJSONString(read)); - examineResult.setExamineDataArr(JSON.toJSONString(read)); - service.save(examineResult); - } - } - return R.data(read); - } - - /** - * 口蹄疫Excel解析数据 - */ - private R ktyExcel(MultipartFile file, String examineId) throws Exception { - List originRowDatas = ExcelUtil.read(file, ExamineExcel.class); - String[] split = examineId.split(","); - Examine examine = examineService.getById(split[0]); - examine.setTemplateType(split[1]); - examineService.updateById(examine); - // 兰所单板---------------------------------------------------------------------------------------------------- - if ("1".equals(split[1])) { - String simpleName1 = examine.getSimpleName().split("-")[0]; - - String[] experieNum = examine.getExperieNum().split(","); - // 获取4个抗原对照值 - List list = new ArrayList<>(); - 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"); - // 对照平均值 - Double avg = Double.valueOf(df.format((list1.get(1) + list1.get(2)) / 4)); - - // 结果resultList - List> resultList = new ArrayList<>(); - for (int r = 0; r < 8; r++) { - if (r > 0) { - // 第1列 - resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), originRowDatas.get(r - 1).getCode1(), avg, simpleName1, experieNum)); - // 第2列 - resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), originRowDatas.get(r - 1).getCode2(), avg, simpleName1, experieNum)); - // 第3列 - resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), originRowDatas.get(r - 1).getCode3(), avg, simpleName1, experieNum)); - // 第4列 - resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), originRowDatas.get(r - 1).getCode4(), avg, simpleName1, experieNum)); - // 第5列 - resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), originRowDatas.get(r - 1).getCode5(), avg, simpleName1, experieNum)); - // 第6列 - resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), originRowDatas.get(r - 1).getCode6(), avg, simpleName1, experieNum)); - // 第7列 - resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), originRowDatas.get(r - 1).getCode7(), avg, simpleName1, experieNum)); - // 第8列 - resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), originRowDatas.get(r - 1).getCode8(), avg, simpleName1, experieNum)); - // 第9列 - resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), originRowDatas.get(r - 1).getCode9(), avg, simpleName1, experieNum)); - // 第10列 - resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), originRowDatas.get(r - 1).getCode10(), avg, simpleName1, experieNum)); - // 第11列 - resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), originRowDatas.get(r - 1).getCode11(), avg, simpleName1, experieNum)); - // 第12列 - resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), originRowDatas.get(r - 1).getCode12(), avg, simpleName1, experieNum)); - } else { - // 第1列 - resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), null, avg, simpleName1, experieNum)); - // 第2列 - resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), null, avg, simpleName1, experieNum)); - // 第3列 - resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), null, avg, simpleName1, experieNum)); - // 第4列 - resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), null, avg, simpleName1, experieNum)); - // 第5列 - resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), null, avg, simpleName1, experieNum)); - // 第6列 - resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), null, avg, simpleName1, experieNum)); - // 第7列 - resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), null, avg, simpleName1, experieNum)); - // 第8列 - resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), null, avg, simpleName1, experieNum)); - // 第9列 - resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), null, avg, simpleName1, experieNum)); - // 第10列 - resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), null, avg, simpleName1, experieNum)); - // 第11列 - resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), null, avg, simpleName1, experieNum)); - // 第12列 - resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), null, avg, simpleName1, experieNum)); - } - } - - List> mapList = new ArrayList<>(); - for (Map map : resultList) { - if (!"".equals(map.get("log2")) && !"".equals(map.get("result"))) { - mapList.add(map); - } - } - - // mapList根据order排序 - Collections.sort(mapList, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != mapList.size()) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(mapList)); - result.setOriginRecordResult(JSON.toJSONString(mapList)); -// result.setExamineDataArr(JSON.toJSONString(list)); - result.setExamineDataArr(JSON.toJSONString(resultList)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(mapList)); - examineResult.setOriginRecordResult(JSON.toJSONString(mapList)); -// examineResult.setExamineDataArr(JSON.toJSONString(list)); - examineResult.setExamineDataArr(JSON.toJSONString(resultList)); - service.save(examineResult); - } - return R.data(mapList); - } - // 兰所多板---------------------------------------------------------------------------------------------------- - else if ("2".equals(split[1])) { - int yinCount = 0; - int yangCount = 0; - Map>>> resultMap = new HashMap<>(); - // 以组为维度的所有数据:<1:行...>、<2:行...> - Map> groupsMap = new HashMap<>(); - // 组数 - int groupCount = (originRowDatas.size() + 1) / 9; - - // 取实际的数据(排除数字标题) - groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); - // 检测编号s - String[] experieNum = examine.getExperieNum().split(","); - // 用于存放每个格子的值,有顺序,无规则 - List> allDatas = new ArrayList<>(); - List> allData = new ArrayList<>(); - int simpleCount = 0; - // 按照公式计算实验数据并返回;两板对照:取偶数组去循环做参照,+1组做对照 - // 参照组:2n 、对照组:2n + 1 - 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)); - // 计算该组的[对照平均值] - Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); - for (int row = 0; row < rowInGroup1.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 1, 1); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup1.add(allPosDatasInAGroup); - } - resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); - - // 2.对照组 - // 存这一组的所有数据 - List>> allDataInCurrGroup2 = new ArrayList<>(); - // i = 0时,是取1组的那8行 - List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); - // 计算该组的[对照平均值] - Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); - for (int row = 0; row < rowInGroup2.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 1, 2); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup2.add(allPosDatasInAGroup); - } - resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); - - // 3.两相比较取结果 - for (int i = 0; i < allDataInCurrGroup1.size(); i++) { - Map> layer1 = allDataInCurrGroup1.get(i); - Map> layer2 = allDataInCurrGroup2.get(i); - Set set1 = layer1.keySet(); - for (String key : set1) { - Map data1 = layer1.get(key); - Map data2 = layer2.get(key); - Map data = new HashMap<>(); - data.put("result", data1.get("result")); - data.put("log2", data1.get("log2")); - data.put("value", data1.get("value")); - data.put("order", data1.get("order")); - data.put("num", data1.get("num")); - - boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); - if (data.get("result") == null || data2.get("result") == null) { - allDatas.add(data); - continue; - } - if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { - data.put("log2", isPig ? "≥1:64" : "≥1:128"); - data.put("result", "阳性"); - allDatas.add(data); - yangCount++; - simpleCount++; - } else { - data.put("log2", isPig ? "<1:64" : "<1:128"); - data.put("result", "阴性"); - allDatas.add(data); - yinCount++; - simpleCount++; - } - } - } - } - - // 排序 - Collections.sort(allData, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - Collections.sort(allDatas, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - // 检测编号计数器 - int numIndex = 0; - int numIndex2 = 0; - int numIndex3 = 0; - // 循环 - for (int i = 0; i < groupCount / 2; i++) { - // 参照组 - for (int j = 0; j < 96; j++) { - Map map = allData.get((i * 192) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex]; - map.put("num", num); - numIndex++; - } - } - // 对照组 - for (int j = 96; j < 192; j++) { - Map map = allData.get((i * 192) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex2]; - map.put("num", num); - numIndex2++; - } - } - // 最终结果组 - for (int j = 0; j < 96; j++) { - Map map = allDatas.get((i * 96) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex3]; - map.put("num", num); - numIndex3++; - } - } - } - - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != simpleCount) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - Map realResultMap = new HashMap<>(); - realResultMap.put("data", resultMap); - realResultMap.put("yinCount", yinCount); - realResultMap.put("yangCount", yangCount); - - // 新增或修改Result数据 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - result.setOriginRecordResult(JSON.toJSONString(realResultMap)); - result.setExamineDataArr(JSON.toJSONString(allDatas)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); - examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); - service.save(examineResult); - } - return R.data(realResultMap); - } - // 非兰所,11列也是样品 --------------------------------------------------------------------------------------- - else { - int yinCount = 0; - int yangCount = 0; - Map>>> resultMap = new HashMap<>(); - // 以组为维度的所有数据:<1:行...>、<2:行...> - Map> groupsMap = new HashMap<>(); - // 组数 - int groupCount = (originRowDatas.size() + 1) / 9; - - // 取实际的数据(排除数字标题) - groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); - - // 检测编号s - String[] experieNum = examine.getExperieNum().split(","); - // 用于存放每个格子的值,有顺序,无规则 - List> allDatas = new ArrayList<>(); - List> allData = new ArrayList<>(); - int simpleCount = 0; - // 按照公式计算实验数据并返回 - // 参照组:2n 、对照组:2n + 1 - 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)); - // 计算该组的[对照平均值] - Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); - for (int row = 0; row < rowInGroup1.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 2, 1); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup1.add(allPosDatasInAGroup); - } - resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); - - // 1.对照组 - // 存这一组的所有数据 - List>> allDataInCurrGroup2 = new ArrayList<>(); - // i = 0时,是取1组的那8行 - List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); - // 计算该组的[对照平均值] - Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); - for (int row = 0; row < rowInGroup2.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 2, 2); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup2.add(allPosDatasInAGroup); - } - resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); - - // 3.两相比较取结果 - for (int i = 0; i < allDataInCurrGroup1.size(); i++) { - Map> layer1 = allDataInCurrGroup1.get(i); - Map> layer2 = allDataInCurrGroup2.get(i); - Set set1 = layer1.keySet(); - Set set2 = layer2.keySet(); - for (String key : set1) { - Map data1 = layer1.get(key); - Map data2 = layer2.get(key); - Map data = new HashMap<>(); - data.put("result", data1.get("result")); - data.put("log2", data1.get("log2")); - data.put("value", data1.get("value")); - data.put("order", data1.get("order")); - data.put("num", data1.get("num")); - - boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); - if (data.get("result") == null || data2.get("result") == null) { - allDatas.add(data); - continue; - } - if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { - data.put("log2", isPig ? "≥1:64" : "≥1:128"); - data.put("result", "阳性"); - allDatas.add(data); - yangCount++; - simpleCount++; - } else { - data.put("log2", isPig ? "<1:64" : "<1:128"); - data.put("result", "阴性"); - allDatas.add(data); - yinCount++; - simpleCount++; - } - } - } - } - - // 排序 - Collections.sort(allData, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - Collections.sort(allDatas, new Comparator>() { - @Override - public int compare(Map o1, Map o2) { - Integer id1 = (Integer) o1.get("order"); - Integer id2 = (Integer) o2.get("order"); - // 升序 - return id1.compareTo(id2); - } - }); - - // 检测编号计数器 - int numIndex = 0; - int numIndex2 = 0; - int numIndex3 = 0; - // 循环 - for (int i = 0; i < groupCount / 2; i++) { - // 参照组 - for (int j = 0; j < 96; j++) { - Map map = allData.get((i * 192) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex]; - map.put("num", num); - numIndex++; - } - } - // 对照组 - for (int j = 96; j < 192; j++) { - Map map = allData.get((i * 192) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex2]; - map.put("num", num); - numIndex2++; - } - } - // 最终结果组 - for (int j = 0; j < 96; j++) { - Map map = allDatas.get((i * 96) + j); - String num = (String) map.get("num"); - if (num != null && !"".equals(num)) { - num = experieNum[numIndex3]; - map.put("num", num); - numIndex3++; - } - } - } +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.CollectionUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.lims.entry.*; +import org.springblade.lims.excel.*; +import org.springblade.lims.service.*; +import org.springblade.lims.utils.FormulaTool; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; - Map realResultMap = new HashMap<>(); - realResultMap.put("data", resultMap); - realResultMap.put("yinCount", yinCount); - realResultMap.put("yangCount", yangCount); +import javax.servlet.http.HttpServletResponse; +import java.text.DecimalFormat; +import java.util.*; +import java.util.stream.Collectors; - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != simpleCount) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } +@RestController +@AllArgsConstructor +@RequestMapping("/examineResult") +public class ExamineResultController extends BladeController { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - result.setOriginRecordResult(JSON.toJSONString(realResultMap)); - result.setExamineDataArr(JSON.toJSONString(allDatas)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); - examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); - service.save(examineResult); - } - return R.data(realResultMap); - } - } + private final IExamineResultService service; /** - * 口蹄疫Excel解析数据 + * 分页 */ - private R ktyExcel1(MultipartFile file, String examineId, - String infoStr, - String reg) throws Exception { - List originRowDatas = ExcelUtil.read(file, ExamineExcel.class); - String[] split = examineId.split(","); - Examine examine = examineService.getById(split[0]); - examine.setTemplateType(split[1]); - examineService.updateById(examine); - // 兰所单板---------------------------------------------------------------------------------------------------- - if ("1".equals(split[1])) { - String simpleName1 = examine.getSimpleName().split("-")[0]; - - String[] experieNum = examine.getExperieNum().split(","); - // 获取4个抗原对照值 - List list = new ArrayList<>(); - 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"); - // 对照平均值 - Double avg = Double.valueOf(df.format((list1.get(1) + list1.get(2)) / 4)); - - // 结果resultList - List> resultList = new ArrayList<>(); - for (int r = 0; r < 8; r++) { - if (r > 0) { - // 第1列 - resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), originRowDatas.get(r - 1).getCode1(), avg, simpleName1, experieNum)); - // 第2列 - resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), originRowDatas.get(r - 1).getCode2(), avg, simpleName1, experieNum)); - // 第3列 - resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), originRowDatas.get(r - 1).getCode3(), avg, simpleName1, experieNum)); - // 第4列 - resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), originRowDatas.get(r - 1).getCode4(), avg, simpleName1, experieNum)); - // 第5列 - resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), originRowDatas.get(r - 1).getCode5(), avg, simpleName1, experieNum)); - // 第6列 - resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), originRowDatas.get(r - 1).getCode6(), avg, simpleName1, experieNum)); - // 第7列 - resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), originRowDatas.get(r - 1).getCode7(), avg, simpleName1, experieNum)); - // 第8列 - resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), originRowDatas.get(r - 1).getCode8(), avg, simpleName1, experieNum)); - // 第9列 - resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), originRowDatas.get(r - 1).getCode9(), avg, simpleName1, experieNum)); - // 第10列 - resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), originRowDatas.get(r - 1).getCode10(), avg, simpleName1, experieNum)); - // 第11列 - resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), originRowDatas.get(r - 1).getCode11(), avg, simpleName1, experieNum)); - // 第12列 - resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), originRowDatas.get(r - 1).getCode12(), avg, simpleName1, experieNum)); - } else { - // 第1列 - resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), null, avg, simpleName1, experieNum)); - // 第2列 - resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), null, avg, simpleName1, experieNum)); - // 第3列 - resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), null, avg, simpleName1, experieNum)); - // 第4列 - resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), null, avg, simpleName1, experieNum)); - // 第5列 - resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), null, avg, simpleName1, experieNum)); - // 第6列 - resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), null, avg, simpleName1, experieNum)); - // 第7列 - resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), null, avg, simpleName1, experieNum)); - // 第8列 - resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), null, avg, simpleName1, experieNum)); - // 第9列 - resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), null, avg, simpleName1, experieNum)); - // 第10列 - resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), null, avg, simpleName1, experieNum)); - // 第11列 - resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), null, avg, simpleName1, experieNum)); - // 第12列 - resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), null, avg, simpleName1, experieNum)); - } - } - - List> mapList = new ArrayList<>(); - for (Map map : resultList) { - if (!"".equals(map.get("log")) && !"".equals(map.get("result"))) { - mapList.add(map); - } - } - - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != mapList.size()) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(mapList)); - result.setOriginRecordResult(JSON.toJSONString(mapList)); -// result.setExamineDataArr(JSON.toJSONString(list)); - result.setExamineDataArr(JSON.toJSONString(resultList)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(mapList)); - examineResult.setOriginRecordResult(JSON.toJSONString(mapList)); -// examineResult.setExamineDataArr(JSON.toJSONString(list)); - examineResult.setExamineDataArr(JSON.toJSONString(resultList)); - service.save(examineResult); - } - return R.data(mapList); - } - // 兰所多板---------------------------------------------------------------------------------------------------- - else if ("2".equals(split[1])) { - int yinCount = 0; - int yangCount = 0; - Map>>> resultMap = new HashMap<>(); - // 以组为维度的所有数据:<1:行...>、<2:行...> - Map> groupsMap = new HashMap<>(); - // 组数 - int groupCount = (originRowDatas.size() + 1) / 9; - - // 取实际的数据(排除数字标题) - groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); - // 检测编号s - String[] experieNum = examine.getExperieNum().split(","); - // 用于存放每个格子的值,有顺序,无规则 - List> allDatas = new ArrayList<>(); - List> allData = new ArrayList<>(); - int simpleCount = 0; - // 按照公式计算实验数据并返回;两板对照:取偶数组去循环做参照,+1组做对照 - // 参照组:2n 、对照组:2n + 1 - 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)); - // 计算该组的[对照平均值] - Double avg1 = calcCurrGroupContrastAvg1(rowInGroup1, infoStr, reg); - for (int row = 0; row < rowInGroup1.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 1, 1); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup1.add(allPosDatasInAGroup); - } - resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); - - // 2.对照组 - // 存这一组的所有数据 - List>> allDataInCurrGroup2 = new ArrayList<>(); - // i = 0时,是取1组的那8行 - List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); - // 计算该组的[对照平均值] - Double avg2 = calcCurrGroupContrastAvg1(rowInGroup2, infoStr, reg); - for (int row = 0; row < rowInGroup2.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 1, 2); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup2.add(allPosDatasInAGroup); - } - resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); - - // 3.两相比较取结果 - for (int i = 0; i < allDataInCurrGroup1.size(); i++) { - Map> layer1 = allDataInCurrGroup1.get(i); - Map> layer2 = allDataInCurrGroup2.get(i); - Set set1 = layer1.keySet(); - Set set2 = layer2.keySet(); - for (String key : set1) { - Map data1 = layer1.get(key); - Map data2 = layer2.get(key); - Map data = new HashMap<>(); - data.put("result", data1.get("result")); - data.put("log2", data1.get("log2")); - data.put("value", data1.get("value")); - data.put("order", data1.get("order")); - data.put("num", data1.get("num")); - boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); - if (data.get("result") == null || data2.get("result") == null) { - allDatas.add(data); - continue; - } - if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { - data.put("log2", isPig ? "≥1:64" : "≥1:128"); - data.put("result", "阳性"); - allDatas.add(data); - yangCount++; - simpleCount++; - } else { - data.put("log2", isPig ? "<1:64" : "<1:128"); - data.put("result", "阴性"); - allDatas.add(data); - yinCount++; - simpleCount++; - } - } - } - } - - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != simpleCount) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - Map realResultMap = new HashMap<>(); - realResultMap.put("data", resultMap); - realResultMap.put("yinCount", yinCount); - realResultMap.put("yangCount", yangCount); - - // 新增或修改Result数据 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - result.setOriginRecordResult(JSON.toJSONString(realResultMap)); - result.setExamineDataArr(JSON.toJSONString(allDatas)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(allData)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); - examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); - service.save(examineResult); - } - return R.data(realResultMap); - } - // 非兰所,11列也是样品 --------------------------------------------------------------------------------------- - else { - int yinCount = 0; - int yangCount = 0; - Map>>> resultMap = new HashMap<>(); - // 以组为维度的所有数据:<1:行...>、<2:行...> - Map> groupsMap = new HashMap<>(); - // 组数 - int groupCount = (originRowDatas.size() + 1) / 9; - - // 取实际的数据(排除数字标题) - groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); - - // 检测编号s - String[] experieNum = examine.getExperieNum().split(","); - // 用于存放每个格子的值,有顺序,无规则 - List> allDatas = new ArrayList<>(); - List> allData = new ArrayList<>(); - int simpleCount = 0; - // 按照公式计算实验数据并返回 - // 参照组:2n 、对照组:2n + 1 - 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)); - // 计算该组的[对照平均值] - Double avg1 = calcCurrGroupContrastAvg1(rowInGroup1, infoStr, reg); - for (int row = 0; row < rowInGroup1.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 2, 1); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup1.add(allPosDatasInAGroup); - } - resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); - - // 1.对照组 - // 存这一组的所有数据 - List>> allDataInCurrGroup2 = new ArrayList<>(); - // i = 0时,是取1组的那8行 - List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); - // 计算该组的[对照平均值] - Double avg2 = calcCurrGroupContrastAvg1(rowInGroup2, infoStr, reg); - for (int row = 0; row < rowInGroup2.size(); row++) { - // 行标头:前端渲染需要A、B、C.... - String a = String.valueOf((char) (row + 65)); - // 每一个位置的值: A1、B2... - Map> allPosDatasInAGroup = new HashMap<>(); - int u = 1; - // 计算每一列 - for (int i = 1; i <= 12; i++) { - Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 2, 2); - allData.add(cPosData); - allPosDatasInAGroup.put(a + i, cPosData); - if (i != 1) { - u++; - } - } - allDataInCurrGroup2.add(allPosDatasInAGroup); - } - resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); - - // 3.两相比较取结果 - for (int i = 0; i < allDataInCurrGroup1.size(); i++) { - Map> layer1 = allDataInCurrGroup1.get(i); - Map> layer2 = allDataInCurrGroup2.get(i); - Set set1 = layer1.keySet(); - Set set2 = layer2.keySet(); - for (String key : set1) { - Map data1 = layer1.get(key); - Map data2 = layer2.get(key); - Map data = new HashMap<>(); - data.put("result", data1.get("result")); - data.put("log2", data1.get("log2")); - data.put("value", data1.get("value")); - data.put("order", data1.get("order")); - data.put("num", data1.get("num")); - - boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); - if (data.get("result") == null || data2.get("result") == null) { - allDatas.add(data); - continue; - } - if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { - data.put("log2", isPig ? "≥1:64" : "≥1:128"); - data.put("result", "阳性"); - allDatas.add(data); - yangCount++; - simpleCount++; - } else { - data.put("log2", isPig ? "<1:64" : "<1:128"); - data.put("result", "阴性"); - allDatas.add(data); - yinCount++; - simpleCount++; - } - } - } - } - - // 判断应实验样品数量和实际样品数量是否相等 - if (experieNum.length != simpleCount) { - throw new Exception("分配样品数量与检测样品数量不一致!"); - } - - Map realResultMap = new HashMap<>(); - realResultMap.put("data", resultMap); - realResultMap.put("yinCount", yinCount); - realResultMap.put("yangCount", yangCount); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examine.getId()); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(allData)); - result.setOriginRecordResult(JSON.toJSONString(realResultMap)); -// result.setOriginRecordResult(JSON.toJSONString(resultMap)); - result.setExamineDataArr(JSON.toJSONString(allDatas)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examine.getId())); - examineResult.setOriginRecordData(JSON.toJSONString(allData)); - examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); -// examineResult.setOriginRecordResult(JSON.toJSONString(resultMap)); - examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); - service.save(examineResult); - } - return R.data(realResultMap); - } + @GetMapping("/list") + @ApiOperationSupport(order = 2) + public R> list(ExamineResult entry, Query query) { + IPage page = service.page(Condition.getPage(query), Condition.getQueryWrapper(entry)); + return R.data(page); } - /** - * 将当前位置的数据存入allPosDatasInAGroup、addDatas - * b:从一个顺序排的检测编号里获取G1这个位置的值 - * examineType: 1:多版, 2:非兰所 + * 检验修改 */ - 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) { - value = excels.get(row).getCode1(); - } else if (col == 2) { - value = excels.get(row).getCode2(); - } else if (col == 3) { - value = excels.get(row).getCode3(); - } else if (col == 4) { - value = excels.get(row).getCode4(); - } else if (col == 5) { - value = excels.get(row).getCode5(); - } else if (col == 6) { - value = excels.get(row).getCode6(); - } else if (col == 7) { - value = excels.get(row).getCode7(); - } else if (col == 8) { - value = excels.get(row).getCode8(); - } else if (col == 9) { - value = excels.get(row).getCode9(); - } else if (col == 10) { - value = excels.get(row).getCode10(); - } else if (col == 11) { - value = excels.get(row).getCode11(); - } else if (col == 12) { - value = excels.get(row).getCode12(); - } - Map cPosData = new HashMap<>(4); - int b = (group * 96) + row; - int order = (group * 192) + row; - if (col != 1) { - b += (u * 8); - order += (u * 8); - } - boolean isIncludeCurr = col == 12 ? false : (examineType == 1 && col == 11 ? false : true); - if (value != null && isIncludeCurr) { - cPosData.put("value", value); - // 如果是参照组 - if (a == 1) { -// cPosData.put("order", b + 1); - cPosData.put("order", order + 1); - } else { -// cPosData.put("order", b + 1 + 96); - cPosData.put("order", order + 1 + 96); - } -// cPosData.put("num", experieNum[b - ((group + 1) * 6 + (group * 16))]); -// cPosData.put("num", experieNum[b - (group + (group * 8))]); - cPosData.put("num", "1"); - cPosData.put("result", Double.parseDouble(value) > avg ? "阴性" : "阳性"); - return cPosData; - } - cPosData.put("value", value != null ? value : " "); - // 如果是参照组 - if (a == 1) { -// cPosData.put("order", b + 1); - cPosData.put("order", order + 1); - } else { -// cPosData.put("order", b + 1 + 96); - cPosData.put("order", order + 1 + 96); - } - return cPosData; + @PostMapping("/update") + @ApiOperation(value = "更改", notes = "更改") + public R update(@RequestBody ExamineResult entry) { + return R.data(service.updateById(entry)); } /** - * 计算该组的 对照平均值 + * 普通检验提交 */ - private Double calcCurrGroupContrastAvg(List excels) { - // 获取4个抗原对照值 - List list1 = new ArrayList<>(); - list1.add(Double.parseDouble(excels.get(4).getCode12())); - list1.add(Double.parseDouble(excels.get(5).getCode12())); - list1.add(Double.parseDouble(excels.get(6).getCode12())); - list1.add(Double.parseDouble(excels.get(7).getCode12())); - // 排序后,去掉一个最大值去掉一个最小值,相加除以4 - List list2 = list1.stream().sorted().collect(Collectors.toList()); - DecimalFormat df = new DecimalFormat("#0.000"); - return Double.valueOf(df.format((list2.get(1) + list2.get(2)) / 4)); + @PostMapping("/insert") + public boolean insertExamineResult(@RequestBody ExamineResult entry) throws Exception { + return service.doExamine(entry); } /** - * 计算该组的 对照平均值 - * 1.公式内容map的value值换成真实数据值 - * 2.按照公式算对照平均值 + * 布鲁氏杆菌检验提交 */ - private Double calcCurrGroupContrastAvg1(List excels, String infoStr, String reg) { - Map params = new HashMap<>(); - DecimalFormat df = new DecimalFormat("#0.000"); - - // 获取4个抗原对照值 - List list1 = new ArrayList<>(); - list1.add(Double.parseDouble(excels.get(4).getCode12())); - list1.add(Double.parseDouble(excels.get(5).getCode12())); - list1.add(Double.parseDouble(excels.get(6).getCode12())); - list1.add(Double.parseDouble(excels.get(7).getCode12())); - - // 排序,取中间两个值 - List list2 = list1.stream().sorted().collect(Collectors.toList()); - List list3 = new ArrayList<>(); - list3.add(list2.get(1)); - list3.add(list2.get(2)); - Map info = JSON.parseObject(infoStr, new TypeReference>() { - }); - List list = new ArrayList<>(info.keySet()); - - // 公示内容换成真实数据换成真实数据值 - for (int i = 0; i < list.size(); i++) { - params.put(list.get(i), list3.get(i)); - } - - // 得出最终对照平均值并返回 - String value = null; - try { - value = FormulaTool.getResult(reg, params); - } catch (Exception e) { - e.printStackTrace(); - } - return Double.valueOf(df.format(Double.parseDouble(value))); + @PostMapping("/resultCommit") + public void resultCommit(@RequestBody ExamineResult examineResult) throws Exception { + service.resultCommit(examineResult); } /** - * 取实际的数据(排除数字标题) + * 解析数据 */ - private Map> excludeNumTitle(int groupCount, List rows, Map> map) { - for (int i = 0; i < groupCount; i++) { - List excels = new ArrayList<>(); - for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { - ExamineExcel excel = rows.get(j); - excels.add(excel); - } - map.put((i + 1) + "", excels); - } - return map; + @PostMapping("/excel") + public R excel(MultipartFile file, String examineId, String reagentId) throws Exception { + return service.excel(file, examineId, reagentId); } /** * PCRExcel解析数据 */ -// private R pcrExcel(MultipartFile file, String examineId) { -// List read = ExcelUtil.read(file, PCR2Excel.class); -// if (read != null && read.size() > 0) { -// for (int i = 0; i < read.size(); i++) { -// String ctValue = read.get(i).getCtValue(); -// String length = ""; -// if (ctValue != null && !"".equals(ctValue)) { -// int length1 = 10 - ctValue.length(); -// for (int i1 = 0; i1 < length1; i1++) { -// length += " "; -// } -// } -// -// if (i == (read.size() - 1)) { -// read.get(i).setCtValue(length + ctValue); -// 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("/"); -// read.get(i).setResult("阴性"); -// } else { -// read.get(i).setCtValue(length + ctValue); -// read.get(i).setResult(" 阳性"); -// } -// } -// } -// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); -// wrapper.eq(ExamineResult::getExamineId, examineId); -// ExamineResult result = service.getOne(wrapper); -// if (result != null) { -// result.setOriginRecordData(JSON.toJSONString(read)); -// result.setOriginRecordResult(JSON.toJSONString(read)); -// result.setExamineDataArr(JSON.toJSONString(read)); -// service.updateById(result); -// } else { -// ExamineResult examineResult = new ExamineResult(); -// examineResult.setExamineId(Long.valueOf(examineId)); -// examineResult.setOriginRecordData(JSON.toJSONString(read)); -// examineResult.setOriginRecordResult(JSON.toJSONString(read)); -// examineResult.setExamineDataArr(JSON.toJSONString(read)); -// service.save(examineResult); -// } -// } -// return R.data(read); -// } @PostMapping("/pcrExcel") public R pcrExcel(@RequestBody ExamineResult entry) { List read = JSON.parseArray(entry.getJsonDatas(), PCR2Excel.class); @@ -5304,147 +134,6 @@ public class ExamineResultController extends BladeController { return R.data(read); } - /** - * 血凝检测解析数据 - */ - private R xnExcel(MultipartFile file, String examineId) throws Exception { - List read = ExcelUtil.read(file, XN2Excel.class); - if (read != null && read.size() > 0) { - List list = Arrays.asList("<1", "<1", "1", "2", "3"); - List list2 = Arrays.asList("4", "5", "6", "≥6", "7", "8", "9", "≥10", ">=6", ">=10"); - for (int i = 0; i < read.size() - 2; i++) { - XN2Excel excel = read.get(i); - if (list.contains(excel.getCtValue())) { - excel.setResult("阴性"); - } else if (list2.contains(excel.getCtValue())) { - excel.setResult("阳性"); - } else { - throw new Exception("请输入正确格式的滴度Log2值,并重新上传!"); - } - } - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ExamineResult::getExamineId, examineId); - ExamineResult result = service.getOne(wrapper); - if (result != null) { - result.setOriginRecordData(JSON.toJSONString(read)); - result.setOriginRecordResult(JSON.toJSONString(read)); - result.setExamineDataArr(JSON.toJSONString(read)); - service.updateById(result); - } else { - ExamineResult examineResult = new ExamineResult(); - examineResult.setExamineId(Long.valueOf(examineId)); - examineResult.setOriginRecordData(JSON.toJSONString(read)); - examineResult.setOriginRecordResult(JSON.toJSONString(read)); - examineResult.setExamineDataArr(JSON.toJSONString(read)); - service.save(examineResult); - } - } - return R.data(read); - } - - /** - * 组装每一个实验数据及结果map - */ - private Map assumb(int row, int col, String value, String lastValue, Double avg, String simpleName1, String[] experieNums) { - // row:行: 0-7 - // col:列: 1-12 - // 計算排序 - int order = (row + 1) + (col - 1) * 8; - // 如果是前十列 - if (col < 11) { - if (value != null && !"".equals(value)) { - // 抗原對照和原始数值比较 - Double currValue = Double.valueOf(value); - Double lastValue1 = 0.00; - if (lastValue != null) { - lastValue1 = Double.valueOf(lastValue); - } - // 滴度 - String log = ""; - log = calcLog(row, currValue, lastValue1, avg); - // 判断阴阳性 - Integer linJie = 0; - - if ("牛".equals(simpleName1) || "羊".equals(simpleName1)) { - linJie = 128; - } else if ("猪".equals(simpleName1)) { - linJie = 64; - } - String result = ""; - if (!"".equals(log)) { - Integer fenMu = Integer.valueOf(log.split(":")[1]); - result = fenMu < linJie ? "阴性" : "阳性"; - } - - Map map = new HashMap<>(); - map.put("order", order); - map.put("value", value); - map.put("log2", log); - map.put("result", result); - map.put("num", experieNums[col - 1]); - return map; - } else { - Map map = new HashMap<>(); - map.put("order", order); - map.put("value", ""); - map.put("log2", ""); - map.put("result", ""); - map.put("num", ""); - return map; - } - } else { - Map map = new HashMap<>(); - map.put("order", order); - map.put("value", value); - map.put("log2", ""); - map.put("result", ""); - map.put("num", ""); - return map; - } - } - - /** - * 计算滴度 - */ - private String calcLog(Integer row, Double currValue, Double lastValue, Double avg) { - if (row == 0) { - if (avg < currValue) { - return "<1:8"; - } - } else if (row == 1) { - if (avg < currValue && avg > lastValue) { - return "1:11"; - } - } else if (row == 2) { - if (avg < currValue && avg > lastValue) { - return "1:22"; - } - } else if (row == 3) { - if (avg < currValue && avg > lastValue) { - return "1:45"; - } - } else if (row == 4) { - if (avg < currValue && avg > lastValue) { - return "1:90"; - } - } else if (row == 5) { - if (avg < currValue && avg > lastValue) { - return "1:180"; - } - } else if (row == 6) { - if (avg < currValue && avg > lastValue) { - return "1:360"; - } - } else if (row == 7) { - if (avg < currValue && avg > lastValue) { - return "1:720"; - } else if (avg > currValue) { - return ">1:1024"; - } - } - return ""; - } - /** * 导出相关本实验的模板 */ @@ -5452,108 +141,7 @@ public class ExamineResultController extends BladeController { @ApiOperationSupport(order = 8) @ApiOperation(value = "结果模板") public void exportCurrExamineTemplate(HttpServletResponse response, String id) { - Examine examine = examineService.getById(id); -// ExamineItem examineItem = examineItemService.getById(examine.getExamineItemId()); - ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); - // 如果是布鲁氏杆菌抗体检测 - if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(SimpleDoExamineLog::getExamineId, id); - wrapper.eq(SimpleDoExamineLog::getIsFinished, 0); - List logs = simpleDoExamineLogService.list(wrapper); - - String experieNum = ""; - for (SimpleDoExamineLog log : logs) { - experieNum += log.getExperieNum(); - } - - List list = new ArrayList<>(); - String[] split = experieNum.split(","); - // 布鲁氏杆菌抗体检测(平板凝集) - for (String s : split) { - ExamineTemplateExcel excel = new ExamineTemplateExcel(); - excel.setExperieNum(s); - list.add(excel); - } - ExcelUtil.export(response, "结果模板", "结果模板", list, ExamineTemplateExcel.class); - } - // PCR检测 - else if ("4".equals(examineWay.getInputMode())) { - String experieNum = examine.getExperieNum(); - List list = new ArrayList<>(); - String[] split = experieNum.split(","); - for (String s : split) { - PCRExcel pcrExcel = new PCRExcel(); - pcrExcel.setExperieNum(s); - list.add(pcrExcel); - } - PCRExcel pcrExcel = new PCRExcel(); - pcrExcel.setExperieNum("阴性 对照"); - list.add(pcrExcel); - PCRExcel pcrExcel1 = new PCRExcel(); - pcrExcel1.setExperieNum("阳性 对照"); - list.add(pcrExcel1); - ExcelUtil.export(response, "结果模板", "结果模板", list, PCRExcel.class); - } - // 血凝 - else if ("5".equals(examineWay.getInputMode())) { - String experieNum = examine.getExperieNum(); - List list = new ArrayList<>(); - String[] split = experieNum.split(","); - for (String s : split) { - XNExcel pcrExcel = new XNExcel(); - pcrExcel.setExperieNum(s); - list.add(pcrExcel); - } - XNExcel pcrExcel1 = new XNExcel(); - pcrExcel1.setExperieNum("阴性对照"); - list.add(pcrExcel1); - XNExcel pcrExcel2 = new XNExcel(); - pcrExcel2.setExperieNum("阳性对照"); - list.add(pcrExcel2); - ExcelUtil.export(response, "结果模板", "结果模板", list, XNExcel.class); - } - // 生化鉴定 - else if ("8".equals(examineWay.getInputMode())) { - String experieNum = examine.getExperieNum(); - List list = new ArrayList<>(); - String[] split = experieNum.split(","); - for (String s : split) { - BiochemicalIdentificationExcel pcrExcel = new BiochemicalIdentificationExcel(); - pcrExcel.setExperieNum(s); - list.add(pcrExcel); - } - ExcelUtil.export(response, "结果模板", "结果模板", list, BiochemicalIdentificationExcel.class); - } - // 普通检测 - else { - List list = new ArrayList<>(8); - ExamineOutExcel excel = new ExamineOutExcel(); - ExamineOutExcel excel1 = new ExamineOutExcel(); - ExamineOutExcel excel2 = new ExamineOutExcel(); - ExamineOutExcel excel3 = new ExamineOutExcel(); - ExamineOutExcel excel4 = new ExamineOutExcel(); - ExamineOutExcel excel5 = new ExamineOutExcel(); - ExamineOutExcel excel6 = new ExamineOutExcel(); - ExamineOutExcel excel7 = new ExamineOutExcel(); - excel.setCode("A"); - excel1.setCode("B"); - excel2.setCode("C"); - excel3.setCode("D"); - excel4.setCode("E"); - excel5.setCode("F"); - excel6.setCode("G"); - excel7.setCode("H"); - list.add(excel); - list.add(excel1); - list.add(excel2); - list.add(excel3); - list.add(excel4); - list.add(excel5); - list.add(excel6); - list.add(excel7); - ExcelUtil.export(response, "结果模板", "结果模板", list, ExamineOutExcel.class); - } + service.exportCurrExamineTemplate(response, id); } /** @@ -5594,38 +182,6 @@ public class ExamineResultController extends BladeController { */ @GetMapping("/handleNum") public R handleNum(String id, Integer number) { - - Examine examine = examineService.getById(id); - - // 原始检测编号 - String[] nums = examine.getExperieNum().split(","); - - // 合样类型(5合1,,10合1) -// int type = Integer.parseInt(number); - - String res = ""; - if (number > 1) { - // 循环次数 - int count = examine.getSimpleCount() % number == 0 ? examine.getSimpleCount() / number : examine.getSimpleCount() / number + 1; - - for (int i = 0; i < count; i++) { - String start = nums[i * number]; - String end = ""; - if (i * number != nums.length - 1) { - if (i == count - 1) { - String[] split = nums[nums.length - 1].split("-"); - end = "-" + split[split.length - 1]; - } else { - String[] split = nums[(i + 1) * number - 1].split("-"); - end = "-" + split[split.length - 1]; - } - } - res += start + end + ","; - } - } else { - res = examine.getExperieNum(); - } - - return R.data(res); + return R.data(service.handleNum(id, number)); } } \ No newline at end of file diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/HandleSampleController.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/HandleSampleController.java index cd31eb9..c82b1f6 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/HandleSampleController.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/controller/HandleSampleController.java @@ -27,7 +27,7 @@ import java.util.Date; @RequestMapping("/handleSample") public class HandleSampleController extends BladeController { - private IHandleSampleService handleSampleService; + private final IHandleSampleService handleSampleService; /** * 留样处理申请列表 diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/mapper/EntrustMapper.xml b/lab-service/lab-lims/src/main/java/org/springblade/lims/mapper/EntrustMapper.xml index d7373ec..5fa7ce1 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/mapper/EntrustMapper.xml +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/mapper/EntrustMapper.xml @@ -108,10 +108,10 @@ AND b.experie_num like concat('%',#{handleSample.handleOpinion},'%') - + AND a.handle_state = #{handleSample.status} - + AND a.handle_state in (2,3) AND a.is_deleted = 0 AND a.entrust_status != '-1' diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java index fe30853..d4ae3f0 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java @@ -3,10 +3,14 @@ package org.springblade.lims.service; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; import org.springblade.lims.entry.Entrust; import org.springblade.lims.entry.ExamineResult; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + /** * 委托单表 服务类 * @@ -20,4 +24,10 @@ public interface IExamineResultService extends BaseService { void resultCommit(ExamineResult examineResult) throws Exception; String resultPicture(MultipartFile file, String examineId); + + R excel(MultipartFile file, String examineId, String reagentId) throws Exception; + + void exportCurrExamineTemplate(HttpServletResponse response, String id); + + String handleNum(String id, Integer number); } 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 3d088bc..60b50f5 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 @@ -7,16 +7,14 @@ import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import io.swagger.models.auth.In; import lombok.NoArgsConstructor; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.rendering.PDFRenderer; import org.apache.poi.xwpf.usermodel.*; import org.springblade.common.utils.ZipCompressUtil; -import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.StringUtil; import org.springblade.lims.entry.*; import org.springblade.lims.excel.*; import org.springblade.lims.mapper.EntrustMapper; @@ -24,21 +22,23 @@ import org.springblade.lims.service.*; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.system.cache.DictBizCache; import org.springblade.system.enums.DictBizEnum; -import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.time.LocalDateTime; @@ -1135,76 +1135,6 @@ public class EntrustServiceImpl extends BaseServiceImpl result1.put("resultList1", ItemAndAllList); // 图片路劲 String path = sysClient.getParamValue("electronic_signature_real_path").getData(); - // 编制人签名 -// if (StringUtil.isNotBlank(entrust.getOrganizationBy())) { -// User user = userClient.userInfoById(Long.parseLong(entrust.getOrganizationBy())).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(); -// } -// result1.put("1", farView); -// } - // 审核人签名 -// if (StringUtil.isNotBlank(entrust.getVerifyBy())) { -// User user = userClient.userInfoById(Long.parseLong(entrust.getVerifyBy())).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(); -// } -// result1.put("2", farView); -// } - // 审批人签名 -// if (StringUtil.isNotBlank(entrust.getApprovalBy())) { -// User user = userClient.userInfoById(Long.parseLong(entrust.getApprovalBy())).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(); -// } -// result1.put("3", farView); -// } - // 盖章图片 -// ImageEntity farView = new ImageEntity(); -// farView.setHeight(80);//设置高度 -// farView.setWidth(80);//设置宽度 -// farView.setType(ImageEntity.Data);//类型 -// String pictureName = sysClient.getParamValue("seal_picture_path").getData(); -// String s1 = path + pictureName; -// FileInputStream fis = null; -// try { -// fis = new FileInputStream(new File(s1)); -// byte[] bytes = readInputStream(fis); -// farView.setData(bytes); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// result1.put("11", farView); return result1; } @@ -1254,27 +1184,6 @@ public class EntrustServiceImpl extends BaseServiceImpl int yangNum = 0; int yinNum = 0; int keyiNum = 0; -// for (ExamineResultVo vo : list) { -// if (StringUtils.isNotBlank(vo.getResult())) { -// if (examineResult.getConformityType() != null && examineResult.getConformityType() > 1) { -// if (vo.getResult().contains("阳性")) { -// yangNum += examineResult.getConformityType(); -// } else if ("阴性".equals(vo.getResult())) { -// yinNum += examineResult.getConformityType(); -// } else if ("可疑".equals(vo.getResult())) { -// keyiNum += examineResult.getConformityType(); -// } -// } else { -// if (vo.getResult().contains("阳性")) { -// yangNum++; -// } else if ("阴性".equals(vo.getResult())) { -// yinNum++; -// } else if ("可疑".equals(vo.getResult())) { -// keyiNum++; -// } -// } -// } -// } for (int j = 0; j < list.size(); j++) { ExamineResultVo vo = list.get(j); @@ -1383,94 +1292,8 @@ public class EntrustServiceImpl extends BaseServiceImpl } } -// String batchNos = examineResult.getBatchNos(); -// if (StringUtils.isNotBlank(batchNos)) { -// String[] batch = batchNos.split(","); -// for (int i = 0; i < batch.length; i++) { -// String[] split2 = batch[i].split("-"); -// Reagent reagent = reagentService.getById(split2[0]); -// if (i == (batch.length - 1)) { -// regentName += reagent.getName() + "(生产批号:" + split2[1] + ")" + reagent.getManufacturer(); -// } else { -// regentName += reagent.getName() + "(生产批号:" + split2[1] + ")" + reagent.getManufacturer() + "\r\n"; -// } -// } -// } - result.put("7", 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(); -// } 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(","); String instrumentName = ""; List strings = new ArrayList<>(); @@ -1548,7 +1371,7 @@ public class EntrustServiceImpl extends BaseServiceImpl String s1 = dateFormat.format(examineResult.getVerificationTime()); result.put("17", s1); } - // 检测时间 + // 检测时间\\]]]] if (examineResult.getInspectionTime() != null) { String s1 = dateFormat.format(examineResult.getInspectionTime()); result.put("16", s1); @@ -1563,28 +1386,13 @@ public class EntrustServiceImpl extends BaseServiceImpl } List list = JSON.parseArray(examineResult.getExamineDataArr(), ExamineTemplate2Excel.class); - // 阴阳性数量 -// long yin = list.stream().filter((ExamineTemplate2Excel e) -> "阴性".equals(e.getResult())).count(); -// long yang = list.stream().filter((ExamineTemplate2Excel e) -> "阳性".equals(e.getResult())).count(); -// -// ExamineTemplate2Excel examineTemplate2Excel1 = new ExamineTemplate2Excel(); -// examineTemplate2Excel1.setExperieNum("阴性数量"); -// examineTemplate2Excel1.setValue(String.valueOf(yin)); -// list.add(examineTemplate2Excel1); -// -// ExamineTemplate2Excel examineTemplate2Excel2 = new ExamineTemplate2Excel(); -// examineTemplate2Excel2.setExperieNum("阳性数量"); -// examineTemplate2Excel2.setValue(String.valueOf(yang)); -// list.add(examineTemplate2Excel2); - - // 如果是平板的,只有阴性和阳性,如果是试管的才有可疑 -// if ("6".equals(byId.getInputMode())) { -// long keyi = list.stream().filter((ExamineTemplate2Excel e) -> "可疑".equals(e.getResult())).count(); -// ExamineTemplate2Excel examineTemplate2Excel3 = new ExamineTemplate2Excel(); -// examineTemplate2Excel3.setExperieNum("可疑数量"); -// examineTemplate2Excel3.setValue(String.valueOf(keyi)); -// list.add(examineTemplate2Excel3); -// } + + ExamineTemplate2Excel yinExcel = list.get(list.size() - 2); + yinExcel.setResult("阴性"); + list.set(list.size() - 2, yinExcel); + ExamineTemplate2Excel yangExcel = list.get(list.size() - 1); + yangExcel.setResult("阳性"); + list.set(list.size() - 1, yangExcel); if (list.size() > 0) { Map> resultMap = new HashMap<>(); @@ -1640,19 +1448,6 @@ public class EntrustServiceImpl extends BaseServiceImpl // PCR检测 else if ("4".equals(examineWay.getInputMode())) { List list = JSON.parseArray(examineResult.getExamineDataArr(), PCR2Excel.class); - // 阴阳性数量 -// long yin = list.stream().filter((PCR2Excel e) -> "阴性".equals(e.getValue())).count(); -// long yang = list.stream().filter((PCR2Excel e) -> " 阳性".equals(e.getValue())).count(); -// PCR2Excel pcr2Excel1 = new PCR2Excel(); -// PCR2Excel pcr2Excel2 = new PCR2Excel(); -// pcr2Excel1.setExperieNum("阴性数量"); -// // 减1是因为,不能把阴性对照的阴性结果当做样品计算 -// pcr2Excel1.setCtValue(String.valueOf(yin - 1)); -// pcr2Excel2.setExperieNum("阳性数量"); -// // 减1是因为,不能把阳性对照的阳性结果当做样品计算 -// pcr2Excel2.setCtValue(String.valueOf(yang - 1)); -// list.add(pcr2Excel1); -// list.add(pcr2Excel2); if (list.size() > 0) { Map> resultMap = new HashMap<>(); @@ -1675,32 +1470,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } for (int j = 1; j <= resultMap.size(); j++) { List arrVOList = resultMap.get(String.valueOf(j)); - //按照阴阳性进行分组 start -// Map> collect = arrVOList.stream().collect(Collectors.groupingBy(PCR2Excel::getValue)); -// List listYang = collect.get("阳性"); -// List listYin = collect.get("阴性"); -// List> resultYang = new ArrayList<>(); -// List> resultYin = new ArrayList<>(); -// -// listYang.forEach(yang -> { -// Map map = new HashMap<>(); -// map.put("numYang", yang.getExperieNum()); -// map.put("valueYang", yang.getCtValue()); -// map.put("resultYang", yang.getValue()); -// resultYang.add(map); -// }); -// -// listYin.forEach(yin ->{ -// Map map = new HashMap<>(); -// map.put("numYin", yin.getExperieNum()); -// map.put("valueYin", yin.getCtValue()); -// map.put("resultYin", yin.getValue()); -// resultYin.add(map); -// }); -// result.put("listYang", listYang); -// result.put("listYin", listYin); - //按照阴阳性进行分组 end - // 使用每一页的数据 if (arrVOList.size() % 2 == 0) { for (int i = 0; i < arrVOList.size() / 2; i++) { Map map = new HashMap<>(); @@ -1727,67 +1496,58 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list.size() % 2 == 0) { -// for (int i = 0; i < list.size() / 2; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// map.put("num2", list.get(list.size() / 2 + i).getExperieNum()); -// map.put("value2", list.get(list.size() / 2 + i).getCtValue()); -// map.put("result2", list.get(list.size() / 2 + i).getValue()); -// resultList1.add(map); -// } -// } else { -// for (int i = 0; i < list.size() / 2 + 1; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// if (i < list.size() / 2) { -// map.put("num2", list.get(list.size() / 2 + i + 1).getExperieNum()); -// map.put("value2", list.get(list.size() / 2 + i + 1).getCtValue()); -// map.put("result2", list.get(list.size() / 2 + i + 1).getValue()); -// } -// resultList1.add(map); -// } -// } - if (examineResult.getPicturePath() != null && !"".equals(examineResult.getPicturePath())) { + if (StringUtils.isNotBlank(examineResult.getPicturePath())) { String[] sp = examineResult.getPicturePath().split(","); for (String picturePath : sp) { - Map map = new HashMap<>(); - ImageEntity farView1 = new ImageEntity(); - farView1.setHeight(350);//设置高度 - farView1.setWidth(550);//设置宽度 - farView1.setType(ImageEntity.Data);//类型 - String s1 = path + picturePath; - FileInputStream fis = null; - try { - fis = new FileInputStream(new File(s1)); - byte[] bytes = readInputStream(fis); - farView1.setData(bytes); - } catch (Exception e) { - e.printStackTrace(); + String fileSuffix = picturePath.substring(picturePath.lastIndexOf(".") + 1); + System.out.println("fileSuffix:" + fileSuffix); + if ("pdf".equals(fileSuffix) || "PDF".equals(fileSuffix)) { + System.out.println("pdf执行了。。。。"); + List urls = pdfResule(picturePath, path); + for (String pngUrl : urls) { + Map map = new HashMap<>(); + ImageEntity farView1 = new ImageEntity(); + farView1.setHeight(800);//设置高度 + farView1.setWidth(580);//设置宽度 + farView1.setType(ImageEntity.Data);//类型 + String s1 = path + pngUrl; + FileInputStream fis = null; + try { + fis = new FileInputStream(new File(s1)); + byte[] bytes = readInputStream(fis); + farView1.setData(bytes); + } catch (Exception e) { + e.printStackTrace(); + } + map.put("p", farView1); + resultList2.add(map); + + // 删除临时文件 + File file = new File(s1); + if (file.exists()) { + file.delete(); + } + } + } else { + System.out.println("png执行了。。。。"); + Map map = new HashMap<>(); + ImageEntity farView1 = new ImageEntity(); + farView1.setHeight(350);//设置高度 + farView1.setWidth(550);//设置宽度 + farView1.setType(ImageEntity.Data);//类型 + String s1 = path + picturePath; + FileInputStream fis = null; + try { + fis = new FileInputStream(new File(s1)); + byte[] bytes = readInputStream(fis); + farView1.setData(bytes); + } catch (Exception e) { + e.printStackTrace(); + } + map.put("p", farView1); + resultList2.add(map); } - map.put("p", farView1); - resultList2.add(map); } -// String picturePath = examineResult.getPicturePath(); -// ImageEntity farView1 = new ImageEntity(); -// farView1.setHeight(350);//设置高度 -// farView1.setWidth(550);//设置宽度 -// farView1.setType(ImageEntity.Data);//类型 -// -// String s1 = path + picturePath; -// FileInputStream fis = null; -// try { -// fis = new FileInputStream(new File(s1)); -// byte[] bytes = readInputStream(fis); -// farView1.setData(bytes); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// result.put("16", farView1); } } result.put("list1", resultList2); @@ -1798,17 +1558,6 @@ public class EntrustServiceImpl extends BaseServiceImpl // XN检测 else if ("5".equals(examineWay.getInputMode())) { List list = JSON.parseArray(examineResult.getExamineDataArr(), XN2Excel.class); - // 阴阳性数量 -// long yin = list.stream().filter((XN2Excel e) -> "阴性".equals(e.getValue())).count(); -// long yang = list.stream().filter((XN2Excel e) -> "阳性".equals(e.getValue())).count(); -// XN2Excel xn2Excel1 = new XN2Excel(); -// XN2Excel xn2Excel2 = new XN2Excel(); -// xn2Excel1.setExperieNum("阴性数量"); -// xn2Excel1.setCtValue(String.valueOf(yin)); -// xn2Excel2.setExperieNum("阳性数量"); -// xn2Excel2.setCtValue(String.valueOf(yang)); -// list.add(xn2Excel1); -// list.add(xn2Excel2); if (list.size() > 0) { Map> resultMap = new HashMap<>(); int count = 0; @@ -1857,53 +1606,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list.size() % 3 == 0) { -// for (int i = 0; i < list.size() / 3; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// map.put("num2", list.get(list.size() / 3 + i).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i).getValue()); -// map.put("num3", list.get(list.size() / 3 * 2 + i).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i).getValue()); -// resultList1.add(map); -// } -// } else { -// for (int i = 0; i < list.size() / 3 + 1; i++) { -// if (list.size() % 3 == 1) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// if (i < list.size() / 3) { -// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); -// map.put("num3", list.get(list.size() / 3 * 2 + i + 1).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i + 1).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i + 1).getValue()); -// } -// resultList1.add(map); -// } else if (list.size() % 3 == 2) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); -// if (i < list.size() / 3) { -// map.put("num3", list.get(list.size() / 3 * 2 + i + 2).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i + 2).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i + 2).getValue()); -// } -// resultList1.add(map); -// } -// } -// } } result.put("list", resultList1); url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "XNreportPrint"); @@ -1911,17 +1613,6 @@ public class EntrustServiceImpl extends BaseServiceImpl // 生化鉴定 else if ("8".equals(examineWay.getInputMode())) { List list = JSON.parseArray(examineResult.getExamineDataArr(), BiochemicalIdentificationExcel.class); - // 阴阳性数量 -// long yin = list.stream().filter((XN2Excel e) -> "阴性".equals(e.getValue())).count(); -// long yang = list.stream().filter((XN2Excel e) -> "阳性".equals(e.getValue())).count(); -// XN2Excel xn2Excel1 = new XN2Excel(); -// XN2Excel xn2Excel2 = new XN2Excel(); -// xn2Excel1.setExperieNum("阴性数量"); -// xn2Excel1.setCtValue(String.valueOf(yin)); -// xn2Excel2.setExperieNum("阳性数量"); -// xn2Excel2.setCtValue(String.valueOf(yang)); -// list.add(xn2Excel1); -// list.add(xn2Excel2); if (list.size() > 0) { Map> resultMap = new HashMap<>(); int count = 0; @@ -1970,53 +1661,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list.size() % 3 == 0) { -// for (int i = 0; i < list.size() / 3; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// map.put("num2", list.get(list.size() / 3 + i).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i).getValue()); -// map.put("num3", list.get(list.size() / 3 * 2 + i).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i).getValue()); -// resultList1.add(map); -// } -// } else { -// for (int i = 0; i < list.size() / 3 + 1; i++) { -// if (list.size() % 3 == 1) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// if (i < list.size() / 3) { -// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); -// map.put("num3", list.get(list.size() / 3 * 2 + i + 1).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i + 1).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i + 1).getValue()); -// } -// resultList1.add(map); -// } else if (list.size() % 3 == 2) { -// Map map = new HashMap<>(); -// map.put("num1", list.get(i).getExperieNum()); -// map.put("value1", list.get(i).getCtValue()); -// map.put("result1", list.get(i).getValue()); -// map.put("num2", list.get(list.size() / 3 + i + 1).getExperieNum()); -// map.put("value2", list.get(list.size() / 3 + i + 1).getCtValue()); -// map.put("result2", list.get(list.size() / 3 + i + 1).getValue()); -// if (i < list.size() / 3) { -// map.put("num3", list.get(list.size() / 3 * 2 + i + 2).getExperieNum()); -// map.put("value3", list.get(list.size() / 3 * 2 + i + 2).getCtValue()); -// map.put("result3", list.get(list.size() / 3 * 2 + i + 2).getValue()); -// } -// resultList1.add(map); -// } -// } -// } } result.put("list", resultList1); url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "SHJDreportPrint"); @@ -2061,17 +1705,6 @@ public class EntrustServiceImpl extends BaseServiceImpl examineDataArrVO.setResult(""); list1.add(examineDataArrVO); list1.addAll(voList); - // 阴阳性数量 -// long yin = list1.stream().filter((ExamineDataArrVO e) -> "阴性".equals(e.getResult())).count(); -// long yang = list1.stream().filter((ExamineDataArrVO e) -> "阳性".equals(e.getResult())).count(); -// ExamineDataArrVO dataArrVO1 = new ExamineDataArrVO(); -// ExamineDataArrVO dataArrVO2 = new ExamineDataArrVO(); -// dataArrVO1.setNum("阴性数量"); -// dataArrVO1.setValue(String.valueOf(yin)); -// dataArrVO2.setNum("阳性数量"); -// dataArrVO2.setValue(String.valueOf(yang)); -// list1.add(dataArrVO1); -// list1.add(dataArrVO2); if (list1.size() > 0) { Map> resultMap = new HashMap<>(); @@ -2146,57 +1779,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list1.size() % 3 == 0) { -// 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("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("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()); -// 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()); -// 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("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()); -// } -// 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("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()); -// 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()); -// } -// resultList1.add(map); -// } -// } -// } result.put("list1", resultList1); } for (int i = 0; i < (list.size() / 96); i++) { @@ -2282,29 +1864,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } x++; } -// 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); } @@ -2348,18 +1907,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } - // 阴阳性数量 -// long yin = list1.stream().filter((ExamineDataArrVO e) -> "阴性".equals(e.getResult())).count(); -// long yang = list1.stream().filter((ExamineDataArrVO e) -> "阳性".equals(e.getResult())).count(); -// ExamineDataArrVO dataArrVO1 = new ExamineDataArrVO(); -// ExamineDataArrVO dataArrVO2 = new ExamineDataArrVO(); -// dataArrVO1.setNum("阴性数量"); -// dataArrVO1.setLog2(String.valueOf(yin)); -// dataArrVO2.setNum("阳性数量"); -// dataArrVO2.setLog2(String.valueOf(yang)); -// list1.add(dataArrVO1); -// list1.add(dataArrVO2); - if (list1.size() > 0) { Map> resultMap = new HashMap<>(); int count = 0; @@ -2433,55 +1980,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list1.size() % 3 == 0) { -// for (int i = 0; i < list1.size() / 3; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list1.get(i).getNum()); -// 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("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("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("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("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("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("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("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("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); -// } -// } -// } result.put("list1", resultList1); } for (int i = 0; i < (arrVOList.size() / 96); i++) { @@ -2567,29 +2065,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } x++; } -// 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); } @@ -2633,17 +2108,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } - // 阴阳性数量 -// long yin = list1.stream().filter((ExamineDataArrVO e) -> "阴性".equals(e.getResult())).count(); -// long yang = list1.stream().filter((ExamineDataArrVO e) -> "阳性".equals(e.getResult())).count(); -// ExamineDataArrVO dataArrVO1 = new ExamineDataArrVO(); -// ExamineDataArrVO dataArrVO2 = new ExamineDataArrVO(); -// dataArrVO1.setNum("阴性数量"); -// dataArrVO1.setLog2(String.valueOf(yin)); -// dataArrVO2.setNum("阳性数量"); -// dataArrVO2.setLog2(String.valueOf(yang)); -// list1.add(dataArrVO1); -// list1.add(dataArrVO2); if (list1.size() > 0) { Map> resultMap = new HashMap<>(); @@ -2718,55 +2182,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } } } -// if (list1.size() % 3 == 0) { -// for (int i = 0; i < list1.size() / 3; i++) { -// Map map = new HashMap<>(); -// map.put("num1", list1.get(i).getNum()); -// 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("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("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("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("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("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("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("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("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); -// } -// } -// } result.put("list1", resultList1); } for (int i = 0; i < (arrVOList.size() / 96); i++) { @@ -2852,29 +2267,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } x++; } -// 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); } @@ -2886,7 +2278,8 @@ public class EntrustServiceImpl extends BaseServiceImpl // 普通检测 else { // 根据试剂给不同检测数值命名 - if ("1580730163250188290".equals(examineResult.getReagentId()) + if ( + "1580730163250188290".equals(examineResult.getReagentId()) || "1570297916894146562".equals(examineResult.getReagentId()) || "1570667729797705730".equals(examineResult.getReagentId()) || "1570671477110534145".equals(examineResult.getReagentId()) @@ -2894,14 +2287,21 @@ public class EntrustServiceImpl extends BaseServiceImpl || "1589877000410296322".equals(examineResult.getReagentId()) || "1677607364850900993".equals(examineResult.getReagentId()) || "1677607364859289601".equals(examineResult.getReagentId()) - || "1582988982068027393".equals(examineResult.getReagentId())) { + || "1682203934330204161".equals(examineResult.getReagentId()) + || "1582988982068027393".equals(examineResult.getReagentId()) + || "1691712889624555522".equals(examineResult.getReagentId()) + || "1680136574547013633".equals(examineResult.getReagentId()) + || "1691710090853576706".equals(examineResult.getReagentId()) + ) { result.put("18", "S/P"); } else if ("1580815808211578882".equals(examineResult.getReagentId())) { result.put("18", "PI"); - } else if ("1570666183341043714".equals(examineResult.getReagentId())) { + } else if ("1570666183341043714".equals(examineResult.getReagentId()) + || "1692066046158401537".equals(examineResult.getReagentId())) { result.put("18", "PB"); } else if ("1570283733628678145".equals(examineResult.getReagentId()) - || "1533624738296389636".equals(examineResult.getReagentId())) { + || "1533624738296389636".equals(examineResult.getReagentId()) + || "1691714318883975170".equals(examineResult.getReagentId())) { result.put("18", "阻断率"); } else if ("1665968083879366657".equals(examineResult.getReagentId()) || "1665964229817307138".equals(examineResult.getReagentId())) { @@ -2913,6 +2313,9 @@ public class EntrustServiceImpl extends BaseServiceImpl || "1570664922961080322".equals(examineResult.getReagentId()) || "1656852607882579970".equals(examineResult.getReagentId()) || "1570666622551781378".equals(examineResult.getReagentId()) + || "1692059030258020354".equals(examineResult.getReagentId()) + || "1682203201220390913".equals(examineResult.getReagentId()) + || "1692060337681297410".equals(examineResult.getReagentId()) || "1570667398619656194".equals(examineResult.getReagentId())) { result.put("18", "S/N"); } else if ("1570297053211455490".equals(examineResult.getReagentId()) @@ -2925,22 +2328,22 @@ public class EntrustServiceImpl extends BaseServiceImpl if (list.size() % 96 == 0) { for (int i = 0; i < list.size() / 96; i++) { -// double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); -// double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); -// String format = df.format((a1 + b1) / 2); -// ExamineDataArrVO arrVO = new ExamineDataArrVO(); -// arrVO.setNum("阴性对照平均OD值"); -// arrVO.setValue(format); -// arrVO.setResult(" "); -// list1.add(arrVO); -// double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); -// double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); -// String format1 = df.format((a2 + b2) / 2); -// ExamineDataArrVO arrVO1 = new ExamineDataArrVO(); -// arrVO1.setNum("阳性对照平均OD值"); -// arrVO1.setValue(format1); -// arrVO1.setResult(" "); -// list1.add(arrVO1); + double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); + double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); + String format = df.format((a1 + b1) / 2); + ExamineDataArrVO arrVO = new ExamineDataArrVO(); + arrVO.setNum("阴性对照平均OD值"); + arrVO.setValue(format); + arrVO.setResult(" "); + list1.add(arrVO); + double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); + double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); + String format1 = df.format((a2 + b2) / 2); + ExamineDataArrVO arrVO1 = new ExamineDataArrVO(); + arrVO1.setNum("阳性对照平均OD值"); + arrVO1.setValue(format1); + arrVO1.setResult(" "); + list1.add(arrVO1); for (int j = 0; j < 96; j++) { ExamineDataArrVO vo = list.get((i * 96) + j); if (vo.getNum() != null && !"".equals(vo.getNum())) { @@ -2950,22 +2353,22 @@ public class EntrustServiceImpl extends BaseServiceImpl } } else { for (int i = 0; i < list.size() / 96 + 1; i++) { -// double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); -// double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); -// String format = df.format((a1 + b1) / 2); -// ExamineDataArrVO arrVO = new ExamineDataArrVO(); -// arrVO.setNum("阴性对照平均OD值"); -// arrVO.setValue(format); -// arrVO.setResult(" "); -// list1.add(arrVO); -// double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); -// double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); -// String format1 = df.format((a2 + b2) / 2); -// ExamineDataArrVO arrVO1 = new ExamineDataArrVO(); -// arrVO1.setNum("阳性对照平均OD值"); -// arrVO1.setValue(format1); -// arrVO1.setResult(" "); -// list1.add(arrVO1); + double a1 = Double.parseDouble(list.get(i * 96).getOriginResult()); + double b1 = Double.parseDouble(list.get((i * 96) + 1).getOriginResult()); + String format = df.format((a1 + b1) / 2); + ExamineDataArrVO arrVO = new ExamineDataArrVO(); + arrVO.setNum("阴性对照平均OD值"); + arrVO.setValue(format); + arrVO.setResult(" "); + list1.add(arrVO); + double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult()); + double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult()); + String format1 = df.format((a2 + b2) / 2); + ExamineDataArrVO arrVO1 = new ExamineDataArrVO(); + arrVO1.setNum("阳性对照平均OD值"); + arrVO1.setValue(format1); + arrVO1.setResult(" "); + list1.add(arrVO1); for (int j = 0; j < 96; j++) { if ((i * 96) + j > list.size() - 1) { break; @@ -3220,59 +2623,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } x++; } -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult()); -// String num = list.get(start + (8 * x + j) - 1).getNum(); -// if (num != null && !"".equals(num) && num.split("-").length == 3) { -// map.put("13", num.split("-")[2]); -// } else { -// map.put("13", " "); -// } -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } -// x++; -// if (list.size() - 1 >= start + (8 * x + j) - 1) { -// map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult()); -// } } resultList2.add(map); } @@ -3364,29 +2714,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } x++; } -// map.put("1", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("2", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("3", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("4", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("5", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("6", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("7", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("8", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("9", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("10", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("11", list.get(start + (8 * x + j) - 1).getOriginResult()); -// x++; -// map.put("12", list.get(start + (8 * x + j) - 1).getOriginResult()); } resultList2.add(map); } @@ -3735,6 +3062,82 @@ public class EntrustServiceImpl extends BaseServiceImpl map2.put("2", "阳性对照OD平均值"); map2.put("3", format1); } + // 小反刍兽疫病毒抗体检测试剂盒---北京纳百生物科技有限公司 + else if ("1682203934330204161".equals(reagentId)) { + map1.put("2", "阴性对照OD平均值"); + map1.put("3", format); + map2.put("2", "阳性对照OD平均值"); + map2.put("3", format1); + } + // 猪繁殖与呼吸障碍综合征病毒间接法抗体检测试剂盒---禾旭(郑州)生物技术有限公司 + else if ("1691712889624555522".equals(reagentId)) { + map1.put("2", "阴性对照OD平均值"); + map1.put("3", format); + map2.put("2", "阳性对照OD平均值"); + map2.put("3", format1); + } + // 猪瘟病毒间接ELISA抗体检测试剂盒---禾旭(郑州)生物技术有限公司 + else if ("1680136574547013633".equals(reagentId)) { + map1.put("2", "阴性对照OD平均值"); + map1.put("3", format); + map2.put("2", "阳性对照OD平均值"); + map2.put("3", format1); + } + // 猪伪狂犬gB阻断ELISA抗体检测试剂盒---北京天之泰生物科技有限公司 + else if ("1692059030258020354".equals(reagentId)) { + map1.put("2", "阴性对照OD平均值"); + map1.put("3", format); + map2.put("2", "阳性对照OD平均值"); + map2.put("3", format1); + } + // 非洲猪瘟病毒阻断ELISA抗体检测试剂盒---北京天之泰生物科技有限公司 + else if ("1691714318883975170".equals(reagentId)) { + map1.put("2", "阴性对照OD值"); + map1.put("3", a1); + map1.put("4", a2); + map2.put("2", "阳性对照OD值平均值/阴性对照OD值平均值*100%"); + map2.put("3", df.format(Double.parseDouble(format1) / Double.parseDouble(format) * 100) + "%"); + } + // 猪繁殖与呼吸障碍综合征病毒间接法抗体检测试剂盒---北京天之泰生物科技有限公司 + else if ("1691710090853576706".equals(reagentId)) { + map1.put("2", "阴性对照OD值"); + map1.put("3", a1); + map1.put("4", a2); + map2.put("2", "阳性对照OD值"); + map2.put("3", b1); + map2.put("4", b2); + } + // 小反刍兽疫病毒阻断ELISA检测试剂盒---北京天之泰生物科技有限公司 + else if ("1682203201220390913".equals(reagentId)) { + map1.put("2", "阴性对照OD值"); + map1.put("3", a1); + map1.put("4", a2); + map2.put("2", "阳性对照OD值"); + map2.put("3", b1); + map2.put("4", b2); + } + // 狂犬病病毒抗体抗体检测试剂盒---唐山怡安生物工程有限公司 + else if ("1691714927305519105".equals(reagentId)) { + map1.put("2", "质控阴性血清OD值"); + map1.put("3", a1); + map1.put("4", a2); + map2.put("2", "质控阳性血清OD值"); + map2.put("3", b1); + map2.put("4", b2); + } + // 猪伪狂犬gB阻断ELISA抗体检测试剂盒---北京纳百生物科技有限公司 + else if ("1692060337681297410".equals(reagentId)) { + map1.put("2", "阴性对照OD值平均值-阳性对照OD值平均值"); + map1.put("3", df.format(Double.parseDouble(format) - Double.parseDouble(format1))); + } + // 小反刍兽疫病毒竞争ELISA抗体检测试剂盒---青岛立见生物科技有限公司 + else if ("1692066046158401537".equals(reagentId)) { + double v3 = (c1 + c2) / 2; + map1.put("2", "阴性对照血清阻断率"); + map1.put("3", df.format(100 - (Double.parseDouble(format) / v3 * 100)) + "%"); + map2.put("2", "阳性对照血清阻断率"); + map2.put("3", df.format(100 - (Double.parseDouble(format1) / v3 * 100)) + "%"); + } map1.put("5", "成立"); map2.put("5", "成立"); resultList3.add(map1); @@ -3771,6 +3174,38 @@ public class EntrustServiceImpl extends BaseServiceImpl return ctValue; } + /** + * pdf转图片 + * + * @param picturePath + * @param path + * @return + */ + private List pdfResule(String picturePath, String path) { + List urls = new ArrayList<>(); + // 将Path对象转换为File对象 + Path path1 = Paths.get(path + picturePath); + File file = path1.toFile(); + try { + // 写入文件 + PDDocument doc = PDDocument.load(file); + PDFRenderer renderer = new PDFRenderer(doc); + int pageCount = doc.getNumberOfPages(); + for (int i = 0; i < pageCount; i++) { + // dpi为144,越高越清晰,转换越慢 +// BufferedImage image = renderer.renderImageWithDPI(i, 96); // Windows native DPI + BufferedImage image = renderer.renderImage(i); + // 将图片写出到该路径下 + String s = UUID.randomUUID().toString() + ".png"; + urls.add(s); + ImageIO.write(image, "png", new File(path + s)); + } + } catch (IOException e) { + e.printStackTrace(); + } + return urls; + } + @Override public void simpleRegisterPrint(String id, HttpServletResponse response) { Map result = new HashMap<>(); @@ -4201,7 +3636,6 @@ public class EntrustServiceImpl extends BaseServiceImpl } - //模板地址 // String handleUrl = "C://Users//AAA//Desktop//烁今//打印模板//留样处理(销毁)申请表(模板).docx"; diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java index 466fc5d..40559d0 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java @@ -2,14 +2,19 @@ package org.springblade.lims.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.nacos.common.utils.CollectionUtils; +import com.alibaba.nacos.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.AllArgsConstructor; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.lims.entry.*; +import org.springblade.lims.excel.*; import org.springblade.lims.mapper.ExamineResultMapper; import org.springblade.lims.service.*; import org.springblade.resource.enums.SysTypeEnum; @@ -21,13 +26,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.text.DecimalFormat; import java.util.*; +import java.util.stream.Collectors; -/** - * @author wanghua - * @since 2021-08-02 - */ @Service @AllArgsConstructor public class ExamineResultServiceImpl extends BaseServiceImpl implements IExamineResultService { @@ -185,8 +189,8 @@ public class ExamineResultServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SimpleDoExamineLog::getExamineId, id); + wrapper.eq(SimpleDoExamineLog::getIsFinished, 0); + List logs = simpleDoExamineLogService.list(wrapper); + + String experieNum = ""; + for (SimpleDoExamineLog log : logs) { + experieNum += log.getExperieNum(); + } + + List list = new ArrayList<>(); + String[] split = experieNum.split(","); + // 布鲁氏杆菌抗体检测(平板凝集) + for (String s : split) { + ExamineTemplateExcel excel = new ExamineTemplateExcel(); + excel.setExperieNum(s); + list.add(excel); + } + + ExamineTemplateExcel excel1 = new ExamineTemplateExcel(); + excel1.setExperieNum("阴性对照"); + list.add(excel1); + ExamineTemplateExcel excel2 = new ExamineTemplateExcel(); + excel2.setExperieNum("阳性对照"); + list.add(excel2); + ExcelUtil.export(response, "结果模板", "结果模板", list, ExamineTemplateExcel.class); + } + // PCR检测 + else if ("4".equals(examineWay.getInputMode())) { + String experieNum = examine.getExperieNum(); + List list = new ArrayList<>(); + String[] split = experieNum.split(","); + for (String s : split) { + PCRExcel pcrExcel = new PCRExcel(); + pcrExcel.setExperieNum(s); + list.add(pcrExcel); + } + PCRExcel pcrExcel = new PCRExcel(); + pcrExcel.setExperieNum("阴性 对照"); + list.add(pcrExcel); + PCRExcel pcrExcel1 = new PCRExcel(); + pcrExcel1.setExperieNum("阳性 对照"); + list.add(pcrExcel1); + ExcelUtil.export(response, "结果模板", "结果模板", list, PCRExcel.class); + } + // 血凝 + else if ("5".equals(examineWay.getInputMode())) { + String experieNum = examine.getExperieNum(); + List list = new ArrayList<>(); + String[] split = experieNum.split(","); + for (String s : split) { + XNExcel pcrExcel = new XNExcel(); + pcrExcel.setExperieNum(s); + list.add(pcrExcel); + } + XNExcel pcrExcel1 = new XNExcel(); + pcrExcel1.setExperieNum("阴性对照"); + list.add(pcrExcel1); + XNExcel pcrExcel2 = new XNExcel(); + pcrExcel2.setExperieNum("阳性对照"); + list.add(pcrExcel2); + ExcelUtil.export(response, "结果模板", "结果模板", list, XNExcel.class); + } + // 生化鉴定 + else if ("8".equals(examineWay.getInputMode())) { + String experieNum = examine.getExperieNum(); + List list = new ArrayList<>(); + String[] split = experieNum.split(","); + for (String s : split) { + BiochemicalIdentificationExcel pcrExcel = new BiochemicalIdentificationExcel(); + pcrExcel.setExperieNum(s); + list.add(pcrExcel); + } + ExcelUtil.export(response, "结果模板", "结果模板", list, BiochemicalIdentificationExcel.class); + } + // 普通检测 + else { + List list = new ArrayList<>(8); + ExamineOutExcel excel = new ExamineOutExcel(); + ExamineOutExcel excel1 = new ExamineOutExcel(); + ExamineOutExcel excel2 = new ExamineOutExcel(); + ExamineOutExcel excel3 = new ExamineOutExcel(); + ExamineOutExcel excel4 = new ExamineOutExcel(); + ExamineOutExcel excel5 = new ExamineOutExcel(); + ExamineOutExcel excel6 = new ExamineOutExcel(); + ExamineOutExcel excel7 = new ExamineOutExcel(); + excel.setCode("A"); + excel1.setCode("B"); + excel2.setCode("C"); + excel3.setCode("D"); + excel4.setCode("E"); + excel5.setCode("F"); + excel6.setCode("G"); + excel7.setCode("H"); + list.add(excel); + list.add(excel1); + list.add(excel2); + list.add(excel3); + list.add(excel4); + list.add(excel5); + list.add(excel6); + list.add(excel7); + ExcelUtil.export(response, "结果模板", "结果模板", list, ExamineOutExcel.class); + } + } + + @Override + public String handleNum(String id, Integer number) { + + Examine examine = examineService.getById(id); + + // 原始检测编号 + String[] nums = examine.getExperieNum().split(","); + + // 合样类型(5合1,,10合1) +// int type = Integer.parseInt(number); + + String res = ""; + if (number > 1) { + // 循环次数 + int count = examine.getSimpleCount() % number == 0 ? examine.getSimpleCount() / number : examine.getSimpleCount() / number + 1; + + for (int i = 0; i < count; i++) { + String start = nums[i * number]; + String end = ""; + if (i * number != nums.length - 1) { + if (i == count - 1) { + String[] split = nums[nums.length - 1].split("-"); + end = "-" + split[split.length - 1]; + } else { + String[] split = nums[(i + 1) * number - 1].split("-"); + end = "-" + split[split.length - 1]; + } + } + res += start + end + ","; + } + } else { + res = examine.getExperieNum(); + } + + return res; + } + @Override @Transactional(rollbackFor = Exception.class) public boolean doExamine(ExamineResult entry) throws Exception { @@ -323,7 +493,7 @@ public class ExamineResultServiceImpl extends BaseServiceImpl path = entry.getPath(); // 所有上传过的照片 - if (examineResult.getPicturePath() != null) { + if (StringUtils.isNotBlank(examineResult.getPicturePath())) { String[] split = examineResult.getPicturePath().split(","); if (CollectionUtils.isNotEmpty(path)) { String picturePath = ""; @@ -342,14 +512,14 @@ public class ExamineResultServiceImpl extends BaseServiceImpl 1) { for (String s : path) { - String s1 = s + ","; - picturePath += s1; + picturePath += s + ","; } } else { picturePath = path.get(0); } entry.setPicturePath(picturePath); } else { + // 删除之前上传所有图片 for (String s : split) { // 获取图片路径 String realPath1 = realPath + s; @@ -464,21 +634,32 @@ public class ExamineResultServiceImpl extends BaseServiceImpl 1) { for (String s : path) { - String s1 = s + ","; - picturePath += s1; + picturePath += s + ","; } } else { picturePath = path.get(0); } entry.setPicturePath(picturePath); + } else { + // 删除之前上传所有图片 + for (String s : split) { + // 获取图片路径 + String realPath1 = realPath + s; + File file = new File(realPath1); + if (file.exists()) { + file.delete(); + } + } + entry.setPicturePath(""); } return this.updateById(entry); } } - // 仪器设备记录表,试剂使用记录表 入库 + // 仪器设备记录表,试剂使用记录表入库 private void saves(ExamineResult examineResult) { Examine examine = examineService.getById(examineResult.getExamineId()); String[] split = examineResult.getInstrumentId().split(","); @@ -538,4 +719,5298 @@ public class ExamineResultServiceImpl extends BaseServiceImpl read = ExcelUtil.read(file, ExamineTemplate2Excel.class); + if (CollectionUtils.isNotEmpty(read)) { + // 布鲁氏杆菌抗体检测(虎红平板凝集) + if ("2".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { + for (int i = 0; i < read.size() - 2; i++) { + ExamineTemplate2Excel excel = read.get(i); + if ("+".equals(excel.getValue())) { + excel.setResult("阳性"); + } else if ("-".equals(excel.getValue())) { + excel.setResult("阴性"); + } else if (excel.getValue() == null || "".equals(excel.getValue())) { + throw new Exception("有样品未填写的对应的结果!"); + } + read.set(i, excel); + } +// for (ExamineTemplate2Excel excel : read) { +// if ("+".equals(excel.getValue())) { +// excel.setResult("阳性"); +// } else if ("-".equals(excel.getValue())) { +// excel.setResult("阴性"); +// } else if (excel.getValue() == null || "".equals(excel.getValue())) { +// throw new Exception("有样品未填写的对应的结果!"); +// } +// } + } + // 布鲁氏杆菌抗体检测(试管凝集微量法) + else if ("6".equals(examineWay.getInputMode())) { + for (int i = 0; i < read.size() - 2; i++) { + ExamineTemplate2Excel excel = read.get(i); + if ("++++".equals(excel.getValue()) || "+++".equals(excel.getValue()) || "++".equals(excel.getValue())) { + excel.setResult("阳性"); + } else if ("+".equals(excel.getValue())) { + excel.setResult("可疑"); + } else if ("-".equals(excel.getValue())) { + excel.setResult("阴性"); + } else if (excel.getValue() == null || "".equals(excel.getValue())) { + throw new Exception("有样品未填写的对应的结果!"); + } + read.set(i, excel); + } +// for (ExamineTemplate2Excel excel : read) { +// if ("++++".equals(excel.getValue()) || "+++".equals(excel.getValue()) || "++".equals(excel.getValue())) { +// excel.setResult("阳性"); +// } else if ("+".equals(excel.getValue())) { +// excel.setResult("可疑"); +// } else if ("-".equals(excel.getValue())) { +// excel.setResult("阴性"); +// } else if (excel.getValue() == null || "".equals(excel.getValue())) { +// throw new Exception("有样品未填写的对应的结果!"); +// } +// } + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examineId); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(read)); + result.setOriginRecordResult(JSON.toJSONString(read)); + result.setExamineDataArr(JSON.toJSONString(read)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examineId)); + examineResult.setOriginRecordData(JSON.toJSONString(read)); + examineResult.setOriginRecordResult(JSON.toJSONString(read)); + examineResult.setExamineDataArr(JSON.toJSONString(read)); + this.save(examineResult); + } + } + return R.data(read); + } + + /** + * 口蹄疫Excel解析数据 + */ + private R ktyExcel(MultipartFile file, String examineId) throws Exception { + List originRowDatas = ExcelUtil.read(file, ExamineExcel.class); + String[] split = examineId.split(","); + Examine examine = examineService.getById(split[0]); + examine.setTemplateType(split[1]); + examineService.updateById(examine); + // 兰所单板---------------------------------------------------------------------------------------------------- + if ("1".equals(split[1])) { + String simpleName1 = examine.getSimpleName().split("-")[0]; + + String[] experieNum = examine.getExperieNum().split(","); + // 获取4个抗原对照值 + List list = new ArrayList<>(); + 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"); + // 对照平均值 + Double avg = Double.valueOf(df.format((list1.get(1) + list1.get(2)) / 4)); + + // 结果resultList + List> resultList = new ArrayList<>(); + for (int r = 0; r < 8; r++) { + if (r > 0) { + // 第1列 + resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), originRowDatas.get(r - 1).getCode1(), avg, simpleName1, experieNum)); + // 第2列 + resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), originRowDatas.get(r - 1).getCode2(), avg, simpleName1, experieNum)); + // 第3列 + resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), originRowDatas.get(r - 1).getCode3(), avg, simpleName1, experieNum)); + // 第4列 + resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), originRowDatas.get(r - 1).getCode4(), avg, simpleName1, experieNum)); + // 第5列 + resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), originRowDatas.get(r - 1).getCode5(), avg, simpleName1, experieNum)); + // 第6列 + resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), originRowDatas.get(r - 1).getCode6(), avg, simpleName1, experieNum)); + // 第7列 + resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), originRowDatas.get(r - 1).getCode7(), avg, simpleName1, experieNum)); + // 第8列 + resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), originRowDatas.get(r - 1).getCode8(), avg, simpleName1, experieNum)); + // 第9列 + resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), originRowDatas.get(r - 1).getCode9(), avg, simpleName1, experieNum)); + // 第10列 + resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), originRowDatas.get(r - 1).getCode10(), avg, simpleName1, experieNum)); + // 第11列 + resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), originRowDatas.get(r - 1).getCode11(), avg, simpleName1, experieNum)); + // 第12列 + resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), originRowDatas.get(r - 1).getCode12(), avg, simpleName1, experieNum)); + } else { + // 第1列 + resultList.add(assumb(r, 1, originRowDatas.get(r).getCode1(), null, avg, simpleName1, experieNum)); + // 第2列 + resultList.add(assumb(r, 2, originRowDatas.get(r).getCode2(), null, avg, simpleName1, experieNum)); + // 第3列 + resultList.add(assumb(r, 3, originRowDatas.get(r).getCode3(), null, avg, simpleName1, experieNum)); + // 第4列 + resultList.add(assumb(r, 4, originRowDatas.get(r).getCode4(), null, avg, simpleName1, experieNum)); + // 第5列 + resultList.add(assumb(r, 5, originRowDatas.get(r).getCode5(), null, avg, simpleName1, experieNum)); + // 第6列 + resultList.add(assumb(r, 6, originRowDatas.get(r).getCode6(), null, avg, simpleName1, experieNum)); + // 第7列 + resultList.add(assumb(r, 7, originRowDatas.get(r).getCode7(), null, avg, simpleName1, experieNum)); + // 第8列 + resultList.add(assumb(r, 8, originRowDatas.get(r).getCode8(), null, avg, simpleName1, experieNum)); + // 第9列 + resultList.add(assumb(r, 9, originRowDatas.get(r).getCode9(), null, avg, simpleName1, experieNum)); + // 第10列 + resultList.add(assumb(r, 10, originRowDatas.get(r).getCode10(), null, avg, simpleName1, experieNum)); + // 第11列 + resultList.add(assumb(r, 11, originRowDatas.get(r).getCode11(), null, avg, simpleName1, experieNum)); + // 第12列 + resultList.add(assumb(r, 12, originRowDatas.get(r).getCode12(), null, avg, simpleName1, experieNum)); + } + } + + List> mapList = new ArrayList<>(); + for (Map map : resultList) { + if (!"".equals(map.get("log2")) && !"".equals(map.get("result"))) { + mapList.add(map); + } + } + + // mapList根据order排序 + Collections.sort(mapList, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + + // 判断应实验样品数量和实际样品数量是否相等 + if (experieNum.length != mapList.size()) { + throw new Exception("分配样品数量与检测样品数量不一致!"); + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examine.getId()); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(mapList)); + result.setOriginRecordResult(JSON.toJSONString(mapList)); + result.setExamineDataArr(JSON.toJSONString(resultList)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examine.getId())); + examineResult.setOriginRecordData(JSON.toJSONString(mapList)); + examineResult.setOriginRecordResult(JSON.toJSONString(mapList)); + examineResult.setExamineDataArr(JSON.toJSONString(resultList)); + this.save(examineResult); + } + return R.data(mapList); + } + // 兰所多板---------------------------------------------------------------------------------------------------- + else if ("2".equals(split[1])) { + int yinCount = 0; + int yangCount = 0; + Map>>> resultMap = new HashMap<>(); + // 以组为维度的所有数据:<1:行...>、<2:行...> + Map> groupsMap = new HashMap<>(); + // 组数 + int groupCount = (originRowDatas.size() + 1) / 9; + + // 取实际的数据(排除数字标题) + groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); + // 检测编号s + String[] experieNum = examine.getExperieNum().split(","); + // 用于存放每个格子的值,有顺序,无规则 + List> allDatas = new ArrayList<>(); + List> allData = new ArrayList<>(); + int simpleCount = 0; + // 按照公式计算实验数据并返回;两板对照:取偶数组去循环做参照,+1组做对照 + // 参照组:2n 、对照组:2n + 1 + 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)); + // 计算该组的[对照平均值] + Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); + for (int row = 0; row < rowInGroup1.size(); row++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (row + 65)); + // 每一个位置的值: A1、B2... + Map> allPosDatasInAGroup = new HashMap<>(); + int u = 1; + // 计算每一列 + for (int i = 1; i <= 12; i++) { + Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 1, 1); + allData.add(cPosData); + allPosDatasInAGroup.put(a + i, cPosData); + if (i != 1) { + u++; + } + } + allDataInCurrGroup1.add(allPosDatasInAGroup); + } + resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); + + // 2.对照组 + // 存这一组的所有数据 + List>> allDataInCurrGroup2 = new ArrayList<>(); + // i = 0时,是取1组的那8行 + List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); + // 计算该组的[对照平均值] + Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); + for (int row = 0; row < rowInGroup2.size(); row++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (row + 65)); + // 每一个位置的值: A1、B2... + Map> allPosDatasInAGroup = new HashMap<>(); + int u = 1; + // 计算每一列 + for (int i = 1; i <= 12; i++) { + Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 1, 2); + allData.add(cPosData); + allPosDatasInAGroup.put(a + i, cPosData); + if (i != 1) { + u++; + } + } + allDataInCurrGroup2.add(allPosDatasInAGroup); + } + resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); + + // 3.两相比较取结果 + for (int i = 0; i < allDataInCurrGroup1.size(); i++) { + Map> layer1 = allDataInCurrGroup1.get(i); + Map> layer2 = allDataInCurrGroup2.get(i); + Set set1 = layer1.keySet(); + for (String key : set1) { + Map data1 = layer1.get(key); + Map data2 = layer2.get(key); + Map data = new HashMap<>(); + data.put("result", data1.get("result")); + data.put("log2", data1.get("log2")); + data.put("value", data1.get("value")); + data.put("order", data1.get("order")); + data.put("num", data1.get("num")); + + boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); + if (data.get("result") == null || data2.get("result") == null) { + allDatas.add(data); + continue; + } + if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { + data.put("log2", isPig ? "≥1:64" : "≥1:128"); + data.put("result", "阳性"); + allDatas.add(data); + yangCount++; + simpleCount++; + } else { + data.put("log2", isPig ? "<1:64" : "<1:128"); + data.put("result", "阴性"); + allDatas.add(data); + yinCount++; + simpleCount++; + } + } + } + } + + // 排序 + Collections.sort(allData, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + + Collections.sort(allDatas, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + + // 检测编号计数器 + int numIndex = 0; + int numIndex2 = 0; + int numIndex3 = 0; + // 循环 + for (int i = 0; i < groupCount / 2; i++) { + // 参照组 + for (int j = 0; j < 96; j++) { + Map map = allData.get((i * 192) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex]; + map.put("num", num); + numIndex++; + } + } + // 对照组 + for (int j = 96; j < 192; j++) { + Map map = allData.get((i * 192) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex2]; + map.put("num", num); + numIndex2++; + } + } + // 最终结果组 + for (int j = 0; j < 96; j++) { + Map map = allDatas.get((i * 96) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex3]; + map.put("num", num); + numIndex3++; + } + } + } + + // 判断应实验样品数量和实际样品数量是否相等 + if (experieNum.length != simpleCount) { + throw new Exception("分配样品数量与检测样品数量不一致!"); + } + + Map realResultMap = new HashMap<>(); + realResultMap.put("data", resultMap); + realResultMap.put("yinCount", yinCount); + realResultMap.put("yangCount", yangCount); + + // 新增或修改Result数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examine.getId()); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(allData)); +// result.setOriginRecordResult(JSON.toJSONString(resultMap)); + result.setOriginRecordResult(JSON.toJSONString(realResultMap)); + result.setExamineDataArr(JSON.toJSONString(allDatas)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examine.getId())); + examineResult.setOriginRecordData(JSON.toJSONString(allData)); +// result.setOriginRecordResult(JSON.toJSONString(resultMap)); + examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); + examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); + this.save(examineResult); + } + return R.data(realResultMap); + } + // 非兰所,11列也是样品 --------------------------------------------------------------------------------------- + else { + int yinCount = 0; + int yangCount = 0; + Map>>> resultMap = new HashMap<>(); + // 以组为维度的所有数据:<1:行...>、<2:行...> + Map> groupsMap = new HashMap<>(); + // 组数 + int groupCount = (originRowDatas.size() + 1) / 9; + + // 取实际的数据(排除数字标题) + groupsMap = excludeNumTitle(groupCount, originRowDatas, groupsMap); + + // 检测编号s + String[] experieNum = examine.getExperieNum().split(","); + // 用于存放每个格子的值,有顺序,无规则 + List> allDatas = new ArrayList<>(); + List> allData = new ArrayList<>(); + int simpleCount = 0; + // 按照公式计算实验数据并返回 + // 参照组:2n 、对照组:2n + 1 + 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)); + // 计算该组的[对照平均值] + Double avg1 = calcCurrGroupContrastAvg(rowInGroup1); + for (int row = 0; row < rowInGroup1.size(); row++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (row + 65)); + // 每一个位置的值: A1、B2... + Map> allPosDatasInAGroup = new HashMap<>(); + int u = 1; + // 计算每一列 + for (int i = 1; i <= 12; i++) { + Map cPosData = calcAndPutcPosData(rowInGroup1, avg1, experieNum, group, row, i, u, 2, 1); + allData.add(cPosData); + allPosDatasInAGroup.put(a + i, cPosData); + if (i != 1) { + u++; + } + } + allDataInCurrGroup1.add(allPosDatasInAGroup); + } + resultMap.put("g" + (2 * group + 1), allDataInCurrGroup1); + + // 1.对照组 + // 存这一组的所有数据 + List>> allDataInCurrGroup2 = new ArrayList<>(); + // i = 0时,是取1组的那8行 + List rowInGroup2 = groupsMap.get(String.valueOf((2 * group + 1) + 1)); + // 计算该组的[对照平均值] + Double avg2 = calcCurrGroupContrastAvg(rowInGroup2); + for (int row = 0; row < rowInGroup2.size(); row++) { + // 行标头:前端渲染需要A、B、C.... + String a = String.valueOf((char) (row + 65)); + // 每一个位置的值: A1、B2... + Map> allPosDatasInAGroup = new HashMap<>(); + int u = 1; + // 计算每一列 + for (int i = 1; i <= 12; i++) { + Map cPosData = calcAndPutcPosData(rowInGroup2, avg2, experieNum, group, row, i, u, 2, 2); + allData.add(cPosData); + allPosDatasInAGroup.put(a + i, cPosData); + if (i != 1) { + u++; + } + } + allDataInCurrGroup2.add(allPosDatasInAGroup); + } + resultMap.put("g" + ((2 * group + 1) + 1), allDataInCurrGroup2); + + // 3.两相比较取结果 + for (int i = 0; i < allDataInCurrGroup1.size(); i++) { + Map> layer1 = allDataInCurrGroup1.get(i); + Map> layer2 = allDataInCurrGroup2.get(i); + Set set1 = layer1.keySet(); + Set set2 = layer2.keySet(); + for (String key : set1) { + Map data1 = layer1.get(key); + Map data2 = layer2.get(key); + Map data = new HashMap<>(); + data.put("result", data1.get("result")); + data.put("log2", data1.get("log2")); + data.put("value", data1.get("value")); + data.put("order", data1.get("order")); + data.put("num", data1.get("num")); + + boolean isPig = "猪".equals(examine.getSimpleName().split("-")[0]); + if (data.get("result") == null || data2.get("result") == null) { + allDatas.add(data); + continue; + } + if (data.get("result").equals("阳性") || data2.get("result").equals("阳性")) { + data.put("log2", isPig ? "≥1:64" : "≥1:128"); + data.put("result", "阳性"); + allDatas.add(data); + yangCount++; + simpleCount++; + } else { + data.put("log2", isPig ? "<1:64" : "<1:128"); + data.put("result", "阴性"); + allDatas.add(data); + yinCount++; + simpleCount++; + } + } + } + } + + // 排序 + Collections.sort(allData, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + Collections.sort(allDatas, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + + // 检测编号计数器 + int numIndex = 0; + int numIndex2 = 0; + int numIndex3 = 0; + // 循环 + for (int i = 0; i < groupCount / 2; i++) { + // 参照组 + for (int j = 0; j < 96; j++) { + Map map = allData.get((i * 192) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex]; + map.put("num", num); + numIndex++; + } + } + // 对照组 + for (int j = 96; j < 192; j++) { + Map map = allData.get((i * 192) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex2]; + map.put("num", num); + numIndex2++; + } + } + // 最终结果组 + for (int j = 0; j < 96; j++) { + Map map = allDatas.get((i * 96) + j); + String num = (String) map.get("num"); + if (num != null && !"".equals(num)) { + num = experieNum[numIndex3]; + map.put("num", num); + numIndex3++; + } + } + } + + Map realResultMap = new HashMap<>(); + realResultMap.put("data", resultMap); + realResultMap.put("yinCount", yinCount); + realResultMap.put("yangCount", yangCount); + + // 判断应实验样品数量和实际样品数量是否相等 + if (experieNum.length != simpleCount) { + throw new Exception("分配样品数量与检测样品数量不一致!"); + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examine.getId()); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(allData)); + result.setOriginRecordResult(JSON.toJSONString(realResultMap)); + result.setExamineDataArr(JSON.toJSONString(allDatas)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examine.getId())); + examineResult.setOriginRecordData(JSON.toJSONString(allData)); + examineResult.setOriginRecordResult(JSON.toJSONString(realResultMap)); + examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); + this.save(examineResult); + } + return R.data(realResultMap); + } + } + + private R shjdExcel(MultipartFile file, String examineId) throws Exception { + List read = ExcelUtil.read(file, BiochemicalIdentificationExcel.class); + if (read != null && read.size() > 0) { + for (BiochemicalIdentificationExcel excel : read) { + if ("+".equals(excel.getValue())) { + excel.setResult("阳性"); + } else if ("-".equals(excel.getValue())) { + excel.setResult("阴性"); + } else if (excel.getValue() == null || "".equals(excel.getValue())) { + throw new Exception("有样品未填写的对应的结果!"); + } + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examineId); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(read)); + result.setOriginRecordResult(JSON.toJSONString(read)); + result.setExamineDataArr(JSON.toJSONString(read)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examineId)); + examineResult.setOriginRecordData(JSON.toJSONString(read)); + examineResult.setOriginRecordResult(JSON.toJSONString(read)); + examineResult.setExamineDataArr(JSON.toJSONString(read)); + this.save(examineResult); + } + } + return R.data(read); + } + + /** + * 血凝检测解析数据 + */ + private R xnExcel(MultipartFile file, String examineId) throws Exception { + List read = ExcelUtil.read(file, XN2Excel.class); + if (read != null && read.size() > 0) { + List list = Arrays.asList("<1", "<1", "1", "2", "3"); + List list2 = Arrays.asList("4", "5", "6", "≥6", "7", "8", "9", "≥10", ">=6", ">=10"); + for (int i = 0; i < read.size() - 2; i++) { + XN2Excel excel = read.get(i); + if (list.contains(excel.getCtValue())) { + excel.setResult("阴性"); + } else if (list2.contains(excel.getCtValue())) { + excel.setResult("阳性"); + } else { + throw new Exception("请输入正确格式的滴度Log2值,并重新上传!"); + } + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examineId); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(read)); + result.setOriginRecordResult(JSON.toJSONString(read)); + result.setExamineDataArr(JSON.toJSONString(read)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examineId)); + examineResult.setOriginRecordData(JSON.toJSONString(read)); + examineResult.setOriginRecordResult(JSON.toJSONString(read)); + examineResult.setExamineDataArr(JSON.toJSONString(read)); + this.save(examineResult); + } + } + return R.data(read); + } + + /** + * 常规Excel解析数据 + */ + 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<>(); + // 组数 + int group = 0; + // 除9是否有余数 + int size = (read.size() + 1) % 9; + if (size == 0) { + group = (read.size() + 1) / 9; + } else { + group = (read.size() + 1) / 9 + 1; + } + + for (int i = 0; i < group; i++) { + List excels = new ArrayList<>(); + for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { + ExamineExcel excel = read.get(j); + excels.add(excel); + } + map.put((i + 1) + "", excels); + } + + Examine examine = examineService.getById(examineId); + String experieNum = examine.getExperieNum(); + String[] split = experieNum.split(","); + + List> list = new ArrayList<>(); + // 按照公式计算实验数据并返回 + Map>>> map1 = new HashMap<>(); + + // 不同试剂计算公式不同 + DecimalFormat df = new DecimalFormat("#0.000"); + // 猪繁殖与呼吸综合征病毒抗体ELISA检测试剂盒---山东百邦世纪科技有限公司 + if ("1580030700969861121".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()); + + // 成立条件校验 + if (code1 > 0.2 || code2 > 0.2 || code3 < 0.8 || code4 < 0.8) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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)); + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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 { + 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); + } + } + // 伪狂犬病毒gE蛋白lgG抗体ELISA检测试剂盒---山东百邦世纪科技有限公司 + else if ("1580733683995009026".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()); + // 成立条件校验 + if (code1 > 0.6 || code2 > 0.6 || code3 < 0.8 || code4 < 0.8) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + if (code1 < 0.05) { + code1 = 0.05; + } + if (code2 < 0.05) { + code2 = 0.05; + } + double v = (code1 + code2) / 2 + 0.18; + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 非洲猪瘟病毒ELISA抗体检测试剂盒(哈尔滨维科生物技术有限公司) + else if ("1580730163250188290".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; + + // 成立条件校验 + if (v1 >= 0.2 || v2 < 1.0) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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 ("1589877000410296322".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()); + // 成立条件校验 + if (code1 >= 0.1 || code2 >= 0.1 || code3 < 0.2 || code4 < 0.2) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + double v1 = (code1 + code2) / 2; + double v2 = (code3 + code4) / 2; + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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 { + 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 ("1570666183341043714".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 code3 = Double.parseDouble(excels.get(0).getCode1()); + double code4 = Double.parseDouble(excels.get(1).getCode1()); + double code5 = Double.parseDouble(excels.get(2).getCode1()); + double code6 = Double.parseDouble(excels.get(3).getCode1()); + // 成立条件校验 + double v1 = (code1 + code2) / 2; + double yin = (code3 + code4) / 2; + double yang = (code5 + code6) / 2; + if (100 - (yin * 100 / v1) >= 40 || 100 - (yang * 100 / v1) <= 60) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + String PB = df.format(100 - Double.parseDouble(code) / v1 * 100); + mapResult.put("originResult", code); + mapResult.put("value", PB); + mapResult.put("num", "1"); + if (Double.parseDouble(PB) > 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); + } + } + // 非洲猪瘟病毒cELISA抗体检测试剂盒---百沃特(天津)生物技术有限公司 + else if ("1580815808211578882".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; + + // 成立条件校验 + if (v1 < 0.8 || (v1 - code3) / v1 < 0.5 || (v1 - code4) / v1 < 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 PI = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + PI = df.format((v1 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", PI); + mapResult.put("num", "1"); + if (Double.parseDouble(PI) >= 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); + } + } + // 非洲猪瘟病毒cELISA抗体检测试剂盒---北京金诺百泰生物技术有限公司 + else if ("1570667398619656194".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; + // 成立条件校验 + if (v1 <= 0.7 || code3 / v1 >= 0.3 || code4 / v1 >= 0.3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format((Double.parseDouble(code) - v2) / (v1 - v2)); + } + mapResult.put("originResult", code); + mapResult.put("value", SN); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) >= 0.5) { + mapResult.put("result", "阴性"); + } else if (Double.parseDouble(SN) <= 0.4) { + 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 ("1570667729797705730".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; + // 成立条件校验 + if (v1 >= 0.2 || v2 <= 0.8) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.4) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SP) <= 0.3) { + 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); + } + } + // 猪繁殖与呼吸综合征病毒抗体检测试剂盒(爱德士IDEXX) + else if ("1659464963116519426".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; + + // 成立条件校验 + if (v2 - v1 < 0.15 || v1 > 0.15) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.4) { + 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 ("1582988982068027393".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 v2 = (code3 + code4) / 2; + // 成立条件校验 + if (code1 > 0.2 || code2 > 0.2 || code3 < 0.5 || code4 < 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + SP = df.format((Double.parseDouble(code) / v2)); + } + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.4) { + 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 ("1570283733628678145".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; + // 成立条件校验 + if (v1 <= 0.5 || 1 - (code3 / v1) <= 0.5 || 1 - (code4 / v1) <= 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SP = df.format(1 - (Double.parseDouble(code) / v1)); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.4) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SP) <= 0.3) { + 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); + } + } + // 猪伪狂犬病病毒gE蛋白ELISA抗体检测试剂盒(武汉科前生物股份有限公司) + else if ("1570296117147660290".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; + // 成立条件校验 + if (code3 > 0.4 || code4 > 0.4 || Math.abs(v1 - v2) < 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) <= 0.35) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SN) > 0.4) { + 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 ("1570671477110534145".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()); + // 成立条件校验 + if (code1 >= 0.3 || code2 >= 0.3 || code3 < 1 || code4 < 1) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + double v1 = (code1 + code2) / 2; + double v2 = (code3 + code4) / 2; + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.45) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SP) < 0.35) { + 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 ("1570295395605737473".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; + // 成立条件校验 + if (v2 - v1 < 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 KQ = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + KQ = df.format((Double.parseDouble(code) - v1) / (v2 - v1) * 100); + } + mapResult.put("originResult", code); + mapResult.put("value", KQ); + mapResult.put("num", "1"); + if (Double.parseDouble(KQ) >= 40) { + 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 ("1570295846749270017".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; + // 成立条件校验 + if (Math.abs(v1 - v2) < 0.4) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) <= 0.6) { + mapResult.put("result", "阳性"); + } else if (Double.parseDouble(SN) > 0.7) { + 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 ("1570297916894146562".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; + // 成立条件校验 + if (v2 < 0.8 || v1 >= 0.1 || v1 / v2 >= 0.1) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + SP = df.format(Double.parseDouble(code) / v2); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(SP) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) >= 0.2) { + 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 ("1570664922961080322".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; + // 成立条件校验 + if (v1 - v2 < 0.5 || v2 > 0.3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) < 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); + } + } + // 牛布鲁氏菌竞争ELISA抗体检测试剂盒(羊)---洛阳莱普生信息科技有限公司 + else if ("1570666622551781378".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; + // 成立条件校验 + if (v1 - v2 < 0.5 || v2 > 0.3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) < 0.3) { + 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); + } + } + // 口蹄疫病毒非结构蛋白3ABC阻断ELISA抗体检测试剂盒---兰州兽研生物科技有限公司 + else if ("1533624738296389636".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 code5 = Double.parseDouble(excels.get(4).getCode1()); + double code6 = Double.parseDouble(excels.get(5).getCode1()); + double v1 = (code1 + code2) / 2; + // 成立条件校验 + if (v1 <= 1 || 1 - (code3 / v1) <= 0.5 || 1 - (code4 / v1) <= 0.5 || 1 - (code5 / v1) <= 0.7 || 1 - (code6 / v1) <= 0.7) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 PI = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + PI = df.format((v1 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(PI) >= 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); + } + } + // 布鲁氏菌CELISA抗体检测试剂盒---青岛立见生物科技有限公司 + else if ("1665968083879366657".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; + // 成立条件校验 + if (code1 <= 0.5 || code2 <= 0.5 || (v1 - v2) / v1 <= 0.6) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 PI = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + PI = df.format((v1 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(PI) > 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); + } + } + // 布鲁氏菌CELISA抗体检测试剂盒---科前生物 + else if ("1665964229817307138".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; + // 成立条件校验 + if (code1 < 0.8 || code2 < 0.8 || (v1 - code3) / v1 < 0.6 || (v1 - code4) / v1 < 0.6) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 PI = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + PI = df.format((v1 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", df.format(Double.parseDouble(PI) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(PI) >= 0.3) { + 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 ("1631222146321997826".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double yin1 = Double.parseDouble(excels.get(0).getCode1()); + double yin2 = Double.parseDouble(excels.get(0).getCode2()); + double yang1 = Double.parseDouble(excels.get(1).getCode1()); + double yang2 = Double.parseDouble(excels.get(1).getCode2()); + double pjz1 = (yin1 + yin2) / 2; + double pjz2 = (yang1 + yang2) / 2; + // 成立条件校验 + if (pjz1 >= 0.3 || pjz2 < 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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<>(); + + // 一行有四组数据,一组数据对应一个样品,一个样品做三次实验,有三个结果(牛型PPD,禽型PPD,PBS抗原) + for (int n = 1; n <= filedsLength; n++) { + int num; + String code; + String code1; + String code2; + String code3; + switch (n) { + case 1: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode1(); + num = 0; + break; + case 2: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode2(); + num = 0; + break; + case 3: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode3(); + num = 0; + break; + case 4: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode4(); + num = 1; + break; + case 5: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode5(); + num = 1; + break; + case 6: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode6(); + num = 1; + break; + case 7: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode7(); + num = 2; + break; + case 8: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode8(); + num = 2; + break; + case 9: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode9(); + num = 2; + break; + case 10: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode10(); + num = 3; + break; + case 11: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode11(); + num = 3; + break; + case 12: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode12(); + num = 3; + break; + default: + code1 = "0"; + code2 = "0"; + code3 = "0"; + code = "0"; + num = 0; + } + + Map mapResult = new HashMap<>(); + Map mapResult1 = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + double v1 = 0; + double v2 = 0; + if (org.apache.commons.lang3.StringUtils.isNotBlank(code1) && org.apache.commons.lang3.StringUtils.isNotBlank(code2) && org.apache.commons.lang3.StringUtils.isNotBlank(code3)) { + if (j > 1 || n > 3) { + v1 = Double.parseDouble(code1) - Double.parseDouble(code3); + v2 = Double.parseDouble(code1) - Double.parseDouble(code2); + mapResult.put("originResult", code); + mapResult1.put("originResult", code); + mapResult.put("value", code); + mapResult1.put("value", df.format(v1) + "," + df.format(v2)); + int indexNum = (i * 32) + (num * 8 + j) - ((i + 1) * 2); + mapResult.put("num", split[indexNum]); + mapResult1.put("num", split[indexNum]); + if (v1 >= 0.2 && v2 >= 0.2) { + mapResult.put("result", "阳性"); + mapResult1.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + mapResult1.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult1.put("originResult", code); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } + } else { + mapResult.put("originResult", ""); + mapResult1.put("originResult", ""); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } + mapResult.put("order", index + i * 96); + mapResult1.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult1); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 牛结核病γ-干扰素ELISA检测试剂盒---武汉科前生物股份有限公司 + else if ("1570297053211455490".equals(reagentId)) { + for (int i = 0; i < group; i++) { + List>> mapList = new ArrayList<>(); + List excels = map.get(i + 1 + ""); + double yin1 = Double.parseDouble(excels.get(6).getCode10()); + double yin2 = Double.parseDouble(excels.get(6).getCode11()); + double yang1 = Double.parseDouble(excels.get(7).getCode10()); + double yang2 = Double.parseDouble(excels.get(7).getCode11()); + double pjz1 = (yin1 + yin2) / 2; + double pjz2 = (yang1 + yang2) / 2; + // 成立条件校验 + if (pjz1 >= 0.1 || pjz2 < 1) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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<>(); + + // 一行有四组数据,一组数据对应一个样品,一个样品做三次实验,有三个结果(牛型PPD,禽型PPD,PBS抗原) + for (int n = 1; n <= filedsLength; n++) { + int num; + String code; + String code1; + String code2; + String code3; + switch (n) { + case 1: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode1(); + num = 0; + break; + case 2: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode2(); + num = 0; + break; + case 3: + code1 = examineExcel.getCode1(); + code2 = examineExcel.getCode2(); + code3 = examineExcel.getCode3(); + code = examineExcel.getCode3(); + num = 0; + break; + case 4: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode4(); + num = 1; + break; + case 5: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode5(); + num = 1; + break; + case 6: + code1 = examineExcel.getCode4(); + code2 = examineExcel.getCode5(); + code3 = examineExcel.getCode6(); + code = examineExcel.getCode6(); + num = 1; + break; + case 7: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode7(); + num = 2; + break; + case 8: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode8(); + num = 2; + break; + case 9: + code1 = examineExcel.getCode7(); + code2 = examineExcel.getCode8(); + code3 = examineExcel.getCode9(); + code = examineExcel.getCode9(); + num = 2; + break; + case 10: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode10(); + num = 3; + break; + case 11: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode11(); + num = 3; + break; + case 12: + code1 = examineExcel.getCode10(); + code2 = examineExcel.getCode11(); + code3 = examineExcel.getCode12(); + code = examineExcel.getCode12(); + num = 3; + break; + default: + code1 = "0"; + code2 = "0"; + code3 = "0"; + code = "0"; + num = 0; + } + + Map mapResult = new HashMap<>(); + Map mapResult1 = new HashMap<>(); + int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义 + double v1 = 0; + double v2 = 0; + if (org.apache.commons.lang3.StringUtils.isNotBlank(code1) && org.apache.commons.lang3.StringUtils.isNotBlank(code2) && org.apache.commons.lang3.StringUtils.isNotBlank(code3)) { + if (j < 6 || n < 10) { + v1 = Double.parseDouble(code1) - Double.parseDouble(code3); + v2 = Double.parseDouble(code1) - Double.parseDouble(code2); + mapResult.put("originResult", code); + mapResult1.put("originResult", code); + mapResult.put("value", code); + mapResult1.put("value", df.format(v1) + "," + df.format(v2)); + int indexNum = (i * 30) + (num * 8 + j); + mapResult.put("num", split[indexNum]); + mapResult1.put("num", split[indexNum]); + if (v1 >= 0.2 && v2 >= 0.2) { + mapResult.put("result", "阳性"); + mapResult1.put("result", "阳性"); + } else { + mapResult.put("result", "阴性"); + mapResult1.put("result", "阴性"); + } + } else { + mapResult.put("originResult", code); + mapResult1.put("originResult", code); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } + } else { + if (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + mapResult.put("originResult", code); + mapResult1.put("originResult", code); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } else { + mapResult.put("originResult", ""); + mapResult1.put("originResult", ""); + mapResult.put("num", ""); + mapResult1.put("num", ""); + } + } + mapResult.put("order", index + i * 96); + mapResult1.put("order", index + i * 96); + map2.put(a + n, mapResult); + list.add(mapResult1); + } + mapList.add(map2); + } + map1.put("g" + (i + 1), mapList); + } + } + // 羊小反刍兽疫病毒ELISA抗体检测试剂盒---真瑞生物 + else if ("1656852607882579970".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; + // 成立条件校验 + if (code1 <= 0.6 || code2 <= 0.6 || v2 / v1 >= 0.3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", Double.parseDouble(SN)); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) > 0.7) { + 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抗体检测试剂盒---百沃特(ID.VET) + else if ("1677607364850900993".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; + // 成立条件校验 + if (v2 <= 0.25 || v2 / v1 <= 3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.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); + } + } + // 禽滑液囊支原体ELISA抗体检测试剂盒---百沃特(ID.VET) + else if ("1677607364859289601".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; + // 成立条件校验 + if (v2 <= 0.25 || v2 / v1 <= 3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.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); + } + } + // 小反刍兽疫病毒抗体检测试剂盒---北京纳百生物科技有限公司 + else if ("1682203934330204161".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; + // 成立条件校验 + if (code1 >= 0.3 || code2 >= 0.3 || code3 < 1 || code4 < 1) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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 { + 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 ("1691712889624555522".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; + // 成立条件校验 + if (v1 >= 0.3 || v2 < 0.7) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + SP = df.format(Double.parseDouble(code) / v2); + } + mapResult.put("originResult", code); + mapResult.put("value", SP); + mapResult.put("num", "1"); + if (Double.parseDouble(SP) < 0.3) { + 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 ("1680136574547013633".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; + // 成立条件校验 + if (v1 >= 0.3 || v2 <= 0.6) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v2 != 0) { + SP = df.format(Double.parseDouble(code) / v2); + } + 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); + } + } + // 猪伪狂犬gB阻断ELISA抗体检测试剂盒---北京天之泰生物科技有限公司 + else if ("1692059030258020354".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; + // 成立条件校验 + if (v2 > 0.5 || v1 <= 0.7) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", SN); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) > 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); + } + } + // 非洲猪瘟病毒阻断ELISA抗体检测试剂盒---北京天之泰生物科技有限公司 + else if ("1691714318883975170".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; + // 成立条件校验 + if (code1 <= 0.5 || code2 <= 0.5 || v2 / v1 > 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 Inh = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v1 != 0) { + Inh = df.format((v1 - Double.parseDouble(code)) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", (Double.parseDouble(Inh) * 100) + "%"); + mapResult.put("num", "1"); + if (Double.parseDouble(Inh) < 0.4) { + 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 ("1691710090853576706".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; + // 成立条件校验 + if (code1 > 0.15 || code2 > 0.15 || code3 < 0.6 || code4 < 0.6) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(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.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); + } + } + // 小反刍兽疫病毒阻断ELISA检测试剂盒---北京天之泰生物科技有限公司 + else if ("1682203201220390913".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; + // 成立条件校验 + if (code1 <= 0.7 || code2 <= 0.7 || code3 > 0.5 || code4 > 0.5) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if ((v2 - v1) != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", SN); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) > 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); + } + } + // 狂犬病病毒抗体抗体检测试剂盒---唐山怡安生物工程有限公司 + else if ("1691714927305519105".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 v2 = (code3 + code4) / 2; + // 成立条件校验 + if (code1 > 0.1 || code2 > 0.1 || code3 < 0.6 || code4 < 0.6) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + + 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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + mapResult.put("originResult", code); + mapResult.put("value", code); + mapResult.put("num", "1"); + if (Double.parseDouble(code) < v2) { + 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); + } + } + // 猪伪狂犬gB阻断ELISA抗体检测试剂盒---北京纳百生物科技有限公司 + else if ("1692060337681297410".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; + // 成立条件校验 + if (v1 - v2 < 0.3) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + 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 SN = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if ((v2 - v1) != 0) { + SN = df.format(Double.parseDouble(code) / v1); + } + mapResult.put("originResult", code); + mapResult.put("value", SN); + mapResult.put("num", "1"); + if (Double.parseDouble(SN) <= 0.6) { + mapResult.put("result", "阴性"); + } else if (Double.parseDouble(SN) > 0.7) { + 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 ("1692066046158401537".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 code5 = Double.parseDouble(excels.get(4).getCode1()); + double code6 = Double.parseDouble(excels.get(5).getCode1()); + double v1 = (code1 + code2) / 2; + double v2 = (code3 + code4) / 2; + double v3 = (code5 + code6) / 2; + // 成立条件校验 + if (100 - (v1 / v3 * 100) >= 40 || 100 - (v2 / v3 * 100) <= 60) { + throw new ServiceException("第" + (i + 1) + "板阴阳性对照OD值条件不成立,请修改后重新上传!"); + } + 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 PB = "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 (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { + if (j > 5 || n > 1) { + if (v3 != 0) { + PB = df.format(100 - (Double.parseDouble(code) / v3 * 100)); + } + mapResult.put("originResult", code); + mapResult.put("value", PB); + mapResult.put("num", "1"); + if (Double.parseDouble(PB) <= 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 { + throw new Exception("该试剂未维护公式计算,请联系相关开发人员!"); + } + + if (!"1570297053211455490".equals(reagentId) && !"1631222146321997826".equals(reagentId)) { + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map o1, Map o2) { + Integer id1 = (Integer) o1.get("order"); + Integer id2 = (Integer) o2.get("order"); + // 升序 + return id1.compareTo(id2); + } + }); + + int numIndex = 0; + for (Map stringObjectMap : list) { + String num = (String) stringObjectMap.get("num"); + if (num != null && !"".equals(num)) { + num = split[numIndex]; + stringObjectMap.put("num", num); + numIndex++; + } + } +// System.out.println("split.length: " + split.length); +// System.out.println("numIndex: " + numIndex); + // 判断分配样品数量与检测样品数量是否一致 + if (split.length != numIndex) { + throw new Exception("分配样品数量与检测样品数量不一致!"); + } + } + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ExamineResult::getExamineId, examineId); + ExamineResult result = this.getOne(wrapper); + if (result != null) { + result.setOriginRecordData(JSON.toJSONString(map)); + result.setOriginRecordResult(JSON.toJSONString(map1)); + result.setExamineDataArr(JSON.toJSONString(list)); + this.updateById(result); + } else { + ExamineResult examineResult = new ExamineResult(); + examineResult.setExamineId(Long.valueOf(examineId)); + examineResult.setOriginRecordData(JSON.toJSONString(map)); + examineResult.setOriginRecordResult(JSON.toJSONString(map1)); + examineResult.setExamineDataArr(JSON.toJSONString(list)); + this.save(examineResult); + } + return R.data(map1); + } + + /** + * 组装每一个实验数据及结果map + */ + private Map assumb(int row, int col, String value, String lastValue, Double avg, String simpleName1, String[] experieNums) { + // row:行: 0-7 + // col:列: 1-12 + // 计算排序 + int order = (row + 1) + (col - 1) * 8; + // 如果是前十列 + if (col < 11) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(value)) { + // 抗原对照和原始数值比较 + Double currValue = Double.valueOf(value); + Double lastValue1 = 0.00; + if (lastValue != null) { + lastValue1 = Double.valueOf(lastValue); + } + // 滴度 + String log = ""; + log = calcLog(row, currValue, lastValue1, avg); + // 判断阴阳性 + Integer linJie = 0; + + if ("牛".equals(simpleName1) || "羊".equals(simpleName1)) { + linJie = 128; + } else if ("猪".equals(simpleName1)) { + linJie = 64; + } + String result = ""; + if (!"".equals(log)) { + Integer fenMu = Integer.valueOf(log.split(":")[1]); + result = fenMu < linJie ? "阴性" : "阳性"; + } + + Map map = new HashMap<>(); + map.put("order", order); + map.put("value", value); + map.put("log2", log); + map.put("result", result); + map.put("num", experieNums[col - 1]); + return map; + } else { + Map map = new HashMap<>(); + map.put("order", order); + map.put("value", ""); + map.put("log2", ""); + map.put("result", ""); + map.put("num", ""); + return map; + } + } else { + Map map = new HashMap<>(); + map.put("order", order); + map.put("value", value); + map.put("log2", ""); + map.put("result", ""); + map.put("num", ""); + return map; + } + } + + /** + * 取实际的数据(排除数字标题) + */ + private Map> excludeNumTitle(int groupCount, List rows, Map> map) { + for (int i = 0; i < groupCount; i++) { + List excels = new ArrayList<>(); + for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { + ExamineExcel excel = rows.get(j); + excels.add(excel); + } + map.put((i + 1) + "", excels); + } + return map; + } + + /** + * 计算滴度 + */ + private String calcLog(Integer row, Double currValue, Double lastValue, Double avg) { + if (row == 0) { + if (avg < currValue) { + return "<1:8"; + } + } else if (row == 1) { + if (avg < currValue && avg > lastValue) { + return "1:11"; + } + } else if (row == 2) { + if (avg < currValue && avg > lastValue) { + return "1:22"; + } + } else if (row == 3) { + if (avg < currValue && avg > lastValue) { + return "1:45"; + } + } else if (row == 4) { + if (avg < currValue && avg > lastValue) { + return "1:90"; + } + } else if (row == 5) { + if (avg < currValue && avg > lastValue) { + return "1:180"; + } + } else if (row == 6) { + if (avg < currValue && avg > lastValue) { + return "1:360"; + } + } else if (row == 7) { + if (avg < currValue && avg > lastValue) { + return "1:720"; + } else if (avg > currValue) { + return ">1:1024"; + } + } + return ""; + } + + /** + * 计算该组的 对照平均值 + */ + private Double calcCurrGroupContrastAvg(List excels) { + // 获取4个抗原对照值 + List list1 = new ArrayList<>(); + list1.add(Double.parseDouble(excels.get(4).getCode12())); + list1.add(Double.parseDouble(excels.get(5).getCode12())); + list1.add(Double.parseDouble(excels.get(6).getCode12())); + list1.add(Double.parseDouble(excels.get(7).getCode12())); + // 排序后,去掉一个最大值去掉一个最小值,相加除以4 + List list2 = list1.stream().sorted().collect(Collectors.toList()); + DecimalFormat df = new DecimalFormat("#0.000"); + return Double.valueOf(df.format((list2.get(1) + list2.get(2)) / 4)); + } + + /** + * 将当前位置的数据存入allPosDatasInAGroup、addDatas + * b:从一个顺序排的检测编号里获取G1这个位置的值 + * examineType: 1:多版, 2:非兰所 + */ + 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) { + value = excels.get(row).getCode1(); + } else if (col == 2) { + value = excels.get(row).getCode2(); + } else if (col == 3) { + value = excels.get(row).getCode3(); + } else if (col == 4) { + value = excels.get(row).getCode4(); + } else if (col == 5) { + value = excels.get(row).getCode5(); + } else if (col == 6) { + value = excels.get(row).getCode6(); + } else if (col == 7) { + value = excels.get(row).getCode7(); + } else if (col == 8) { + value = excels.get(row).getCode8(); + } else if (col == 9) { + value = excels.get(row).getCode9(); + } else if (col == 10) { + value = excels.get(row).getCode10(); + } else if (col == 11) { + value = excels.get(row).getCode11(); + } else if (col == 12) { + value = excels.get(row).getCode12(); + } + Map cPosData = new HashMap<>(4); + int b = (group * 96) + row; + int order = (group * 192) + row; + if (col != 1) { + b += (u * 8); + order += (u * 8); + } + boolean isIncludeCurr = col == 12 ? false : (examineType == 1 && col == 11 ? false : true); + if (value != null && isIncludeCurr) { + cPosData.put("value", value); + // 如果是参照组 + if (a == 1) { +// cPosData.put("order", b + 1); + cPosData.put("order", order + 1); + } else { +// cPosData.put("order", b + 1 + 96); + cPosData.put("order", order + 1 + 96); + } +// cPosData.put("num", experieNum[b - ((group + 1) * 6 + (group * 16))]); +// cPosData.put("num", experieNum[b - (group + (group * 8))]); + cPosData.put("num", "1"); + cPosData.put("result", Double.parseDouble(value) > avg ? "阴性" : "阳性"); + return cPosData; + } + cPosData.put("value", value != null ? value : " "); + // 如果是参照组 + if (a == 1) { +// cPosData.put("order", b + 1); + cPosData.put("order", order + 1); + } else { +// cPosData.put("order", b + 1 + 96); + cPosData.put("order", order + 1 + 96); + } + return cPosData; + } + + /** + * 暂时不用代码开始 + */ +// /** +// * 普通Excel解析数据 review start +// **/ +// //获取单元格的值 +// private String getCode(List list, Integer order) { +// String result; +// ExamineExcel examineExcel = (order % 8 - 1 >= 0) ? list.get(order % 8 - 1) : list.get(list.size() - 1); +// Integer re = order / 8 + 1; +// switch (re) { +// case 1: +// result = examineExcel.getCode1(); +// break; +// case 2: +// result = examineExcel.getCode2(); +// break; +// case 3: +// result = examineExcel.getCode3(); +// break; +// case 4: +// result = examineExcel.getCode4(); +// break; +// case 5: +// result = examineExcel.getCode5(); +// break; +// case 6: +// result = examineExcel.getCode6(); +// break; +// case 7: +// result = examineExcel.getCode7(); +// break; +// case 8: +// result = examineExcel.getCode8(); +// break; +// case 9: +// result = examineExcel.getCode9(); +// break; +// case 10: +// result = examineExcel.getCode10(); +// break; +// case 11: +// result = examineExcel.getCode11(); +// break; +// case 12: +// result = examineExcel.getCode12(); +// break; +// default: +// result = "0"; +// } +// return result; +// } +// +// private R>>>> ptExcelReview( +// MultipartFile file, +// String examineId, +// Map info, //变量对应的标版的孔位,一行行的逐渐递增 +// String reg //计算公式 +// ) { +// try { +// List read = ExcelUtil.read(file, ExamineExcel.class); +// Map> map = new HashMap<>(); +//// int index = 0; +// // 组数 +// int group = 0; +// // 除9是否有余数 +// int size = (read.size() + 1) % 9; +// +// if (size == 0) { +// group = (read.size() + 1) / 9; +// } else { +// group = (read.size() + 1) / 9 + 1; +// } +// +// //将读取到的excel按照每一版分组 +// for (int i = 0; i < group; i++) { +// List excels = new ArrayList<>(); +// for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { +// ExamineExcel excel = read.get(j); +// excels.add(excel); +// } +// map.put((i + 1) + "", excels); +// } +// +// Examine examine = examineService.getById(examineId); +// String experieNum = examine.getExperieNum(); +// String[] split = experieNum.split(","); +// +// List> list = new ArrayList<>(); +// // 按照公式计算实验数据并返回 +// Map>>> map1 = new HashMap<>(); +// +// for (int i = 0; i < group; i++) { +// List>> mapList = new ArrayList<>(); +// List excels = map.get(i + 1 + ""); +// //解析info,确定参数x的值和其它相对不变的参数 +// Map params = new HashMap<>(); //存放解析出的参数 +// +// Integer xStart = 0; +// Integer xEnd = 0; +// //解析参数 +// Set strings = info.keySet(); +// String x = ""; +// for (String s : strings) { +// String para = info.get(s); +// if (para.split("-").length > 1) {//可变参数 +// String[] xs = para.split("-"); +// xStart = Integer.parseInt(xs[0]); +// xEnd = Integer.parseInt(xs[1]); +// x = s; +// } else {//相对固定的参数 +// Integer order = Integer.valueOf(para); +// params.put(s, StringUtil.isBlank(getCode(excels, order)) ? "0" : getCode(excels, order)); +// } +// } +// +// //按照列循环每一版的数据 +// for (int m = 0; m < excels.size(); m++) { +// String a = ""; +// if (m == 0) { +// a = "A"; +// } +// if (m == 1) { +// a = "B"; +// } +// if (m == 2) { +// a = "C"; +// } +// if (m == 3) { +// a = "D"; +// } +// if (m == 4) { +// a = "E"; +// } +// if (m == 5) { +// a = "F"; +// } +// if (m == 6) { +// a = "G"; +// } +// if (m == 7) { +// a = "H"; +// } +// ExamineExcel examineExcel = excels.get(m);//取到一行记录 +// int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1; +// +// Map> map2 = new HashMap<>(); +// for (int n = 1; n <= filedsLength; n++) { +// System.out.println(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 + m + 1; //n是列,m是行 ,我们定义index是一列列的定义 +// System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + m); +// System.out.println("-------------------"); +// if (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { +// if (xStart <= index && index <= xEnd) { +// params.put(x, code); +// String value = FormulaTool.getResult(reg, params); +// mapResult.put("originResult", examineExcel.getCode1()); +// mapResult.put("value", "0E-10".equals(value) ? "0" : value); +// if (Double.parseDouble(value) >= 0.4) { +// mapResult.put("result", "阳性"); +// } else { +// mapResult.put("result", "阴性"); +// } +// } +// } else { +// if (xStart <= index && index <= xEnd) { +// 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); +// } +// } +// +// Collections.sort(list, new Comparator>() { +// @Override +// public int compare(Map o1, Map o2) { +// Integer id1 = (Integer) o1.get("order"); +// Integer id2 = (Integer) o2.get("order"); +// // 升序 +// return id1.compareTo(id2); +// } +// }); +// +// int numIndex = 0; +// for (Map stringObjectMap : list) { +// String num = (String) stringObjectMap.get("num"); +// if (num != null && !"".equals(num)) { +// num = split[numIndex]; +// stringObjectMap.put("num", num); +// numIndex++; +// } +// } +// +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(ExamineResult::getExamineId, examineId); +// ExamineResult result = this.getOne(wrapper); +// if (result != null) { +// result.setOriginRecordData(JSON.toJSONString(map)); +// result.setOriginRecordResult(JSON.toJSONString(map1)); +// result.setExamineDataArr(JSON.toJSONString(list)); +// this.updateById(result); +// } else { +// ExamineResult examineResult = new ExamineResult(); +// examineResult.setExamineId(Long.valueOf(examineId)); +// examineResult.setOriginRecordData(JSON.toJSONString(map)); +// examineResult.setOriginRecordResult(JSON.toJSONString(map1)); +// examineResult.setExamineDataArr(JSON.toJSONString(list)); +// this.save(examineResult); +// } +// return R.data(map1); +// } catch (ArrayIndexOutOfBoundsException e) { +// throw new RuntimeException("分配样品数量与检测样品数量不一致!"); +// } catch (Exception e1) { +// throw new RuntimeException("算术异常,请检查实验数据!"); +// } +// } +// /** 普通Excel解析数据 review stop **/ +// +// /** +// * 常规Excel解析数据 +// */ +// private R>>>> ptExcel1( +// MultipartFile file, +// String examineId, +// String infoStr, //变量对应的标版的孔位,一行行的逐渐递增 +// String reg //计算公式 +// ) throws Exception { +// List read = ExcelUtil.read(file, ExamineExcel.class); +// Map> map = new HashMap<>(); +// // 组数 +// int group = 0; +// // 除9是否有余数 +// int size = (read.size() + 1) % 9; +// if (size == 0) { +// group = (read.size() + 1) / 9; +// } else { +// group = (read.size() + 1) / 9 + 1; +// } +// +// for (int i = 0; i < group; i++) { +// List excels = new ArrayList<>(); +// for (int j = i * 8 + i; j < (i + 1) * 8 + i; j++) { +// ExamineExcel excel = read.get(j); +// excels.add(excel); +// } +// map.put((i + 1) + "", excels); +// } +// +// Examine examine = examineService.getById(examineId); +// String experieNum = examine.getExperieNum(); +// String[] split = experieNum.split(","); +// +// List> list = new ArrayList<>(); +// // 按照公式计算实验数据并返回 +// 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"); +// //解析info,确定参数x的值和其它相对不变的参数 +// Map params = new HashMap<>(); //存放解析出的参数 +// Integer xStart = 0; +// Integer xEnd = 0; +// //解析参数 +// +// Map info = JSON.parseObject(infoStr, new TypeReference>() { +// }); +// // 测试假数据 +//// reg = "(x-((x1+x2)/2))/(((x3+x4)/2)-(((x1+x2)/2)))"; +//// Map info = new HashMap<>(); +//// info.put("x1", "1"); +//// info.put("x2", "2"); +//// info.put("x3", "3"); +//// info.put("x4", "4"); +//// info.put("x", "7-96"); +// +// Set strings = info.keySet(); +// String x = ""; +// for (String s : strings) { +// String para = info.get(s); +// if (para.split("-").length > 1) {//可变参数 +// String[] xs = para.split("-"); +// xStart = Integer.parseInt(xs[0]); +// xEnd = Integer.parseInt(xs[1]); +// x = s; +// } else {//相对固定的参数 +// Integer order = Integer.valueOf(para); +// params.put(s, StringUtil.isBlank(getCode(excels, order)) ? "0" : getCode(excels, order)); +// } +// } +// +// 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++) { +// System.out.println(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是一列列的定义 +// System.out.println("code的值==" + code + ",列n ==" + n + ",行m=" + j); +// System.out.println("-------------------"); +// if (org.apache.commons.lang3.StringUtils.isNotBlank(code)) { +// if (xStart <= index && index <= xEnd) { +// params.put(x, code); +// String value = FormulaTool.getResult(reg, params); +// System.out.println(value); +// String format = df.format(Double.parseDouble(value)); +// mapResult.put("originResult", code); +// mapResult.put("value", "0E-10".equals(format) ? "0" : format); +// mapResult.put("num", "1"); +// if (Double.parseDouble(format) >= 0.4) { +// mapResult.put("result", "阳性"); +// } else { +// mapResult.put("result", "阴性"); +// } +// } +// } else { +// if (xStart <= index && index <= xEnd) { +// 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); +// } +// +// Collections.sort(list, new Comparator>() { +// @Override +// public int compare(Map o1, Map o2) { +// Integer id1 = (Integer) o1.get("order"); +// Integer id2 = (Integer) o2.get("order"); +// // 升序 +// return id1.compareTo(id2); +// } +// }); +// +// int numIndex = 0; +// for (Map stringObjectMap : list) { +// String num = (String) stringObjectMap.get("num"); +// if (num != null && !"".equals(num)) { +// num = split[numIndex]; +// stringObjectMap.put("num", num); +// numIndex++; +// } +// } +// // 判断分配样品数量与检测样品数量是否一致 +// if (split.length != numIndex) { +// throw new Exception("分配样品数量与检测样品数量不一致!"); +// } +// +// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); +// wrapper.eq(ExamineResult::getExamineId, examineId); +// ExamineResult result = this.getOne(wrapper); +// if (result != null) { +// result.setOriginRecordData(JSON.toJSONString(map)); +// result.setOriginRecordResult(JSON.toJSONString(map1)); +// result.setExamineDataArr(JSON.toJSONString(list)); +// this.updateById(result); +// } else { +// ExamineResult examineResult = new ExamineResult(); +// examineResult.setExamineId(Long.valueOf(examineId)); +// examineResult.setOriginRecordData(JSON.toJSONString(map)); +// examineResult.setOriginRecordResult(JSON.toJSONString(map1)); +// examineResult.setExamineDataArr(JSON.toJSONString(list)); +// this.save(examineResult); +// } +// return R.data(map1); +// } +// +// +// /** +// * 计算常规检验的阴或阳性对照平均值 +// */ +// private double getConventionalAvg(String i, String j) { +// double v1 = Double.parseDouble(i); +// double v2 = Double.parseDouble(j); +// return (v1 + v2) / 2; +// } +// +// /** +// * 计算该组的 对照平均值 +// * 1.公式内容map的value值换成真实数据值 +// * 2.按照公式算对照平均值 +// */ +// private Double calcCurrGroupContrastAvg1(List excels, String infoStr, String reg) { +// Map params = new HashMap<>(); +// DecimalFormat df = new DecimalFormat("#0.000"); +// +// // 获取4个抗原对照值 +// List list1 = new ArrayList<>(); +// list1.add(Double.parseDouble(excels.get(4).getCode12())); +// list1.add(Double.parseDouble(excels.get(5).getCode12())); +// list1.add(Double.parseDouble(excels.get(6).getCode12())); +// list1.add(Double.parseDouble(excels.get(7).getCode12())); +// +// // 排序,取中间两个值 +// List list2 = list1.stream().sorted().collect(Collectors.toList()); +// List list3 = new ArrayList<>(); +// list3.add(list2.get(1)); +// list3.add(list2.get(2)); +// Map info = JSON.parseObject(infoStr, new TypeReference>() { +// }); +// List list = new ArrayList<>(info.keySet()); +// +// // 公示内容换成真实数据换成真实数据值 +// for (int i = 0; i < list.size(); i++) { +// params.put(list.get(i), list3.get(i)); +// } +// +// // 得出最终对照平均值并返回 +// String value = null; +// try { +// value = FormulaTool.getResult(reg, params); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return Double.valueOf(df.format(Double.parseDouble(value))); +// } + /** + * 暂时不用代码结束 + */ + +} \ No newline at end of file diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/HandleSampleServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/HandleSampleServiceImpl.java index 8c00a8e..3756f4e 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/HandleSampleServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/HandleSampleServiceImpl.java @@ -47,13 +47,13 @@ import static org.springblade.core.cache.constant.CacheConstant.PARAM_CACHE; @AllArgsConstructor public class HandleSampleServiceImpl extends BaseServiceImpl implements IHandleSampleService { - private EntrustMapper entrustMapper; + private final EntrustMapper entrustMapper; - private IUserClient userClient; + private final IUserClient userClient; - private ISimpleService simpleService; + private final ISimpleService simpleService; - private ISysClient sysClient; + private final ISysClient sysClient; @Override public IPage entrustList(HandleSample handleSample, IPage page) { @@ -327,11 +327,11 @@ public class HandleSampleServiceImpl extends BaseServiceImpl map = new HashMap<>(); - map.put("originalNum", start + "-" + (start + size)); - map.put("experieNum", num + start + "-" + num + (start + size)); + map.put("originalNum", start + "-" + (start + size - 1)); + map.put("experieNum", num + start + "-" + num + (start + size - 1)); map.put("simpleName", simple.getSimpleName()); map.put("sampleHandle", entrust.getSampleHandle()); - map.put("a", "~"); + map.put("a", "30天"); map.put("b", "接样室"); map.put("c", "李玉杰"); resultList.add(map); @@ -344,12 +344,12 @@ public class HandleSampleServiceImpl extends BaseServiceImpl