From c0f0bf3c1c598c10d4eb80751960bca76da50b0d Mon Sep 17 00:00:00 2001
From: zjh <zjh@888>
Date: 星期五, 14 六月 2024 18:03:32 +0800
Subject: [PATCH] zjh 本地 2024/06/14 --1

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java |  213 ++++++++++++++++++++++++++---------------------------
 1 files changed, 105 insertions(+), 108 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
index 85157ab..bb19a92 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -63,7 +63,7 @@
 
     //瀵规帴his鎬绘帴鍙�  娉ㄥ唽鎸傚彿鎺ヨ瘖鐢宠鍗曟搷浣�
     @Transactional
-    public void HisApiMethods(TjCustomer customer, Long orderId) {
+    public AjaxResult HisApiMethods(TjCustomer customer, Long orderId) {
 
         Date dates = new Date();
         final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
@@ -79,32 +79,6 @@
                 if (null != pationid) {
                     customer.setPationId(pationid);
                     customerService.updateById(customer);
-                    /*                  String key = configService.selectConfigByKey("getInfoFromSqlData");
-                    if (null != key && key.equals("Y")) {
-                        OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
-                        outpinregapplyDto.setPationid(pationid);
-                        outpinregapplyDto.setSqysbm(SecurityUtils.getUsername());
-                        outpinregapplyDto.setMzksbm("0101");
-                        outpinregapplyDto.setCzybm("00029");
-                        outpinregapplyDto.setSfjz("0");
-                        outpinregapplyDto.setGhzlbm("01");
-                        outpinregapplyDto.setYwckbm("0001");
-                        outpinregapplyDto.setSflstd("0");
-                        outpinregapplyDto.setGhrq(date);
-                        //闂ㄨ瘖鎸傚彿
-                        AjaxResult ajaxResult = controller.Outpinregapply(outpinregapplyDto);
-                        String result2 = getAjaxResult(ajaxResult);
-                        JSONObject object1 = getJSONObject(result2);
-                        String code1 = object1.getStr("ResultCode");
-                        if (code1.equals("0")) {
-                            JSONArray resultDatas = object1.getJSONArray("ResultData");
-                            if (null != resultDatas && resultDatas.size() > 0) {
-                                //闂ㄨ瘖鍖荤敓鎺ヨ瘖
-                                controller.Outpinconapply(customer.getCardId(), date, SecurityUtils.getUsername());
-                            }
-                        }
-                    }
-*/
 
                     //妫�楠岀敵璇�
                     OutpintestapplyDto dto = new OutpintestapplyDto();
@@ -142,28 +116,26 @@
                             }
                         }
                     }
-                    if (detailsDtos.size()==0) {
-                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
-                        detailsDto.setMxfyxmbm("");
-                        detailsDto.setSfzhfy("");
-                        detailsDto.setSl(0);
-                        detailsDtos.add(detailsDto);
-                    }
-                    dto.setDetails(detailsDtos);
-                    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", 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);
+                    if (detailsDtos.size()>0) {
+                        dto.setDetails(detailsDtos);
+                        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", 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();
+                        }
                     }
+
                     //闂ㄨ瘖妫�鏌ョ敵璇�
                     OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto();
                     outpinexamapplyDto.setHisRegistrationId(customer.getCardId());
@@ -199,28 +171,26 @@
                             }
                         }
                     }
-                    if (detailsDtoss.size()==0) {
-                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
-                        detailsDto.setMxfyxmbm("");
-                        detailsDto.setSfzhfy("");
-                        detailsDto.setSl(0);
-                        detailsDtoss.add(detailsDto);
-                    }
-                    outpinexamapplyDto.setDetails(detailsDtoss);
-                    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", customer.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);
+                    if (detailsDtoss.size()>0) {
+                        outpinexamapplyDto.setDetails(detailsDtoss);
+                        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", customer.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)));
 
+                        }else {
+                            return AjaxResult.error();
+                        }
                     }
+
 
                     //闂ㄨ瘖娌荤枟澶勭疆鐢宠
                     OutpintreatapplyDto dao = new OutpintreatapplyDto();
@@ -257,38 +227,35 @@
                             }
                         }
                     }
-                    if (detailDtos.size()==0) {
-                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
-                        detailsDto.setMxfyxmbm("");
-                        detailsDto.setSfzhfy("");
-                        detailsDto.setSl(0);
-                        detailDtos.add(detailsDto);
+                    if (detailDtos.size()>0) {
+                        dao.setDetails(detailDtos);
+                        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", customer.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)));
+                        }else {
+                            return AjaxResult.error();
+                        }
                     }
-                    dao.setDetails(detailDtos);
-                    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", customer.getCardId());
-                        JSONObject jsonObject = JSONUtil.parseObj(map);
-                        LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-                        lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinmedapply");
-                        HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
-                        hisApiGetMethodService.save(jsonObject, "Outpinmedapply", hisApiConfig);
-
-                    }
+                    return AjaxResult.success();
                 }
             }
         }
-
+        return AjaxResult.error();
     }
 
 
     //閫�璐瑰悗鍙栨秷鎺ヨ瘖浣滃簾鐢宠鍗曠瓑鎿嶄綔
     @Transactional
-    public void ZfHisApiMethods(TjCustomer customer, TjOrder order) {
+    public boolean ZfHisApiMethods(TjCustomer customer, TjOrder order) {
         Date dates = new Date();
         final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
 
@@ -299,28 +266,58 @@
 
         String zlsqdh = orderService.getHuoQuZlsqdh(order.getCardId());
 
-        //浣滃簾闂ㄨ瘖妫�鏌ョ敵璇�
-        AjaxResult result = controller.Outpindelexamapply(order.getCardId(), "00029", jcsqdh);
-        String result1 = getAjaxResult(result);
-        JSONObject object = getJSONObject(result1);
-        String code = object.getStr("ResultCode");
-        if (code.equals("0")) {
-            orderService.delHuoQuJcsqdh(order.getCardId());
+        //2.1.6.5 浣滃簾闂ㄨ瘖妫�鏌ョ敵璇�
+        if (null !=jcsqdh){
+            AjaxResult result = controller.Outpindelexamapply(order.getCardId(), "00029", jcsqdh);
+            String result1 = getAjaxResult(result);
+            JSONObject object = getJSONObject(result1);
+            String code = object.getStr("ResultCode");
+            if (code.equals("0")) {
+                orderService.delHuoQuJcsqdh(order.getCardId());
+            }else {
+                return false;
+            }
         }
 
-        //浣滃簾闂ㄨ瘖鐢宠
-        AjaxResult ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", jysqdh);
-        String result2 = getAjaxResult(ajaxResult);
-        JSONObject object1 = getJSONObject(result2);
-        String code1 = object1.getStr("ResultCode");
-        if (code1.equals("0")) {
-            orderService.delHuoQuJysqdh(order.getCardId());
+
+        //2.1.6.3 浣滃簾闂ㄨ瘖妫�楠岀敵璇�
+
+        AjaxResult ajaxResult =null;
+        String result2 =null;
+        JSONObject object1 =null;
+        String code1 =null;
+
+        if(null !=jysqdh){
+             ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", jysqdh);
+             result2 = getAjaxResult(ajaxResult);
+             object1 = getJSONObject(result2);
+             code1 = object1.getStr("ResultCode");
+            if (code1.equals("0")) {
+                orderService.delHuoQuJysqdh(order.getCardId());
+            }else {
+                return false;
+            }
         }
 
-        controller.Outpinunconapply(order.getCardId(), date, "00029");
-
-        controller.Outpindelmedapply(order.getCardId(), "00029", zlsqdh);
-
+        //2.1.6.9 浣滃簾闂ㄨ瘖娌荤枟澶勭疆鐢宠
+        if(null !=zlsqdh){
+            ajaxResult = controller.Outpintdelreatapply(order.getCardId(), "00029", zlsqdh);
+            result2 = getAjaxResult(ajaxResult);
+            object1 = getJSONObject(result2);
+            code1 = object1.getStr("ResultCode");
+            if (!code1.equals("0")){
+                return false;
+            }
+        }
+        //2.1.3 闂ㄨ瘖鍖荤敓鍙栨秷鎺ヨ瘖
+        ajaxResult = controller.Outpinunconapply(order.getCardId(), date, "00029");
+        result2 = getAjaxResult(ajaxResult);
+        object1 = getJSONObject(result2);
+        code1 = object1.getStr("ResultCode");
+        if (!code1.equals("0")){
+            return false;
+        }
+        return true;
     }
 
 

--
Gitblit v1.8.0