c2fb78a77b7996065d2ff1498adcf15b2b344085.svn-base 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.yihu.platform.api;
  2. import com.yihu.platform.utils.HttpUtil;
  3. import net.sf.json.JSONObject;
  4. import java.util.HashMap;
  5. import java.util.Map;
  6. /**
  7. * 厦门i健康api
  8. */
  9. public class IHealthApi {
  10. private static final String URL = "http://ehr.yihu.com/wlyy/";
  11. /**
  12. * 获取token
  13. *
  14. * @return
  15. * @throws Exception
  16. */
  17. public String getToken() throws Exception {
  18. HttpUtil httpUtil = new HttpUtil(URL + "gc/accesstoken");
  19. Map map = new HashMap();
  20. map.put("appid", "915d0345-5b1d-11e6-8344-fa163e8aee56");
  21. map.put("appSecret", "915d0345-5b1d-11e6-8344-fa163e8aee52");
  22. String resp = httpUtil.post(map);
  23. JSONObject json = JSONObject.fromObject(resp);
  24. if (json.getInt("code") != 10000) throw new Exception("获取token失败:" + json);
  25. return json.getJSONObject("result").getString("accesstoken");
  26. }
  27. public static String queryPatient(String userId) throws Exception {
  28. HttpUtil httpUtil = new HttpUtil(URL + "wlyygc/patient/user/patient");
  29. Map map = new HashMap();
  30. map.put("code", userId);
  31. String resp = httpUtil.get(map);
  32. return resp;
  33. }
  34. public static String queryHospital(String hospitalId, String provinceId, String cityId, Integer page, Integer pageSize) throws Exception {
  35. HttpUtil httpUtil = new HttpUtil(URL + "wlyygc/hospital");
  36. Map map = new HashMap();
  37. String resp = httpUtil.get(map);
  38. return resp;
  39. }
  40. public static String queryDoctor(String hosDeptId, String doctorUid, String doctorUids, String hospitalId, Integer pageIndex, Integer pageSize) {
  41. return null;
  42. }
  43. }