package com.yihu.platform.api; import com.yihu.platform.utils.ApiUtil; import com.yihu.platform.utils.StringUtil; import com.yihu.wsgw.api.InterfaceMessage; import net.sf.json.JSONException; import net.sf.json.JSONObject; /** * 医院接口 * @author wengsb----yihu.com * 2017年8月17日下午3:00:15 */ public class HospitalApi { /** * 通过省市医院id等获取医院信息 * @param msg * @return */ public String queryComplexHospitalList_v2(InterfaceMessage msg) { try { JSONObject json = JSONObject.fromObject(msg.getParam()); Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id"); String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param"); if (StringUtil.isEmpty(id)) { return ApiUtil.getRespJSON(-10000, "id不能为空").toString(); } JSONObject result = new JSONObject(); result.put("hospitalId", ""); result.put("hosName", ""); result.put("spells", ""); result.put("levelId", ""); result.put("levelName", ""); result.put("provinceId", ""); result.put("provinceName", ""); result.put("cityId", ""); result.put("cityName", ""); result.put("address", ""); result.put("contact", ""); result.put("clinicTime", ""); result.put("traffic", ""); result.put("url", ""); result.put("intro", ""); result.put("photoUri", ""); JSONObject obj = ApiUtil.getRespJSON(10000, "成功"); obj.put("Result", result); obj.put("Count", 10); return obj.toString(); } catch (JSONException e) { return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString(); } catch (Exception e) { e.printStackTrace(); return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString(); } } }