From f0eca55f5108aca1222c9fc7356d9ee4e4a59478 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期一, 19 五月 2025 16:50:38 +0800 Subject: [PATCH] 宝鸡西机医院改为从管理表动态取配置 --- src/main/java/com/example/service/shanxiqin/baoji/bjxjyy/BjxjyyHisService.java | 101 +++++++++++++++++++++++++++++++------------------- 1 files changed, 63 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/example/service/shanxiqin/baoji/bjxjyy/BjxjyyHisService.java b/src/main/java/com/example/service/shanxiqin/baoji/bjxjyy/BjxjyyHisService.java index 2e2c862..c679810 100644 --- a/src/main/java/com/example/service/shanxiqin/baoji/bjxjyy/BjxjyyHisService.java +++ b/src/main/java/com/example/service/shanxiqin/baoji/bjxjyy/BjxjyyHisService.java @@ -8,8 +8,10 @@ import cn.hutool.json.JSONUtil; import com.example.config.ConfigValue; import com.example.constant.ApiParamsConstants; +import com.example.domain.DictCommonHisConfig; import com.example.domain.HisSyncDict; import com.example.domain.TjFlowingWaterHis; +import com.example.service.DictCommonHisConfigService; import com.example.service.HisService; import com.example.utils.AjaxResult; import com.example.utils.FieldNameConverter; @@ -44,23 +46,25 @@ // client_secret:05a192176c21edfcc9cf5fa26fc5a9e0c5b131ad // http://oapi.xamjyy.com/OAPI - @Autowired - public BjxjyyHisService(ApplicationContext applicationContext, ConfigValue configValue) { - this.applicationContext = applicationContext; - this.configValue = configValue; - HIS_URL = configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.his_api_url") + ":" + configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.his_api_port") + configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.hisapiappend"); - TJ_URL = configValue.getConfigValue("tjUrl"); - CZY = configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.czy"); - } +// @Autowired +// public BjxjyyHisService(ApplicationContext applicationContext, ConfigValue configValue) { +// this.applicationContext = applicationContext; +// this.configValue = configValue; +// HIS_URL = configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.his_api_url") + ":" + configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.his_api_port") + configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.hisapiappend"); +// TJ_URL = configValue.getConfigValue("tjUrl"); +// CZY = configValue.getConfigValue("ShanXi_Qin_BaoJi_Bjxjyy.czy"); +// } @Autowired private RedisTemplate<Object ,Object> redisTemplate; + @Autowired + private DictCommonHisConfigService dictCommonHisConfigService; - private final ApplicationContext applicationContext; - - private final String HIS_URL; - private final String TJ_URL; - private final String CZY; +// private final ApplicationContext applicationContext; +// +// private final String HIS_URL; +// private final String TJ_URL; +// private final String CZY; //鑾峰彇token private JSONObject getToken () { @@ -74,7 +78,8 @@ map.put("client_secret", CLIENT_SECRET); // map.put("scope",SCOP); // String post = sendPostTokenFormUrlencoded (HIS_URL+"/oauth/token", map); - String post = HttpClientUtils.sendPostTokenFormUrlencoded(HIS_URL + "/oauth/token", map, null); + String his_url = dictCommonHisConfigService.getConfigValByHospitalAndKey("bjxjyy", "HIS_URL"); + String post = HttpClientUtils.sendPostTokenFormUrlencoded(his_url + "/oauth/token", map, null); if (StrUtil.isBlank(post)) return null; return JSONUtil.parseObj(post); } @@ -101,7 +106,8 @@ map.put ("feiYongLb",""); map.put ("feiYongXz",""); map.put ("jiLuLy","3"); - map.put ("caoZuoYuan",CZY); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + map.put ("caoZuoYuan",config.getCzyId()); map.put ("chongZhiJe",""); map.put ("yiBaoKh",""); map.put ("geRenBh",""); @@ -114,7 +120,7 @@ map.put ("minZuDm",""); map.put ("minZuMc",""); // 鑱屼笟缂栫爜 - String post = sendPost(HIS_URL + "/menZhenJz/jianDang", map); + String post = sendPost(config.getHisUrl() + "/menZhenJz/jianDang", map); JSONObject jsonObject = JSONUtil.parseObj(post); if (jsonObject.getStr("returnCode").equals("1")) { JSONObject obj = JSONUtil.createObj(); @@ -131,11 +137,12 @@ @Override public String getBingRenXxByShengFenZheng(Map<String, Object> params) { Map<String, Object> map = new HashMap<> (); - map.put ("caoZuoYuan",CZY); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + map.put ("caoZuoYuan",config.getCzyId()); map.put ("shenFenZh", params.get(ApiParamsConstants.CUS_ID_CARD)); map.put ("danWeiBh",params.get(ApiParamsConstants.COMP_ID)); //鑱屼笟缂栫爜 - String string = sendPostTokenFormUrlencoded(HIS_URL + "/menZhenJz/getBingRenXxByShengFenZheng", map); + String string = sendPostTokenFormUrlencoded(config.getHisUrl() + "/menZhenJz/getBingRenXxByShengFenZheng", map); JSONObject object = JSONUtil.createObj(); if (StrUtil.isBlank(string)){ object.putOpt("code",500); @@ -183,9 +190,10 @@ map.put ("feiYongLb",""); map.put ("feiYongXz",""); map.put ("jiLuLy","3"); - map.put ("caoZuoYuan",CZY); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + map.put ("caoZuoYuan",config.getCzyId()); //鑱屼笟缂栫爜 - String post = sendPost(HIS_URL + "/menZhenJz/saveBingRenXx", map); + String post = sendPost(config.getHisUrl() + "/menZhenJz/saveBingRenXx", map); JSONObject jsonObject = JSONUtil.parseObj(post); if (jsonObject.getStr("returnCode").equals("1")) { JSONObject obj = JSONUtil.createObj(); @@ -206,7 +214,8 @@ map.put ("jiuZhenKh",params.get(ApiParamsConstants.CARD_ID)); map.put ("yuanQuId","1"); //鑱屼笟缂栫爜 - String post = sendPost(HIS_URL + "/shouFei/getListDaiShouFei", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + String post = sendPost(config.getHisUrl() + "/shouFei/getListDaiShouFei", map); JSONObject jsonObject = JSONUtil.parseObj(post); if (jsonObject.getStr("returnCode").equals("1")) { JSONObject data = jsonObject.getJSONObject("returnData"); @@ -223,10 +232,11 @@ @Override public String createMenZhenFy(Map<String, Object> params) { + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); Map<String, Object> map = new HashMap<> (); map.put ("bingRenId",params.get(ApiParamsConstants.PATIONID)); map.put ("jiuZhenKh",params.get(ApiParamsConstants.CARD_ID)); - map.put ("caoZuoYuan",CZY); + map.put ("caoZuoYuan",config.getCzyId()); map.put ("yuanQuId","1"); map.put ("yingYongId","870101"); map.put ("kaiDanKs",params.get(ApiParamsConstants.kaiDanKeShi)); @@ -234,7 +244,7 @@ map.put ("shouTuiBz",params.get(ApiParamsConstants.SHOU_TUI_STATUS)); map.put ("feiYongMxList",params.get(ApiParamsConstants.FEI_YONG_INFO_LIST)); //鑱屼笟缂栫爜 - String post = sendPost(HIS_URL + "/shouFei/createMenZhenFy", map); + String post = sendPost(config.getHisUrl() + "/shouFei/createMenZhenFy", map); JSONObject jsonObject = JSONUtil.parseObj(post); if (jsonObject.getInt("returnCode") != 1) return AjaxResult.error(post); JSONObject data = jsonObject.getJSONObject("returnData"); @@ -272,8 +282,9 @@ ids.add(object); }); map.put ("feiYongIdList",ids); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); //鑱屼笟缂栫爜 - String post = sendPost(HIS_URL + "/shouFei/cheXiaoMzFy", map); + String post = sendPost(config.getHisUrl() + "/shouFei/cheXiaoMzFy", map); JSONObject entries = JSONUtil.parseObj(post); if (entries.getStr("returnCode").equals("1")) return AjaxResult.success(); @@ -288,7 +299,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getKeShi", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getKeShi", map); } @Override @@ -300,7 +312,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getListYiShengZd", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getListYiShengZd", map); } @Override @@ -311,7 +324,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getShouFeiXm", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getShouFeiXm", map); } @Override @@ -324,7 +338,8 @@ map.put ("keShiIds",params.get(ApiParamsConstants.DEPT_IDS)); map.put ("ifPlus",""); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getKeShiByConditions", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getKeShiByConditions", map); } @Override @@ -334,7 +349,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getYangBen", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getYangBen", map); } @Override @@ -345,7 +361,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getListBingQuZd", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getListBingQuZd", map); } @Override @@ -355,7 +372,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getZhiGongPage", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getZhiGongPage", map); } @Override @@ -366,7 +384,8 @@ map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); //鑱屼笟缂栫爜 - return sendPost(HIS_URL+"/zhuShuJu/getJianChaXm", map); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getJianChaXm", map); } @Override @@ -375,7 +394,8 @@ hashMap.put("queryCode",map.get(ApiParamsConstants.COMMON_QUERY_KEY)); hashMap.put("page",map.get(ApiParamsConstants.PAGE_INDEX)); hashMap.put("size",map.get(ApiParamsConstants.PAGE_SIZE)); - return sendPost(HIS_URL+"/zhuShuJu/getJianYanXm", hashMap); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getJianYanXm", hashMap); } @Override @@ -383,7 +403,8 @@ HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("shouFeiXmId",map.get(ApiParamsConstants.COMMON_QUERY_KEY)); hashMap.put("jiaGeTx",map.get(ApiParamsConstants.COMMON_QUERY_KEY2)); - return sendPost(HIS_URL+"/zhuShuJu/getShouFeiXmJg", hashMap); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getShouFeiXmJg", hashMap); } @Override @@ -392,7 +413,8 @@ hashMap.put("queryString",map.get(ApiParamsConstants.COMMON_QUERY_KEY)); hashMap.put("pageIndex",map.get(ApiParamsConstants.PAGE_INDEX)); hashMap.put("pageSize",map.get(ApiParamsConstants.PAGE_SIZE)); - return sendPost(HIS_URL+"/zhuShuJu/getRongQi", hashMap); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getRongQi", hashMap); } @Override @@ -401,7 +423,8 @@ hashMap.put("queryString",map.get(ApiParamsConstants.COMMON_QUERY_KEY)); hashMap.put("pageIndex",map.get(ApiParamsConstants.PAGE_INDEX)); hashMap.put("pageSize",map.get(ApiParamsConstants.PAGE_SIZE)); - return sendPost(HIS_URL+"/zhuShuJu/getYangBen", hashMap); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + return sendPost(config.getHisUrl()+"/zhuShuJu/getYangBen", hashMap); } @Override @@ -418,7 +441,8 @@ map.put("type","1"); HashMap<String, Object> headers = new HashMap<>(); headers.put("hospId","bjxjyy"); - String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/pushZhiFuMsg", map,headers); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + String post = HttpClientUtils.sendPost(config.getTjUrl() + "/callBack/pushZhiFuMsg", map,headers); JSONObject jsonObject = JSONUtil.parseObj(post); JSONObject obj = JSONUtil.createObj(); if (jsonObject.getStr("code").equals("200")) { @@ -549,7 +573,8 @@ map.put("hosp","shanxiqinbjxjyy"); HashMap<String, Object> headers = new HashMap<>(); headers.put("hospId","bjxjyy"); - String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map,headers); + DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("bjxjyy"); + String post = HttpClientUtils.sendPost(config.getTjUrl() + "/callBack/getZdList", map,headers); JSONArray jsonArray = JSONUtil.parseObj(post).getJSONArray("data"); if (jsonArray != null && !jsonArray.isEmpty()) { List<HisSyncDict> list = jsonArray.toList(HisSyncDict.class); -- Gitblit v1.8.0