2024年1月19日16:20:00

dev
litao 2 years ago
parent 03842918ab
commit cd04f2776e
  1. 5
      lab-service-api/lab-capital-api/src/main/java/org/springblade/lims/capital/entity/ProductStoreDetial.java
  2. 9
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java
  3. 1
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/GoodsController.java
  4. 1
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineController.java
  5. 50
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  6. 3
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/IExamineResultService.java
  7. 41
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  8. 172
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java

@ -98,6 +98,7 @@ public class ProductStoreDetial extends BaseEntity {
private Date qualityTestDate;
// 品牌
@TableField(exist = false)
private String brand;
}

@ -1,5 +1,6 @@
package org.springblade.lims.goods.controller;
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;
@ -392,8 +393,9 @@ public class ApplyController extends BladeController {
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ApplyDetail::getApplyId, apply.getId());
List<ApplyDetail> applyDetails = applyDetailService.list(wrapper);
if (applyDetails != null && applyDetails.size() > 0) {
if (CollectionUtils.isNotEmpty(applyDetails)) {
for (ApplyDetail detail : applyDetails) {
detail.setBrand(goodsService.getById(detail.getProductId()).getBrand());
if (detail.getOutNum() != null && detail.getReturnNum() != null) {
detail.setNeedReturnNum(detail.getOutNum() - detail.getReturnNum());
}
@ -414,8 +416,11 @@ public class ApplyController extends BladeController {
LambdaQueryWrapper<ApplyDetail> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ApplyDetail::getApplyId, apply.getId());
List<ApplyDetail> applyDetails = applyDetailService.list(wrapper);
if (applyDetails != null && applyDetails.size() > 0) {
if (CollectionUtils.isNotEmpty(applyDetails)) {
for (ApplyDetail detail : applyDetails) {
// 品牌
detail.setBrand(goodsService.getById(detail.getProductId()).getBrand());
if (detail.getOutNum() != null && detail.getReturnNum() != null) {
detail.setNeedReturnNum(detail.getOutNum() - detail.getReturnNum());

@ -310,6 +310,7 @@ public class GoodsController extends BladeController {
String company = byId.getCompany();
record.setCompany(company);
record.setXh(byId.getXh());
record.setBrand(byId.getBrand());
}
return R.data(page);
}

@ -413,7 +413,6 @@ public class ExamineController extends BladeController {
@PostMapping("/receiveSubmit")
public void receiveSubmit(@RequestBody Examine examine) throws Exception {
examineService.receiveSubmit(examine);
}
/**

@ -84,54 +84,8 @@ public class ExamineResultController extends BladeController {
*/
@PostMapping("/pcrExcel")
public R pcrExcel(@RequestBody 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(" 阳性");
}
}
}
LambdaQueryWrapper<ExamineResult> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ExamineResult::getExamineId, entry.getExamineId().toString());
ExamineResult result = service.getOne(wrapper);
if (result != null) {
result.setConformityType(entry.getConformityType());
result.setOriginRecordData(JSON.toJSONString(read));
result.setOriginRecordResult(JSON.toJSONString(read));
result.setExamineDataArr(JSON.toJSONString(read));
service.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));
service.save(examineResult);
}
}
return R.data(read);
List<PCR2Excel> recheck = service.isRecheck(entry);
return R.data(recheck);
}
/**

@ -6,6 +6,7 @@ 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.springblade.lims.excel.PCR2Excel;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@ -30,4 +31,6 @@ public interface IExamineResultService extends BaseService<ExamineResult> {
void exportCurrExamineTemplate(HttpServletResponse response, String id);
String handleNum(String id, Integer number);
List<PCR2Excel> isRecheck(ExamineResult entry);
}

@ -1442,6 +1442,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// PCR检测
else if ("4".equals(examineWay.getInputMode())) {
List<PCR2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), PCR2Excel.class);
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "PCRreportPrint");
if (examine.getIsRecheck() != null && examine.getIsRecheck() == 1) {
list = JSON.parseArray(examineResult.getOriginRecordData(), PCR2Excel.class);
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "PCRreportPrintFJ");
}
if (list.size() > 0) {
Map<String, List<PCR2Excel>> resultMap = new HashMap<>();
@ -1546,8 +1552,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
result.put("list1", resultList2);
result.put("list", resultList1);
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "PCRreportPrint");
}
// XN检测
else if ("5".equals(examineWay.getInputMode())) {
@ -2358,6 +2362,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
arrVO.setNum("阴性对照平均OD值");
arrVO.setValue(format);
arrVO.setResult(" ");
arrVO.setOrder(0);
list1.add(arrVO);
double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult());
double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult());
@ -2366,6 +2371,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
arrVO1.setNum("阳性对照平均OD值");
arrVO1.setValue(format1);
arrVO1.setResult(" ");
arrVO1.setOrder(0);
list1.add(arrVO1);
for (int j = 0; j < 96; j++) {
ExamineDataArrVO vo = list.get((i * 96) + j);
@ -2383,6 +2389,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
arrVO.setNum("阴性对照平均OD值");
arrVO.setValue(format);
arrVO.setResult(" ");
arrVO.setOrder(0);
list1.add(arrVO);
double a2 = Double.parseDouble(list.get((i * 96) + 2).getOriginResult());
double b2 = Double.parseDouble(list.get((i * 96) + 3).getOriginResult());
@ -2391,6 +2398,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
arrVO1.setNum("阳性对照平均OD值");
arrVO1.setValue(format1);
arrVO1.setResult(" ");
arrVO1.setOrder(0);
list1.add(arrVO1);
for (int j = 0; j < 96; j++) {
if ((i * 96) + j > list.size() - 1) {
@ -2423,6 +2431,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ExamineDataArrVO::getNum))),
ArrayList::new));
// 根据order排序
System.out.println("list1:" + list1);
sortByOrder(list1);
if (list1.size() > 0) {
@ -2451,12 +2460,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
for (int i = 0; i < arrVOList.size() / 2; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue().split(",")[0]);
map.put("value2", arrVOList.get(i).getValue().split(",")[1]);
String[] split4 = arrVOList.get(i).getValue().split(",");
map.put("value1", split4[0]);
if (split4.length > 1) {
map.put("value2", split4[1]);
}
map.put("result1", arrVOList.get(i).getResult());
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 2 + i).getValue().split(",")[0]);
map.put("value4", arrVOList.get(arrVOList.size() / 2 + i).getValue().split(",")[1]);
String[] split3 = arrVOList.get(arrVOList.size() / 2 + i).getValue().split(",");
map.put("value3", split3[0]);
if (split3.length > 1) {
map.put("value4", split3[1]);
}
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i).getResult());
resultList1.add(map);
}
@ -2464,13 +2479,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
for (int i = 0; i < arrVOList.size() / 2 + 1; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue().split(",")[0]);
map.put("value2", arrVOList.get(i).getValue().split(",")[1]);
String[] split3 = arrVOList.get(i).getValue().split(",");
map.put("value1", split3[0]);
if (split3.length > 1) {
map.put("value2", split3[1]);
}
map.put("result1", arrVOList.get(i).getResult());
if (i < arrVOList.size() / 2) {
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i + 1).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue().split(",")[0]);
map.put("value4", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue().split(",")[1]);
String[] split4 = arrVOList.get(arrVOList.size() / 2 + i + 1).getValue().split(",");
map.put("value3", split4[0]);
if (split4.length > 1) {
map.put("value4", split4[1]);
}
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i + 1).getResult());
}
resultList1.add(map);

@ -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);

Loading…
Cancel
Save