zjh
2024-07-02 a51a70b780ef0ed24abb81b096c80649a0255ece
ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
@@ -114,6 +114,14 @@
    private HisApiGetMethodService hisApiGetMethodService;
    @Resource
    private ISysConfigService configService;
    @Autowired
    private LtkjJfzhglmxjfxmzdService ltkjJfzhglmxjfxmzdService;
    @Autowired
    private LtkjMxjfxmzdService ltkjMxjfxmzdService;
    @Autowired
    private LtkjEjjfxmzdService ltkjEjjfxmzdService;
    @Autowired
    private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService;
    @Override
    public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) {
@@ -510,7 +518,7 @@
        for (String tjProId : tjProIds) {
            LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>();
            wqq.eq(TbTransition::getCusId, customer.getCusIdcard());
            TjProject project = projectService.selectTjProjectByProId(Long.valueOf(tjProId));
            TjProject project = projectService.getById(Long.valueOf(tjProId));
            if (null != project && project.getProParentId() == 0) {
                TjOrderRemark tjOrderRemark = new TjOrderRemark();
                tjOrderRemark.setProId(Long.valueOf(tjProId));
@@ -567,7 +575,7 @@
                        } else {
                            detailsDto.setSfzhfy("0");
                        }
                        detailsDto.setSl(1);
                        detailsDto.setSl(project.getSl());
                        detailsDtos.add(detailsDto);
                    }
                }
@@ -586,7 +594,7 @@
                        } else {
                            detailsDto.setSfzhfy("0");
                        }
                        detailsDto.setSl(1);
                        detailsDto.setSl(project.getSl());
                        detailsDtoss.add(detailsDto);
                    }
                }
@@ -605,7 +613,7 @@
                        } else {
                            detailsDto.setSfzhfy("0");
                        }
                        detailsDto.setSl(1);
                        detailsDto.setSl(project.getSl());
                        detailDtos.add(detailsDto);
                    }
                }
@@ -617,12 +625,10 @@
                wqq.in(TbTransition::getProId, Arrays.asList(tjProIds));
                TjProject projects = projectService.selectTjProjectByProId(Long.valueOf(tjProId));
                if (null != projects) {
                    TjProject projectss = projectService.selectTjProjectByProId(projects.getProParentId());
                    TjProject projectss = projectService.getById(projects.getProParentId());
                    if (null != projectss && projectss.getProParentId()==0L) {
                        projectList.add(projectss);
                    }
                }
//                List<Long> proIds = projectService.getTjProjectListBySoneId(tjProId).stream().map(TjProject::getProId).collect(Collectors.toList());
                TjOrderDetail detail = new TjOrderDetail();
@@ -644,6 +650,8 @@
            List<TbTransition> tbTransitionList = transitionService.list(wqq);
            if (null != tbTransitionList && tbTransitionList.size() > 0) {
                for (TbTransition transition : tbTransitionList) {
                    transition.setTjNum(order.getTjNumber());
                    transition.setCardId(order.getCardId());
                    transition.setNowPrice(transition.getOrdPrice().multiply(BigDecimal.valueOf(Double.parseDouble(tjFlowingWater.getDiscount())).divide(BigDecimal.valueOf(10))));
                    transitionService.updateById(transition);
                    TjProject tjProject = projectService.selectTjProjectByProId(transition.getProId());
@@ -736,7 +744,7 @@
                            } else {
                                detailsDto.setSfzhfy("0");
                            }
                            detailsDto.setSl(1);
                            detailsDto.setSl(project.getSl());
                            detailsDtos.add(detailsDto);
                        }
                    }
@@ -755,7 +763,7 @@
                            } else {
                                detailsDto.setSfzhfy("0");
                            }
                            detailsDto.setSl(1);
                            detailsDto.setSl(project.getSl());
                            detailsDtoss.add(detailsDto);
                        }
                    }
@@ -774,7 +782,7 @@
                            } else {
                                detailsDto.setSfzhfy("0");
                            }
                            detailsDto.setSl(1);
                            detailsDto.setSl(project.getSl());
                            detailDtos.add(detailsDto);
                        }
                    }
@@ -789,26 +797,58 @@
            if(detailsDtos.size()>0){
                OutpintestapplyDto dto = new OutpintestapplyDto();
                dto.setHisRegistrationId(order.getCardId());
                dto.setSfjz(customer.getCusIdcard());
                dto.setSqysbm(sysUser.getUserName());
                dto.setSfzh(customer.getCusIdcard());
                dto.setSqysbm("00029");
                dto.setMzksbm("0101");
                dto.setSjrq(date);
                dto.setCzybm("00029");
                dto.setCzyksbm("0101");
                dto.setSfjz("1");
                dto.setSfjz("0");
                dto.setDetails(detailsDtos.stream().distinct().collect(Collectors.toList()));
                AjaxResult ajaxResult1 = controller.Outpintestapply(dto);
                String result5 = getAjaxResult(ajaxResult1);
                JSONObject object3 = getJSONObject(result5);
                String code3 = object3.getStr("ResultCode");
                if (code3.equals("0")) {
                    Map<String, Object> datas = object3.getJSONObject("ResultData");
                    datas.put("cardId", order.getCardId());
                    JSONObject object4 = JSONUtil.parseObj(datas);
                    LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                    lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintestapply");
                    HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                    hisApiGetMethodService.save(object4, "Outpintestapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dto)));
                    List<OutpintestapplyDetailsDto> details = dto.getDetails();
                    for (OutpintestapplyDetailsDto detail : details) {
                        LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
                        tree.setCardId(dto.getHisRegistrationId());
                        LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
                        wrapper4.eq(TjCustomer::getCardId, tree.getCardId());
                        TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4);
                        tree.setPationid(tjCustomer.getPationId());
                        JSONObject resultData = object3.getJSONObject("ResultData");
                        tree.setSqdh(resultData.getStr("jysqdh"));
                        tree.setFyhj(resultData.getStr("fyhj"));
                        String mxfyxmbm = detail.getMxfyxmbm();
                        tree.setHisXmdm(mxfyxmbm);
                        tree.setType("检验");
                        LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>();
                        wrapper.eq(TjProject::getHisXmbm, mxfyxmbm);
                        List<TjProject> list = projectService.list(wrapper);
                        String tj_price = "";
                        for (TjProject project : list) {
                            tj_price += project.getProPrice() + "、";
                        }
                        tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1));
                        LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
                        if (detail.getSfzhfy().equals("1"))
                            wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm);
                        else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm);
                        List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1);
                        if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) {
                            String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm();
                            LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>();
                            wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm);
                            LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2);
                            LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>();
                            wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm());
                            LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                            tree.setXmfl(ejjfxmzd.getYjkmdm());
                        }
                        ltkjJianchajianyanTreeService.save(tree);
                    }
                }
            }
@@ -818,24 +858,56 @@
                OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto();
                outpinexamapplyDto.setHisRegistrationId(order.getCardId());
                outpinexamapplyDto.setSfzh(customer.getCusIdcard());
                outpinexamapplyDto.setSqysbm(sysUser.getUserName());
                outpinexamapplyDto.setSqysbm("00029");
                outpinexamapplyDto.setMzksbm("0101");
                outpinexamapplyDto.setCzybm("00029");
                outpinexamapplyDto.setCzyksbm("0101");
                outpinexamapplyDto.setSfjz("0");
                outpinexamapplyDto.setDetails(detailsDtoss.stream().distinct().collect(Collectors.toList()));
                AjaxResult ajaxResult2 = controller.Outpinexamapply(outpinexamapplyDto);
                String result6 = getAjaxResult(ajaxResult2);
                JSONObject object5 = getJSONObject(result6);
                String code4 = object5.getStr("ResultCode");
                if (code4.equals("0")) {
                    Map<String, Object> map = object5.getJSONObject("ResultData");
                    map.put("cardId", order.getCardId());
                    JSONObject jsonObject = JSONUtil.parseObj(map);
                    LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                    lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinexamapply");
                    HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                    hisApiGetMethodService.save(jsonObject, "Outpinexamapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinexamapplyDto)));
                    List<OutpintestapplyDetailsDto> details = outpinexamapplyDto.getDetails();
                    for (OutpintestapplyDetailsDto detail : details) {
                        LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
                        tree.setCardId(outpinexamapplyDto.getHisRegistrationId());
                        LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
                        wrapper4.eq(TjCustomer::getCardId, tree.getCardId());
                        TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4);
                        tree.setPationid(tjCustomer.getPationId());
                        JSONObject resultData = object5.getJSONObject("ResultData");
                        tree.setSqdh(resultData.getStr("jcsqdh"));
                        tree.setFyhj(resultData.getStr("fyhj"));
                        String mxfyxmbm = detail.getMxfyxmbm();
                        tree.setHisXmdm(mxfyxmbm);
                        tree.setType("检查");
                        LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>();
                        wrapper.eq(TjProject::getHisXmbm, mxfyxmbm);
                        List<TjProject> list = projectService.list(wrapper);
                        String tj_price = "";
                        for (TjProject project : list) {
                            tj_price += project.getProPrice() + "、";
                        }
                        tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1));
                        LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
                        if (detail.getSfzhfy().equals("1"))
                            wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm);
                        else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm);
                        List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1);
                        if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) {
                            String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm();
                            LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>();
                            wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm);
                            LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2);
                            LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>();
                            wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm());
                            LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                            tree.setXmfl(ejjfxmzd.getYjkmdm());
                        }
                        ltkjJianchajianyanTreeService.save(tree);
                    }
                }
            }
@@ -845,28 +917,59 @@
                OutpintreatapplyDto dao = new OutpintreatapplyDto();
                dao.setHisRegistrationId(order.getCardId());
                dao.setSfzh(customer.getCusIdcard());
                dao.setSqysbm(sysUser.getUserName());
                dao.setSqysbm("00029");
                dao.setMzksbm("0101");
                dao.setSjrq(date);
                dao.setCzybm("00029");
                dao.setCzyksbm("0101");
                dao.setSfjz("0");
                dao.setDetails(detailDtos.stream().distinct().collect(Collectors.toList()));
                AjaxResult mzylyzsq1 = controller.Outpintreatapply(dao);
                String mzylyzsq2 = getAjaxResult(mzylyzsq1);
                JSONObject mzylyzsq3 = getJSONObject(mzylyzsq2);
                String code5 = mzylyzsq3.getStr("ResultCode");
                if (code5.equals("0")) {
                    Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData");
                    map.put("cardId", order.getCardId());
                    JSONObject jsonObject = JSONUtil.parseObj(map);
                    LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                    lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintreatapply");
                    HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                    hisApiGetMethodService.save(jsonObject, "Outpintreatapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dao)));
                    List<OutpintestapplyDetailsDto> details1 = dao.getDetails();
                    for (OutpintestapplyDetailsDto detail : details1) {
                        LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
                        tree.setCardId(dao.getHisRegistrationId());
                        LambdaQueryWrapper<TjCustomer> wrapper4 = new LambdaQueryWrapper<>();
                        wrapper4.eq(TjCustomer::getCardId, tree.getCardId());
                        TjCustomer tjCustomer = tjCustomerService.getOne(wrapper4);
                        tree.setPationid(tjCustomer.getPationId());
                        JSONObject resultData = mzylyzsq3.getJSONObject("ResultData");
                        tree.setSqdh(resultData.getStr("zlczh"));
                        tree.setFyhj(resultData.getStr("fyhj"));
                        String mxfyxmbm = detail.getMxfyxmbm();
                        tree.setHisXmdm(mxfyxmbm);
                        tree.setType("处置");
                        LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>();
                        wrapper.eq(TjProject::getHisXmbm, mxfyxmbm);
                        List<TjProject> list = projectService.list(wrapper);
                        String tj_price = "";
                        for (TjProject project : list) {
                            tj_price += project.getProPrice() + "、";
                        }
                        tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1));
                        LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
                        if (detail.getSfzhfy().equals("1"))
                            wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm);
                        else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm);
                        List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1);
                        if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) {
                            String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm();
                            LambdaQueryWrapper<LtkjMxjfxmzd> wrapper2 = new LambdaQueryWrapper<>();
                            wrapper2.eq(LtkjMxjfxmzd::getXmdm, xmdm);
                            LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper2);
                            LambdaQueryWrapper<LtkjEjjfxmzd> wrapper3 = new LambdaQueryWrapper<>();
                            wrapper3.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm());
                            LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                            tree.setXmfl(ejjfxmzd.getYjkmdm());
                        }
                        ltkjJianchajianyanTreeService.save(tree);
                    }
                }
            }
        }
@@ -2291,11 +2394,14 @@
    //临时表添加单项
    public void saveRedisTransitionByProId(String cusId,String cardId, List<Long> proIds) {
        for (Long proId : proIds) {
            List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
            if (null != transitionList && transitionList.size() > 0) {
                continue;
            TjProject project = projectService.selectTjProjectByProId(proId);
            if(null !=project){ //&& (!project.getProName().contains("静脉采血")|| !project.getProName().contains("费"))
                List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
                if (null == transitionList || transitionList.size() == 0) {
                    transitionService.saveRedisTransitionByProId(cusId,cardId, proId);
                }
            }
            transitionService.saveRedisTransitionByProId(cusId,cardId, proId);
//            if(null !=project) transitionService.saveRedisTransitionByProId(cusId,cardId, proId);
        }
    }