package com.yihu.wlyy.web.wx; import java.io.IOException; import javax.servlet.http.HttpServletResponse; import io.swagger.annotations.Api; import org.json.JSONException; import org.json.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.yihu.wlyy.util.SystemConf; import com.yihu.wlyy.web.WeixinBaseController; @Controller @RequestMapping("/wx/my/info") @Api(description = "患者端-个人信息") public class MyInfoController extends WeixinBaseController { /** * 我的»我的资料 * @param code * @return * @throws IOException * @throws JSONException */ @RequestMapping(value = "wdzl", method = RequestMethod.GET) public void wdzl(HttpServletResponse response, String code) throws JSONException, IOException { String message = getOpenid(code); JSONObject json = new JSONObject(message); if (Integer.parseInt(json.get("status").toString()) == 100) { response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=11&openid=" + json.get("msg").toString()); } else if (Integer.parseInt(json.get("status").toString()) == 200) { // String json2 = json.get("data").toString(); // String paramUrl = getParamUrl(json2, 11); response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/grzx/html/my-detail.html"); } else response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html"); } /** * 我的»我的预约 * @param code * @return * @throws IOException * @throws JSONException */ @RequestMapping(value = "wdyy", method = RequestMethod.GET) public void wdyy(HttpServletResponse response, String code) throws JSONException, IOException { String message = getOpenid(code); JSONObject json = new JSONObject(message); if (Integer.parseInt(json.get("status").toString()) == 100) { response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=12&openid=" + json.get("msg").toString()); } else if (Integer.parseInt(json.get("status").toString()) == 200) { // String json2 = json.get("data").toString(); // String paramUrl = getParamUrl(json2, 12); response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/grzx/html/my-appointment.html"); } else response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html"); } /** * 我的»咨询记录 * @param code * @return * @throws IOException * @throws JSONException */ @RequestMapping(value = "zxjl", method = RequestMethod.GET) public void zxjl(HttpServletResponse response, String code) throws JSONException, IOException { String message = getOpenid(code); JSONObject json = new JSONObject(message); if (Integer.parseInt(json.get("status").toString()) == 100) { response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=13&openid=" + json.get("msg").toString()); } else if (Integer.parseInt(json.get("status").toString()) == 200) { // String json2 = json.get("data").toString(); // String paramUrl = getParamUrl(json2, 13); response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/zxwz/html/teachers-consulting-list.html"); } else response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html"); } /** * 我的»我的设备 * @param code * @return * @throws IOException * @throws JSONException */ @RequestMapping(value = "wdsb", method = RequestMethod.GET) public void wdsb(HttpServletResponse response, String code) throws JSONException, IOException { String message = getOpenid(code); JSONObject json = new JSONObject(message); if (Integer.parseInt(json.get("status").toString()) == 100) { response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=14&openid=" + json.get("msg").toString()); } else if (Integer.parseInt(json.get("status").toString()) == 200) { // String json2 = json.get("data").toString(); // String paramUrl = getParamUrl(json2, 14); response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/grzx/html/my-equipments.html"); } else response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html"); } /** * 我的»就诊指导 * @param code * @return * @throws IOException * @throws JSONException */ @RequestMapping(value = "jzzd", method = RequestMethod.GET) public void jzzd(HttpServletResponse response, String code) throws JSONException, IOException { String message = getOpenid(code); JSONObject json = new JSONObject(message); if (Integer.parseInt(json.get("status").toString()) == 100) { response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/login.html?type=15&openid=" + json.get("msg").toString()); } else if (Integer.parseInt(json.get("status").toString()) == 200) { // String json2 = json.get("data").toString(); // String paramUrl = getParamUrl(json2, 15); response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/html/home/html/guide.html"); } else response.sendRedirect(SystemConf.getInstance().getServerUrlStr() + "wx/health_service/404.html"); } }