Search in sources :

Example 6 with Info24

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

the class Info24Dao method queryInfo24.

public List queryInfo24(int uid) {
    String sql = "";
    sql = "select * from info24 where uid='" + uid + "' order by id desc";
    ArrayList list = null;
    Info24 info24 = null;
    ResultSet rs = this.connection.executeQuery(sql);
    if (rs != null) {
        list = new ArrayList();
        try {
            while (rs.next()) {
                info24 = new Info24();
                info24.setId(rs.getInt(1));
                info24.setUid(rs.getInt(2));
                info24.setDate(rs.getString(3));
                info24.setTime(rs.getInt(4));
                info24.setDataaddr(rs.getString(5));
                info24.setConclusionaddr(rs.getString(6));
                list.add(info24);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    return list;
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) Info24(com.zyf.bean.Info24)

Example 7 with Info24

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

the class Info24Dao method queryInfoSingle.

public Info24 queryInfoSingle(int id, int uid) {
    Info24 info24 = null;
    String sql = "select * from info24 where id=" + id + " and uid=" + uid;
    ResultSet rs = this.connection.executeQuery(sql);
    try {
        if (rs.next()) {
            info24 = new Info24();
            info24.setId(rs.getInt(1));
            info24.setUid(rs.getInt(2));
            info24.setDate(rs.getString(3));
            info24.setTime(rs.getInt(4));
            info24.setDataaddr(rs.getString(5));
            info24.setConclusionaddr(rs.getString(6));
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return info24;
}
Also used : SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) Info24(com.zyf.bean.Info24)

Example 8 with Info24

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

the class Info24Servlet method select_con_list.

public void select_con_list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    Info24Dao info24Dao = new Info24Dao();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    // List infoList = info24Dao.queryInfo24(uid);
    // JsonArray array = new JsonArray();
    int id = MyTools.strToint(request.getParameter("id"));
    Info24 single = info24Dao.queryInfoSingle(id, uid);
    JsonObject ob = new JsonObject();
    String conclusion = "";
    String addr = single.getConclusionaddr();
    String file = request.getSession().getServletContext().getRealPath("/") + "24holter/conclusion/" + addr;
    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();
    }
    conclusion = "[" + conclusion + "]";
    ob.addProperty("con", conclusion);
    // array.add(ob);
    PrintWriter out = response.getWriter();
    out.print(ob);
    out.flush();
    out.close();
}
Also used : Info24Dao(com.zyf.dao.Info24Dao) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) Info24(com.zyf.bean.Info24)

Example 9 with Info24

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

the class Info24Dao method queryTimeInfo.

public List queryTimeInfo(int uid, String startdate, String enddate) {
    String sql = "";
    sql = "select * from info24 where uid='" + uid + "'" + "and to_days(date)>=to_days('" + startdate + "') and to_days(date)<=to_days('" + enddate + "') order by id desc";
    ArrayList list = null;
    Info24 info24 = null;
    ResultSet rs = this.connection.executeQuery(sql);
    if (rs != null) {
        list = new ArrayList();
        try {
            while (rs.next()) {
                info24 = new Info24();
                info24.setId(rs.getInt(1));
                info24.setUid(rs.getInt(2));
                info24.setDate(rs.getString(3));
                info24.setTime(rs.getInt(4));
                info24.setDataaddr(rs.getString(5));
                info24.setConclusionaddr(rs.getString(6));
                list.add(info24);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    return list;
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) Info24(com.zyf.bean.Info24)

Aggregations

Info24 (com.zyf.bean.Info24)9 User (com.zyf.bean.User)6 Info24Dao (com.zyf.dao.Info24Dao)6 HttpSession (javax.servlet.http.HttpSession)6 JsonObject (com.google.gson.JsonObject)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 RequestDispatcher (javax.servlet.RequestDispatcher)3 JsonArray (com.google.gson.JsonArray)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2