|
|
|
|
@ -826,17 +826,20 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
/** |
|
|
|
|
* 布鲁氏杆菌Excel解析数据 |
|
|
|
|
*/ |
|
|
|
|
private R blsExcel(MultipartFile file, String examineId) { |
|
|
|
|
private R blsExcel(MultipartFile file, String examineId) throws Exception { |
|
|
|
|
Examine examine = examineService.getById(examineId); |
|
|
|
|
List<ExamineTemplate2Excel> read = ExcelUtil.read(file, ExamineTemplate2Excel.class); |
|
|
|
|
if (read != null && read.size() > 0) { |
|
|
|
|
// 布鲁氏杆菌抗体检测(平板凝集)
|
|
|
|
|
// TODO 需要换掉硬编码 ↓
|
|
|
|
|
if (examine.getExamineItemId() == 1544979879090921474L) { |
|
|
|
|
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("有样品未填写的对应的结果!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -849,6 +852,8 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
excel.setResult("可疑"); |
|
|
|
|
} else if ("-".equals(excel.getValue())) { |
|
|
|
|
excel.setResult("阴性"); |
|
|
|
|
} else if (excel.getValue() == null || "".equals(excel.getValue())) { |
|
|
|
|
throw new Exception("有样品未填写的对应的结果!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -875,7 +880,7 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
/** |
|
|
|
|
* 口蹄疫Excel解析数据 |
|
|
|
|
*/ |
|
|
|
|
private R ktyExcel(MultipartFile file, String examineId) { |
|
|
|
|
private R ktyExcel(MultipartFile file, String examineId) throws Exception { |
|
|
|
|
List<ExamineExcel> originRowDatas = ExcelUtil.read(file, ExamineExcel.class); |
|
|
|
|
String[] split = examineId.split(","); |
|
|
|
|
Examine examine = examineService.getById(split[0]); |
|
|
|
|
@ -960,6 +965,11 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 判断应实验样品数量和实际样品数量是否相等
|
|
|
|
|
if (experieNum.length != mapList.size()) { |
|
|
|
|
throw new Exception("分配样品数量与检测样品数量不一致!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ExamineResult::getExamineId, examine.getId()); |
|
|
|
|
ExamineResult result = service.getOne(wrapper); |
|
|
|
|
@ -982,6 +992,8 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
} |
|
|
|
|
// 兰所多板----------------------------------------------------------------------------------------------------
|
|
|
|
|
else if ("2".equals(split[1])) { |
|
|
|
|
int yinCount = 0; |
|
|
|
|
int yangCount = 0; |
|
|
|
|
Map<String, List<Map<String, Map<String, Object>>>> resultMap = new HashMap<>(); |
|
|
|
|
// 以组为维度的所有数据:<1:行...>、<2:行...>
|
|
|
|
|
Map<String, List<ExamineExcel>> groupsMap = new HashMap<>(); |
|
|
|
|
@ -995,6 +1007,7 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
// 用于存放每个格子的值,有顺序,无规则
|
|
|
|
|
List<Map<String, Object>> allDatas = new ArrayList<>(); |
|
|
|
|
List<Map<String, Object>> allData = new ArrayList<>(); |
|
|
|
|
int simpleCount = 0; |
|
|
|
|
// 按照公式计算实验数据并返回;两板对照:取偶数组去循环做参照,+1组做对照
|
|
|
|
|
// 参照组:2n 、对照组:2n + 1
|
|
|
|
|
for (int group = 0; group < groupCount / 2; group++) { |
|
|
|
|
@ -1069,15 +1082,26 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
data1.put("log2", isPig ? "≥1:64" : "≥1:128"); |
|
|
|
|
data1.put("result", "阳性"); |
|
|
|
|
allDatas.add(data1); |
|
|
|
|
yangCount ++; |
|
|
|
|
simpleCount ++; |
|
|
|
|
} else { |
|
|
|
|
data1.put("log2", isPig ? "<1:64" : "<1:128"); |
|
|
|
|
data1.put("result", "阴性"); |
|
|
|
|
allDatas.add(data1); |
|
|
|
|
yinCount ++; |
|
|
|
|
simpleCount ++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 判断应实验样品数量和实际样品数量是否相等
|
|
|
|
|
System.out.println(experieNum.length + "experieNum.length_________________________________________________"); |
|
|
|
|
System.out.println(simpleCount + "simpleCount_____________________________________________________________"); |
|
|
|
|
if (experieNum.length != simpleCount) { |
|
|
|
|
throw new Exception("分配样品数量与检测样品数量不一致!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 新增或修改Result数据
|
|
|
|
|
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ExamineResult::getExamineId, examine.getId()); |
|
|
|
|
@ -1095,10 +1119,16 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); |
|
|
|
|
service.save(examineResult); |
|
|
|
|
} |
|
|
|
|
return R.data(resultMap); |
|
|
|
|
Map<String, Object> realResultMap = new HashMap<>(); |
|
|
|
|
realResultMap.put("data", resultMap); |
|
|
|
|
realResultMap.put("yinCount", yinCount); |
|
|
|
|
realResultMap.put("yangCount", yangCount); |
|
|
|
|
return R.data(realResultMap); |
|
|
|
|
} |
|
|
|
|
// 非兰所,11列也是样品 ---------------------------------------------------------------------------------------
|
|
|
|
|
else { |
|
|
|
|
int yinCount = 0; |
|
|
|
|
int yangCount = 0; |
|
|
|
|
Map<String, List<Map<String, Map<String, Object>>>> resultMap = new HashMap<>(); |
|
|
|
|
// 以组为维度的所有数据:<1:行...>、<2:行...>
|
|
|
|
|
Map<String, List<ExamineExcel>> groupsMap = new HashMap<>(); |
|
|
|
|
@ -1187,14 +1217,22 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
data1.put("log2", isPig ? "≥1:64" : "≥1:128"); |
|
|
|
|
data1.put("result", "阳性"); |
|
|
|
|
allDatas.add(data1); |
|
|
|
|
yangCount ++; |
|
|
|
|
} else { |
|
|
|
|
data1.put("log2", isPig ? "<1:64" : "<1:128"); |
|
|
|
|
data1.put("result", "阴性"); |
|
|
|
|
allDatas.add(data1); |
|
|
|
|
yinCount ++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 判断应实验样品数量和实际样品数量是否相等
|
|
|
|
|
if (experieNum.length != allDatas.size()) { |
|
|
|
|
throw new Exception("分配样品数量与检测样品数量不一致!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ExamineResult::getExamineId, examine.getId()); |
|
|
|
|
ExamineResult result = service.getOne(wrapper); |
|
|
|
|
@ -1211,7 +1249,11 @@ public class ExamineResultController extends BladeController { |
|
|
|
|
examineResult.setExamineDataArr(JSON.toJSONString(allDatas)); |
|
|
|
|
service.save(examineResult); |
|
|
|
|
} |
|
|
|
|
return R.data(resultMap); |
|
|
|
|
Map<String, Object> realResultMap = new HashMap<>(); |
|
|
|
|
realResultMap.put("data", resultMap); |
|
|
|
|
realResultMap.put("yinCount", yinCount); |
|
|
|
|
realResultMap.put("yangCount", yangCount); |
|
|
|
|
return R.data(realResultMap); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|