| | |
| | | import com.example.utils.AjaxResult; |
| | | import com.example.utils.FieldNameConverter; |
| | | import com.example.utils.HttpClientUtils; |
| | | import com.example.utils.synczd.shanjianyi.DictionaryUtilShanXiWeiNanBjxjyy; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | @Service("ShanXiQinBaoJiSsyjyy") |
| | | public class SsyjyyHisService implements HisService { |
| | | @Autowired |
| | | private DictionaryUtilShanXiWeiNanBjxjyy syncZd; |
| | | private DictionaryUtilShanXiBaoJiSsyjyy syncZd; |
| | | @Autowired |
| | | private ConfigValue configValue; |
| | | |
| | |
| | | @Autowired |
| | | private DictCommonHisConfigService dictCommonHisConfigService; |
| | | |
| | | |
| | | private static final String HOSP_ID = "ssyjyy"; |
| | | |
| | | private static final String TJ_HOSP_ID = "shanxiqinssyjyy"; |
| | | |
| | | //获取token |
| | | private JSONObject getToken () { |
| | | String GRANT_TYPE = "client_credentials"; |
| | |
| | | map.put("client_secret", CLIENT_SECRET); |
| | | // map.put("scope",SCOP); |
| | | // String post = sendPostTokenFormUrlencoded (HIS_URL+"/oauth/token", map); |
| | | String his_url = dictCommonHisConfigService.getConfigValByHospitalAndKey("ssyjyy", "HIS_URL"); |
| | | String his_url = dictCommonHisConfigService.getConfigValByHospitalAndKey(HOSP_ID, "HIS_URL"); |
| | | String post = HttpClientUtils.sendPostTokenFormUrlencoded(his_url + "/oauth/token", map, null); |
| | | if (StrUtil.isBlank(post)) return null; |
| | | return JSONUtil.parseObj(post); |
| | |
| | | map.put ("feiYongLb",""); |
| | | map.put ("feiYongXz",""); |
| | | map.put ("jiLuLy","3"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | map.put ("caoZuoYuan",config.getCzyId()); |
| | | map.put ("chongZhiJe",""); |
| | | map.put ("yiBaoKh",""); |
| | |
| | | @Override |
| | | public String getBingRenXxByShengFenZheng(Map<String, Object> params) { |
| | | Map<String, Object> map = new HashMap<> (); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | map.put ("caoZuoYuan",config.getCzyId()); |
| | | map.put ("shenFenZh", params.get(ApiParamsConstants.CUS_ID_CARD)); |
| | | map.put ("danWeiBh",params.get(ApiParamsConstants.COMP_ID)); |
| | |
| | | map.put ("feiYongLb",""); |
| | | map.put ("feiYongXz",""); |
| | | map.put ("jiLuLy","3"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | map.put ("caoZuoYuan",config.getCzyId()); |
| | | //职业编码 |
| | | String post = sendPost(config.getHisUrl() + "/menZhenJz/saveBingRenXx", map); |
| | |
| | | map.put ("jiuZhenKh",params.get(ApiParamsConstants.CARD_ID)); |
| | | map.put ("yuanQuId","1"); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | String post = sendPost(config.getHisUrl() + "/shouFei/getListDaiShouFei", map); |
| | | JSONObject jsonObject = JSONUtil.parseObj(post); |
| | | if (jsonObject.getStr("returnCode").equals("1")) { |
| | |
| | | |
| | | @Override |
| | | public String createMenZhenFy(Map<String, Object> params) { |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | Map<String, Object> map = new HashMap<> (); |
| | | map.put ("bingRenId",params.get(ApiParamsConstants.PATIONID)); |
| | | map.put ("jiuZhenKh",params.get(ApiParamsConstants.CARD_ID)); |
| | |
| | | ids.add(object); |
| | | }); |
| | | map.put ("feiYongIdList",ids); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | //职业编码 |
| | | String post = sendPost(config.getHisUrl() + "/shouFei/cheXiaoMzFy", map); |
| | | JSONObject entries = JSONUtil.parseObj(post); |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getKeShi", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getListYiShengZd", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getShouFeiXm", map); |
| | | } |
| | | |
| | |
| | | map.put ("keShiIds",params.get(ApiParamsConstants.DEPT_IDS)); |
| | | map.put ("ifPlus",""); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getKeShiByConditions", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getYangBen", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getListBingQuZd", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getZhiGongPage", map); |
| | | } |
| | | |
| | |
| | | map.put ("pageIndex",params.get(ApiParamsConstants.PAGE_INDEX)); |
| | | map.put ("pageSize",params.get(ApiParamsConstants.PAGE_SIZE)); |
| | | //职业编码 |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getJianChaXm", map); |
| | | } |
| | | |
| | |
| | | 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)); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getJianYanXm", hashMap); |
| | | } |
| | | |
| | |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("shouFeiXmId",map.get(ApiParamsConstants.COMMON_QUERY_KEY)); |
| | | hashMap.put("jiaGeTx",map.get(ApiParamsConstants.COMMON_QUERY_KEY2)); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getShouFeiXmJg", hashMap); |
| | | } |
| | | |
| | |
| | | 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)); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getRongQi", hashMap); |
| | | } |
| | | |
| | |
| | | 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)); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | return sendPost(config.getHisUrl()+"/zhuShuJu/getYangBen", hashMap); |
| | | } |
| | | |
| | |
| | | // 参数类型区分 |
| | | map.put("type","1"); |
| | | HashMap<String, Object> headers = new HashMap<>(); |
| | | headers.put("hospId","ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | headers.put("hospId",HOSP_ID); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | String post = HttpClientUtils.sendPost(config.getTjUrl() + "/callBack/pushZhiFuMsg", map,headers); |
| | | JSONObject jsonObject = JSONUtil.parseObj(post); |
| | | JSONObject obj = JSONUtil.createObj(); |
| | |
| | | |
| | | |
| | | private String sendPost(String url, Map<String, Object> hashMap){ |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:shanxiqinssyjyy"); |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:"+TJ_HOSP_ID); |
| | | if (entries != null && !entries.isEmpty()) { |
| | | String timeStr = entries.get("time").toString(); |
| | | String expiresInStr = entries.get("expires_in").toString(); |
| | |
| | | } |
| | | |
| | | private String sendPostTokenFormUrlencoded(String url, Map<String, Object> hashMap){ |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:shanxiqinssyjyy"); |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:"+TJ_HOSP_ID); |
| | | if (!entries.isEmpty()) { |
| | | String timeStr = entries.get("time").toString(); |
| | | String expiresInStr = entries.get("expires_in").toString(); |
| | |
| | | } |
| | | |
| | | private String sendPostTokenFormData(String url, Map<String, Object> hashMap){ |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:shanxiqinssyjyy"); |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:"+TJ_HOSP_ID); |
| | | if (entries != null && !entries.isEmpty()) { |
| | | String timeStr = entries.get("time").toString(); |
| | | String expiresInStr = entries.get("expires_in").toString(); |
| | |
| | | Integer expiresIn = parseObj.getInt("expires_in"); |
| | | if (expiresIn != null) { |
| | | parseObj.putOpt("time", Instant.now().getEpochSecond()); |
| | | redisTemplate.opsForHash().putAll("token:his:shanxiqinssyjyy", parseObj); |
| | | redisTemplate.expire("token:his:shanxiqinssyjyy", expiresIn - 10, TimeUnit.SECONDS); |
| | | redisTemplate.opsForHash().putAll("token:his:"+TJ_HOSP_ID, parseObj); |
| | | redisTemplate.expire("token:his:"+TJ_HOSP_ID, expiresIn - 10, TimeUnit.SECONDS); |
| | | |
| | | String accessToken = parseObj.getStr("access_token"); |
| | | String tokenType = parseObj.getStr("token_type"); |
| | |
| | | @Override |
| | | public void syncDict(String hospName) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("hosp","shanxiqinssyjyy"); |
| | | map.put("hosp",TJ_HOSP_ID); |
| | | HashMap<String, Object> headers = new HashMap<>(); |
| | | headers.put("hospId","ssyjyy"); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital("ssyjyy"); |
| | | headers.put("hospId",HOSP_ID); |
| | | DictCommonHisConfig config = dictCommonHisConfigService.getConfigByHospital(HOSP_ID); |
| | | 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); |
| | | String token = ""; |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:shanxiqinssyjyy"); |
| | | Map<Object, Object> entries = redisTemplate.opsForHash().entries("token:his:"+TJ_HOSP_ID); |
| | | if (!entries.isEmpty()) { |
| | | String timeStr = entries.get("time").toString(); |
| | | String expiresInStr = entries.get("expires_in").toString(); |
| | |
| | | expiresIn = parseObj.getLong("expires_in"); |
| | | if (expiresIn != null) { |
| | | parseObj.putOpt("time", Instant.now().getEpochSecond()); |
| | | redisTemplate.opsForHash().putAll("token:his:shanxiqinssyjyy", parseObj); |
| | | redisTemplate.expire("token:his:shanxiqinssyjyy", expiresIn - 10, TimeUnit.SECONDS); |
| | | redisTemplate.opsForHash().putAll("token:his:"+TJ_HOSP_ID, parseObj); |
| | | redisTemplate.expire("token:his:"+TJ_HOSP_ID, expiresIn - 10, TimeUnit.SECONDS); |
| | | String accessToken = parseObj.getStr("access_token"); |
| | | String tokenType = parseObj.getStr("token_type"); |
| | | token = tokenType + " " + accessToken; |
| | |
| | | Integer expiresIn = parseObj.getInt("expires_in"); |
| | | if (expiresIn != null) { |
| | | parseObj.putOpt("time", Instant.now().getEpochSecond()); |
| | | redisTemplate.opsForHash().putAll("token:his:shanxiqinssyjyy", parseObj); |
| | | redisTemplate.expire("token:his:shanxiqinssyjyy", expiresIn - 10, TimeUnit.SECONDS); |
| | | redisTemplate.opsForHash().putAll("token:his:"+TJ_HOSP_ID, parseObj); |
| | | redisTemplate.expire("token:his:"+TJ_HOSP_ID, expiresIn - 10, TimeUnit.SECONDS); |
| | | String accessToken = parseObj.getStr("access_token"); |
| | | String tokenType = parseObj.getStr("token_type"); |
| | | token = tokenType + " " + accessToken; |