use of com.zyf.bean.Info24 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);
}
}
use of com.zyf.bean.Info24 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);
}
use of com.zyf.bean.Info24 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);
}
}
use of com.zyf.bean.Info24 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);
}
use of com.zyf.bean.Info24 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);
}
Aggregations