Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
*
*/
package edu.ncsu.csc.itrust.action;
import java.util.ArrayList;
import java.util.List;
import edu.ncsu.csc.itrust.action.base.EditOfficeVisitBaseAction;
import edu.ncsu.csc.itrust.beans.ReferralBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO;
import edu.ncsu.csc.itrust.dao.mysql.ReferralDAO;
import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
* Class for creating and editing referrals associated with a particular office
* visit.
*
*/
public class EditReferralsAction extends EditOfficeVisitBaseAction {
private ReferralDAO referralDAO;
private PatientDAO patientDAO;
private PersonnelDAO personnelDAO;
public EditReferralsAction(DAOFactory factory, long hcpid,
String pidString, String ovIDString)
throws ITrustException {
super(factory, hcpid, pidString, ovIDString);
referralDAO = factory.getReferralDAO();
patientDAO = factory.getPatientDAO();
personnelDAO = factory.getPersonnelDAO();
}
public EditReferralsAction(DAOFactory factory, long hcpid,
String pidString)
throws ITrustException {
super(factory, hcpid, pidString);
referralDAO = factory.getReferralDAO();
patientDAO = factory.getPatientDAO();
personnelDAO = factory.getPersonnelDAO();
}
/**
* Get all referrals associated with this office visit.
* @return List of ReferralBeans.
* @throws DBException
*/
public List<ReferralBean> getReferrals() throws DBException {
if (isUnsaved()) {
return new ArrayList<ReferralBean>();
} else {
return referralDAO.getReferralsFromOV(getOvID());
}
}
/**
* Get a specific referral.
* @param id The id of the desired referral.
* @return ReferralBean
* @throws DBException
*/
public ReferralBean getReferral(long id) throws DBException {
return referralDAO.getReferral(id);
}
/**
* Get the patient name associated with the given referral.
* @param bean
* @return The patient's name as a String.
* @throws ITrustException
*/
public String getPatientName(ReferralBean bean) throws ITrustException {
return patientDAO.getName(bean.getPatientID());
}
/**
* Get the name of the receiving HCP associated with the given referral.
* @param bean
* @return The HCP's name as a String.
* @throws ITrustException
*/
public String getReceivingHCPName(ReferralBean bean) throws ITrustException {
return personnelDAO.getName(bean.getReceiverID());
}
}