package com.yihu.platform.api; import com.yihu.platform.utils.HttpUtil; import net.sf.json.JSONObject; import java.util.HashMap; import java.util.Map; /** * 厦门i健康api */ public class IHealthApi { private static final String URL = "http://ehr.yihu.com/wlyy/"; /** * 获取token * * @return * @throws Exception */ public String getToken() throws Exception { HttpUtil httpUtil = new HttpUtil(URL + "gc/accesstoken"); Map map = new HashMap(); map.put("appid", "915d0345-5b1d-11e6-8344-fa163e8aee56"); map.put("appSecret", "915d0345-5b1d-11e6-8344-fa163e8aee52"); String resp = httpUtil.post(map); JSONObject json = JSONObject.fromObject(resp); if (json.getInt("code") != 10000) throw new Exception("获取token失败:" + json); return json.getJSONObject("result").getString("accesstoken"); } public static String queryPatient(String userId) throws Exception { HttpUtil httpUtil = new HttpUtil(URL + "wlyygc/patient/user/patient"); Map map = new HashMap(); map.put("code", userId); String resp = httpUtil.get(map); return resp; } public static String queryHospital(String hospitalId, String provinceId, String cityId, Integer page, Integer pageSize) throws Exception { HttpUtil httpUtil = new HttpUtil(URL + "wlyygc/hospital"); Map map = new HashMap(); String resp = httpUtil.get(map); return resp; } public static String queryDoctor(String hosDeptId, String doctorUid, String doctorUids, String hospitalId, Integer pageIndex, Integer pageSize) { return null; } }