zjh
2024-07-30 2d2665c4e27393cacde08f2b5980ffcb58dfa284
ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -20,10 +20,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/* @Authot:zjh
@@ -77,22 +74,11 @@
    //对接his总接口  注册挂号接诊申请单操作
    @Logger
    public AjaxResult HisApiMethods(TjCustomer customer, Long orderId) {
        String jzh=null;
        try {
        TjOrder tjOrder = orderService.getById(orderId);
        Date dates = new Date();
        final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
//        AjaxResult result = controller.Outpincreateapply(customer);
//        String result1 = getAjaxResult(result);
//        JSONObject object = getJSONObject(result1);
//        String code = object.getStr("ResultCode");
//        if (code.equals("0")) {
//            JSONArray resultDatass = object.getJSONArray("ResultData");
//            Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0);
//            if (null != resultData && resultData.size() > 0) {
//                String pationid = resultData.get("PationId").toString();
//                if (null != pationid) {
//                customer.setPationId(pationid);
//                customerService.updateById(customer);
        OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
        outpinregapplyDto.setPationid(customer.getPationId());
        outpinregapplyDto.setSqysbm("00029");
@@ -113,6 +99,7 @@
            if (null != resultDatas && resultDatas.size() > 0) {
                Map<String, Object> resultDatasss = (Map<String, Object>) resultDatas.get(0);
                String hisRegistrationId = resultDatasss.get("his_registration_id").toString();
                    jzh=hisRegistrationId;
                //保存挂号入参出参
                resultDatasss.put("cardId",hisRegistrationId);
                JSONObject object4 = JSONUtil.parseObj(resultDatasss);
@@ -160,14 +147,13 @@
            dto.setSfqj("0");
            dto.setJzqk(9);
            controller.Outpinimpapply(dto);
            return tijianshenqing(customer, date,tjOrder.getCardId());
        }
//                }
//            }
//        }
        return AjaxResult.error();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error().put("jzh",jzh);
        }
    }
@@ -288,12 +274,11 @@
                        LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                        tree.setXmfl(ejjfxmzd.getYjkmdm());
                    }
                    tree.setCreateTime(DateUtil.date());
                    ltkjJianchajianyanTreeService.save(tree);
                }
            }
        }
        //门诊检查申请
        OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto();
@@ -408,6 +393,7 @@
                        LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                        tree.setXmfl(ejjfxmzd.getYjkmdm());
                    }
                    tree.setCreateTime(DateUtil.date());
                    ltkjJianchajianyanTreeService.save(tree);
                }
//                Map<String, Object> map = object5.getJSONObject("ResultData");
@@ -532,6 +518,7 @@
                        LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3);
                        tree.setXmfl(ejjfxmzd.getYjkmdm());
                    }
                    tree.setCreateTime(DateUtil.date());
                    ltkjJianchajianyanTreeService.save(tree);
                }
//                Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData");
@@ -661,9 +648,9 @@
                result2 = getAjaxResult(ajaxResult);
                object1 = getJSONObject(result2);
                code1 = object1.getStr("ResultCode");
//                if (!code1.equals("0")) {
//                    return false;
//                }
                if (code1.equals("0")) {
                    orderService.delHuoQuZlsqdh(order.getCardId());
                }
            }
        }
@@ -693,6 +680,186 @@
    }
    //作废补录项目
    public boolean ZfBlXm(List<String> bldhs, TjOrder order) {
        if(null !=bldhs && bldhs.size()>0){
            try {
                for (String bldh : bldhs) {
                    List<String> jcsqdh = orderService.getHuoQuBlJcsqdh(order.getCardId(),bldh);
                    List<String> jysqdh = orderService.getHuoQuBlJysqdh(order.getCardId(),bldh);
                    List<String> zlsqdh = orderService.getHuoQuBlZlsqdh(order.getCardId(),bldh);
                    List<String> cfhs = cfService.getCfBlhs(order.getCardId(),bldh);
                    //2.1.6.5 作废门诊检查申请
                    if (null != jcsqdh && jcsqdh.size()>0) {
                        for (String s : jcsqdh) {
                            AjaxResult result = controller.Outpindelexamapply(order.getCardId(), "00029", s);
                            String result1 = getAjaxResult(result);
                            JSONObject object = getJSONObject(result1);
                            String code = object.getStr("ResultCode");
                            if (code.equals("0")) {
                                orderService.delHuoQuBlJcsqdh(order.getCardId(),bldh);
                            }
                        }
                    }
                    //2.1.6.3 作废门诊检验申请
                    AjaxResult ajaxResult = null;
                    String result2 = null;
                    JSONObject object1 = null;
                    String code1 = null;
                    if (null != jysqdh && jysqdh.size()>0) {
                        for (String s : jysqdh) {
                            ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", s);
                            result2 = getAjaxResult(ajaxResult);
                            object1 = getJSONObject(result2);
                            code1 = object1.getStr("ResultCode");
                            if (code1.equals("0")) {
                                orderService.delHuoQuBlJysqdh(order.getCardId(),bldh);
                            }
                        }
                    }
                    //2.1.6.9 作废门诊治疗处置申请
                    if (null != zlsqdh && zlsqdh.size()>0) {
                        for (String s : zlsqdh) {
                            ajaxResult = controller.Outpintdelreatapply(order.getCardId(), "00029", s);
                            result2 = getAjaxResult(ajaxResult);
                            object1 = getJSONObject(result2);
                            code1 = object1.getStr("ResultCode");
                            if (code1.equals("0")) {
                                orderService.delHuoQuZlsqdh(order.getCardId(),bldh);
                            }
                        }
                    }
                    //作废药品申请
                    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);
                            }
                        }
                    }
                    return true;
                }
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }
        return true;
    }
    //退费后取消接诊作废申请单等操作
    public boolean ZfHisApiMethod(String jzh) {
        Date dates = new Date();
        final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
        List<String> jcsqdh = orderService.getHuoQuJcsqdh(jzh);
        List<String> jysqdh = orderService.getHuoQuJysqdh(jzh);
        List<String> zlsqdh = orderService.getHuoQuZlsqdh(jzh);
        List<String> cfhs = cfService.getCfhs(jzh);
        //2.1.6.5 作废门诊检查申请
        if (null != jcsqdh && jcsqdh.size()>0) {
            for (String s : jcsqdh) {
                AjaxResult result = controller.Outpindelexamapply(jzh, "00029", s);
                String result1 = getAjaxResult(result);
                JSONObject object = getJSONObject(result1);
                String code = object.getStr("ResultCode");
                if (code.equals("0")) {
                    orderService.delHuoQuJcsqdh(jzh);
                }
//                else {
//                    return false;
//                }
            }
        }
        //2.1.6.3 作废门诊检验申请
        AjaxResult ajaxResult = null;
        String result2 = null;
        JSONObject object1 = null;
        String code1 = null;
        if (null != jysqdh && jysqdh.size()>0) {
            for (String s : jysqdh) {
                ajaxResult = controller.Outpindeltestapply(jzh, "00029", s);
                result2 = getAjaxResult(ajaxResult);
                object1 = getJSONObject(result2);
                code1 = object1.getStr("ResultCode");
                if (code1.equals("0")) {
                    orderService.delHuoQuJysqdh(jzh);
                }
//                else {
//                    return false;
//                }
            }
        }
        //2.1.6.9 作废门诊治疗处置申请
        if (null != zlsqdh && zlsqdh.size()>0) {
            for (String s : zlsqdh) {
                ajaxResult = controller.Outpintdelreatapply(jzh, "00029", s);
                result2 = getAjaxResult(ajaxResult);
                object1 = getJSONObject(result2);
                code1 = object1.getStr("ResultCode");
                if (code1.equals("0")) {
                    orderService.delHuoQuZlsqdh(jzh);
                }
            }
        }
        //作废药品申请
        if(null !=cfhs && cfhs.size()>0){
            for (String cfh : cfhs) {
                AjaxResult result = controller.Outpindelmedicapply(jzh, "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(jzh, date, "00029");
        result2 = getAjaxResult(ajaxResult);
        object1 = getJSONObject(result2);
        code1 = object1.getStr("ResultCode");
//        if (!code1.equals("0")) {
//            return false;
//        }
        return true;
    }
    //获取门诊结算记录
    @Transactional
    public void getHisMzJsJl(TjOrder order) {