1.委托单列表去掉待编制,并把待生成报告和已完成数据结合

2.解决打印报告仪器和操作程序换行问题
3.解决驳回功能问题
dev
litao 3 years ago
parent 81423b98ff
commit fccf211c4c
  1. 38
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java
  2. 12
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  3. 151
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  4. 176
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/TaskBlueprintServiceImpl.java

@ -473,12 +473,11 @@ public class EntrustController extends BladeController {
}
return R.data(page);
}
// 待编制报告状态
if (entry != null && entry.getEntrustStatus() != null && "5".equals(entry.getEntrustStatus())) {
// 已完成状态
if (entry != null && entry.getEntrustStatus() != null && "8".equals(entry.getEntrustStatus())) {
QueryWrapper<Entrust> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entrust_status", "4").or();
queryWrapper.eq("entrust_status", "5").or();
queryWrapper.eq("entrust_status", "6");
queryWrapper.eq("entrust_status", "7").or()
.eq("entrust_status", "8");
query.setDescs("create_time");
IPage<Entrust> page = service.page(Condition.getPage(query), queryWrapper);
return R.data(page);
@ -855,19 +854,8 @@ public class EntrustController extends BladeController {
map.put("jcz", service.count(queryWrapper));
queryWrapper.clear();
// queryWrapper.eq("entrust_status", "3");
// map.put("jcwc", service.count(queryWrapper));
// queryWrapper.clear();
queryWrapper.eq("entrust_status", "4");
map.put("shtg", service.count(queryWrapper));
queryWrapper.clear();
// queryWrapper.eq("entrust_status", "5");
// map.put("shbh", service.count(queryWrapper));
// queryWrapper.clear();
queryWrapper.eq("entrust_status", "8");
queryWrapper.eq("entrust_status", "7").or()
.eq("entrust_status", "8");
map.put("ywc", service.count(queryWrapper));
queryWrapper.clear();
@ -875,12 +863,16 @@ public class EntrustController extends BladeController {
map.put("yzf", service.count(queryWrapper));
queryWrapper.clear();
queryWrapper.eq("entrust_status", "4").or();
queryWrapper.eq("entrust_status", "5").or();
queryWrapper.eq("entrust_status", "6");
map.put("dbz", service.count(queryWrapper));
queryWrapper.eq("entrust_status", "-0.5");
map.put("djc", service.count(queryWrapper));
queryWrapper.clear();
// queryWrapper.eq("entrust_status", "4").or();
// queryWrapper.eq("entrust_status", "5").or();
// queryWrapper.eq("entrust_status", "6");
// map.put("dbz", service.count(queryWrapper));
// queryWrapper.clear();
// queryWrapper.eq("entrust_status", "-1");
// map.put("sb", service.count(queryWrapper));
// }
@ -1224,7 +1216,7 @@ public class EntrustController extends BladeController {
if ("0".equals(entrust.getIsGenreport())) {
entrust.setEntrustStatus("8");
} else {
entrust.setEntrustStatus("4");
entrust.setEntrustStatus("7");
}
service.updateById(entrust);

@ -790,10 +790,7 @@ public class ExamineResultController extends BladeController {
List<ExamineExcel> 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....
@ -853,7 +850,7 @@ public class ExamineResultController extends BladeController {
if (StringUtil.isNoneBlank(code)) {
if (j > 5 || n > 1) {
if (v1 != 0) {
SP = df.format((v2 - Double.parseDouble(code)) / v1);
SP = df.format((v1 - Double.parseDouble(code)) / v1);
}
mapResult.put("originResult", code);
mapResult.put("value", SP);
@ -1278,6 +1275,8 @@ public class ExamineResultController extends BladeController {
numIndex++;
}
}
System.out.println("split.length: " + split.length);
System.out.println("numIndex: " + numIndex);
// 判断分配样品数量与检测样品数量是否一致
if (split.length != numIndex) {
throw new Exception("分配样品数量与检测样品数量不一致!");
@ -3015,7 +3014,7 @@ public class ExamineResultController extends BladeController {
String ctValue = read.get(i).getCtValue();
String length = "";
if (ctValue != null && !"".equals(ctValue)) {
int length1 = 15 - ctValue.length();
int length1 = 10 - ctValue.length();
for (int i1 = 0; i1 < length1; i1++) {
length += " ";
}
@ -3024,6 +3023,9 @@ public class ExamineResultController extends BladeController {
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("/");

@ -1009,9 +1009,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 拼接仪器编号及名称
instrumentName += instrument.getName() + "" + instrument.getCode() + ",";
}
String replace = instrumentName.replace(",", "\r");
result1.put("code", instrumentName);
result1.put("code", instrumentName.replace(",", "\r\n"));
result1.put("experieDate", format3.format(taskBlueprint.getCreateTime()));
result1.put("remark", entrust.getRemark());
result1.put("resultList1", ItemAndAllList);
@ -1191,76 +1189,86 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 诊断试剂
String[] split1 = examineResult.getReagentId().split(",");
String regentName = "";
Set<String> 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();
regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer();
} else {
regentName += reagent.getName() + ",";
regentName += reagent.getName() + "(生产批号:" + reagent.getBatchNo() + ")" + reagent.getManufacturer() + "\r\n";
}
set.add(reagent.getManufacturer());
}
result.put("7", regentName);
// 生产厂家及批号
String manufacturer = "";
List<String> 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<String, List<String>> 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<String> list = tempListMap.get(reagentId);
if (CollectionUtils.isNotEmpty(list)) {
list.add(realBatch);
} else {
List<String> temp = new ArrayList<>();
temp.add(realBatch);
tempListMap.put(reagentId, temp);
}
}
String resultBatchStr = "";
// 遍历处理批号
Set<String> strings = tempListMap.keySet();
for (String reagentId : strings) {
// 根据试剂名称查询厂家名称
Reagent reagent = reagentService.getById(reagentId);
String manufacturerName = reagent.getManufacturer();
List<String> 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);
// Set<String> 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<String> 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<String, List<String>> 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<String> list = tempListMap.get(reagentId);
// if (CollectionUtils.isNotEmpty(list)) {
// list.add(realBatch);
// } else {
// List<String> temp = new ArrayList<>();
// temp.add(realBatch);
// tempListMap.put(reagentId, temp);
// }
// }
// String resultBatchStr = "";
// // 遍历处理批号
// Set<String> strings = tempListMap.keySet();
// for (String reagentId : strings) {
// // 根据试剂名称查询厂家名称
// Reagent reagent = reagentService.getById(reagentId);
// String manufacturerName = reagent.getManufacturer();
// List<String> 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(",");
@ -1274,17 +1282,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
instrumentName += s2 + ",";
}
}
result.put("9", instrumentName.replace(",", "\r"));
result.put("9", instrumentName.replace(",", "\r\n"));
// String value = DictBizCache.getValue(DictBizEnum.SIMPLE_STATUS, examineResult.getSimpleStatus());
result.put("10", examineResult.getSimpleStatus());
result.put("11", "温度" + examineResult.getTemperature() + "℃; " + "湿度" + examineResult.getHumidity() + "%RH");
// 操作程序内容
result.put("12", examineResult.getOperateContent().replace("#", "\r"));
// if (examineBasis != null) {
// result.put("13", examineBasis.getContent().replace("$", "(char)11"));
// }
result.put("12", examineResult.getOperateContent().replace("\n", "\r\n"));
// 结果判定方法和依据
result.put("13", examineResult.getExamineBasisContent().replace("#", "\r"));
result.put("13", examineResult.getExamineBasisContent().replace("\n", "\r\n"));
String path = sysClient.getParamValue("electronic_signature_real_path").getData();
// 检测人
if (!"".equals(examine.getExamineBy()) && examine.getExamineBy() != null) {
@ -3347,12 +3352,16 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
result.put("flowTime", "/");
}
//检测任务书交回日期
if (eTask.getBackCrossTime() != null) {
result.put("backCrossTime", format.format(eTask.getBackCrossTime()));
}
if (eTask.getBackCrossRecipientBy() != null) {
String name1 = userClient.userInfoById(Long.parseLong(eTask.getBackCrossRecipientBy())).getData().getName();
//接收人
result.put("backCrossRecipient", name1);
}
}
}
List<Map<String, Object>> resultList = new ArrayList<>();

@ -70,9 +70,29 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
List<Simple> simples = simpleService.list(wrapper1);
// 如果是追加检验计划提交
Random random = new Random();
if (taskBlueprint.getIsContinue() != null && taskBlueprint.getIsContinue() == 1) {
List<ETask> eTasks = taskBlueprint.getTasks();
for (ETask eTask : eTasks) {
// 如果是新分配的子任务
if (eTask.getId() == null) {
eTask.setId(random.nextLong());
LambdaQueryWrapper<TaskBlueprint> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaskBlueprint::getEntrustId, taskBlueprint.getEntrustId());
TaskBlueprint one = this.getOne(wrapper);
eTask.setTaskBlueprintId(one.getId());
taskBlueprint.setId(one.getId());
if (eTask.getDeptId() != null) {
Integer sort = sysClient.getDept(eTask.getDeptId()).getData().getSort();
eTask.setWeight(sort);
}
eTask.setDemandCompletionTime(taskBlueprint.getDemandCompletionTime());
eTask.setStatus(0);
eTask.setIsDeleted(0);
eTask.setCreateTime(new Date());
eTask.setUpdateTime(new Date());
ieTaskService.save(eTask);
}
// 发送提示消息
sendMessage(String.valueOf(eTask.getDeptId()));
@ -80,71 +100,71 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
List<Examine> examines = eTask.getExamines();
// 库里的检验
QueryWrapper<Examine> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("dept_id", eTask.getDeptId());
queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId());
List<Examine> examinesInDB = examineService.list(queryWrapper);
// 要加的检验
List<Examine> examinesWillAdd = new ArrayList<>();
// 要去掉的检验
List<Examine> examinesWillSub = new ArrayList<>();
// 不变的检验
List<Examine> examinesWillKeep = new ArrayList<>();
// 计算出要保持的
for (Examine dbExamine : examinesInDB) {
// 判断对象是都在该集合中包含
if (isContain(examines, dbExamine)) {
// 如果在,添加到不变的检验接集合中
examinesWillKeep.add(dbExamine);
// 最新检验集合中删除包含的
for (Examine examine : examines) {
if (examine.getId().equals(dbExamine.getId())) {
examine.setIsDeleted(1);
}
}
// examines.remove(dbExamine);
// 之前检验集合中删除包含的
dbExamine.setIsDeleted(1);
// examinesInDB.remove(dbExamine);
}
}
// 要加的
for (Examine examine : examines) {
if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) {
examinesWillAdd.add(examine);
}
}
// 要去掉的
for (Examine examine : examinesInDB) {
if (examine.getIsDeleted() == 0) {
examinesWillSub.add(examine);
}
}
// 找样品当前位置?
String simpleCurrPlace = "";
for (Examine examine : examines) {
if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) {
simpleCurrPlace = examine.getSimpleCurrPlace();
break;
}
}
// 获取委托单所有样品
LambdaQueryWrapper<Simple> wrapperTemp = new LambdaQueryWrapper<>();
wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId());
wrapperTemp.orderByAsc(Simple::getSort);
List<Simple> simplesTemp = simpleService.list(wrapperTemp);
for (int i = 0; i < simplesTemp.size(); i++) {
simplesTemp.get(i).setIsDistribution(0);
}
simpleService.updateBatchById(simplesTemp);
// QueryWrapper<Examine> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("dept_id", eTask.getDeptId());
// queryWrapper.eq("entrust_id", taskBlueprint.getEntrustId());
// List<Examine> examinesInDB = examineService.list(queryWrapper);
//
// // 要加的检验
// List<Examine> examinesWillAdd = new ArrayList<>();
// // 要去掉的检验
// List<Examine> examinesWillSub = new ArrayList<>();
// // 不变的检验
// List<Examine> examinesWillKeep = new ArrayList<>();
//
// // 计算出要保持的
// for (Examine dbExamine : examinesInDB) {
// // 判断对象是都在该集合中包含
// if (isContain(examines, dbExamine)) {
// // 如果在,添加到不变的检验接集合中
// examinesWillKeep.add(dbExamine);
// // 最新检验集合中删除包含的
// for (Examine examine : examines) {
// if (examine.getId().equals(dbExamine.getId())) {
// examine.setIsDeleted(1);
// }
// }
//// examines.remove(dbExamine);
// // 之前检验集合中删除包含的
// dbExamine.setIsDeleted(1);
//// examinesInDB.remove(dbExamine);
// }
// }
// // 要加的
// for (Examine examine : examines) {
// if (examine.getIsDeleted() == null || examine.getIsDeleted() == 0) {
// examinesWillAdd.add(examine);
// }
// }
// // 要去掉的
// for (Examine examine : examinesInDB) {
// if (examine.getIsDeleted() == 0) {
// examinesWillSub.add(examine);
// }
// }
//
// // 找样品当前位置?
// String simpleCurrPlace = "";
// for (Examine examine : examines) {
// if (examine.getSimpleCurrPlace() != null && !"".equals(examine.getSimpleCurrPlace())) {
// simpleCurrPlace = examine.getSimpleCurrPlace();
// break;
// }
// }
//
// // 获取委托单所有样品
// LambdaQueryWrapper<Simple> wrapperTemp = new LambdaQueryWrapper<>();
// wrapperTemp.eq(Simple::getEntrustId, taskBlueprint.getEntrustId());
// wrapperTemp.orderByAsc(Simple::getSort);
// List<Simple> simplesTemp = simpleService.list(wrapperTemp);
// for (int i = 0; i < simplesTemp.size(); i++) {
// simplesTemp.get(i).setIsDistribution(0);
// }
// simpleService.updateBatchById(simplesTemp);
// 遍历检验
List<Examine> examinesWillAddTemp = new ArrayList<>();
for (Examine examine : examinesWillAdd) {
for (Examine examine : examines) {
if (!"".equals(examine.getExperieNum())) {
continue;
}
@ -171,7 +191,7 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
StringBuilder experieNum = new StringBuilder();
for (int i = min - 1; i < max; i++) {
simples.get(i).setIsDistribution(1);
experieNum.append(simples.get(i).getExperieNum());
experieNum.append(simples.get(i).getExperieNum()).append(",");
}
// simpleService.updateBatchById(simples);
@ -190,13 +210,39 @@ public class TaskBlueprintServiceImpl extends BaseServiceImpl<TaskBlueprintMappe
}
examineService.saveOrUpdateBatch(examinesWillAddTemp);
// 删掉要去掉的
List<Long> collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList());
// List<Long> collect = examinesWillSub.stream().map(Examine::getId).collect(Collectors.toList());
// examineService.removeByIds(collect);
}
// 筛选出驳回的检测数据
LambdaQueryWrapper<Examine> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Examine::getEntrustId, taskBlueprint.getEntrustId());
wrapper.eq(Examine::getStatus, -1);
List<Examine> examines = examineService.list(wrapper);
// 拿到需要删除的检测id集合,批量删除
List<Long> collect = examines.stream().map(Examine::getId).collect(Collectors.toList());
examineService.removeByIds(collect);
// 删除没有对应检测的子任务
LambdaQueryWrapper<ETask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ETask::getTaskBlueprintId, taskBlueprint.getId());
// 查询任务书下所有子任务
List<ETask> eTaskList = ieTaskService.list(queryWrapper);
// 如果不为空
if (CollectionUtils.isNotEmpty(eTaskList)) {
// 循环
for (ETask eTask : eTaskList) {
// 查询该子任务下所有的检测
LambdaQueryWrapper<Examine> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(Examine::getETaskId, eTask.getId());
List<Examine> examineList = examineService.list(wrapper2);
// 如果没有数据,删除该子任务
if (examineList == null || examineList.size() == 0) {
ieTaskService.removeById(eTask.getId());
}
}
}
}
// 第一次计划提交
else {
Random random = new Random();
long taskBlueprintId = random.nextLong();
taskBlueprint.setId(taskBlueprintId);
List<ETask> eTasks = taskBlueprint.getTasks();

Loading…
Cancel
Save