-
1.1 postForObject String urlAddPatients = “http://192.168.10.180:8000/life-account/”+"/static/patients/addpatients";
CompleteUserInfo completeUserInfo = new CompleteUserInfo(); completeUserInfo.setPhone(patients.getPhone()); //注册+完善个人信息 BaseResult<Map<String,String>> baseResult = restTemplate.postForObject(urlAddPatients, completeUserInfo, BaseResult.class); String userId = baseResult.getData().get("userId"); 1.2 MultiValueMap<String, Object> map= new LinkedMultiValueMap<>(); map.add("uid", userId); //根据userid从redis中获取用户的基本信息 BaseResult<LinkedHashMap<String,Object>> baseResult = restTemplate.postForObject(userInfoUrl, map, BaseResult.class); LinkedHashMap<String,Object> linkedHashMap = baseResult.getData();
2. getForObject
String getUserInfoByUserIds = userInfo+"/static/rpc/userInfo/clinicData/getUserByUserIds";
//根据用户Id获取用户信息
String userIdsStr = userIds.toString();
String userIdsStringuri = userIdsStr.replace("'","").replace("[","").replace("]","");
BaseResult<List<HashMap<String,Object>>> baseResult1 = restTemplate.getForObject(getUserInfoByUserIds+"?userIds="+userIdsStringuri, BaseResult.class);
List<HashMap<String,Object>> userInfos = baseResult1.getData();