zjh
2024-07-10 02fc34a5283d43cf0aef9265123cf2f2dfac10a0
ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -59,6 +59,8 @@
    private LtkjMxjfxmzdService ltkjMxjfxmzdService;
    @Autowired
    private LtkjEjjfxmzdService ltkjEjjfxmzdService;
    @Autowired
    private TjCfService cfService;
    //将方法返回值解析成json格式
    public JSONObject getJSONObject(String builder) {
@@ -179,6 +181,7 @@
        dto.setSfjz("0");
        List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(), customer.getCardId());
        List<OutpintestapplyDetailsDto> detailsDtos = new ArrayList<>();
        List<OutpinmedicapplyDetilsDto> outpinmedicapplyDetilsDtos =new ArrayList<>();
        if (null != detailList && detailList.size() > 0) {
            LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
            wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
@@ -198,6 +201,17 @@
                            }
                            detailsDto.setSl(project.getSl());
                            detailsDtos.add(detailsDto);
                        }
                        if(project.getProId()==1740177341251154377L){
                            OutpinmedicapplyDetilsDto detilsDto=new OutpinmedicapplyDetilsDto();
                            detilsDto.setYpbm("00006670");
                            detilsDto.setPcbm("1");
                            detilsDto.setSl(1);
                            detilsDto.setDj(60);
                            detilsDto.setDcjl(1);
                            detilsDto.setPj(60);
                            detilsDto.setJj(60);
                            outpinmedicapplyDetilsDtos.add(detilsDto);
                        }
                    }
                }
@@ -249,18 +263,50 @@
                    }
                    ltkjJianchajianyanTreeService.save(tree);
                }
//                Map<String, Object> datas = object3.getJSONObject("ResultData");
//                datas.put("cardId", customer.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)));
            }
//            else {
//                return AjaxResult.error("检验申请失败!");
//            }
        }
        //药品申请
        if(outpinmedicapplyDetilsDtos.size()>0){
            OutpinmedicapplyDto dto1=new OutpinmedicapplyDto();
            dto1.setHisRegistrationId(customer.getCardId());
            dto1.setSfzh(customer.getCusIdcard());
            dto1.setSqysbm("00029");
            dto1.setMzksbm("0101");
            dto1.setSjrq(date);
            dto1.setCzybm("00029");
            dto1.setCzyksbm("0101");
            dto1.setDetails(outpinmedicapplyDetilsDtos);
            AjaxResult result = controller.Outpinmedicapply(dto1);
            String result1 = getAjaxResult(result);
            JSONObject object = getJSONObject(result1);
            String code = object.getStr("ResultCode");
            if(null !=code && code.equals("200")){
                JSONArray resultData = object.getJSONArray("ResultData");
                Map<String, Object> resultDatasss = (Map<String, Object>) resultData.get(0);
                String cfh = resultDatasss.get("cfh").toString();
                for (OutpinmedicapplyDetilsDto detilsDto : outpinmedicapplyDetilsDtos) {
                    TjCf cf=new TjCf();
                    cf.setCardId(customer.getCardId());
                    cf.setSfzh(customer.getCusIdcard());
                    cf.setCfh(cfh);
                    cf.setSqysbm("00029");
                    cf.setSqysxm("王健萍");
                    cf.setMzksbn("0101");
                    cf.setSqrq(date);
                    cf.setCzybm("00029");
                    cf.setYpbm(detilsDto.getYpbm());
                    cf.setYpmc("尿素[14C]呼气试验药盒");
                    cf.setSl(String.valueOf(detilsDto.getSl()));
                    cf.setDj(String.valueOf(detilsDto.getDj()));
                    cf.setDcjl(String.valueOf(detilsDto.getDcjl()));
                    cf.setPj(String.valueOf(detilsDto.getPj()));
                    cf.setJj(String.valueOf(detilsDto.getJj()));
                    cf.setCreateTime(new Date());
                    cfService.save(cf);
                }
            }
        }
        //门诊检查申请
@@ -472,6 +518,9 @@
        List<String> zlsqdh = orderService.getHuoQuZlsqdh(order.getCardId());
        List<String> cfhs = cfService.getCfhs(order.getCardId());
        //2.1.6.5 作废门诊检查申请
        if (null != jcsqdh && jcsqdh.size()>0) {
            for (String s : jcsqdh) {
@@ -524,6 +573,21 @@
//                }
            }
        }
        //作废药品申请
        if(null !=cfhs && cfhs.size()>0){
            for (String cfh : cfhs) {
                AjaxResult result = controller.Outpindelmedicapply(order.getCardId(), "00029", cfh);
                String result1 = getAjaxResult(result);
                JSONObject object = getJSONObject(result1);
                String code = object.getStr("ResultCode");
                if(null !=code && code.equals("200")){
                    cfService.delCfByCardId(cfh);
                }
            }
        }
        //2.1.3 门诊医生取消接诊
        ajaxResult = controller.Outpinunconapply(order.getCardId(), date, "00029");
        result2 = getAjaxResult(ajaxResult);