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
package edu.ncsu.csc.itrust.action;
import java.text.SimpleDateFormat;
import java.util.List;
import edu.ncsu.csc.itrust.beans.BillingBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.BillingDAO;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
* ViewClaimsAction handles interaction between user input and the billing DAO.
*/
public class ViewClaimsAction {
/**billingAccess provides access to the Billing table*/
private BillingDAO billingAccess;
/**patientRetriever provides access to the patients table*/
private PatientDAO patientRetriever;
/**
* ViewClaimsAction simply initializes the DAOs.
* @param fact The dao factory that will create the DAOs
*/
public ViewClaimsAction(DAOFactory fact){
billingAccess = fact.getBillingDAO();
patientRetriever = fact.getPatientDAO();
}
/**
* getClaims returns a list of all the insurance claims.
* @return A list of all the insurance claims.
*/
public List<BillingBean> getClaims(){
List<BillingBean> result = null;
try {
result = billingAccess.getInsuranceBills();
} catch (DBException e) {
e.printStackTrace();
}
return result;
}
/**
* getSubmitter returns the person who submitted the claim.
* @param b The bill we are curious about.
* @return The name of the submitter.
*/
public String getSubmitter(BillingBean b){
String result = null;
try {
result = patientRetriever.getName(b.getPatient());
} catch (ITrustException e) {
e.printStackTrace();
}
return result;
}
/**
* getDate returns the date the bill was submitted.
* @param b The bill we are talking
* @return
*/
public String getDate(BillingBean b){
return new SimpleDateFormat("MM/dd/YYYY").format(b.getSubTime());
}
}