Search in sources :

Example 46 with User

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

the class MedicalhistoryServlet method hisSingle.

public void hisSingle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    MedicalhistoryDao dao = new MedicalhistoryDao();
    HttpSession session = request.getSession();
    int id = MyTools.strToint(request.getParameter("id"));
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Medicalhistory his = dao.hisSingle(id, uid);
    request.setAttribute("his", his);
    RequestDispatcher rd = request.getRequestDispatcher("medicalhistorymodify.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) MedicalhistoryDao(com.zyf.dao.MedicalhistoryDao) RequestDispatcher(javax.servlet.RequestDispatcher) Medicalhistory(com.zyf.bean.Medicalhistory)

Example 47 with User

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

the class MedicalhistoryServlet method hisModify.

public void hisModify(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    MedicalhistoryDao dao = new MedicalhistoryDao();
    HttpSession session = request.getSession();
    int id = MyTools.strToint(request.getParameter("id"));
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Medicalhistory his = new Medicalhistory();
    String city = request.getParameter("city");
    String date = request.getParameter("date");
    String hospital = request.getParameter("hospital");
    String office = request.getParameter("office");
    String doctor = request.getParameter("doctor");
    String conclusion = request.getParameter("conclusion");
    his.setId(id);
    his.setUid(uid);
    his.setCity(city);
    his.setDate(date);
    his.setHospital(hospital);
    his.setOffice(office);
    his.setDoctor(doctor);
    his.setConclusion(conclusion);
    boolean rs = dao.hisModify(his);
    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=\"medicalhistory.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=\"medicalhistory.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=\"medicalhistory.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=\"medicalhistory.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    }
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) MedicalhistoryDao(com.zyf.dao.MedicalhistoryDao) Medicalhistory(com.zyf.bean.Medicalhistory) PrintWriter(java.io.PrintWriter)

Example 48 with User

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

the class RelaServlet method relaAgree.

private void relaAgree(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 reid = user.getUid();
    int id = MyTools.strToint(request.getParameter("id"));
    boolean rs = reladao.relaAgree(id, reid);
    if (rs) {
        messages = "添加好友成功";
        forward = "tishi.jsp";
        href = "RelaServlet?action=RelaList";
    } else {
        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 49 with User

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

the class RelaServlet method relaInfoSingle.

public void relaInfoSingle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    InfoDao infodao = new InfoDao();
    int id = MyTools.strToint(request.getParameter("para"));
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    int reid = MyTools.strToint(request.getParameter("para1"));
    Info infosingle = infodao.queryRelaInfoSingle(id, uid, reid);
    request.setAttribute("infosingle", infosingle);
    String relaid = String.valueOf(reid);
    request.setAttribute("reid", relaid);
    RequestDispatcher rd = request.getRequestDispatcher("relainfosingle.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) InfoDao(com.zyf.dao.InfoDao) Info(com.zyf.bean.Info) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 50 with User

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

the class RelaServlet method relaDelete.

private void relaDelete(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.relaDelete(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)

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