public class Person extends BaseOpenmrsData implements java.io.Serializable
Patient
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.lang.Integer |
personId |
static long |
serialVersionUID |
creator
Constructor and Description |
---|
Person()
default empty constructor
|
Person(java.lang.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. |
java.util.List<PersonAttribute> |
getActiveAttributes()
Returns only the non-voided attributes for this person
|
java.util.Set<PersonAddress> |
getAddresses() |
java.lang.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.
|
java.lang.Integer |
getAge(java.util.Date onDate)
Convenience method: calculates the person's age on a given date based on the birthdate
|
PersonAttribute |
getAttribute(java.lang.Integer attributeTypeId)
Convenience method to get this person's first attribute that has a PersonAttributeTypeId
equal to
attributeTypeId .Returns null if this person has no non-voided PersonAttribute with the given type id
or this person has no attributes.The given id cannot be null. |
PersonAttribute |
getAttribute(PersonAttributeType pat)
Convenience Method to return the first non-voided person attribute matching a person
attribute type.
|
PersonAttribute |
getAttribute(java.lang.String attributeName)
Convenience method to get this person's first attribute that has a PersonAttributeType.name
equal to
attributeName .Returns null if this person has no non-voided PersonAttribute with the given type
name, the given name is null, or this person has no attributes. |
java.util.Map<java.lang.String,PersonAttribute> |
getAttributeMap()
Convenience method to get all of this person's attributes in map form:
|
java.util.Set<PersonAttribute> |
getAttributes() |
java.util.List<PersonAttribute> |
getAttributes(java.lang.Integer attributeTypeId)
Convenience method to get all of this person's attributes that have a PersonAttributeType.id
equal to
attributeTypeId . |
java.util.List<PersonAttribute> |
getAttributes(PersonAttributeType personAttributeType)
Convenience method to get all of this person's attributes that have a PersonAttributeType
equal to
personAttributeType . |
java.util.List<PersonAttribute> |
getAttributes(java.lang.String attributeName)
Convenience method< to get all of this person's attributes that have a
PersonAttributeType.name equal to
attributeName . |
java.util.Date |
getBirthdate() |
java.lang.Boolean |
getBirthdateEstimated() |
Concept |
getCauseOfDeath() |
java.lang.Boolean |
getDead() |
java.util.Date |
getDeathDate() |
java.lang.String |
getFamilyName()
Convenience method to get the family name attribute on this person's preferred PersonName
|
java.lang.String |
getGender() |
java.lang.String |
getGivenName()
Convenience method to get the given name attribute on this person's preferred PersonName
|
java.lang.Integer |
getId() |
java.lang.String |
getMiddleName()
Convenience method to get the middle name attribute on this person's preferred PersonName
|
java.util.Set<PersonName> |
getNames() |
PersonAddress |
getPersonAddress()
Convenience method to get the
PersonAddress object that is marked as "preferred". |
User |
getPersonChangedBy() |
User |
getPersonCreator() |
java.util.Date |
getPersonDateChanged() |
java.util.Date |
getPersonDateCreated() |
java.util.Date |
getPersonDateVoided() |
java.lang.Integer |
getPersonId() |
PersonName |
getPersonName()
Convenience method to get the
PersonName object that is marked as "preferred". |
java.lang.Boolean |
getPersonVoided() |
User |
getPersonVoidedBy() |
java.lang.String |
getPersonVoidReason() |
java.lang.Boolean |
isBirthdateEstimated() |
java.lang.Boolean |
isDead() |
boolean |
isPatient() |
java.lang.Boolean |
isPersonVoided() |
boolean |
isUser()
Deprecated.
|
java.lang.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(java.util.Map<?,?> sessionMap)
If the serializer wishes, don't serialize this entire object, just the important parts
|
void |
setAddresses(java.util.Set<PersonAddress> addresses) |
void |
setAttributes(java.util.Set<PersonAttribute> attributes) |
void |
setBirthdate(java.util.Date birthdate) |
void |
setBirthdateEstimated(java.lang.Boolean birthdateEstimated) |
void |
setBirthdateFromAge(int age,
java.util.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(java.lang.Boolean dead) |
void |
setDeathDate(java.util.Date deathDate) |
void |
setGender(java.lang.String gender) |
void |
setId(java.lang.Integer id) |
void |
setNames(java.util.Set<PersonName> names) |
void |
setPersonChangedBy(User changedBy) |
void |
setPersonCreator(User creator) |
void |
setPersonDateChanged(java.util.Date dateChanged) |
void |
setPersonDateCreated(java.util.Date dateCreated) |
void |
setPersonDateVoided(java.util.Date dateVoided) |
void |
setPersonId(java.lang.Integer personId) |
void |
setPersonVoided(java.lang.Boolean voided) |
void |
setPersonVoidedBy(User voidedBy) |
void |
setPersonVoidReason(java.lang.String voidReason) |
java.lang.String |
toString()
Returns a string consisting of the name of the class of which the object is an instance and
the
uuid field surrounded by [ and ] . |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
equals, getUuid, hashCode, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
protected java.lang.Integer personId
public Person()
public Person(Person person)
person
- Person to create this person object frompublic Person(java.lang.Integer personId)
personId
- Integer internal id for this personpublic java.lang.Integer getPersonId()
public void setPersonId(java.lang.Integer personId)
personId
- The personId to set.public java.lang.String getGender()
public void setGender(java.lang.String gender)
gender
- person's genderpublic java.util.Date getBirthdate()
public void setBirthdate(java.util.Date birthdate)
birthdate
- person's date of birthpublic java.lang.Boolean isBirthdateEstimated()
public java.lang.Boolean getBirthdateEstimated()
public void setBirthdateEstimated(java.lang.Boolean birthdateEstimated)
birthdateEstimated
- true if person's birthdate is estimatedpublic java.lang.Boolean isDead()
public java.lang.Boolean getDead()
public void setDead(java.lang.Boolean dead)
dead
- The dead to set.public java.util.Date getDeathDate()
public void setDeathDate(java.util.Date deathDate)
deathDate
- date of person's deathpublic Concept getCauseOfDeath()
public void setCauseOfDeath(Concept causeOfDeath)
causeOfDeath
- cause of person's deathpublic java.util.Set<PersonAddress> getAddresses()
PersonAddress
public void setAddresses(java.util.Set<PersonAddress> addresses)
addresses
- SetPersonAddress
public java.util.Set<PersonName> getNames()
PersonName
public void setNames(java.util.Set<PersonName> names)
names
- update all known names for personPersonName
public java.util.Set<PersonAttribute> getAttributes()
PersonAttribute
public java.util.List<PersonAttribute> getActiveAttributes()
public void setAttributes(java.util.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)
PersonAttribute
with the given
PersonAttributeType
, the given PersonAttributeType
is null, or this person
has no attributes.pat
- the PersonAttributeType to look for (can be a stub, see
BaseOpenmrsObject.equals(Object)
for how its compared)public PersonAttribute getAttribute(java.lang.String attributeName)
attributeName
.PersonAttribute
with the given type
name, the given name is null, or this person has no attributes.attributeName
- the name string to match onBaseOpenmrsMetadata.getName()
matchs the given name
stringpublic PersonAttribute getAttribute(java.lang.Integer attributeTypeId)
attributeTypeId
.PersonAttribute
with the given type id
or this person has no attributes.attributeTypeId
- the id of the PersonAttributeType
to look forPersonAttributeType.getId()
equals the given Integer idpublic java.util.List<PersonAttribute> getAttributes(java.lang.String attributeName)
attributeName
.attributeName
- public java.util.List<PersonAttribute> getAttributes(java.lang.Integer attributeTypeId)
attributeTypeId
.attributeTypeId
- public java.util.List<PersonAttribute> getAttributes(PersonAttributeType personAttributeType)
personAttributeType
.personAttributeType
- public java.util.Map<java.lang.String,PersonAttribute> getAttributeMap()
public java.lang.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()
PersonName
object that is marked as "preferred". getNames()
,
PersonName.isPreferred()
public java.lang.String getGivenName()
public java.lang.String getMiddleName()
public java.lang.String getFamilyName()
public PersonAddress getPersonAddress()
PersonAddress
object that is marked as "preferred". getAddresses()
,
PersonAddress.isPreferred()
public java.lang.Integer getAge()
public java.lang.Integer getAge(java.util.Date onDate)
onDate
- (null defaults to today)public void setBirthdateFromAge(int age, java.util.Date ageOnDate)
age
- (the age to set)ageOnDate
- (null defaults to today)public User getPersonChangedBy()
public void setPersonChangedBy(User changedBy)
public java.util.Date getPersonDateChanged()
public void setPersonDateChanged(java.util.Date dateChanged)
public User getPersonCreator()
public void setPersonCreator(User creator)
public java.util.Date getPersonDateCreated()
public void setPersonDateCreated(java.util.Date dateCreated)
public java.util.Date getPersonDateVoided()
public void setPersonDateVoided(java.util.Date dateVoided)
public void setPersonVoided(java.lang.Boolean voided)
public java.lang.Boolean getPersonVoided()
public java.lang.Boolean isPersonVoided()
public User getPersonVoidedBy()
public void setPersonVoidedBy(User voidedBy)
public java.lang.String getPersonVoidReason()
public void setPersonVoidReason(java.lang.String voidReason)
public boolean isPatient()
public boolean isUser()
UserService.getUsersByPerson(Person, boolean)
public java.lang.String toString()
BaseOpenmrsObject
uuid
field surrounded by [
and ]
. In other words,
this method returns a string equal to the value of: getClass().getName() + '[' + uuid + ']'
If the uuid
field is null
, it delegates to
Object.toString()
toString
in class BaseOpenmrsObject
Object.toString()
public Person replaceSerialization(java.util.Map<?,?> sessionMap)
sessionMap
- serialization session informationOpenmrsUtil.isShortSerialization(Map)
public java.lang.Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(java.lang.Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.