|
|
|
|
@ -227,11 +227,11 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
Examine examine = examineService.getById(examineId); |
|
|
|
|
ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); |
|
|
|
|
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { |
|
|
|
|
return blsExcel(file, examineId); |
|
|
|
|
return blsExcel(file, examineId, examine, examineWay); |
|
|
|
|
} else if ("3".equals(examineWay.getInputMode())) { |
|
|
|
|
return ktyExcel(file, examineId); |
|
|
|
|
} else if ("8".equals(examineWay.getInputMode())) { |
|
|
|
|
return shjdExcel(file, examineId); |
|
|
|
|
return shjdExcel(file, examineId, examine); |
|
|
|
|
} else if ("5".equals(examineWay.getInputMode())) { |
|
|
|
|
return xnExcel(file, examineId); |
|
|
|
|
} else { |
|
|
|
|
@ -388,6 +388,108 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<PCR2Excel> isRecheck(ExamineResult entry) { |
|
|
|
|
List<PCR2Excel> read = JSON.parseArray(entry.getJsonDatas(), PCR2Excel.class); |
|
|
|
|
if (CollectionUtils.isNotEmpty(read)) { |
|
|
|
|
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()) || "/".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(" 阳性"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果是非洲猪瘟病毒核酸检测(复检)
|
|
|
|
|
List<PCR2Excel> excels = new ArrayList<>(); |
|
|
|
|
Examine examine = examineService.getById(entry.getExamineId()); |
|
|
|
|
if (examine != null && examine.getIsRecheck() != null && examine.getIsRecheck() == 1 && (read.size() - 2) > examine.getSimpleCount()) { |
|
|
|
|
List<PCR2Excel> pcr2Excels = new ArrayList<>(); |
|
|
|
|
Map<String, List<PCR2Excel>> listMap = read.stream().collect(Collectors.groupingBy(PCRExcel::getExperieNum)); |
|
|
|
|
|
|
|
|
|
// String[] split = examine.getExperieNum().split(",");
|
|
|
|
|
// for (String s : split) {
|
|
|
|
|
// List<PCR2Excel> excelList = listMap.get(s);
|
|
|
|
|
// for (PCR2Excel pcr2Excel : excelList) {
|
|
|
|
|
// if (!"/".equals(pcr2Excel.getCtValue())) {
|
|
|
|
|
// pcr2Excels.add(pcr2Excel);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (pcr2Excels.size() > 0) {
|
|
|
|
|
// pcr2Excels.sort(Comparator.comparing(pcr2Excel -> pcr2Excel.getCtValue().replace(" ", "")));
|
|
|
|
|
// excels.add(pcr2Excels.get(0));
|
|
|
|
|
// pcr2Excels.clear();
|
|
|
|
|
// } else {
|
|
|
|
|
// excels.add(excelList.get(0));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<PCR2Excel>> stringListEntry : listMap.entrySet()) { |
|
|
|
|
List<PCR2Excel> excelList = stringListEntry.getValue(); |
|
|
|
|
for (PCR2Excel pcr2Excel : excelList) { |
|
|
|
|
if (!"/".equals(pcr2Excel.getCtValue())) { |
|
|
|
|
pcr2Excels.add(pcr2Excel); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pcr2Excels.size() > 0) { |
|
|
|
|
pcr2Excels.sort(Comparator.comparing(pcr2Excel -> pcr2Excel.getCtValue().replace(" ", ""))); |
|
|
|
|
excels.add(pcr2Excels.get(0)); |
|
|
|
|
pcr2Excels.clear(); |
|
|
|
|
} else { |
|
|
|
|
excels.add(excelList.get(0)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(ExamineResult::getExamineId, entry.getExamineId().toString()); |
|
|
|
|
ExamineResult result = this.getOne(wrapper); |
|
|
|
|
if (result != null) { |
|
|
|
|
result.setConformityType(entry.getConformityType()); |
|
|
|
|
result.setOriginRecordData(JSON.toJSONString(read)); |
|
|
|
|
result.setOriginRecordResult(JSON.toJSONString(read)); |
|
|
|
|
result.setExamineDataArr(JSON.toJSONString(read)); |
|
|
|
|
if (excels.size() > 0) { |
|
|
|
|
result.setExamineDataArr(JSON.toJSONString(excels)); |
|
|
|
|
} |
|
|
|
|
this.updateById(result); |
|
|
|
|
} else { |
|
|
|
|
ExamineResult examineResult = new ExamineResult(); |
|
|
|
|
examineResult.setConformityType(entry.getConformityType()); |
|
|
|
|
examineResult.setExamineId(entry.getExamineId()); |
|
|
|
|
examineResult.setOriginRecordData(JSON.toJSONString(read)); |
|
|
|
|
examineResult.setOriginRecordResult(JSON.toJSONString(read)); |
|
|
|
|
examineResult.setExamineDataArr(JSON.toJSONString(read)); |
|
|
|
|
if (excels.size() > 0) { |
|
|
|
|
examineResult.setExamineDataArr(JSON.toJSONString(excels)); |
|
|
|
|
} |
|
|
|
|
this.save(examineResult); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return read; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public boolean doExamine(ExamineResult entry) throws Exception { |
|
|
|
|
@ -531,6 +633,52 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
entry.setPicturePath(""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 非洲猪瘟病毒核酸1565164433829933058L
|
|
|
|
|
if (byId.getExamineItemId() == 1565164433829933058L && entry.getNeedTwice() == 1) { |
|
|
|
|
// 上次检测结果为阳性的数据
|
|
|
|
|
String[] split = entry.getPositiveNum().split(","); |
|
|
|
|
|
|
|
|
|
String yang = ""; |
|
|
|
|
if (entry.getConformityType() == 1) { |
|
|
|
|
for (int i = 0; i < split.length - 1; i++) { |
|
|
|
|
yang += split[i] + ","; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 检测编号前缀
|
|
|
|
|
String qz = split[0].split("-")[0] + "-" + split[0].split("-")[1] + "-"; |
|
|
|
|
for (int i = 0; i < split.length - 1; i++) { |
|
|
|
|
String[] num = split[i].split("-"); |
|
|
|
|
if (num.length == 4) { |
|
|
|
|
int startNum = Integer.parseInt(num[num.length - 2]); |
|
|
|
|
int endNum = Integer.parseInt(num[num.length - 1]); |
|
|
|
|
for (int j = startNum; j <= endNum; j++) { |
|
|
|
|
yang += qz + j + ","; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
yang += split[i] + ","; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
entry.setPositiveNum(yang); |
|
|
|
|
int length = yang.split(",").length; |
|
|
|
|
// 非洲猪瘟病毒核酸(复检)
|
|
|
|
|
Examine examine = BeanUtil.copy(byId, Examine.class); |
|
|
|
|
examine.setId(null); |
|
|
|
|
examine.setExperieNum(yang); |
|
|
|
|
examine.setSimpleCount(length); |
|
|
|
|
examine.setIsFinished("-1"); |
|
|
|
|
examine.setIsRecheck(1); |
|
|
|
|
examineService.save(examine); |
|
|
|
|
// 新增一条记录
|
|
|
|
|
SimpleDoExamineLog log = new SimpleDoExamineLog(); |
|
|
|
|
log.setExamineId(examine.getId()); |
|
|
|
|
log.setBatch(1); |
|
|
|
|
log.setSimpleCount(length); |
|
|
|
|
log.setExperieNum(entry.getPositiveNum()); |
|
|
|
|
log.setIsFinished(0); |
|
|
|
|
simpleDoExamineLogService.save(log); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果是禽流感病毒核酸检测且有阳性
|
|
|
|
|
if (byId.getExamineItemId() == 1595723686709940226L && entry.getNeedTwice() == 1) { |
|
|
|
|
// 上次检测结果为阳性的数据
|
|
|
|
|
@ -723,11 +871,12 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
/** |
|
|
|
|
* 布鲁氏杆菌Excel解析数据 |
|
|
|
|
*/ |
|
|
|
|
private R blsExcel(MultipartFile file, String examineId) throws Exception { |
|
|
|
|
Examine examine = examineService.getById(examineId); |
|
|
|
|
ExamineWay examineWay = examineWayService.getById(examine.getExamineWayId()); |
|
|
|
|
private R blsExcel(MultipartFile file, String examineId, Examine examine, ExamineWay examineWay) throws Exception { |
|
|
|
|
List<ExamineTemplate2Excel> read = ExcelUtil.read(file, ExamineTemplate2Excel.class); |
|
|
|
|
if (CollectionUtils.isNotEmpty(read)) { |
|
|
|
|
if (read.size() - 2 != examine.getSimpleCount()) { |
|
|
|
|
throw new Exception("上传的样品数量有误!!!"); |
|
|
|
|
} |
|
|
|
|
// 布鲁氏杆菌抗体检测(虎红平板凝集)
|
|
|
|
|
if ("2".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) { |
|
|
|
|
for (int i = 0; i < read.size() - 2; i++) { |
|
|
|
|
@ -738,6 +887,8 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
excel.setResult("阴性"); |
|
|
|
|
} else if (excel.getValue() == null || "".equals(excel.getValue())) { |
|
|
|
|
throw new Exception("有样品未填写的对应的结果!"); |
|
|
|
|
} else { |
|
|
|
|
throw new Exception("数据填写错误!!!"); |
|
|
|
|
} |
|
|
|
|
read.set(i, excel); |
|
|
|
|
} |
|
|
|
|
@ -763,6 +914,8 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
excel.setResult("阴性"); |
|
|
|
|
} else if (excel.getValue() == null || "".equals(excel.getValue())) { |
|
|
|
|
throw new Exception("有样品未填写的对应的结果!"); |
|
|
|
|
} else { |
|
|
|
|
throw new Exception("数据填写错误!!!"); |
|
|
|
|
} |
|
|
|
|
read.set(i, excel); |
|
|
|
|
} |
|
|
|
|
@ -1380,9 +1533,12 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private R shjdExcel(MultipartFile file, String examineId) throws Exception { |
|
|
|
|
private R shjdExcel(MultipartFile file, String examineId, Examine examine) throws Exception { |
|
|
|
|
List<BiochemicalIdentificationExcel> read = ExcelUtil.read(file, BiochemicalIdentificationExcel.class); |
|
|
|
|
if (read != null && read.size() > 0) { |
|
|
|
|
if (read.size() - 2 != examine.getSimpleCount()) { |
|
|
|
|
throw new Exception("上传的样品数量有误!!!"); |
|
|
|
|
} |
|
|
|
|
for (BiochemicalIdentificationExcel excel : read) { |
|
|
|
|
if ("+".equals(excel.getValue())) { |
|
|
|
|
excel.setResult("阳性"); |
|
|
|
|
@ -1390,6 +1546,8 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
excel.setResult("阴性"); |
|
|
|
|
} else if (excel.getValue() == null || "".equals(excel.getValue())) { |
|
|
|
|
throw new Exception("有样品未填写的对应的结果!"); |
|
|
|
|
} else { |
|
|
|
|
throw new Exception("数据填写错误!!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
@ -3757,7 +3915,7 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe |
|
|
|
|
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 (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); |
|
|
|
|
|