org.openmrs
Class Patient

java.lang.Object
  extended by org.openmrs.BaseOpenmrsObject
      extended by org.openmrs.BaseOpenmrsData
          extended by org.openmrs.Person
              extended by org.openmrs.Patient
All Implemented Interfaces:
java.io.Serializable, Auditable, OpenmrsData, OpenmrsObject, Voidable

public class Patient
extends Person
implements java.io.Serializable

Defines a Patient in the system. A patient is simply an extension of a person and all that that implies.

Version:
2.0
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class org.openmrs.Person
personId
 
Fields inherited from class org.openmrs.BaseOpenmrsData
creator
 
Constructor Summary
Patient()
          default constructor
Patient(java.lang.Integer patientId)
          Constructor with default patient id
Patient(Person person)
          This constructor creates a new Patient object from the given Person object.
 
Method Summary
 void addIdentifier(PatientIdentifier patientIdentifier)
          Will add this PatientIdentifier if the patient doesn't contain it already
 void addIdentifiers(java.util.Collection<PatientIdentifier> patientIdentifiers)
          Will only add PatientIdentifiers in this list that this patient does not have already
 boolean equals(java.lang.Object obj)
          Compares two objects for similarity This must pass through to the parent object (org.openmrs.Person) in order to get similarity of person/patient objects
 java.util.List<PatientIdentifier> getActiveIdentifiers()
          Returns only the non-voided identifiers for this patient.
 java.lang.Integer getId()
           
 java.util.Set<PatientIdentifier> getIdentifiers()
          Get all of this patients identifiers -- both voided and non-voided ones.
 java.lang.Integer getPatientId()
           
 PatientIdentifier getPatientIdentifier()
          Convenience method to get the first "preferred" identifier for a patient.
 PatientIdentifier getPatientIdentifier(java.lang.Integer identifierTypeId)
          Return's the first (preferred) patient identifier matching identifierTypeId
 PatientIdentifier getPatientIdentifier(PatientIdentifierType pit)
          Returns the first (preferred) patient identifier matching a PatientIdentifierType Otherwise, returns the first non-voided identifier Otherwise, null
 PatientIdentifier getPatientIdentifier(java.lang.String identifierTypeName)
          Return's the (preferred) patient identifier matching identifierTypeName Otherwise returns that last PatientIdenitifer
 java.util.List<PatientIdentifier> getPatientIdentifiers(PatientIdentifierType pit)
          Returns only the non-voided identifiers for this patient.
 Tribe getTribe()
          Deprecated. Tribe is not long a value on Patient. Install the Tribe module
 int hashCode()
          The hashcode for a patient/person is used to index the objects in a tree This must pass through to the parent object (org.openmrs.Person) in order to get similarity of person/patient objects
 void removeIdentifier(PatientIdentifier patientIdentifier)
          Convenience method to remove the given identifier from this patient's list of identifiers.
 void setId(java.lang.Integer id)
           
 void setIdentifiers(java.util.Set<PatientIdentifier> identifiers)
          Update all identifiers for patient
 void setPatientId(java.lang.Integer patientId)
          Sets the internal identifier for a patient.
 void setPersonId(java.lang.Integer personId)
          Overrides the parent setPersonId(Integer) so that we can be sure patient id is also set correctly.
 void setTribe(Tribe tribe)
          Deprecated. Tribe is not long a value on Patient. Install the Tribe module
 java.lang.String toString()
           
 
Methods inherited from class org.openmrs.Person
addAddress, addAttribute, addName, getActiveAttributes, getAddresses, getAge, getAge, getAttribute, getAttribute, getAttribute, getAttributeMap, getAttributes, getAttributes, getAttributes, getAttributes, getBirthdate, getBirthdateEstimated, getCauseOfDeath, getDead, getDeathDate, getFamilyName, getGender, getGivenName, getMiddleName, getNames, getPersonAddress, getPersonChangedBy, getPersonCreator, getPersonDateChanged, getPersonDateCreated, getPersonDateVoided, getPersonId, getPersonName, getPersonVoided, getPersonVoidedBy, getPersonVoidReason, isBirthdateEstimated, isDead, isPatient, isPersonVoided, isUser, printAttributes, removeAddress, removeAttribute, removeName, replaceSerialization, setAddresses, setAttributes, setBirthdate, setBirthdateEstimated, setBirthdateFromAge, setCauseOfDeath, setDead, setDeathDate, setGender, setNames, setPersonChangedBy, setPersonCreator, setPersonDateChanged, setPersonDateCreated, setPersonDateVoided, setPersonVoided, setPersonVoidedBy, setPersonVoidReason
 
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

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Patient

public Patient()
default constructor


Patient

public Patient(Person person)
This constructor creates a new Patient object from the given Person object. All attributes are copied over to the new object. NOTE! All child collection objects are copied as pointers, each individual element is not copied.

TODO Should the patient specific attributes be copied? (like identifiers)

Parameters:
person - the person object to copy onto a new Patient
See Also:
Person.Person(Person)

Patient

public Patient(java.lang.Integer patientId)
Constructor with default patient id

Parameters:
patientId -
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two objects for similarity This must pass through to the parent object (org.openmrs.Person) in order to get similarity of person/patient objects

Overrides:
equals in class Person
Parameters:
obj -
Returns:
boolean true/false whether or not they are the same objects
See Also:
Person.equals(java.lang.Object)

hashCode

public int hashCode()
The hashcode for a patient/person is used to index the objects in a tree This must pass through to the parent object (org.openmrs.Person) in order to get similarity of person/patient objects

Overrides:
hashCode in class Person
See Also:
Person.hashCode()

getPatientId

public java.lang.Integer getPatientId()
Returns:
internal identifier for patient

setPatientId

public void setPatientId(java.lang.Integer patientId)
Sets the internal identifier for a patient. This should never be called directly. It exists only for the use of the supporting infrastructure.

Parameters:
patientId -

setPersonId

public void setPersonId(java.lang.Integer personId)
Overrides the parent setPersonId(Integer) so that we can be sure patient id is also set correctly.

Overrides:
setPersonId in class Person
Parameters:
personId - The personId to set.
See Also:
Person.setPersonId(java.lang.Integer)

getTribe

@Deprecated
public Tribe getTribe()
Deprecated. Tribe is not long a value on Patient. Install the Tribe module

Returns:
patient's tribe

setTribe

@Deprecated
public void setTribe(Tribe tribe)
Deprecated. Tribe is not long a value on Patient. Install the Tribe module

Parameters:
tribe - patient's tribe

getIdentifiers

public java.util.Set<PatientIdentifier> getIdentifiers()
Get all of this patients identifiers -- both voided and non-voided ones. If you want only non-voided identifiers, use getActiveIdentifiers()

Returns:
Set of all known identifiers for this patient
See Also:
PatientIdentifier, getActiveIdentifiers()
Expected behavior:
not return null

setIdentifiers

public void setIdentifiers(java.util.Set<PatientIdentifier> identifiers)
Update all identifiers for patient

Parameters:
identifiers - Set to set as update all known identifiers for patient
See Also:
PatientIdentifier

addIdentifiers

public void addIdentifiers(java.util.Collection<PatientIdentifier> patientIdentifiers)
Will only add PatientIdentifiers in this list that this patient does not have already

Parameters:
patientIdentifiers -

addIdentifier

public void addIdentifier(PatientIdentifier patientIdentifier)
Will add this PatientIdentifier if the patient doesn't contain it already

Parameters:
patientIdentifier -
Expected behavior:
not fail with null identifiers list, add identifier to current list, not add identifier that is in list already

removeIdentifier

public void removeIdentifier(PatientIdentifier patientIdentifier)
Convenience method to remove the given identifier from this patient's list of identifiers. If patientIdentifier is null, nothing is done.

Parameters:
patientIdentifier - the identifier to remove
Expected behavior:
remove identifier if exists

getPatientIdentifier

public PatientIdentifier getPatientIdentifier()
Convenience method to get the first "preferred" identifier for a patient. Otherwise, returns the first non-voided identifier Otherwise, null

Returns:
Returns the "preferred" patient identifier.

getPatientIdentifier

public PatientIdentifier getPatientIdentifier(PatientIdentifierType pit)
Returns the first (preferred) patient identifier matching a PatientIdentifierType Otherwise, returns the first non-voided identifier Otherwise, null

Parameters:
pit - The PatientIdentifierType of which to return the PatientIdentifier
Returns:
Returns a PatientIdentifier of the specified type.

getPatientIdentifier

public PatientIdentifier getPatientIdentifier(java.lang.Integer identifierTypeId)
Return's the first (preferred) patient identifier matching identifierTypeId

Parameters:
identifierTypeId -
Returns:
preferred patient identifier

getPatientIdentifier

public PatientIdentifier getPatientIdentifier(java.lang.String identifierTypeName)
Return's the (preferred) patient identifier matching identifierTypeName Otherwise returns that last PatientIdenitifer

Parameters:
identifierTypeName -
Returns:
preferred patient identifier

getActiveIdentifiers

public java.util.List<PatientIdentifier> getActiveIdentifiers()
Returns only the non-voided identifiers for this patient. If you want all identifiers, use getIdentifiers()

Returns:
list of non-voided identifiers for this patient
See Also:
getIdentifiers()

getPatientIdentifiers

public java.util.List<PatientIdentifier> getPatientIdentifiers(PatientIdentifierType pit)
Returns only the non-voided identifiers for this patient. If you want all identifiers, use getIdentifiers()

Parameters:
pit - PatientIdentifierType
Returns:
list of non-voided identifiers for this patient
See Also:
getIdentifiers()

toString

public java.lang.String toString()
Overrides:
toString in class Person
See Also:
Object.toString()

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
Overrides:
getId in class Person
Returns:
id - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.getId()

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface OpenmrsObject
Overrides:
setId in class Person
Parameters:
id - - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.setId(java.lang.Integer)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change