use of com.zyf.bean.BloodPressure in project HeartWatchdogJsp by Viczyf.
the class BloodpressureServlet method select_time_bloodpressure.
private void select_time_bloodpressure(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
BloodPressureDao bloodPressureDao = new BloodPressureDao();
String startdate = request.getParameter("startdate");
String enddate = request.getParameter("enddate");
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
int uid = user.getUid();
System.out.println("uid" + uid);
List bpList = bloodPressureDao.queryTimeBloodPressure(uid, startdate, enddate);
System.out.println(bpList.size());
JsonArray array = new JsonArray();
for (int i = 0; i < bpList.size(); i++) {
BloodPressure bp = (BloodPressure) bpList.get(i);
JsonObject ob = new JsonObject();
ob.addProperty("id", i + 1);
ob.addProperty("date", bp.getDate());
ob.addProperty("highPressure", bp.getHighpressure());
ob.addProperty("lowPressure", bp.getLowpressure());
ob.addProperty("xinlv", bp.getXinlv());
array.add(ob);
}
System.out.println(array);
PrintWriter out = response.getWriter();
out.print(array);
}
use of com.zyf.bean.BloodPressure in project HeartWatchdogJsp by Viczyf.
the class BloodPressureDao method queryBloodPressure.
public List queryBloodPressure(int uid) {
String sql = "";
;
sql = "select * from bloodpressure where uid ='" + uid + "' order by id desc";
ArrayList list = null;
BloodPressure bp = null;
ResultSet rs = this.connection.executeQuery(sql);
if (rs != null) {
list = new ArrayList();
try {
while (rs.next()) {
bp = new BloodPressure();
bp.setId(rs.getInt(1));
bp.setUid(rs.getInt(2));
bp.setDate(rs.getString(3));
bp.setHighpressure(rs.getInt(4));
bp.setLowpressure(rs.getInt(5));
bp.setXinlv(rs.getInt(6));
list.add(bp);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
use of com.zyf.bean.BloodPressure in project HeartWatchdogJsp by Viczyf.
the class BloodpressureServlet method selectBloodpressure.
private void selectBloodpressure(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
BloodPressureDao bloodPressureDao = new BloodPressureDao();
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
int uid = user.getUid();
List bpList = bloodPressureDao.queryBloodPressure(uid);
JsonArray array = new JsonArray();
for (int i = 0; i < bpList.size(); i++) {
BloodPressure bp = (BloodPressure) bpList.get(i);
JsonObject ob = new JsonObject();
ob.addProperty("id", i + 1);
ob.addProperty("date", bp.getDate());
ob.addProperty("highPressure", bp.getHighpressure());
ob.addProperty("lowPressure", bp.getLowpressure());
ob.addProperty("xinlv", bp.getXinlv());
array.add(ob);
}
System.out.println(array);
PrintWriter out = response.getWriter();
out.print(array);
}
use of com.zyf.bean.BloodPressure in project HeartWatchdogJsp by Viczyf.
the class BloodPressureDao method queryTimeBloodPressure.
public List queryTimeBloodPressure(int uid, String startdate, String enddate) {
String sql = "";
;
sql = "select * from bloodpressure where uid ='" + uid + "'" + "and to_days(date)>=to_days('" + startdate + "') and to_days(date)<=to_days('" + enddate + "') order by id desc";
ArrayList list = null;
BloodPressure bp = null;
ResultSet rs = this.connection.executeQuery(sql);
if (rs != null) {
list = new ArrayList();
try {
while (rs.next()) {
bp = new BloodPressure();
bp.setId(rs.getInt(1));
bp.setUid(rs.getInt(2));
bp.setDate(rs.getString(3));
bp.setHighpressure(rs.getInt(4));
bp.setLowpressure(rs.getInt(5));
bp.setXinlv(rs.getInt(6));
list.add(bp);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
Aggregations