申领列表所有状态总数量计算错误问题 + 样品数值未填写抛异常提示 + 计算阴性、阳性样品数量用于打印 + 判断应实验样品数量和实际样品数量是否相等 + 解析兰所多版和非兰所时给前端返回阴阳性数量 + 解决一个用户多个角色时访问用户列表报错问题

dev
swj 3 years ago
parent d691140684
commit b10504aed5
  1. 2
      lab-service/lab-capital/src/main/java/org/springblade/lims/goods/controller/ApplyController.java
  2. 50
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  3. 20
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  4. 24
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -71,7 +71,7 @@ public class ApplyController extends BladeController {
LambdaQueryWrapper<Apply> wrapper = new LambdaQueryWrapper<>(apply);
if ("1".equals(apply.getIsGetAll())) {
if (apply.getStatus() == null) {
wrapper.in(Apply::getStatus, 1, 3, 4);
wrapper.in(Apply::getStatus, 1, 2, 3, 4);
}
}

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

@ -1358,10 +1358,10 @@ 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).getExperieNum());
map.put("value1", arrVOList.get(i).getCtValue());
map.put("value1", replaceNullBySpace(arrVOList.get(i).getCtValue()));
map.put("result1", arrVOList.get(i).getValue());
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i).getExperieNum());
map.put("value2", arrVOList.get(arrVOList.size() / 2 + i).getCtValue());
map.put("value2", replaceNullBySpace(arrVOList.get(arrVOList.size() / 2 + i).getCtValue()));
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i).getValue());
resultList1.add(map);
}
@ -1369,11 +1369,11 @@ 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).getExperieNum());
map.put("value1", arrVOList.get(i).getCtValue());
map.put("value1", replaceNullBySpace(arrVOList.get(i).getCtValue()));
map.put("result1", arrVOList.get(i).getValue());
if (i < arrVOList.size() / 2) {
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i + 1).getExperieNum());
map.put("value2", arrVOList.get(arrVOList.size() / 2 + i + 1).getCtValue());
map.put("value2", replaceNullBySpace(arrVOList.get(arrVOList.size() / 2 + i + 1).getCtValue()));
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue());
}
resultList1.add(map);
@ -2933,6 +2933,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
}
/**
* 通过空格替换null
* @param ctValue
* @return
*/
private String replaceNullBySpace(String ctValue) {
if (ctValue == null || ctValue.equals("null")) {
return " ";
}
return ctValue;
}
@Override
public void simpleRegisterPrint(String id, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();

@ -196,20 +196,22 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
@Override
public IPage<User> selectUserPage(IPage<User> page, User user, Long deptId, String tenantId) {
String roleIdsTemp = AuthUtil.getUser().getRoleId();
String[] roleIds = roleIdsTemp.split(",");
List<Long> deptIdList = SysCache.getDeptChildIds(deptId);
String data = sysClient.getRoleAlias(Long.valueOf(AuthUtil.getUser().getRoleId())).getData();
// 那系统参数角色别名
String roleAlais = sysClient.getParamValue("hide_role_alias").getData();
List<Long> userIds = new ArrayList<>();
if (!roleAlais.equals(data)) {
String roleId = sysClient.getRoleIdByAlias(tenantId, roleAlais).getData();
String roleName = sysClient.getRoleName(Long.valueOf(roleId)).getData();
System.out.println("roleName: " + roleName);
List<User> users = listRolebyId(roleName);
List<Long> collect = users.stream().map(User::getId).collect(Collectors.toList());
userIds.addAll(collect);
for (String myRoleId : roleIds) {
String data = sysClient.getRoleAlias(Long.valueOf(myRoleId)).getData();
// 拿系统参数角色别名
String roleAlais = sysClient.getParamValue("hide_role_alias").getData();
if (!roleAlais.equals(data)) {
String roleId = sysClient.getRoleIdByAlias(tenantId, roleAlais).getData();
String roleName = sysClient.getRoleName(Long.valueOf(roleId)).getData();
List<User> users = listRolebyId(roleName);
List<Long> collect = users.stream().map(User::getId).collect(Collectors.toList());
userIds.addAll(collect);
}
}
System.out.println("userIds: " + userIds);
return page.setRecords(baseMapper.selectUserPage(page, user, deptIdList, tenantId, userIds));
}

Loading…
Cancel
Save