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;
import java.util.List;
import java.util.Scanner;
import edu.ncsu.csc.itrust.Messages;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.beans.PatientBean;
import edu.ncsu.csc.itrust.beans.PatientVisitBean;
......@@ -22,38 +21,60 @@ import edu.ncsu.csc.itrust.exception.ITrustException;
*
*/
public class ViewPreRegisteredPatientListAction {
private long loggedInMID;
private PatientDAO patientDAO;
private List<PatientBean> PreRegisteredPatients;
private long loggedInMID;
private PatientDAO patientDAO;
private PersonnelDAO personnelDAO;
/**
* 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 {
private ArrayList<PatientBean> PreRegisteredPatients;
PreRegisteredPatients = patientDAO.getAllPreRegisteredPatients();
if (PreRegisteredPatients != null) {
return PreRegisteredPatients;
} else {
throw new ITrustException("getAllPreRegisteredPatients() has returned null");
}
/**
* 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, 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) {
throw new ITrustException(dbe.getMessage());
}
}
}
for(PatientBean pb : plist) {
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