HealthServiceController.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package com.yihu.wlyy.web.wx;
  2. import java.io.IOException;
  3. import javax.servlet.http.HttpServletResponse;
  4. import io.swagger.annotations.Api;
  5. import org.json.JSONException;
  6. import org.json.JSONObject;
  7. import org.springframework.http.MediaType;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import com.yihu.wlyy.util.SystemConf;
  12. import com.yihu.wlyy.web.WeixinBaseController;
  13. @Controller
  14. @RequestMapping(value = "/wx/health/service", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  15. @Api(description = "患者端-健康服务在线咨询")
  16. public class HealthServiceController extends WeixinBaseController {
  17. /**
  18. * 健康服务»在线咨询
  19. * @param code
  20. * @return
  21. * @throws IOException
  22. */
  23. @RequestMapping(value = "chat", method = RequestMethod.GET)
  24. public void chat(HttpServletResponse response, String code) throws IOException {
  25. String message = getOpenid(code);
  26. JSONObject json = new JSONObject(message);
  27. if (Integer.parseInt(json.get("status").toString()) == 100) {
  28. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=1&openid=" + json.get("msg").toString());
  29. } else if (Integer.parseInt(json.get("status").toString()) == 200) {
  30. // String json2 = json.get("data").toString();
  31. // String paramUrl = getParamUrl(json2, 1);
  32. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/zxwz/html/online-consulting.html");
  33. } else {
  34. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html");
  35. }
  36. }
  37. /**
  38. * 健康服务»预约挂号
  39. * @param code
  40. * @return
  41. * @throws IOException
  42. * @throws JSONException
  43. */
  44. @RequestMapping(value = "yygh", method = RequestMethod.GET)
  45. public void yygh(HttpServletResponse response, String code) throws JSONException, IOException {
  46. String message = getOpenid(code);
  47. JSONObject json = new JSONObject(message);
  48. if (Integer.parseInt(json.get("status").toString()) == 100) {
  49. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=2&openid=" + json.get("msg").toString());
  50. } else if (Integer.parseInt(json.get("status").toString()) == 200) {
  51. // String json2 = json.get("data").toString();
  52. // String paramUrl = getParamUrl(json2, 2);
  53. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/zxyy/html/online-appointment.html");
  54. } else
  55. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html");
  56. }
  57. /**
  58. * 健康服务»健康指导
  59. * @param code
  60. * @return
  61. * @throws IOException
  62. * @throws JSONException
  63. */
  64. @RequestMapping(value = "jkzd", method = RequestMethod.GET)
  65. public void jkzd(HttpServletResponse response, String code) throws JSONException, IOException {
  66. String message = getOpenid(code);
  67. JSONObject json = new JSONObject(message);
  68. if (Integer.parseInt(json.get("status").toString()) == 100) {
  69. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=3&openid=" + json.get("msg").toString());
  70. } else if (Integer.parseInt(json.get("status").toString()) == 200) {
  71. // String json2 = json.get("data").toString();
  72. // String paramUrl = getParamUrl(json2, 3);
  73. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/grzx/html/my-doctor-advice.html");
  74. } else
  75. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html");
  76. }
  77. /**
  78. * 健康服务»用药指导
  79. * @param code
  80. * @return
  81. * @throws IOException
  82. * @throws JSONException
  83. */
  84. @RequestMapping(value = "yyzd", method = RequestMethod.GET)
  85. public void yyzd(HttpServletResponse response, String code) throws JSONException, IOException {
  86. String message = getOpenid(code);
  87. JSONObject json = new JSONObject(message);
  88. if (Integer.parseInt(json.get("status").toString()) == 100) {
  89. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=4&openid=" + json.get("msg").toString());
  90. } else if (Integer.parseInt(json.get("status").toString()) == 200) {
  91. // String json2 = json.get("data").toString();
  92. // String paramUrl = getParamUrl(json2, 4);
  93. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/yygl/html/pharmacy-manage.html");
  94. } else
  95. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html");
  96. }
  97. /**
  98. * 健康服务»随访计划
  99. * @param code
  100. * @return
  101. * @throws IOException
  102. * @throws JSONException
  103. */
  104. @RequestMapping(value = "sfjh", method = RequestMethod.GET)
  105. public void sfjh(HttpServletResponse response, String code) throws JSONException, IOException {
  106. String message = getOpenid(code);
  107. JSONObject json = new JSONObject(message);
  108. if (Integer.parseInt(json.get("status").toString()) == 100) {
  109. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=5&openid=" + json.get("msg").toString());
  110. } else if (Integer.parseInt(json.get("status").toString()) == 200) {
  111. // String json2 = json.get("data").toString();
  112. // String paramUrl = getParamUrl(json2, 5);
  113. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/sfgy/html/jihuaindex.html");
  114. } else
  115. response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html");
  116. }
  117. }