Skip to content
Snippets Groups Projects
Commit 3846322f authored by xuechen5's avatar xuechen5
Browse files

Backend: Add function to retrieve a list of pre-registered patients

parent 677b7bce
No related branches found
No related tags found
2 merge requests!22Merge UC92 into Master,!15Merge 5-uc-92-activate-pre-registered-patient-2 into UC92v2
...@@ -4,7 +4,6 @@ import java.util.ArrayList; ...@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner; import java.util.Scanner;
import edu.ncsu.csc.itrust.Messages;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean; import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.beans.PatientBean; import edu.ncsu.csc.itrust.beans.PatientBean;
import edu.ncsu.csc.itrust.beans.PatientVisitBean; import edu.ncsu.csc.itrust.beans.PatientVisitBean;
...@@ -22,38 +21,60 @@ import edu.ncsu.csc.itrust.exception.ITrustException; ...@@ -22,38 +21,60 @@ 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 List<PatientBean> PreRegisteredPatients; private PersonnelDAO personnelDAO;
/** private ArrayList<PatientBean> PreRegisteredPatients;
* Set up defaults
* @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) {
this.patientDAO = factory.getPatientDAO();
}
/**
* Identify all the PreRegistered Patients from Patients Table using Users Table Role="PreRegistered", and add them to a list.
*
* @throws ITrustException
*/
public List<PatientBean> getPreRegisteredPatients() throws ITrustException {
try {
PreRegisteredPatients = patientDAO.getAllPreRegisteredPatients(); /**
if (PreRegisteredPatients != null) { * Set up defaults
return PreRegisteredPatients; * @param factory The DAOFactory used to create the DAOs used in this action.
} else { * @param loggedInMID The MID of the person viewing the office visits.
throw new ITrustException("getAllPreRegisteredPatients() has returned null"); */
} public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) {
this.loggedInMID = loggedInMID;
this.personnelDAO = factory.getPersonnelDAO();
this.patientDAO = factory.getPatientDAO();
PreRegisteredPatients = new ArrayList<PatientBean>();
}
/**
* Identify all the PreRegistered Patients from Patients Table using Users Table Role="PreRegistered", and add them to a list.
*
* @throws ITrustException
*/
private void getPreRegisteredFromPatientsTable() throws ITrustException {
try {
List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients();
} catch (DBException dbe) { for(PatientBean pb : plist) {
throw new ITrustException(dbe.getMessage());
} PreRegisteredPatients.add(pb);
} }
} }
catch (DBException dbe) {
throw new ITrustException(dbe.getMessage());
}
}
/**
* Get the list of Pre-Registered patients
*
* @return the list of patients an HCP has had office visits with
* @throws DBException
*/
public List<PatientBean> getPreRegisteredPatients() throws DBException {
try {
getPreRegisteredFromPatientsTable();
}
catch (ITrustException ie) {
}
return PreRegisteredPatients;
}
}
\ No newline at end of file
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