From 29c5eb14d235b431714d17b8043149a4c6bd688b Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期三, 25 十二月 2024 17:58:20 +0800
Subject: [PATCH] zjh202412025

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
index 181d9c0..1fff389 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -31,6 +31,7 @@
 import com.ltkj.web.controller.his.HisApiGetMethodService;
 import com.ltkj.web.controller.his.HisApiMethod;
 import com.ltkj.web.controller.his.HisApiMethodService;
+import com.ltkj.web.wxUtils.HttpClientUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -44,10 +45,7 @@
 import com.ltkj.common.utils.poi.ExcelUtil;
 import com.ltkj.common.core.page.TableDataInfo;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 
@@ -491,8 +489,35 @@
             AjaxResult tjCustomer1 = suijieHisXinXi(tjCustomer, date);
             if (tjCustomer1 != null) return tjCustomer1;
         } else {
-            if (tjCustomerService.save(tjCustomer)) {
-                return AjaxResult.success(tjCustomer);
+            String s = sysConfigService.selectConfigByKey("is_request_common_his_api");
+            if (null != s && s.equals("Y")){
+                String apiUrl = sysConfigService.selectConfigByKey("common_api_url");
+                String hospbm = sysConfigService.selectConfigByKey("common_api_service_hospbm");
+                HashMap<String, Object> map = new HashMap<>();
+                map.put("cardId","");
+                map.put("cusName",tjCustomer.getCusName());
+                map.put("cusSex",tjCustomer.getCusSex());
+                map.put("cusIdCard",tjCustomer.getCusIdcard());
+                map.put("compId",tjCustomer.getCompId());
+                map.put("cusBrithday",tjCustomer.getCusBrithday() != null ? DateUtil.format(tjCustomer.getCusBrithday(), "yyyy-MM-dd") : "");
+                map.put("cusAddr",tjCustomer.getCusAddr());
+                map.put("cusPhone",tjCustomer.getCusPhone());
+                map.put("compName",tjCustomer.getCompName());
+                String post = HttpClientUtils.sendPost(apiUrl+"/api/his/"+hospbm+"/creat", map);
+                JSONObject jsonObject = JSONUtil.parseObj(post);
+                if (jsonObject.getStr("code").equals("200")){
+                    JSONObject data = jsonObject.getJSONObject("data");
+                    tjCustomer.setPationId(data.getStr("pationId"));
+                    tjCustomer.setCardId(data.getStr("cardId"));
+                    tjCustomer.setHisJzkh(data.getStr("cardId"));
+                    if (tjCustomerService.save(tjCustomer)) {
+                        return AjaxResult.success(tjCustomer);
+                    }
+                }else return AjaxResult.error();
+            }else {
+                if (tjCustomerService.save(tjCustomer)) {
+                    return AjaxResult.success(tjCustomer);
+                }
             }
         }
         return AjaxResult.error();
@@ -612,6 +637,6 @@
     @DeleteMapping("/{cusIds}")
     @ApiOperation(value = "鍒犻櫎瀹㈡埛")
     public AjaxResult remove(@PathVariable @ApiParam(value = "鎵�鍒犻櫎瀹㈡埛鐨刬d") Long[] cusIds) {
-        return toAjax(tjCustomerService.deleteTjCustomerByCusIds(cusIds));
+        return toAjax(tjCustomerService.removeByIds(Arrays.asList(cusIds)));
     }
 }

--
Gitblit v1.8.0