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; ...@@ -23,10 +23,6 @@ import edu.ncsu.csc.itrust.exception.ITrustException;
public class ViewPreRegisteredPatientListAction { public class ViewPreRegisteredPatientListAction {
private long loggedInMID; private long loggedInMID;
private PatientDAO patientDAO; private PatientDAO patientDAO;
private PersonnelDAO personnelDAO;
// private OfficeVisitDAO officevisitDAO;
// private ArrayList<PatientVisitBean> visits;
private ArrayList<PatientBean> PreRegisteredPatients; private ArrayList<PatientBean> PreRegisteredPatients;
/** /**
...@@ -34,16 +30,10 @@ public class ViewPreRegisteredPatientListAction { ...@@ -34,16 +30,10 @@ public class ViewPreRegisteredPatientListAction {
* @param factory The DAOFactory used to create the DAOs used in this action. * @param factory The DAOFactory used to create the DAOs used in this action.
* @param loggedInMID The MID of the person viewing the office visits. * @param loggedInMID The MID of the person viewing the office visits.
*/ */
public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) { ///////// ??????? long loggedInMID NEEDED public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) {
this.loggedInMID = loggedInMID;
this.patientDAO = factory.getPatientDAO();
this.personnelDAO = factory.getPersonnelDAO(); ///////// ??????? .getPersonnelDAO(); NEEDED ???
//officevisitDAO = factory.getOfficeVisitDAO();
this.patientDAO = factory.getPatientDAO(); //////////////////////////////
// visits = new ArrayList<PatientVisitBean>();
PreRegisteredPatients = new ArrayList<PatientBean>(); PreRegisteredPatients = new ArrayList<PatientBean>();
} }
...@@ -53,37 +43,13 @@ public class ViewPreRegisteredPatientListAction { ...@@ -53,37 +43,13 @@ public class ViewPreRegisteredPatientListAction {
* *
* @throws ITrustException * @throws ITrustException
*/ */
// private void processOfficeVisits() throws ITrustException {
private void getPreRegisteredFromPatientsTable() throws ITrustException { private void getPreRegisteredFromPatientsTable() throws ITrustException {
try { try {
// List<PatientBean> plist = patientDAO.getAllPatients(); ////////////////// change from getAllPatients() to getPREREgistered (), DAO handles SQL List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients();
List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients(); ////////////////// change from getAllPatients() to getPREREgistered (), DAO handles SQL
for(PatientBean pb : plist) { 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); PreRegisteredPatients.add(pb);
} }
...@@ -102,7 +68,6 @@ public class ViewPreRegisteredPatientListAction { ...@@ -102,7 +68,6 @@ public class ViewPreRegisteredPatientListAction {
public List<PatientBean> getPreRegisteredPatients() throws DBException { public List<PatientBean> getPreRegisteredPatients() throws DBException {
try { try {
// processOfficeVisits();
getPreRegisteredFromPatientsTable(); getPreRegisteredFromPatientsTable();
} }
...@@ -110,15 +75,6 @@ public class ViewPreRegisteredPatientListAction { ...@@ -110,15 +75,6 @@ public class ViewPreRegisteredPatientListAction {
//TODO //TODO
} }
// return visits;
return PreRegisteredPatients; 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 { ...@@ -99,19 +99,17 @@ public class PatientDAO {
* Returns the role of a particular patient - why is this in PatientDAO? It should be in AuthDAO * 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 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. * @return A String representing the patient's role.
* @throws ITrustException * @throws ITrustException
* @throws DBException * @throws DBException
*/ */
public String getRole(long mid, String role) throws ITrustException, DBException { public String getRole(long mid) throws ITrustException, DBException {
Connection conn = null; Connection conn = null;
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
conn = factory.getConnection(); 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.setLong(1, mid);
ps.setString(2, "patient"); // role); ///////////////////////// ??????????????
ResultSet rs; ResultSet rs;
rs = ps.executeQuery(); rs = ps.executeQuery();
if (rs.next()) { if (rs.next()) {
...@@ -227,7 +225,6 @@ public class PatientDAO { ...@@ -227,7 +225,6 @@ public class PatientDAO {
} }
} }
/*added for UC91 */
public boolean isEmailInUse(String email) throws DBException { public boolean isEmailInUse(String email) throws DBException {
Connection conn = null; Connection conn = null;
PreparedStatement ps = 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