Search in sources :

Example 6 with User

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

the class ExaminationServlet method emTend.

public void emTend(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int id = user.getUid();
    List examinationList = dao.queryList(id);
    request.setAttribute("emList", examinationList);
    RequestDispatcher rd = request.getRequestDispatcher("examinationtend.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) List(java.util.List) ExaminationDao(com.zyf.dao.ExaminationDao) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 7 with User

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

the class ExaminationServlet method emDel.

public void emDel(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    int id = MyTools.strToint(request.getParameter("id"));
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    boolean rs = dao.emDel(id, uid);
    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=\"examination.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=\"examination.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=\"examination.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=\"examination.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    }
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) ExaminationDao(com.zyf.dao.ExaminationDao) PrintWriter(java.io.PrintWriter)

Example 8 with User

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

the class FileServlet method downloadFile.

public void downloadFile(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    FileDao filedao = new FileDao();
    String strId = request.getParameter("id");
    int id = MyTools.strToint(strId);
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    FileBean fileSingle = filedao.queryFileSingle(id, uid);
    request.setAttribute("filesingle", fileSingle);
    RequestDispatcher rd = request.getRequestDispatcher("filedownload.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) FileBean(com.zyf.bean.FileBean) FileDao(com.zyf.dao.FileDao) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 9 with User

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

the class FileServlet method selectFile.

public void selectFile(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    FileDao filedao = new FileDao();
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int id = user.getUid();
    List fileList = filedao.queryFile(id);
    request.setAttribute("fileList", fileList);
    RequestDispatcher rd = request.getRequestDispatcher("filelist.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) FileDao(com.zyf.dao.FileDao) List(java.util.List) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 10 with User

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

the class Info24Servlet method singleInfo.

public void singleInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Info24Dao infodao = new Info24Dao();
    int id = MyTools.strToint(request.getParameter("id"));
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Info24 infosingle = infodao.queryInfoSingle(id, uid);
    request.setAttribute("infosingle", infosingle);
    // 将结论也放进去
    String addr = infosingle.getConclusionaddr();
    String file = request.getSession().getServletContext().getRealPath("/") + "24holter/conclusion/" + addr;
    System.out.println(file);
    String conclusion = "";
    try {
        BufferedReader rd = new BufferedReader(new FileReader(file));
        String s = rd.readLine();
        while (null != s) {
            conclusion += s;
            s = rd.readLine();
        }
        rd.close();
    // System.out.println(str);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    System.out.println(conclusion);
    request.setAttribute("conclusion", conclusion);
    if (infosingle.getTime() <= 3700) {
        RequestDispatcher rd = request.getRequestDispatcher("info24single.jsp");
        rd.forward(request, response);
    } else {
        RequestDispatcher rd = request.getRequestDispatcher("info24singlemore.jsp");
        rd.forward(request, response);
    }
}
Also used : Info24Dao(com.zyf.dao.Info24Dao) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) RequestDispatcher(javax.servlet.RequestDispatcher) Info24(com.zyf.bean.Info24)

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