Search in sources :

Example 11 with User

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

the class Info24Servlet method selectInfo.

public void selectInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Info24Dao infodao = new Info24Dao();
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int id = user.getUid();
    List infoList = infodao.queryInfo24(id);
    // request.setAttribute("infoList", infoList);
    JsonArray array = new JsonArray();
    for (int i = 0; i < infoList.size(); i++) {
        Info24 single = (Info24) infoList.get(i);
        JsonObject ob = new JsonObject();
        ob.addProperty("id", i + 1);
        ob.addProperty("date", single.getDate());
        // ob.addProperty("conclusion", "<a href=\"#\" class=\"md-trigger\" id=link_"+(i+1)+" data-modal=\"con-"+(i+1)+"\">查看结论</a>");
        ob.addProperty("conclusion", "<a id=link_" + (i + 1) + " onclick=\"funcCon(" + single.getId() + ")\" style=\"cursor: pointer;\">查看结论</a>");
        ob.addProperty("read", "<a href=\"Info24Servlet?action=single&id=" + single.getId() + " \"target=\"_blank\">查看记录</a>");
        ob.addProperty("read1", "<a href=\"Info24Servlet?action=singlepot&id=" + single.getId() + " \"target=\"_blank\">特征点标记</a>");
        // ob.addProperty("del", "<a onclick=\"alert('弹出')\">删除记录</a>");
        // ob.addProperty("del", "<button class=\"btn btn-primary md-close\">Close me!</button>");
        ob.addProperty("del", "<a href=\"Info24Servlet?action=delete&id=" + single.getId() + "\">删除记录</a>");
        array.add(ob);
    }
    PrintWriter out = response.getWriter();
    out.print(array);
    System.out.println(array);
// RequestDispatcher rd = request.getRequestDispatcher("infolist.jsp");
// request.setAttribute("listjson", array);
// rd.forward(request, response);
}
Also used : JsonArray(com.google.gson.JsonArray) Info24Dao(com.zyf.dao.Info24Dao) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) List(java.util.List) Info24(com.zyf.bean.Info24)

Example 12 with User

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

the class Info24Servlet method singlepotInfo.

public void singlepotInfo(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() <= 500) {
        RequestDispatcher rd = request.getRequestDispatcher("info24singlepot.jsp");
        rd.forward(request, response);
    } else {
        RequestDispatcher rd = request.getRequestDispatcher("info24singlemorepot.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)

Example 13 with User

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

the class Info24Servlet method select_time_info.

public void select_time_info(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Info24Dao infodao = new Info24Dao();
    String startdate = request.getParameter("startdate");
    String enddate = request.getParameter("enddate");
    HttpSession session = request.getSession();
    // 获取用户对象
    User user = (User) session.getAttribute("user");
    int id = user.getUid();
    List infoList = infodao.queryTimeInfo(id, startdate, enddate);
    JsonArray array = new JsonArray();
    for (int i = 0; i < infoList.size(); i++) {
        Info24 single = (Info24) infoList.get(i);
        JsonObject ob = new JsonObject();
        ob.addProperty("id", i + 1);
        ob.addProperty("date", single.getDate());
        ob.addProperty("read", "<a href=\"Info24Servlet?action=single&id=" + single.getId() + " \"target=\"_blank\">查看记录</a>");
        ob.addProperty("read1", "<a href=\"Info24Servlet?action=singlepot&id=" + single.getId() + " \"target=\"_blank\">特征点标记</a>");
        ob.addProperty("del", "<a href=\"Info24Servlet?action=delete&id=" + single.getId() + "\">删除记录</a>");
        array.add(ob);
    }
    PrintWriter out = response.getWriter();
    out.print(array);
// System.out.println(array);
}
Also used : JsonArray(com.google.gson.JsonArray) Info24Dao(com.zyf.dao.Info24Dao) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) List(java.util.List) Info24(com.zyf.bean.Info24)

Example 14 with User

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

the class Info24Servlet method deleteInfo.

public void deleteInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String message = "";
    String forward = "";
    String href = "";
    Info24Dao infodao = new Info24Dao();
    int id = MyTools.strToint(request.getParameter("id"));
    Info24 info = new Info24();
    info.setId(id);
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    boolean mark = infodao.delInfo24(info, uid);
    if (mark) {
        message = message + "<li>删除记录成功!</li>";
        forward = "tishi.jsp";
        href = href + "info24time.jsp";
    } else {
        message = message + "<li>删除记录失败!</li>";
        forward = "tishi.jsp";
        href = href + "info24time.jsp";
    }
    request.setAttribute("message", message);
    request.setAttribute("href", href);
    RequestDispatcher rd = request.getRequestDispatcher(forward);
    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)

Example 15 with User

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

the class InfoServlet method selectInfo.

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

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