| | |
| | | Integer userId = null; |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | userId = map1.get("userId"); |
| | | userName=userMapper.selectById(map1.get("userId")).getName(); |
| | | userName = userMapper.selectById(map1.get("userId")).getName(); |
| | | insOrderPlanDTO.setUserId(null); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//试验室 |
| | |
| | | JSONObject jo = JSON.parseObject(JSON.toJSONString(v)); |
| | | InsProduct insProduct = new InsProduct(); |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | InsProductResult result; |
| | | if (CollectionUtils.isEmpty(results)) { |
| | | result = new InsProductResult(); |
| | |
| | | result.setUpdateTime(LocalDateTime.now()); |
| | | insProductResultMapper.updateById(result); |
| | | } |
| | | |
| | | /*如果是第一次选择设备信息,且还有其余样品也有同一个经验项目,那么所有样品的该项目都用这个设备信息*/ |
| | | //先查询是否还有其余样品 |
| | | InsProduct product = insProductMapper.selectById(insProduct.getId()); |
| | | Integer insSampleId = product.getInsSampleId(); |
| | | List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSampleMapper.selectById(insSampleId).getInsOrderId())); |
| | | if (insSamples.size() > 1) { |
| | | //存在其余样品,查询是否有同一种检验项目 |
| | | for (InsSample sample : insSamples.stream().filter(insSample -> !insSample.getId().equals(insSampleId)).collect(Collectors.toList())) { |
| | | InsProduct product1 = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getState, 1) |
| | | .eq(InsProduct::getInsSampleId, sample.getId()) |
| | | .eq(InsProduct::getInspectionItem, product.getInspectionItem()) |
| | | .eq(InsProduct::getInspectionItemEn, product.getInspectionItemEn()) |
| | | .eq(InsProduct::getInspectionItemSubclass, product.getInspectionItemSubclass()) |
| | | .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn()) |
| | | .eq(InsProduct::getTemplateId, product.getTemplateId()) |
| | | .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId()) |
| | | ); |
| | | if (ObjectUtils.isNotEmpty(product1)){ |
| | | //如果存在项目,查询是否有表 |
| | | InsProductResult productResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, product1.getId())); |
| | | if (ObjectUtils.isEmpty(productResult)){ |
| | | //没有表新建表 |
| | | productResult = new InsProductResult(); |
| | | productResult.setInsProductId(product1.getId()); |
| | | productResult.setEquipValue(result.getEquipValue()); |
| | | productResult.setEquipName(result.getEquipValue()); |
| | | productResult.setCreateUser(userId); |
| | | productResult.setUpdateUser(userId); |
| | | insProductResultMapper.insert(productResult); |
| | | }else if(ObjectUtils.isEmpty(productResult.getEquipValue())){ |
| | | //有表判断是否有设备 |
| | | productResult.setEquipValue(result.getEquipValue()); |
| | | productResult.setEquipName(result.getEquipValue()); |
| | | productResult.setUpdateUser(userId); |
| | | productResult.setUpdateTime(LocalDateTime.now()); |
| | | insProductResultMapper.updateById(productResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | insProduct.setUpdateUser(userId); |
| | | insProductMapper.updateById(insProduct); |
| | | insProductUserMapper.insert(new InsProductUser(null, userId, LocalDateTime.now(), insProduct.getId())); |
| | |
| | | Long l = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId())); |
| | | Long l1 = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()).isNotNull(InsProduct::getInsResult)); |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | )); |
| | | if (l == l1) { |
| | | insSample.setInsState(2); |
| | | } |
| | | insSampleMapper.updateById(insSample); |
| | | /*校验一下result表*/ |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProduct.getId()).orderByDesc(InsProductResult::getId)); |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | if (insProductResults.size() > 1) { |
| | | insProductResultMapper.deleteById(insProductResults.get(0)); |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | }); |
| | | return insContext.keySet().stream().findFirst().orElse(null); |
| | |
| | | int orderId = insSampleMapper.selectById(sampleId).getInsOrderId(); |
| | | // 通过订单id查找所有样本id |
| | | List<Integer> sampleIds = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId)).stream().map(InsSample::getId).collect(Collectors.toList()); |
| | | // 通过检查每一个样本id查到属于检验项结论 is null的数量 |
| | | Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery().in(InsProduct::getInsSampleId, sampleIds).isNull(InsProduct::getInsResult).eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()).eq(InsProduct::getState, 1)); |
| | | // 通过检查每一个样本id查到属于检验项结论 is null 或者 =2 的数量 |
| | | Long count = insProductMapper.selectCount(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, sampleIds) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | ) |
| | | //.isNull(InsProduct::getInsResult) |
| | | .eq(InsProduct::getSonLaboratory, insProduct.getSonLaboratory()) |
| | | .eq(InsProduct::getState, 1)); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | |
| | | textRenderData.setText("√"); |
| | | break; |
| | | case 0: |
| | | resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass())); |
| | | resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn())); |
| | | String current = resultCh.get(); |
| | | // 使用 Set 来保持唯一项 |
| | | Set<String> uniqueItems = new HashSet<>(); |
| | | if (!current.isEmpty()) { |
| | | // 分割当前字符串并加入到 Set 中 |
| | | String[] items = current.split("、"); |
| | | for (String item : items) { |
| | | if (!item.isEmpty()) { |
| | | uniqueItems.add(item); |
| | | } |
| | | } |
| | | } |
| | | // 处理新数据 |
| | | String newItem = p.getInspectionItem() + |
| | | (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass()); |
| | | uniqueItems.add(newItem); |
| | | |
| | | // 连接唯一项并更新 AtomicReference |
| | | String result = String.join("、", uniqueItems); |
| | | resultCh.set(result); |
| | | //resultCh.set(resultCh.get() + "、" + p.getInspectionItem() + (Objects.equals(p.getInspectionItemSubclass(), "") ? "" : " " + p.getInspectionItemSubclass())); |
| | | |
| | | String current1 = resultEn.get(); |
| | | // 使用 Set 来保持唯一项 |
| | | Set<String> uniqueItems1 = new HashSet<>(); |
| | | if (!current1.isEmpty()) { |
| | | // 分割当前字符串并加入到 Set 中 |
| | | String[] items = current1.split("、"); |
| | | for (String item : items) { |
| | | if (!item.isEmpty()) { |
| | | uniqueItems1.add(item); |
| | | } |
| | | } |
| | | } |
| | | // 处理新数据 |
| | | String newItem1 = p.getInspectionItemEn() + |
| | | ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn()); |
| | | uniqueItems1.add(newItem1); |
| | | // 连接唯一项并更新 AtomicReference |
| | | String result1 = String.join("、", uniqueItems1); |
| | | resultEn.set(result1); |
| | | //resultEn.set(resultEn.get() + "、" + p.getInspectionItemEn() + ((Objects.equals(p.getInspectionItemSubclassEn(), "") || Objects.equals(p.getInspectionItemSubclassEn(), null)) ? "" : " " + p.getInspectionItemSubclassEn())); |
| | | textRenderData.setText("×"); |
| | | break; |
| | | default: |
| | |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); |
| | | } |
| | | } else { |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); |
| | | textRenderData.setText(v.get("v") == null ? "" : v.get("v") + "∑" + jo1.get("mc")); |
| | | } |
| | | if (jo1.get("mc") != null) { |
| | | textRenderData.setText(textRenderData.getText() + "∑" + jo1.get("mc")); |
| | |
| | | CompletableFuture.supplyAsync(() -> { |
| | | List<Integer> ips = insProducts.stream().map(InsProduct::getId).distinct().collect(Collectors.toList()); |
| | | for (Integer ip : ips) { |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, ip).orderByDesc(InsProductResult::getId)); |
| | | List<InsProductResult> insProductResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, ip)); |
| | | if (insProductResults.size() > 1) { |
| | | insProductResultMapper.deleteById(insProductResults.get(0)); |
| | | for (int i = 1; i < insProductResults.size(); i++) { |
| | | insProductResultMapper.deleteById(insProductResults.get(i)); |
| | | } |
| | | } |
| | | } |
| | | return null; |