Page tree
Skip to end of metadata
Go to start of metadata

This page is in the process of being updated

Contents

Overview

A Person object in OpenMRS represents either a Patient or a User. A Person can have multiple PersonNames and multiple PersonAddresses. There are some general metadata defined on the Person object (birthdate, deathdate, gender, etc) but most attributes of a Person are custom to a certain install location. This is where PersonAttributes come in; they are additional "columns" on a Person that are defined by the implementation. Two or more Person objects can be linked by a Relationship.

Person

A Person object is the basis for all humans in the OpenMRS system.

Properties on a Person:

  • personId is the database's integer used to identify the object
  • gender is the Person's gender
  • birthDate is the Person's birth date
  • birthDateEstimated is only needed if the birth date is uncertain. It is not required.
  • dead is a Boolean denoting whether or not a Person has died. It is not required.
  • deathDate is the date on which the Person died. It is not required.
  • causeOfDeath is the cause of the Person's death. It is not required.
  • 1 to n PersonNames
  • 0 to n PersonAddresses
  • 0 to n PersonAttributes
  • 0 to n Relationships

Inherited from BaseOpenMRSData:

  • creator
PersonService
// Gets Person objects with the given criteria.
public List<Person> getPeople(String searchPhrase, Boolean dead);

// Saves the given Person object to the database. Saves will cascade down onto the Person's fields (PersonName, PersonAddress, etc.)
public Person savePerson(Person person);

// Marks the given Person as invalid. All associated data will be left as-is.
public Person voidPerson(Person person, String reason);

// Gets all PersonAttributeTypes in the system.
public List<PersonAttributeType> getAllPersonAttributeTypes();

// Gets all Relationships in the system.
public List<Relationship> getAllRelationships();

// Gets all RelationshipTypes in the system.
public List<RelationshipType> getAllRelationshipTypes();

// Gets all PersonAttributeTypes in the system.
public List<PersonAttributeType> getAllPersonAttributeTypes();

Example:

Person person = Context.getPersonService().getPersonByUuid("1234-56789-123");
person.setGender("M");
person.addName(new PersonName("Jim", "Bob", "Smith"));
Context.getPersonService().savePerson(person);

Person Name

Person Address

Person Attribute

Person Attribute Type

Also see Managing Person Attribute Types

Relationship

Relationship Type

  • No labels