public class Obs extends BaseOpenmrsData implements java.io.Serializable
getObsGroup()
method returns an optional parent. That parent object is also an Obs.
The parent Obs object knows about its child objects through the getGroupMembers()
method. (Multi-level hierarchies are achieved by an Obs parent object being a member of another
Obs (grand)parent object) Read up on the obs table: http://openmrs.org/wiki/Obs_Table_PrimerEncounter
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.lang.String |
accessionNumber |
protected java.lang.String |
comment |
protected ComplexData |
complexData |
protected Concept |
concept |
protected Encounter |
encounter |
protected java.util.Set<Obs> |
groupMembers
The list of obs grouped under this obs.
|
protected Location |
location |
protected java.util.Date |
obsDatetime |
protected Obs |
obsGroup
The "parent" of this obs.
|
protected java.lang.Integer |
obsId |
protected Order |
order |
protected Person |
person |
protected java.lang.Integer |
personId |
static long |
serialVersionUID |
protected Concept |
valueCoded |
protected ConceptName |
valueCodedName |
protected java.lang.String |
valueComplex |
protected java.util.Date |
valueDatetime |
protected Drug |
valueDrug |
protected java.lang.Integer |
valueGroupId |
protected java.lang.String |
valueModifier |
protected java.lang.Double |
valueNumeric |
protected java.lang.String |
valueText |
creator
Constructor and Description |
---|
Obs()
default constructor
|
Obs(java.lang.Integer obsId)
constructor with id
|
Obs(Person person,
Concept question,
java.util.Date obsDatetime,
Location location)
Required parameters constructor A value is also required, but that can be one of: valueCoded,
valueDrug, valueNumeric, or valueText
|
Modifier and Type | Method and Description |
---|---|
void |
addGroupMember(Obs member)
Convenience method to add the given
obs to this grouping. |
java.lang.String |
getAccessionNumber() |
java.lang.String |
getComment() |
ComplexData |
getComplexData()
Get the ComplexData.
|
Concept |
getConcept() |
ConceptDescription |
getConceptDescription()
Get the concept description that is tied to the concept name that was used when making this
observation
|
Encounter |
getEncounter() |
java.util.Set<Obs> |
getGroupMembers()
Get the non-voided members of the obs group, if this obs is a group.
|
java.util.Set<Obs> |
getGroupMembers(boolean includeVoided)
Get the group members of this obs group, if this obs is a group.
|
java.lang.Integer |
getId() |
Location |
getLocation() |
java.util.Date |
getObsDatetime() |
Obs |
getObsGroup()
An obs grouping occurs when the question (#getConcept()) is a set.
|
java.lang.Integer |
getObsGroupId()
Deprecated.
The
getObsGroup() method should be used |
java.lang.Integer |
getObsId() |
Order |
getOrder() |
Patient |
getPatient()
Deprecated.
use getPerson()
|
Person |
getPerson()
Get the person object that this obs is acting on.
|
java.lang.Integer |
getPersonId()
The person id of the person on this object.
|
Obs |
getPreviousVersion() |
java.util.Set<Obs> |
getRelatedObservations()
Convenience method that returns related Obs If the Obs argument is not an ObsGroup: a
Set
|
java.lang.Boolean |
getValueAsBoolean()
Coerces a value to a Boolean representation
|
java.util.Map<java.util.Locale,java.lang.String> |
getValueAsString()
Deprecated.
|
java.lang.String |
getValueAsString(java.util.Locale locale)
Convenience method for obtaining the observation's value as a string If the Obs is complex,
returns the title of the complexData denoted by the section of getValueComplex() before the
first bar '|' character; or returns the entire getValueComplex() if the bar '|' character is
missing.
|
java.lang.Boolean |
getValueBoolean()
Returns the boolean value if the concept of this obs is of boolean datatype
|
Concept |
getValueCoded() |
ConceptName |
getValueCodedName()
Gets the specific name used for the coded value.
|
java.lang.String |
getValueComplex()
Get the value for the ComplexData.
|
java.util.Date |
getValueDate() |
java.util.Date |
getValueDatetime() |
Drug |
getValueDrug() |
java.lang.Integer |
getValueGroupId() |
java.lang.String |
getValueModifier() |
java.lang.Double |
getValueNumeric() |
java.lang.String |
getValueText() |
java.util.Date |
getValueTime() |
boolean |
hasGroupMembers()
A convenience method to check for nullity and length to determine if this obs has group
members.
|
boolean |
hasGroupMembers(boolean includeVoided)
Convenience method that checks for nullity and length to determine if this obs has group
members.
|
java.lang.Boolean |
hasPreviousVersion() |
boolean |
isComplex() |
boolean |
isObsGrouping()
Convenience method that checks for if this obs has 1 or more group members (either voided or non-voided)
Note this method differs from hasGroupMembers(), as that method excludes voided obs; logic is that
while a obs that has only voided group members should be seen as "having no group members" it
still should be considered an "obs grouping"
|
static Obs |
newInstance(Obs obsToCopy)
This is an equivalent to a copy constructor.
|
void |
removeGroupMember(Obs member)
Convenience method to remove an Obs from this grouping This also removes the link in the
given
obs object to this obs grouper |
void |
setAccessionNumber(java.lang.String accessionNumber) |
void |
setComment(java.lang.String comment) |
void |
setComplexData(ComplexData complexData)
Set the ComplexData for this Obs.
|
void |
setConcept(Concept concept) |
void |
setEncounter(Encounter encounter) |
void |
setGroupMembers(java.util.Set<Obs> groupMembers)
Set the members of the obs group, if this obs is a group.
|
void |
setId(java.lang.Integer id) |
void |
setLocation(Location location) |
void |
setObsDatetime(java.util.Date obsDatetime) |
void |
setObsGroup(Obs obsGroup)
This method does NOT add this current obs to the list of obs in obsGroup.getGroupMembers().
|
void |
setObsGroupId(java.lang.Integer obsGroupId)
Deprecated.
This method should not be used. The #setObsGroup() method should be used instead
|
void |
setObsId(java.lang.Integer obsId) |
void |
setOrder(Order order) |
void |
setPatient(Patient patient)
Deprecated.
use setPerson(org.openmrs.Person)
|
void |
setPerson(Person person)
Set the person object to this obs object.
|
protected void |
setPersonId(java.lang.Integer personId)
Set the person id on this obs object.
|
void |
setPreviousVersion(Obs previousVersion) |
void |
setRequiredProperties(User creator,
java.util.Date dateCreated)
Deprecated.
no longer needed. Replaced by handlers.
|
void |
setValueAsString(java.lang.String s)
Sets the value for the obs from a string depending on the datatype of the question concept
|
void |
setValueBoolean(java.lang.Boolean valueBoolean)
Sets the value of this obs to the specified valueBoolean if this obs has a boolean concept.
|
void |
setValueCoded(Concept valueCoded) |
void |
setValueCodedName(ConceptName valueCodedName)
Sets the specific name used for the coded value.
|
void |
setValueComplex(java.lang.String valueComplex)
Set the value for the ComplexData.
|
void |
setValueDate(java.util.Date valueDate) |
void |
setValueDatetime(java.util.Date valueDatetime) |
void |
setValueDrug(Drug valueDrug) |
void |
setValueGroupId(java.lang.Integer valueGroupId) |
void |
setValueModifier(java.lang.String valueModifier) |
void |
setValueNumeric(java.lang.Double valueNumeric) |
void |
setValueText(java.lang.String valueText) |
void |
setValueTime(java.util.Date valueTime) |
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 obsId
protected Concept concept
protected java.util.Date obsDatetime
protected java.lang.String accessionNumber
protected Obs obsGroup
(??)
protected java.util.Set<Obs> groupMembers
protected Concept valueCoded
protected ConceptName valueCodedName
protected Drug valueDrug
protected java.lang.Integer valueGroupId
protected java.util.Date valueDatetime
protected java.lang.Double valueNumeric
protected java.lang.String valueModifier
protected java.lang.String valueText
protected java.lang.String valueComplex
protected transient ComplexData complexData
protected java.lang.String comment
protected transient java.lang.Integer personId
protected Person person
protected Order order
protected Location location
protected Encounter encounter
public Obs()
public Obs(Person person, Concept question, java.util.Date obsDatetime, Location location)
person
- The Person this obs is acting onquestion
- The question concept this obs is related toobsDatetime
- The time this obs took placelocation
- The location this obs took placepublic Obs(java.lang.Integer obsId)
public static Obs newInstance(Obs obsToCopy)
obsToCopy
with a null obs idobsToCopy
- The Obs that is going to be copied@Deprecated public void setRequiredProperties(User creator, java.util.Date dateCreated)
SaveHandler
, et al.SaveHandler
,
OpenmrsObjectSaveHandler
public java.lang.String getComment()
public void setComment(java.lang.String comment)
comment
- The comment to set.public Concept getConcept()
public void setConcept(Concept concept)
concept
- The concept to set.public ConceptDescription getConceptDescription()
public Encounter getEncounter()
public void setEncounter(Encounter encounter)
encounter
- The encounter to set.public Location getLocation()
public void setLocation(Location location)
location
- The location to set.public java.util.Date getObsDatetime()
public void setObsDatetime(java.util.Date obsDatetime)
obsDatetime
- The obsDatetime to set.public java.lang.Integer getObsGroupId()
getObsGroup()
method should be usedgetObsGroup()
public void setObsGroupId(java.lang.Integer obsGroupId)
obsGroupId
- The obsGroupId to set.setObsGroup(Obs)
public Obs getObsGroup()
obsGroup
.getGroupMembers()
public void setObsGroup(Obs obsGroup)
obsGroup
- the obsGroup to setpublic boolean isObsGrouping()
NOTE: This method could also be called "isObsGroup" for a little less confusion on names. However, jstl in a web layer (or any psuedo-getter) access isn't good with both an "isObsGroup" method and a "getObsGroup" method. Which one should be returned with a simplified jstl call like ${obs.obsGroup} ? With this setup, ${obs.obsGrouping} returns a boolean of whether this obs is a parent and has members. ${obs.obsGroup} returns the parent object to this obs if this obs is a group member of some other group.
public boolean hasGroupMembers()
hasGroupMembers(boolean)
with value true.public boolean hasGroupMembers(boolean includeVoided)
includeVoided
- determines if Voided members should be considered as group members.public java.util.Set<Obs> getGroupMembers()
getGroupMembers(boolean)
with value true.
If it's not a group (i.e. getConcept()
.Concept.isSet()
is not
true, then this returns null.
addGroupMember(Obs)
,
hasGroupMembers()
public java.util.Set<Obs> getGroupMembers(boolean includeVoided)
includeVoided
- public void setGroupMembers(java.util.Set<Obs> groupMembers)
If it's not a group (i.e. getConcept()
.Concept.isSet()
is not
true, then this returns null.
groupMembers
- the groupedObs to setaddGroupMember(Obs)
,
hasGroupMembers()
public void addGroupMember(Obs member)
obs
to this grouping. Will implicitly make
this obs an ObsGroup.member
- Obs to add to this groupsetGroupMembers(Set)
,
getGroupMembers()
public void removeGroupMember(Obs member)
obs
object to this obs groupermember
- Obs to remove from this groupsetGroupMembers(Set)
,
getGroupMembers()
public java.util.Set<Obs> getRelatedObservations()
public java.lang.Integer getObsId()
public void setObsId(java.lang.Integer obsId)
obsId
- The obsId to set.public Order getOrder()
public void setOrder(Order order)
order
- The order to set.public Patient getPatient()
public void setPatient(Patient patient)
setPerson(org.openmrs.Person)
patient
- public java.lang.Integer getPersonId()
getPerson()
.getPersonId()
. It is duplicated here for speed and
simplicity reasonsprotected void setPersonId(java.lang.Integer personId)
setPerson(Person)
method should be used like
setPerson(new Person(personId))
personId
- setPerson(Person)
public Person getPerson()
getPersonId()
public void setPerson(Person person)
person
- the Patient/Person object that this obs is acting onsetPersonId(Integer)
public void setValueBoolean(java.lang.Boolean valueBoolean)
valueBoolean
- the boolean value matching the boolean coded concept to set topublic java.lang.Boolean getValueAsBoolean()
public java.lang.Boolean getValueBoolean()
public Concept getValueCoded()
public void setValueCoded(Concept valueCoded)
valueCoded
- The valueCoded to set.public ConceptName getValueCodedName()
public void setValueCodedName(ConceptName valueCodedName)
valueCodedName
- the name of the coded valuepublic Drug getValueDrug()
public void setValueDrug(Drug valueDrug)
valueDrug
- The valueDrug to set.public java.util.Date getValueDatetime()
public void setValueDatetime(java.util.Date valueDatetime)
valueDatetime
- The valueDatetime to set.public java.util.Date getValueDate()
public void setValueDate(java.util.Date valueDate)
valueDate
- The date value to set.public java.util.Date getValueTime()
public void setValueTime(java.util.Date valueTime)
valueTime
- the time value to setpublic java.lang.Integer getValueGroupId()
public void setValueGroupId(java.lang.Integer valueGroupId)
valueGroupId
- The valueGroupId to set.public java.lang.String getValueModifier()
public void setValueModifier(java.lang.String valueModifier)
valueModifier
- The valueModifier to set.public java.lang.Double getValueNumeric()
public void setValueNumeric(java.lang.Double valueNumeric)
valueNumeric
- The valueNumeric to set.public java.lang.String getValueText()
public void setValueText(java.lang.String valueText)
valueText
- The valueText to set.public boolean isComplex()
public java.lang.String getValueComplex()
getValueAsString()
. The URI is the location where the ComplexData is stored.public void setValueComplex(java.lang.String valueComplex)
valueComplex
- readable title and URI for the location of the ComplexData binary object.public void setComplexData(ComplexData complexData)
ComplexObsHandler
s that are registered to ConceptComplex
s will persist the
ComplexData.getData()
object to the correct place for the given concept.complexData
- public ComplexData getComplexData()
ComplexObsHandler
from the file system
or another location, not from the database. Obs obsWithComplexData = Context.getObsService().getComplexObs(obsId, OpenmrsConstants.RAW_VIEW);
public java.lang.String getAccessionNumber()
public void setAccessionNumber(java.lang.String accessionNumber)
accessionNumber
- The accessionNumber to set.public java.lang.String getValueAsString(java.util.Locale locale)
locale
- locale for locale-specific depictions of valuepublic void setValueAsString(java.lang.String s) throws java.text.ParseException
s
- the string to coerce to a booleanjava.text.ParseException
public java.util.Map<java.util.Locale,java.lang.String> getValueAsString()
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 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)
public Obs getPreviousVersion()
public void setPreviousVersion(Obs previousVersion)
public java.lang.Boolean hasPreviousVersion()
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.