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
package edu.ncsu.csc.itrust.beans;
/**
* A medication is the same thing as an ND code - it's like "Aspirin". A medication is not associated with an
* office visit; that's a "prescription". See {@link PrescriptionBean}
*
*
*/
public class MedicationBean {
private String NDCode = "";
private String description = "";
public MedicationBean() {
}
public MedicationBean(String code) {
NDCode = code;
}
public MedicationBean(String code, String description) {
NDCode = code;
this.description = description;
}
/**
* Gets the ND Code for this procedure
*
* @return The ND Code for this procedure
*/
public String getNDCode() {
return NDCode;
}
public void setNDCode(String code) {
NDCode = code;
}
/**
* Gets the ND Description for this procedure
*
* @return The ND Description for this procedure
*/
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getNDCodeFormatted() {
String code = getNDCode();
if (code.length() > 5)
return code.substring(0, 5) + "-" + code.substring(5);
else
return code;
}
@Override
public int hashCode() {
return 42; // any arbitrary constant will do
}
@Override
public boolean equals(Object other) {
return (other != null) && this.getClass().equals(other.getClass())
&& this.equals((MedicationBean) other);
}
private boolean equals(MedicationBean other) {
return description.equals(other.description) && NDCode.equals(other.NDCode);
}
}