public ObservableList<Patient> searchPatient(Paginate paginate, String query) {
DBConnection connection = new DBConnection();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
ObservableList<Patient> listData = FXCollections.observableArrayList();
con = connection.geConnection();
try {
pst = con.prepareStatement("select * from patient where name like ? or phone like ? or email like ? limit " + paginate.getStart() + "," + paginate.getEnd());
pst.setString(1, query + "%");
pst.setString(2, query + "%");
pst.setString(3, query + "%");
rs = pst.executeQuery();
while (rs.next()) {
listData.add(new Patient(
rs.getInt(1),
rs.getString(2),
rs.getString(3),
LocalDate.parse(rs.getString(4)),
rs.getInt(5),
rs.getString(6),
rs.getString(7),
rs.getString(8),
rs.getString(9),
totalPrescriptionByPatient(rs.getInt(1))
));
}
rs.close();
pst.close();
con.close();
connection.con.close();
} catch (SQLException ex) {
Logger.getLogger(PatientGetway.class.getName()).log(Level.SEVERE, null, ex);
}
return listData;
}
PatientGetway.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:Dr-Assistant
作者:
评论列表
文章目录