zjh
2024-12-25 79f9fbd9f999e26af3f0bca534d825eb687e092c
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();