| | |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | List<TbTransition> detailList = transitionService.getBlTbTransitionListByCusId(customer.getCusIdcard(), cardId, jxbz); |
| | | // Boolean useLisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order); |
| | | List<OutpinmedicapplyDetilsDto> outpinmedicapplyDetilsDtos = new ArrayList<>(); |
| | | String isRequestLisAllzx = configService.selectConfigByKey("jcx_is_requestLisAllzx"); |
| | | |
| | | if (isTuanTiPiao) { |
| | | |
| | | // 检查申请 |
| | | pacsReg(order, customer, jianChaProjects); |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | |
| | | wrapper.eq(TjSampling::getJxbz, jxbz); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | log.info("采样数据 ->{}", JSONUtil.toJsonStr(list)); |
| | | if (!list.isEmpty()) { |
| | | // Map<String, List<TjSampling>> listMap = list.stream().collect(Collectors.groupingBy(TjSampling::getSpecimenTypeCode)); |
| | | Map<String, List<TjSampling>> listMap = list.stream() |
| | | .collect(Collectors.groupingBy(p->p.getSpecimenTypeCode()+"_"+p.getYb())); |
| | | |
| | | log.info("分组后 ->{}", JSONUtil.toJsonStr(listMap)); |
| | | ArrayList<String> ids = new ArrayList<>(); |
| | | for (Map.Entry<String, List<TjSampling>> entry : listMap.entrySet()) { |
| | | log.info("key ->{},val ->{}", entry.getKey(), entry.getValue()); |
| | | // Lis标本代码 |
| | | String specimenTypeCode = entry.getKey(); |
| | | List<TjSampling> samplings = entry.getValue(); |
| | | if (samplings.size() >= 2) { |
| | | // 进行合并 |
| | | List<String> stringList = samplings.stream().map(TjSampling::getId).collect(Collectors.toList()); |
| | | // log.info("提取id ->{}",stringList); |
| | | for (int i = 0; i < stringList.size(); i++) { |
| | | String s = stringList.get(i); |
| | | if (tjSamplingService.isMergeItem(s) != 0) { |
| | | stringList.remove(s); |
| | | ids.add(s); |
| | | } |
| | | if (isRequestLisAllzx != null && isRequestLisAllzx.equalsIgnoreCase("Y")){ |
| | | log.info("补录项目进入团体根据小项标本合并发送方法"); |
| | | |
| | | if(null !=list && !list.isEmpty()){ |
| | | List<String> strings = list.stream().map(TjSampling::getProId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<TjProject> wrapper1 = new LambdaQueryWrapper<>(); |
| | | wrapper1.in(TjProject::getProParentId,strings); |
| | | wrapper1.eq(TjProject::getProStatus,0); |
| | | wrapper1.groupBy(TjProject::getProId); |
| | | List<TjProject> tjProjectList = projectService.list(wrapper1); |
| | | if(null != tjProjectList && !tjProjectList.isEmpty()){ |
| | | Map<String, List<TjProject>> listMap = tjProjectList.stream() |
| | | .collect(Collectors.groupingBy(p->p.getSpecimenType()+"_"+p.getYb())); |
| | | |
| | | log.info("分组后 ->{}",JSONUtil.toJsonStr(listMap)); |
| | | boolean save = lisApiMethod.save(listMap, order, customer); |
| | | if (!save) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("处理失败"); |
| | | } |
| | | if (stringList.size() > 1) { |
| | | String id = tjSamplingService.mergeCaiYangApi(stringList, lis_tmh_prefix); |
| | | ids.add(id); |
| | | } else { |
| | | ids.add(stringList.get(0)); |
| | | for (TjSampling tjSampling : list) { |
| | | tjSampling.setIsSignFor("0"); |
| | | } |
| | | } else { |
| | | ids.add(samplings.get(0).getId()); |
| | | tjSamplingService.updateBatchById(list); |
| | | } |
| | | } |
| | | Boolean confirmed = samplingServiceApi.confirmSamplingApi(ids, "Y", "N"); |
| | | if (!confirmed) |
| | | return AjaxResult.error("处理失败"); |
| | | |
| | | |
| | | }else { |
| | | if (!list.isEmpty()) { |
| | | // Map<String, List<TjSampling>> listMap = list.stream().collect(Collectors.groupingBy(TjSampling::getSpecimenTypeCode)); |
| | | Map<String, List<TjSampling>> listMap = list.stream() |
| | | .collect(Collectors.groupingBy(p->p.getSpecimenTypeCode()+"_"+p.getYb())); |
| | | |
| | | log.info("分组后 ->{}", JSONUtil.toJsonStr(listMap)); |
| | | ArrayList<String> ids = new ArrayList<>(); |
| | | for (Map.Entry<String, List<TjSampling>> entry : listMap.entrySet()) { |
| | | log.info("key ->{},val ->{}", entry.getKey(), entry.getValue()); |
| | | // Lis标本代码 |
| | | String specimenTypeCode = entry.getKey(); |
| | | List<TjSampling> samplings = entry.getValue(); |
| | | if (samplings.size() >= 2) { |
| | | // 进行合并 |
| | | List<String> stringList = samplings.stream().map(TjSampling::getId).collect(Collectors.toList()); |
| | | // log.info("提取id ->{}",stringList); |
| | | for (int i = 0; i < stringList.size(); i++) { |
| | | String s = stringList.get(i); |
| | | if (tjSamplingService.isMergeItem(s) != 0) { |
| | | stringList.remove(s); |
| | | ids.add(s); |
| | | } |
| | | } |
| | | if (stringList.size() > 1) { |
| | | String id = tjSamplingService.mergeCaiYangApi(stringList, lis_tmh_prefix); |
| | | ids.add(id); |
| | | } else { |
| | | ids.add(stringList.get(0)); |
| | | } |
| | | } else { |
| | | ids.add(samplings.get(0).getId()); |
| | | } |
| | | } |
| | | Boolean confirmed = samplingServiceApi.confirmSamplingApi(ids, "Y", "N"); |
| | | if (!confirmed) |
| | | return AjaxResult.error("处理失败"); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | List<TjOutpinmedicXm> outpinmedicXms = tjOutpinmedicXmService.list(); |
| | | //检验申请 |