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
package edu.ncsu.csc.itrust.action;
import java.util.List;
import edu.ncsu.csc.itrust.beans.LabProcedureBean;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.LabProcedureDAO;
import edu.ncsu.csc.itrust.dao.mysql.OfficeVisitDAO;
import edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO;
import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.exception.FormValidationException;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
* Class for LabProcLT.jsp. Handles lab procedures for LTs
*/
public class LabProcLTAction {
private LabProcedureDAO lpDAO;
private OfficeVisitDAO ovDAO;
private PersonnelDAO personDAO;
/**
* Setup
* @param factory The DAOFactory used to create the DAOs used in this action.
*/
public LabProcLTAction(DAOFactory factory) {
ovDAO = factory.getOfficeVisitDAO();
lpDAO = factory.getLabProcedureDAO();
personDAO = factory.getPersonnelDAO();
}
public List<LabProcedureBean> viewInTransitProcedures(long id) throws DBException{
return lpDAO.getLabProceduresInTransitForLabTech(id);
}
public List<LabProcedureBean> viewReceivedProcedures(long id) throws DBException{
return lpDAO.getLabProceduresReceivedForLabTech(id);
}
public List<LabProcedureBean> viewTestingProcedures(long id) throws DBException{
return lpDAO.getLabProceduresTestingForLabTech(id);
}
public LabProcedureBean getLabProcedure(long id) throws DBException{
return lpDAO.getLabProcedure(id);
}
public String getHCPName (long ovid) throws ITrustException {
OfficeVisitBean b = ovDAO.getOfficeVisit(ovid);
return personDAO.getName(b.getHcpID());
}
public Boolean submitResults(String id, String numericalResults, String numericalResultsUnit, String upperBound, String lowerBound) throws FormValidationException {
try {
long procedureID = Long.parseLong(id);
LabProcedureBean lp = lpDAO.getLabProcedure(procedureID);
lp.setNumericalResult(numericalResults);
lp.setNumericalResultUnit(numericalResultsUnit);
lp.setUpperBound(upperBound);
lp.setLowerBound(lowerBound);
lpDAO.submitTestResults(Long.parseLong(id), numericalResults, numericalResultsUnit, upperBound, lowerBound);
} catch (NumberFormatException e) {
return false;
} catch (DBException e) {
return false;
}
return true;
}
public Boolean submitReceived(String id) throws DBException{
try {
lpDAO.submitReceivedLP(Long.parseLong(id));
} catch (NumberFormatException e) {
return false;
}
return true;
}
public Boolean setToTesting(long id) throws DBException {
lpDAO.setLPToTesting(id);
return true;
}
}