Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

package gov.va.med.pbm.ampl.model.patientdemographics;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;

import org.springframework.lang.Nullable;

/**
* This class consists of properties representing a patient identity.
*
* @author Ian Meinert
* @since 1.0
*/
public class PatientIdentity implements Serializable {

private static final long serialVersionUID = -7788619177798333712L;

/**
* The patient id
*/
private String patientId;

/**
* The first name of the patient
*/
private String fullName;

/**
* The dfn
*/
private String dfn;

/**
* The patient date of birth
*/
@Nullable
private OffsetDateTime dob;

/**
* The patient date/time of death
*/
@Nullable
private OffsetDateTime dateOfDeath;

/**
* The patient's age.
*/
private int age;

/**
* The patient gender
*/
private String gender;

/**
* The social security number
*/
private String ssn;

/**
* The getter for the patientId.
*
* @return the patient Id
*/
public String getPatientId() {
return patientId;
}

/**
* The setter for the patientId.
*
* @param patientId the patient Id
*
*/
public void setPatientId(String patientId) {
this.patientId = patientId;
}

/**
* The getter for the fullName.
*
* @return the full name of the patient
*/
public String getFullName() {
return fullName;
}

/**
* The setter for the fullName.
*
* @param fullName the full name of the patient
*
*/
public void setFullName(String fullName) {
this.fullName = fullName;
}

/**
* The getter for the dfn.
*
* @return the patient DFN
*/
public String getDfn() {
return dfn;
}

/**
* The setter for the dfn.
*
* @param dfn the patient DFN
*
*/
public void setDfn(String dfn) {
this.dfn = dfn;
}

/**
* The getter for dob.
*
* @return the patient DOB
*/
public OffsetDateTime getDob() {
return dob;
}

/**
* The setter for dob.
*
* @param offsetDateTime the patient DOB
*
*/
public void setDob(OffsetDateTime offsetDateTime) {
this.dob = offsetDateTime;
}

/**
* The getter for dateOfDeath.
*
* @return the patient's date of death
*/
public OffsetDateTime getDateOfDeath() {
return dateOfDeath;
}

/**
* The setter for dateOfDeath.
*
* @param dateOfDeath the patient's date of death
*
*/
public void setDateOfDeath(OffsetDateTime dateOfDeath) {
this.dateOfDeath = dateOfDeath;
}

/**
* The calculated getter for age.
*
* @return the patient age.
*/
public int getAge() {
age = 0;

if (this.dob != null) {

LocalDate startDate = this.dob.toLocalDate();
LocalDate endDate = this.dateOfDeath == null ? LocalDate.now() : this.dateOfDeath.toLocalDate();

age = (int) ChronoUnit.YEARS.between(startDate, endDate);
}

return age;
}

/**
* The getter for gender.
*
* @return the patient gender
*/
public String getGender() {
return gender;
}

/**
* The setter for gender.
*
* @param gender the patient gender
*
*/
public void setGender(String gender) {
this.gender = gender;
}

/**
* The getter for ssn.
*
* @return the patient SSN
*/
public String getSsn() {
return ssn;
}

/**
* The setter for ssn.
*
* @param ssn the patient SSN
*
*/
public void setSsn(String ssn) {
this.ssn = ssn;
}
}