public class Person extends BaseOpenmrsData implements Serializable
Patient
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Integer |
personId |
static long |
serialVersionUID |
creator
Constructor and Description |
---|
Person()
default empty constructor
|
Person(Integer personId)
Default constructor taking in the primary key personId value
|
Person(Person person)
This constructor is used to build a new Person object copy from another person object
(usually a patient or a user subobject).
|
Modifier and Type | Method and Description |
---|---|
void |
addAddress(PersonAddress address)
Convenience method to add the
address to this person's address list if the
address doesn't exist already. |
void |
addAttribute(PersonAttribute newAttribute)
Convenience method to add the
attribute to this person's attribute list if the
attribute doesn't exist already.Voids any current attribute with type = newAttribute.getAttributeType() NOTE: This effectively limits persons to only one attribute of any given type ** |
void |
addName(PersonName name)
Convenience method to add the
name to this person's name list if the name
doesn't exist already. |
boolean |
equals(Object obj) |
List<PersonAttribute> |
getActiveAttributes()
Returns only the non-voided attributes for this person
|
Set<PersonAddress> |
getAddresses() |
Integer |
getAge()
Convenience method to calculate this person's age based on the birthdate
For a person who lived 1990 to 2000, age would be -5 in 1985, 5 in 1995, 10 in 2000, and 10 2010.
|
Integer |
getAge(Date onDate)
Convenience method: calculates the person's age on a given date based on the birthdate
|
PersonAttribute |
getAttribute(Integer attributeTypeId)
Convenience method to get this person's first attribute that has a PersonAttributeTypeId
equal to
attributeTypeId . |
PersonAttribute |
getAttribute(PersonAttributeType pat)
Convenience Method to return the first non-voided person attribute matching a person
attribute type
|
PersonAttribute |
getAttribute(String attributeName)
Convenience method to get this person's first attribute that has a PersonAttributeType.name
equal to
attributeName . |
Map<String,PersonAttribute> |
getAttributeMap()
Convenience method to get all of this person's attributes in map form:
|
Set<PersonAttribute> |
getAttributes() |
List<PersonAttribute> |
getAttributes(Integer attributeTypeId)
Convenience method to get all of this person's attributes that have a PersonAttributeType.id
equal to
attributeTypeId . |
List<PersonAttribute> |
getAttributes(PersonAttributeType personAttributeType)
Convenience method to get all of this person's attributes that have a PersonAttributeType
equal to
personAttributeType . |
List<PersonAttribute> |
getAttributes(String attributeName)
Convenience method< to get all of this person's attributes that have a
PersonAttributeType.name equal to
attributeName . |
Date |
getBirthdate() |
Boolean |
getBirthdateEstimated() |
Concept |
getCauseOfDeath() |
Boolean |
getDead() |
Date |
getDeathDate() |
String |
getFamilyName()
Convenience method to get the family name attribute on this person's preferred PersonName
|
String |
getGender() |
String |
getGivenName()
Convenience method to get the given name attribute on this person's preferred PersonName
|
Integer |
getId() |
String |
getMiddleName()
Convenience method to get the middle name attribute on this person's preferred PersonName
|
Set<PersonName> |
getNames() |
PersonAddress |
getPersonAddress()
Convenience Method to get the "preferred" address for person.
|
User |
getPersonChangedBy() |
User |
getPersonCreator() |
Date |
getPersonDateChanged() |
Date |
getPersonDateCreated() |
Date |
getPersonDateVoided() |
Integer |
getPersonId() |
PersonName |
getPersonName()
Convenience method to get the "preferred" name for the person.
|
Boolean |
getPersonVoided() |
User |
getPersonVoidedBy() |
String |
getPersonVoidReason() |
int |
hashCode() |
Boolean |
isBirthdateEstimated() |
Boolean |
isDead() |
boolean |
isPatient() |
Boolean |
isPersonVoided() |
boolean |
isUser()
Deprecated.
|
String |
printAttributes()
Convenience method for viewing all of the person's current attributes
|
void |
removeAddress(PersonAddress address)
Convenience method to remove the
address from this person's address list if the
address exists already. |
void |
removeAttribute(PersonAttribute attribute)
Convenience method to get the
attribute from this person's attribute list if the
attribute exists already. |
void |
removeName(PersonName name)
Convenience method remove the
name from this person's name list if the name
exists already. |
Person |
replaceSerialization(Map<?,?> sessionMap)
If the serializer wishes, don't serialize this entire object, just the important parts
|
void |
setAddresses(Set<PersonAddress> addresses) |
void |
setAttributes(Set<PersonAttribute> attributes) |
void |
setBirthdate(Date birthdate) |
void |
setBirthdateEstimated(Boolean birthdateEstimated) |
void |
setBirthdateFromAge(int age,
Date ageOnDate)
Convenience method: sets a person's birth date from an age as of the given date Also sets
flag indicating that the birth date is inexact.
|
void |
setCauseOfDeath(Concept causeOfDeath) |
void |
setDead(Boolean dead) |
void |
setDeathDate(Date deathDate) |
void |
setGender(String gender) |
void |
setId(Integer id) |
void |
setNames(Set<PersonName> names) |
void |
setPersonChangedBy(User changedBy) |
void |
setPersonCreator(User creator) |
void |
setPersonDateChanged(Date dateChanged) |
void |
setPersonDateCreated(Date dateCreated) |
void |
setPersonDateVoided(Date dateVoided) |
void |
setPersonId(Integer personId) |
void |
setPersonVoided(Boolean voided) |
void |
setPersonVoidedBy(User voidedBy) |
void |
setPersonVoidReason(String voidReason) |
String |
toString() |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
getUuid, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
protected Integer personId
public Person()
public Person(Person person)
person
- Person to create this person object frompublic Person(Integer personId)
personId
- Integer internal id for this personpublic boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public Integer getPersonId()
public void setPersonId(Integer personId)
personId
- The personId to set.public String getGender()
public void setGender(String gender)
gender
- person's genderpublic Date getBirthdate()
public void setBirthdate(Date birthdate)
birthdate
- person's date of birthpublic Boolean isBirthdateEstimated()
public Boolean getBirthdateEstimated()
public void setBirthdateEstimated(Boolean birthdateEstimated)
birthdateEstimated
- true if person's birthdate is estimatedpublic Boolean isDead()
public Boolean getDead()
public void setDead(Boolean dead)
dead
- The dead to set.public Date getDeathDate()
public void setDeathDate(Date deathDate)
deathDate
- date of person's deathpublic Concept getCauseOfDeath()
public void setCauseOfDeath(Concept causeOfDeath)
causeOfDeath
- cause of person's deathpublic Set<PersonAddress> getAddresses()
PersonAddress
public void setAddresses(Set<PersonAddress> addresses)
addresses
- SetPersonAddress
public Set<PersonName> getNames()
PersonName
public void setNames(Set<PersonName> names)
names
- update all known names for personPersonName
public Set<PersonAttribute> getAttributes()
PersonAttribute
public List<PersonAttribute> getActiveAttributes()
public void setAttributes(Set<PersonAttribute> attributes)
attributes
- update all known attributes for personPersonAttribute
public void addAttribute(PersonAttribute newAttribute)
attribute
to this person's attribute list if the
attribute doesn't exist already.newAttribute.getAttributeType()
newAttribute
- PersonAttribute to add to the Personpublic void removeAttribute(PersonAttribute attribute)
attribute
from this person's attribute list if the
attribute exists already.attribute
- public PersonAttribute getAttribute(PersonAttributeType pat)
pat
- public PersonAttribute getAttribute(String attributeName)
attributeName
.attributeName
- public PersonAttribute getAttribute(Integer attributeTypeId)
attributeTypeId
.attributeTypeId
- public List<PersonAttribute> getAttributes(String attributeName)
attributeName
.attributeName
- public List<PersonAttribute> getAttributes(Integer attributeTypeId)
attributeTypeId
.attributeTypeId
- public List<PersonAttribute> getAttributes(PersonAttributeType personAttributeType)
personAttributeType
.personAttributeType
- public Map<String,PersonAttribute> getAttributeMap()
public String printAttributes()
public void addName(PersonName name)
name
to this person's name list if the name
doesn't exist already.name
- public void removeName(PersonName name)
name
from this person's name list if the name
exists already.name
- public void addAddress(PersonAddress address)
address
to this person's address list if the
address doesn't exist already.address
- public void removeAddress(PersonAddress address)
address
from this person's address list if the
address exists already.address
- public PersonName getPersonName()
public String getGivenName()
public String getMiddleName()
public String getFamilyName()
public PersonAddress getPersonAddress()
public Integer getAge()
public Integer getAge(Date onDate)
onDate
- (null defaults to today)public void setBirthdateFromAge(int age, Date ageOnDate)
age
- (the age to set)ageOnDate
- (null defaults to today)public User getPersonChangedBy()
public void setPersonChangedBy(User changedBy)
public Date getPersonDateChanged()
public void setPersonDateChanged(Date dateChanged)
public User getPersonCreator()
public void setPersonCreator(User creator)
public Date getPersonDateCreated()
public void setPersonDateCreated(Date dateCreated)
public Date getPersonDateVoided()
public void setPersonDateVoided(Date dateVoided)
public void setPersonVoided(Boolean voided)
public Boolean getPersonVoided()
public Boolean isPersonVoided()
public User getPersonVoidedBy()
public void setPersonVoidedBy(User voidedBy)
public String getPersonVoidReason()
public void setPersonVoidReason(String voidReason)
public boolean isPatient()
public boolean isUser()
UserService.getUsersByPerson(Person, boolean)
public String toString()
toString
in class Object
Object.toString()
public Person replaceSerialization(Map<?,?> sessionMap)
sessionMap
- serialization session informationOpenmrsUtil.isShortSerialization(Map)
public Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
Copyright © 2018 OpenMRS LLC.. All Rights Reserved.