| | |
| | | import com.ltkj.web.controller.lis.LisApiMethod; |
| | | import com.ltkj.web.controller.pacs.PacsApiMethodService; |
| | | import com.ltkj.web.controller.service.TjSysAsyncServiceImpl; |
| | | import com.ltkj.web.controller.system.TjSamplingController; |
| | | import com.ltkj.web.controller.system.SamplingServiceApi; |
| | | import jdk.nashorn.internal.runtime.logging.Logger; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private ITjSamplingService tjSamplingService; |
| | | @Autowired |
| | | private TjSamplingController samplingController; |
| | | private SamplingServiceApi samplingService; |
| | | |
| | | |
| | | //将方法返回值解析成json格式 |
| | |
| | | String mxfyxmbm = detail.getMxfyxmbm(); |
| | | tree.setHisXmdm(mxfyxmbm); |
| | | tree.setType("检验"); |
| | | tree.setService("his"); |
| | | tree.setTjPrice(String.valueOf(detail.getProjg())); |
| | | LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); |
| | | if (detail.getSfzhfy().equals("1")) |
| | |
| | | String mxfyxmbm = detail.getMxfyxmbm(); |
| | | tree.setHisXmdm(mxfyxmbm); |
| | | tree.setType("检查"); |
| | | tree.setService("his"); |
| | | tree.setTjPrice(String.valueOf(detail.getProjg())); |
| | | LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); |
| | | if (detail.getSfzhfy().equals("1")) |
| | |
| | | LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjSampling::getTjNum,tjOrder.getTjNumber()); |
| | | List<TjSampling> list = tjSamplingService.list(wrapper); |
| | | // log.info("采样数据 ->{}",list); |
| | | Map<String, List<TjSampling>> listMap = list.stream().collect(Collectors.groupingBy(TjSampling::getSpecimenTypeCode)); |
| | | log.info("采样数据 ->{}",list); |
| | | if (!list.isEmpty()) { |
| | | Map<String, List<TjSampling>> listMap = list.stream().collect(Collectors.groupingBy(TjSampling::getSpecimenTypeCode)); |
| | | // log.info("分组后 ->{}",JSONUtil.toJsonStr(listMap)); |
| | | ArrayList<String> ids = new ArrayList<>(); |
| | | for (Map.Entry<String, List<TjSampling>> entry : listMap.entrySet()) { |
| | | 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() > 1){ |
| | | // 进行合并 |
| | | List<String> stringList = samplings.stream().map(TjSampling::getId).collect(Collectors.toList()); |
| | | // Lis标本代码 |
| | | String specimenTypeCode = entry.getKey(); |
| | | List<TjSampling> samplings = entry.getValue(); |
| | | if (samplings.size() > 1) { |
| | | // 进行合并 |
| | | 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); |
| | | for (int i = 0; i < stringList.size(); i++) { |
| | | String s = stringList.get(i); |
| | | if (tjSamplingService.isMergeItem(s) != 0) { |
| | | stringList.remove(s); |
| | | ids.add(s); |
| | | } |
| | | } |
| | | String id = tjSamplingService.mergeCaiYangApi(stringList); |
| | | ids.add(id); |
| | | } else { |
| | | ids.add(samplings.get(0).getId()); |
| | | } |
| | | String id = tjSamplingService.mergeCaiYangApi(stringList); |
| | | ids.add(id); |
| | | }else { |
| | | ids.add(samplings.get(0).getId()); |
| | | } |
| | | } |
| | | Boolean confirmed = samplingController.confirmSamplingApi(ids, "Y", "Y"); |
| | | if (!confirmed){ |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("处理失败"); |
| | | Boolean confirmed = samplingService.confirmSamplingApi(ids, "Y", "N"); |
| | | if (!confirmed) { |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return AjaxResult.error("处理失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | // 作废检验申请 |
| | | // 作废检验申请 TODO |
| | | if (jysqdh != null && !jysqdh.isEmpty()){ |
| | | for (String sqdh : jysqdh) { |
| | | List<String> huoQuJysqdhNotBuLu = orderService.getHuoQuJysqdhNotBuLu(order.getCardId()); |
| | | List<String> huoQuJysqdhBuLu = orderService.getHuoQuJysqdhBuLu(order.getCardId()); |
| | | for (String sqdh : huoQuJysqdhNotBuLu) { |
| | | AjaxResult cancelLisAjaxResult = lisApiMethod.cancel(sqdh, order.getCardId(), customer1.getCusName()); |
| | | log.info("lis请求返回 ->{}",JSONUtil.toJsonStr(cancelLisAjaxResult)); |
| | | String result = cancelLisAjaxResult.get("data").toString(); |
| | | JSONObject object = JSONUtil.parseObj(result); |
| | | String code= object.getStr("ResultCode"); |
| | | if(code.equals("1")){ |
| | | if (cancelLisAjaxResult.get("code").toString().equals("200")){ |
| | | String result = cancelLisAjaxResult.get("data").toString(); |
| | | JSONObject object = JSONUtil.parseObj(result); |
| | | String code= object.getStr("ResultCode"); |
| | | if(code.equals("1")){ |
| | | orderService.delHuoQuJysqdh(order.getCardId()); |
| | | } |
| | | } else { |
| | | String str = JSONUtil.parseObj(cancelLisAjaxResult.get("result").toString()).getJSONObject("Response").getStr("ResultContent"); |
| | | if (str.contains("申请已作废")) |
| | | orderService.delHuoQuJysqdh(order.getCardId()); |
| | | } |
| | | } |
| | | for (String s : huoQuJysqdhBuLu) { |
| | | ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", s); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuJysqdh(order.getCardId()); |
| | | } |
| | | } |