Skip to content
Snippets Groups Projects
Commit a4a4215f authored by mjw11's avatar mjw11
Browse files

Remove commented code, fix bugs in PatientDAO

parent 8c1e0821
No related branches found
No related tags found
1 merge request!22Merge UC92 into Master
......@@ -23,10 +23,6 @@ import edu.ncsu.csc.itrust.exception.ITrustException;
public class ViewPreRegisteredPatientListAction {
private long loggedInMID;
private PatientDAO patientDAO;
private PersonnelDAO personnelDAO;
// private OfficeVisitDAO officevisitDAO;
// private ArrayList<PatientVisitBean> visits;
private ArrayList<PatientBean> PreRegisteredPatients;
/**
......@@ -34,16 +30,10 @@ public class ViewPreRegisteredPatientListAction {
* @param factory The DAOFactory used to create the DAOs used in this action.
* @param loggedInMID The MID of the person viewing the office visits.
*/
public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) { ///////// ??????? long loggedInMID NEEDED
this.loggedInMID = loggedInMID;
this.personnelDAO = factory.getPersonnelDAO(); ///////// ??????? .getPersonnelDAO(); NEEDED ???
//officevisitDAO = factory.getOfficeVisitDAO();
this.patientDAO = factory.getPatientDAO(); //////////////////////////////
// visits = new ArrayList<PatientVisitBean>();
public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) {
this.patientDAO = factory.getPatientDAO();
PreRegisteredPatients = new ArrayList<PatientBean>();
}
......@@ -53,37 +43,13 @@ public class ViewPreRegisteredPatientListAction {
*
* @throws ITrustException
*/
// private void processOfficeVisits() throws ITrustException {
private void getPreRegisteredFromPatientsTable() throws ITrustException {
try {
// List<PatientBean> plist = patientDAO.getAllPatients(); ////////////////// change from getAllPatients() to getPREREgistered (), DAO handles SQL
List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients(); ////////////////// change from getAllPatients() to getPREREgistered (), DAO handles SQL
List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients();
for(PatientBean pb : plist) {
// Create a new visit bean
// PatientVisitBean visitBean = new PatientVisitBean();
// PatientBean PreRegisteredBean = new PatientBean();
// Add patient's information to the PreRegisteredPatientBean
// PreRegisteredBean.setPatient(pb); ////////////// ????????????????????
// PreRegisteredBean.setPatientName(pb.getFullName()); /////////// .setPatientName () only in PatientVisitBean.java
// PreRegisteredBean.setFirstName(pb.getFullName());
// PreRegisteredBean.setAddress1(pb.getStreetAddress1() +" " + pb.getStreetAddress2()); /////// WILL CHANGE LATER
// PreRegisteredBean.setAddress2(pb.getCity() + " " +pb.getState() +" " +pb.getZip());
// PreRegisteredBean.setStreetAddress1(pb.getStreetAddress1() +" " + pb.getStreetAddress2()); /////// WILL CHANGE LATER
// Get this patients office visit history
// List<OfficeVisitBean> ovlist = officevisitDAO.getAllOfficeVisits(pb.getMID());
// If they've had an office visit previously, get the date of the latest visit
PreRegisteredPatients.add(pb);
}
......@@ -102,7 +68,6 @@ public class ViewPreRegisteredPatientListAction {
public List<PatientBean> getPreRegisteredPatients() throws DBException {
try {
// processOfficeVisits();
getPreRegisteredFromPatientsTable();
}
......@@ -110,15 +75,6 @@ public class ViewPreRegisteredPatientListAction {
//TODO
}
// return visits;
return PreRegisteredPatients;
}
/**
* Returns a PersonnelBean for the logged in HCP
* @return PersonnelBean for the logged in HCP
* @throws ITrustException
*/
// public PersonnelBean getPersonnel() throws ITrustException {
// return personnelDAO.getPersonnel(loggedInMID);
// }
}
\ No newline at end of file
}
......@@ -99,19 +99,17 @@ public class PatientDAO {
* Returns the role of a particular patient - why is this in PatientDAO? It should be in AuthDAO
*
* @param mid The MID of the patient in question.
* @param role A String representing the role of the patient.
* @return A String representing the patient's role.
* @throws ITrustException
* @throws DBException
*/
public String getRole(long mid, String role) throws ITrustException, DBException {
public String getRole(long mid) throws ITrustException, DBException {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = factory.getConnection();
ps = conn.prepareStatement("SELECT role FROM users WHERE MID=? AND Role=?");
ps = conn.prepareStatement("SELECT role FROM users WHERE MID=?");
ps.setLong(1, mid);
ps.setString(2, "patient"); // role); ///////////////////////// ??????????????
ResultSet rs;
rs = ps.executeQuery();
if (rs.next()) {
......@@ -227,7 +225,6 @@ public class PatientDAO {
}
}
/*added for UC91 */
public boolean isEmailInUse(String email) throws DBException {
Connection conn = null;
PreparedStatement ps = null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment