f924e121d0782837fe739867bbef8c2fa506783b.svn-base 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.yihu.platform.api;
  2. import com.yihu.platform.utils.ApiUtil;
  3. import com.yihu.platform.utils.StringUtil;
  4. import com.yihu.wsgw.api.InterfaceMessage;
  5. import net.sf.json.JSONException;
  6. import net.sf.json.JSONObject;
  7. /**
  8. * 医院接口
  9. * @author wengsb----yihu.com
  10. * 2017年8月17日下午3:00:15
  11. */
  12. public class HospitalApi {
  13. /**
  14. * 通过省市医院id等获取医院信息
  15. * @param msg
  16. * @return
  17. */
  18. public String queryComplexHospitalList_v2(InterfaceMessage msg) {
  19. try {
  20. JSONObject json = JSONObject.fromObject(msg.getParam());
  21. Integer id = StringUtil.isEmpty(json.get("id")) ? null : json.getInt("id");
  22. String param = StringUtil.isEmpty(json.get("param")) ? "" : json.getString("param");
  23. if (StringUtil.isEmpty(id)) {
  24. return ApiUtil.getRespJSON(-10000, "id不能为空").toString();
  25. }
  26. JSONObject result = new JSONObject();
  27. result.put("hospitalId", "");
  28. result.put("hosName", "");
  29. result.put("spells", "");
  30. result.put("levelId", "");
  31. result.put("levelName", "");
  32. result.put("provinceId", "");
  33. result.put("provinceName", "");
  34. result.put("cityId", "");
  35. result.put("cityName", "");
  36. result.put("address", "");
  37. result.put("contact", "");
  38. result.put("clinicTime", "");
  39. result.put("traffic", "");
  40. result.put("url", "");
  41. result.put("intro", "");
  42. result.put("photoUri", "");
  43. JSONObject obj = ApiUtil.getRespJSON(10000, "成功");
  44. obj.put("Result", result);
  45. obj.put("Count", 10);
  46. return obj.toString();
  47. } catch (JSONException e) {
  48. return ApiUtil.getRespJSON(-10000, "非标准json:[" + msg.getParam() + "]").toString();
  49. } catch (Exception e) {
  50. e.printStackTrace();
  51. return ApiUtil.getRespJSON(-14444, "加载异常!" + StringUtil.getException(e)).toString();
  52. }
  53. }
  54. }