Search in sources :

Example 26 with User

use of com.zyf.bean.User in project HeartWatchdogJsp by Viczyf.

the class RelaServlet method relaCancel.

private void relaCancel(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String messages = "";
    String forward = "";
    String href = "";
    RelaDao reladao = new RelaDao();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    int id = MyTools.strToint(request.getParameter("id"));
    boolean rs = reladao.relaCancel(id, uid);
    if (rs) {
        messages = "您已撤回该申请";
        forward = "tishi.jsp";
        href = "RelaServlet?action=RelaList";
    } else {
        // messages = "删除好友失败,请稍后重试或检查该用户是否已经删除";
        messages = "撤回申请失败,请返回检查";
        forward = "tishi.jsp";
        href = "RelaServlet?action=RelaList";
    }
    request.setAttribute("message", messages);
    request.setAttribute("href", href);
    RequestDispatcher requestDispatcher1 = request.getRequestDispatcher(forward);
    requestDispatcher1.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) RelaDao(com.zyf.dao.RelaDao) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 27 with User

use of com.zyf.bean.User in project HeartWatchdogJsp by Viczyf.

the class SuggestionServlet method saveSuggestion.

public void saveSuggestion(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    Suggestion sugg = new Suggestion();
    sugg.setUid(user.getUid());
    sugg.setUname(user.getUname());
    Date now = new Date();
    SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
    String date = format.format(now);
    System.out.println(date);
    sugg.setDate(date);
    String info = request.getParameter("info");
    sugg.setSuggsetion(info);
    SuggestionDao suggestiondao = new SuggestionDao();
    boolean rs = suggestiondao.saveSuggestion(sugg);
    if (rs) {
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        out.print("<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "    <meta charset=\"UTF-8\">\n" + "    <link href=\"css/sweet-alert.css\" rel=\"stylesheet\">\n" + "</head>\n" + "<body>\n" + "<script src=\"js/jquery-3.1.1.js\"></script>\n" + "<script src=\"js/sweet-alert.min.js\"></script>\n" + "<script type=\"text/javascript\">\n" + "    $(document).ready(function(){\n" + "        swal({\n" + "            type:\"success\",\n" + "            title: \"提交成功,感谢您的支持\",\n" + "            text: '<a href=\"suggestion.jsp\" role=\"button\"><font size=\"5\" color=\"green\"> 点此返回</font></a>。<br>3秒后自动返回。',\n" + "            animation:\"slide-from-top\",\n" + "            html: true,\n" + "            timer: 3000,\n" + "            showConfirmButton: false\n" + "        });\n" + "    })\n" + "    window.onload = function(){\n" + "        setTimeout(fun,3000);\n" + "    }\n" + "    function fun(){\n" + "        window.location=\"suggestion.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    } else {
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        out.print("<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "    <meta charset=\"UTF-8\">\n" + "    <link href=\"css/sweet-alert.css\" rel=\"stylesheet\">\n" + "</head>\n" + "<body>\n" + "<script src=\"js/jquery-3.1.1.js\"></script>\n" + "<script src=\"js/sweet-alert.min.js\"></script>\n" + "<script type=\"text/javascript\">\n" + "    $(document).ready(function(){\n" + "        swal({\n" + "            type:\"error\",\n" + "            title: \"提交失败\",\n" + "            text: '<a href=\"suggestion.jsp\" role=\"button\"><font size=\"5\" color=\"green\"> 点此返回</font></a>。<br>3秒后自动返回。',\n" + "            animation:\"slide-from-top\",\n" + "            html: true,\n" + "            timer: 3000,\n" + "            showConfirmButton: false\n" + "        });\n" + "    })\n" + "    window.onload = function(){\n" + "        setTimeout(fun,3000);\n" + "    }\n" + "    function fun(){\n" + "        window.location=\"suggestion.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    }
}
Also used : Suggestion(com.zyf.bean.Suggestion) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) SuggestionDao(com.zyf.dao.SuggestionDao) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) PrintWriter(java.io.PrintWriter)

Example 28 with User

use of com.zyf.bean.User in project HeartWatchdogJsp by Viczyf.

the class TempServlet method tendTemp.

public void tendTemp(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    TempDao tempdao = new TempDao();
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    List tempList = tempdao.queryTemp(uid);
    List tempMaxList = tempdao.queryMaxTemp(uid);
    request.setAttribute("tempList", tempList);
    request.setAttribute("tempMaxList", tempMaxList);
    RequestDispatcher rd = request.getRequestDispatcher("temptend.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) TempDao(com.zyf.dao.TempDao) HttpSession(javax.servlet.http.HttpSession) List(java.util.List) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 29 with User

use of com.zyf.bean.User in project HeartWatchdogJsp by Viczyf.

the class UrineServlet method selectUrine.

public void selectUrine(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    UrineDao urinedao = new UrineDao();
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int id = user.getUid();
    List urineList = urinedao.queryUrine(id);
    // request.setAttribute("urineList", urineList);
    JsonArray array = new JsonArray();
    for (int i = 0; i < urineList.size(); i++) {
        Urine single = (Urine) urineList.get(i);
        JsonObject ob = new JsonObject();
        ob.addProperty("id", i + 1);
        ob.addProperty("date", single.getDate());
        ob.addProperty("read", "<a href=\"UrineServlet?action=single&id=" + single.getId() + " \"target=\"_blank\">查看记录</a>");
        ob.addProperty("del", "<a href=\"UrineServlet?action=delete&id=" + single.getId() + "\">删除记录</a>");
        array.add(ob);
    }
    PrintWriter out = response.getWriter();
    out.print(array);
    System.out.println(array);
// RequestDispatcher rd = request.getRequestDispatcher("urinelist.jsp");
// request.setAttribute("listjson", array);
// rd.forward(request, response);
}
Also used : JsonArray(com.google.gson.JsonArray) Urine(com.zyf.bean.Urine) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) List(java.util.List) UrineDao(com.zyf.dao.UrineDao) PrintWriter(java.io.PrintWriter)

Example 30 with User

use of com.zyf.bean.User in project HeartWatchdogJsp by Viczyf.

the class UrineServlet method singleUrine.

public void singleUrine(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    UrineDao urinedao = new UrineDao();
    int id = MyTools.strToint(request.getParameter("id"));
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Urine urinesingle = urinedao.queryUrineSingle(id, uid);
    request.setAttribute("urinesingle", urinesingle);
    RequestDispatcher rd = request.getRequestDispatcher("urinesingle.jsp");
    rd.forward(request, response);
}
Also used : Urine(com.zyf.bean.Urine) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) UrineDao(com.zyf.dao.UrineDao) RequestDispatcher(javax.servlet.RequestDispatcher)

Aggregations

User (com.zyf.bean.User)53 HttpSession (javax.servlet.http.HttpSession)51 RequestDispatcher (javax.servlet.RequestDispatcher)28 List (java.util.List)18 PrintWriter (java.io.PrintWriter)17 JsonObject (com.google.gson.JsonObject)12 JsonArray (com.google.gson.JsonArray)11 InfoDao (com.zyf.dao.InfoDao)9 Info (com.zyf.bean.Info)7 ExaminationDao (com.zyf.dao.ExaminationDao)7 Info24 (com.zyf.bean.Info24)6 Info24Dao (com.zyf.dao.Info24Dao)6 RelaDao (com.zyf.dao.RelaDao)6 UserDao (com.zyf.dao.UserDao)6 Examination (com.zyf.bean.Examination)5 MedicalhistoryDao (com.zyf.dao.MedicalhistoryDao)5 Medicalhistory (com.zyf.bean.Medicalhistory)4 Urine (com.zyf.bean.Urine)4 FileDao (com.zyf.dao.FileDao)4 UrineDao (com.zyf.dao.UrineDao)4