|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.BaseOpenmrsObject org.openmrs.BaseOpenmrsData org.openmrs.Person
public class Person
A Person in the system. This can be either a small person stub, or indicative of an actual Patient in the system. This class holds the generic person things that both the stubs and patients share. Things like birthdate, names, addresses, and attributes are all generified into the person table (and hence this super class)
Patient
,
Serialized FormField Summary | |
---|---|
protected java.lang.Integer |
personId
|
static long |
serialVersionUID
|
Fields inherited from class org.openmrs.BaseOpenmrsData |
---|
creator |
Constructor Summary | |
---|---|
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). |
Method Summary | |
---|---|
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(java.lang.Object obj)
|
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 . |
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 . |
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 "preferred" address for person. |
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 "preferred" name for the person. |
java.lang.Boolean |
getPersonVoided()
|
User |
getPersonVoidedBy()
|
java.lang.String |
getPersonVoidReason()
|
int |
hashCode()
|
java.lang.Boolean |
isBirthdateEstimated()
|
java.lang.Boolean |
isDead()
|
boolean |
isPatient()
|
java.lang.Boolean |
isPersonVoided()
|
boolean |
isUser()
Deprecated. use UserService.getUsersByPerson(Person, boolean) |
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()
|
Methods inherited from class org.openmrs.BaseOpenmrsData |
---|
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason |
Methods inherited from class org.openmrs.BaseOpenmrsObject |
---|
getUuid, setUuid |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openmrs.OpenmrsObject |
---|
getUuid, setUuid |
Field Detail |
---|
public static final long serialVersionUID
protected java.lang.Integer personId
Constructor Detail |
---|
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 personMethod Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public 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)
pat
-
public PersonAttribute getAttribute(java.lang.String attributeName)
attributeName
.
attributeName
- public PersonAttribute getAttribute(java.lang.Integer attributeTypeId)
attributeTypeId
.
attributeTypeId
- public 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()
public java.lang.String getGivenName()
public java.lang.String getMiddleName()
public java.lang.String getFamilyName()
public PersonAddress getPersonAddress()
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()
toString
in class java.lang.Object
Object.toString()
public Person replaceSerialization(java.util.Map<?,?> sessionMap)
sessionMap
- serialization session information
OpenmrsUtil.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)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |