diff --git a/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java b/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java index aa8ee608bb663ad7ec21b1cd105470ef34144c6f..13bdd58b95468b2c7fda72827f78e8125f15f271 100644 --- a/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java +++ b/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java @@ -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 +} diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java index 8fa49352d50400f863e5523b6d98791b7417837c..7314e60f777846db30353b727eaa33869e577039 100644 --- a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java +++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java @@ -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;