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
package edu.ncsu.csc.itrust.action;
import java.util.List;
import edu.ncsu.csc.itrust.action.base.PatientBaseAction;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.OfficeVisitDAO;
import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
* Used for Document Office Visit page (documentOfficeVisit.jsp). This just adds an empty office visit, and
* provides a list of office visits in case you want to edit an old office visit.
*
* Very similar to {@link AddPatientAction}
*
*
*/
public class AddOfficeVisitAction extends PatientBaseAction {
private DAOFactory factory;
private OfficeVisitDAO ovDAO;
/**
* Sets up the defaults for the class
* @param factory
* @param pidString
* Patient ID to be validated by the superclass, {@link PatientBaseAction}
* @throws ITrustException
*/
public AddOfficeVisitAction(DAOFactory factory, String pidString) throws ITrustException {
super(factory, pidString);
this.factory = factory;
ovDAO = factory.getOfficeVisitDAO();
}
/**
* Adds an empty office visit
*
* @param loggedInMID
* For logging purposes
* @return Office visit ID (primary key) of the new office visit
* @throws DBException
*/
public long addEmptyOfficeVisit(long loggedInMID) throws DBException {
OfficeVisitBean ov = new OfficeVisitBean();
ov.setHcpID(loggedInMID);
ov.setPatientID(pid);
long visitID = ovDAO.add(ov);
return visitID;
}
/**
* Lists all office visits for a particular patient, regardless of who originally documented the office
* visit.
*
* @return List of office visits,
* @throws ITrustException
*/
public List<OfficeVisitBean> getAllOfficeVisits() throws ITrustException {
return ovDAO.getAllOfficeVisits(pid);
}
/**
* Returns the full name of the patient with this MID
*
* @return name in the form of a string
* @throws DBException
* @throws ITrustException
*/
public String getUserName() throws DBException, ITrustException {
return factory.getAuthDAO().getUserName(pid);
}
}