Patient.java
001 package com.bea.medrec.value;
002 
003 import java.util.Calendar;
004 
005 /**
006  <p>This class represents information about a patient.</p>
007  *
008  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
009  */
010 public final class Patient extends BaseVO {
011 
012   // Attributes
013   private String firstName;
014   private String middleName;
015   private String lastName;
016   private Calendar dob;
017   private String gender;
018   private String ssn;
019   private String phone;
020   private String email;
021   private Address address;
022 
023   // Constructors
024   public Patient() {
025   }
026 
027   public Patient(Integer id,
028                  String firstName,
029                  String middleName,
030                  String lastName,
031                  Calendar dob,
032                  String gender,
033                  String ssn,
034                  String phone,
035                  String email,
036                  Address address) {
037     super.setId(id);
038     this.firstName = firstName;
039     this.middleName = middleName;
040     this.lastName = lastName;
041     this.dob = dob;
042     this.gender = gender;
043     this.ssn = ssn;
044     this.phone = phone;
045     this.email = email;
046     this.address = address;
047   }
048 
049   public Patient(String id,
050                  String firstName,
051                  String middleName,
052                  String lastName,
053                  Calendar dob,
054                  String gender,
055                  String ssn,
056                  String phone,
057                  String email,
058                  Address address) {
059     super.setId(id);
060     this.firstName = firstName;
061     this.middleName = middleName;
062     this.lastName = lastName;
063     this.dob = dob;
064     this.gender = gender;
065     this.ssn = ssn;
066     this.phone = phone;
067     this.email = email;
068     this.address = address;
069   }
070 
071   // Getters
072   public String getFirstName() {
073     return this.firstName;
074   }
075 
076   public String getMiddleName() {
077     return this.middleName;
078   }
079 
080   public String getLastName() {
081     return this.lastName;
082   }
083 
084   public Calendar getDateOfBirth() {
085     return this.dob;
086   }
087 
088   public String getDateOfBirthString() {
089     return (dob == null"null" : getDisplayDate(dob);
090   }
091 
092   public String getGender() {
093     return this.gender;
094   }
095 
096   public String getSsn() {
097     return this.ssn;
098   }
099 
100   public String getPhone() {
101     return this.phone;
102   }
103 
104   public String getEmail() {
105     return this.email;
106   }
107 
108   public Address getAddress() {
109     return this.address;
110   }
111 
112   // Setters
113   public void setFirstName(String firstName) {
114     this.firstName = firstName;
115   }
116 
117   public void setMiddleName(String middleName) {
118     this.middleName = middleName;
119   }
120 
121   public void setLastName(String lastName) {
122     this.lastName = lastName;
123   }
124 
125   public void setDateOfBirth(Calendar dob) {
126     this.dob = dob;
127   }
128 
129   public void setGender(String gender) {
130     this.gender = gender;
131   }
132 
133   public void setSsn(String ssn) {
134     this.ssn = ssn;
135   }
136 
137   public void setPhone(String phone) {
138     this.phone = phone;
139   }
140 
141   public void setEmail(String email) {
142     this.email = email;
143   }
144 
145   public void setAddress(Address address) {
146     this.address = address;
147   }
148 
149   // Utility
150   public String toString() {
151     StringBuffer str = new StringBuffer();
152     str.append("Patient[Id: "+super.getId());
153     str.append(" | Name: "+firstName);
154     str.append(" "+middleName);
155     str.append(" "+lastName);
156     str.append(" | DOB: "+getDateOfBirthString());
157     str.append(" | Gender: "+this.gender);
158     str.append(" | SSN: "+ssn);
159     str.append(" | Phone: "+phone);
160     str.append(" | Email: "+email);
161     str.append(" | "+((address == null"Address: null" : address.toString()));
162     str.append("]");
163     return str.toString();
164   }
165 
166   public String toStringLite() {
167     StringBuffer str = new StringBuffer();
168     str.append("Patient[Id: "+super.getId());
169     str.append(" | Name: "+firstName);
170     str.append(" "+middleName);
171     str.append(" "+lastName);
172     str.append(" | SSN: "+ssn);
173     str.append("]");
174     return str.toString();
175   }
176 }