org.openmrs
Class Encounter

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

public class Encounter
extends BaseOpenmrsData
implements java.io.Serializable

An Encounter represents one visit or interaction of a patient with a healthcare worker. Every encounter can have 0 to n Observations associated with it Every encounter can have 0 to n Orders associated with it The patientId attribute should be equal to patient.patientId and is only included this second time for performance increases on bulk calls.

See Also:
Obs, Order, Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class org.openmrs.BaseOpenmrsData
creator
 
Constructor Summary
Encounter()
          default constructor
Encounter(java.lang.Integer encounterId)
           
 
Method Summary
 void addObs(Obs observation)
          Add the given Obs to the list of obs for this Encounter.
 void addOrder(Order order)
          Add the given Order to the list of orders for this Encounter
 boolean equals(java.lang.Object obj)
          Compares two Encounter objects for similarity
 java.util.Set<Obs> getAllObs()
          Convenience method to call getAllObs(boolean) with a false parameter
 java.util.Set<Obs> getAllObs(boolean includeVoided)
          Returns all Obs where Obs.encounterId = Encounter.encounterId In practice, this method should not be used very often...
 java.util.Date getEncounterDatetime()
           
 java.lang.Integer getEncounterId()
           
 EncounterType getEncounterType()
           
 Form getForm()
           
 java.lang.Integer getId()
           
 Location getLocation()
           
 java.util.Set<Obs> getObs()
           
 java.util.Set<Obs> getObsAtTopLevel(boolean includeVoided)
          Returns a Set of all root-level Obs of an Encounter, including obsGroups
 java.util.Set<Order> getOrders()
           
 Patient getPatient()
           
 java.lang.Integer getPatientId()
           
 Person getProvider()
           
 int hashCode()
           
 void removeObs(Obs observation)
          Remove the given observation from the list of obs for this Encounter
 void removeOrder(Order order)
          Remove the given observation from the list of orders for this Encounter
 void setEncounterDatetime(java.util.Date encounterDatetime)
           
 void setEncounterId(java.lang.Integer encounterId)
           
 void setEncounterType(EncounterType encounterType)
           
 void setForm(Form form)
           
 void setId(java.lang.Integer id)
           
 void setLocation(Location location)
           
 void setObs(java.util.Set<Obs> obs)
           
 void setOrders(java.util.Set<Order> orders)
           
 void setPatient(Patient patient)
           
 void setPatientId(java.lang.Integer patientId)
           
 void setProvider(Person provider)
           
 void setProvider(User provider)
          Deprecated. use setProvider(Person)
 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

serialVersionUID

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

Encounter

public Encounter()
default constructor


Encounter

public Encounter(java.lang.Integer encounterId)
Parameters:
encounterId -
Expected behavior:
set encounter id
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two Encounter objects for similarity

Overrides:
equals in class java.lang.Object
Parameters:
obj - Encounter object to compare to
Returns:
boolean true/false whether or not they are the same objects
See Also:
Object.equals(java.lang.Object)
Expected behavior:
equal encounter with same encounter id, not equal encounter with different encounter id, not equal on null, have equal encounter objects with no encounter ids, not have equal encounter objects when one has null encounter id

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Expected behavior:
have same hashcode when equal, have different hash code when not equal, get hash code with null attributes

getEncounterDatetime

public java.util.Date getEncounterDatetime()
Returns:
Returns the encounterDatetime.

setEncounterDatetime

public void setEncounterDatetime(java.util.Date encounterDatetime)
Parameters:
encounterDatetime - The encounterDatetime to set.

getEncounterId

public java.lang.Integer getEncounterId()
Returns:
Returns the encounterId.

setEncounterId

public void setEncounterId(java.lang.Integer encounterId)
Parameters:
encounterId - The encounterId to set.

getEncounterType

public EncounterType getEncounterType()
Returns:
Returns the encounterType.

setEncounterType

public void setEncounterType(EncounterType encounterType)
Parameters:
encounterType - The encounterType to set.

getLocation

public Location getLocation()
Returns:
Returns the location.

setLocation

public void setLocation(Location location)
Parameters:
location - The location to set.

getObs

public java.util.Set<Obs> getObs()
Returns:
Returns a Set of all non-voided, non-obsGroup children Obs of this Encounter
Expected behavior:
not return null with null obs set, get obs, not get voided obs, only get child obs, not get child obs if child also on encounter, get both child and parent obs after removing child from parent grouping, get obs with two levels of hierarchy, get obs with three levels of hierarchy, not get voided obs with three layers of hierarchy

getAllObs

public java.util.Set<Obs> getAllObs(boolean includeVoided)
Returns all Obs where Obs.encounterId = Encounter.encounterId In practice, this method should not be used very often...

Parameters:
includeVoided - specifies whether or not to include voided Obs
Returns:
Returns the all Obs.
Expected behavior:
not return null with null obs set, get obs, get both parent and child obs, get both parent and child with child directly on encounter, get both child and parent obs after removing child from parent grouping

getAllObs

public java.util.Set<Obs> getAllObs()
Convenience method to call getAllObs(boolean) with a false parameter

Returns:
all non-voided obs
Expected behavior:
not get voided obs

getObsAtTopLevel

public java.util.Set<Obs> getObsAtTopLevel(boolean includeVoided)
Returns a Set of all root-level Obs of an Encounter, including obsGroups

Parameters:
includeVoided - specifies whether or not to include voided Obs
Returns:
Returns all obs at top level -- will not be null
Expected behavior:
not return null with null obs set, get obs, not get voided obs, only get parents obs, only return the grouped top level obs, get both child and parent obs after removing child from parent grouping

setObs

public void setObs(java.util.Set<Obs> obs)
Parameters:
obs - The obs to set.

addObs

public void addObs(Obs observation)
Add the given Obs to the list of obs for this Encounter.

Parameters:
observation - the Obs to add to this encounter
Expected behavior:
add obs with null values, not fail with null obs, set encounter attribute on obs, add obs to non null initial obs set, add encounter attrs to obs if attributes are null

removeObs

public void removeObs(Obs observation)
Remove the given observation from the list of obs for this Encounter

Parameters:
observation -
Expected behavior:
remove obs successfully, not throw error when removing null obs from empty set, not throw error when removing null obs from non empty set

getOrders

public java.util.Set<Order> getOrders()
Returns:
Returns the orders

setOrders

public void setOrders(java.util.Set<Order> orders)
Parameters:
orders - The orders to set.

addOrder

public void addOrder(Order order)
Add the given Order to the list of orders for this Encounter

Parameters:
order -
Expected behavior:
add order with null values, not fail with null obs passed to add order, set encounter attribute, add order to non nul initial order set

removeOrder

public void removeOrder(Order order)
Remove the given observation from the list of orders for this Encounter

Parameters:
order -
Expected behavior:
remove order from encounter, not fail when removing null order, not fail when removing non existent order

getPatient

public Patient getPatient()
Returns:
Returns the patient.

setPatient

public void setPatient(Patient patient)
Parameters:
patient - The patient to set.

getPatientId

public java.lang.Integer getPatientId()
Returns:
the patientId

setPatientId

public void setPatientId(java.lang.Integer patientId)
Parameters:
patientId - the patientId to set

getProvider

public Person getProvider()
Returns:
Returns the provider.
Since:
1.6 (used to return User)

setProvider

public void setProvider(User provider)
Deprecated. use setProvider(Person)

Parameters:
provider - The provider to set.

setProvider

public void setProvider(Person provider)
Parameters:
provider - The provider to set.

getForm

public Form getForm()
Returns:
Returns the form.

setForm

public void setForm(Form form)
Parameters:
form - The form to set.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()
Expected behavior:
not fail with empty object

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
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
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