public class Obs extends BaseOpenmrsData implements 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 String |
accessionNumber |
protected String |
comment |
protected ComplexData |
complexData |
protected Concept |
concept |
protected Date |
dateStarted |
protected Date |
dateStopped |
protected Encounter |
encounter |
protected Set<Obs> |
groupMembers
The list of obs grouped under this obs.
|
protected Location |
location |
protected Date |
obsDatetime |
protected Obs |
obsGroup
The "parent" of this obs.
|
protected Integer |
obsId |
protected Order |
order |
protected Person |
person |
protected Integer |
personId |
static long |
serialVersionUID |
protected Concept |
valueCoded |
protected ConceptName |
valueCodedName |
protected String |
valueComplex |
protected Date |
valueDatetime |
protected Drug |
valueDrug |
protected Integer |
valueGroupId |
protected String |
valueModifier |
protected Double |
valueNumeric |
protected String |
valueText |
creator
Constructor and Description |
---|
Obs()
default constructor
|
Obs(Integer obsId)
constructor with id
|
Obs(Person person,
Concept question,
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. |
boolean |
equals(Object obj)
Compares two Obs for similarity.
|
String |
getAccessionNumber() |
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
|
Date |
getDateStarted() |
Date |
getDateStopped() |
Encounter |
getEncounter() |
Set<Obs> |
getGroupMembers()
Get the members of the obs group, if this obs is a group.
|
Integer |
getId() |
Location |
getLocation() |
Date |
getObsDatetime() |
Obs |
getObsGroup()
An obs grouping occurs when the question (#getConcept()) is a set.
|
Integer |
getObsGroupId()
Deprecated.
The
getObsGroup() method should be used |
Integer |
getObsId() |
Order |
getOrder() |
Patient |
getPatient()
Deprecated.
use getPerson()
|
Person |
getPerson()
Get the person object that this obs is acting on.
|
Integer |
getPersonId()
The person id of the person on this object.
|
Set<Obs> |
getRelatedObservations()
Convenience method that returns related Obs If the Obs argument is not an ObsGroup: a
Set
|
Boolean |
getValueAsBoolean()
Coerces a value to a Boolean representation
|
Map<Locale,String> |
getValueAsString()
Deprecated.
|
String |
getValueAsString(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.
|
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.
|
String |
getValueComplex()
Get the value for the ComplexData.
|
Date |
getValueDatetime() |
Drug |
getValueDrug() |
Integer |
getValueGroupId() |
String |
getValueModifier() |
Double |
getValueNumeric() |
String |
getValueText() |
boolean |
hasGroupMembers()
Convenience method that checks for nullity and length of the (@link #getGroupMembers())
method
|
int |
hashCode() |
boolean |
isComplex() |
boolean |
isObsGrouping()
Convenience method that checks for nullity and length of the (@link #getGroupMembers())
method
|
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(String accessionNumber) |
void |
setComment(String comment) |
void |
setComplexData(ComplexData complexData)
Set the ComplexData for this Obs.
|
void |
setConcept(Concept concept) |
void |
setDateStarted(Date dateStarted) |
void |
setDateStopped(Date dateStopped) |
void |
setEncounter(Encounter encounter) |
void |
setGroupMembers(Set<Obs> groupMembers)
Set the members of the obs group, if this obs is a group.
|
void |
setId(Integer id) |
void |
setLocation(Location location) |
void |
setObsDatetime(Date obsDatetime) |
void |
setObsGroup(Obs obsGroup)
This method does NOT add this current obs to the list of obs in obsGroup.getGroupMembers().
|
void |
setObsGroupId(Integer obsGroupId)
Deprecated.
This method should not be used. The #setObsGroup() method should be used instead
|
void |
setObsId(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(Integer personId)
Set the person id on this obs object.
|
void |
setRequiredProperties(User creator,
Date dateCreated)
Deprecated.
no longer needed. Replaced by handlers.
|
void |
setValueAsString(String s)
Sets the value for the obs from a string depending on the datatype of the question concept
|
void |
setValueBoolean(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(String valueComplex)
Set the value for the ComplexData.
|
void |
setValueDatetime(Date valueDatetime) |
void |
setValueDrug(Drug valueDrug) |
void |
setValueGroupId(Integer valueGroupId) |
void |
setValueModifier(String valueModifier) |
void |
setValueNumeric(Double valueNumeric) |
void |
setValueText(String valueText) |
String |
toString() |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
getUuid, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
protected Integer obsId
protected Concept concept
protected Date obsDatetime
protected String accessionNumber
protected Obs obsGroup
(??)
protected Concept valueCoded
protected ConceptName valueCodedName
protected Drug valueDrug
protected Integer valueGroupId
protected Date valueDatetime
protected Double valueNumeric
protected String valueModifier
protected String valueText
protected String valueComplex
protected transient ComplexData complexData
protected String comment
protected transient Integer personId
protected Person person
protected Order order
protected Location location
protected Encounter encounter
protected Date dateStarted
protected Date dateStopped
public Obs()
public Obs(Person person, Concept question, 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(Integer obsId)
public static Obs newInstance(Obs obsToCopy)
obsToCopy
with a null obs idobsToCopy
- The Obs that is going to be copiedpublic boolean equals(Object obj)
obs
object. If either has a null obsId, then they are not equalpublic int hashCode()
hashCode
in class Object
Object.hashCode()
@Deprecated public void setRequiredProperties(User creator, Date dateCreated)
SaveHandler
, et al.SaveHandler
,
OpenmrsObjectSaveHandler
,
AuditableSaveHandler
public String getComment()
public void setComment(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 Date getObsDatetime()
public void setObsDatetime(Date obsDatetime)
obsDatetime
- The obsDatetime to set.public Integer getObsGroupId()
getObsGroup()
method should be usedgetObsGroup()
public void setObsGroupId(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()
public Set<Obs> getGroupMembers()
If it's not a group (i.e. getConcept()
.Concept.isSet()
is not
true, then this returns null.
addGroupMember(Obs)
,
hasGroupMembers()
public void setGroupMembers(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 ObsGroupmember
- 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 Set<Obs> getRelatedObservations()
public Integer getObsId()
public void setObsId(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 Integer getPersonId()
getPerson()
.getPersonId()
. It is duplicated here for speed and
simplicity reasonsprotected void setPersonId(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(Boolean valueBoolean)
valueBoolean
- the boolean value matching the boolean coded concept to set topublic Boolean getValueAsBoolean()
public 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 Date getValueDatetime()
public void setValueDatetime(Date valueDatetime)
valueDatetime
- The valueDatetime to set.public Integer getValueGroupId()
public void setValueGroupId(Integer valueGroupId)
valueGroupId
- The valueGroupId to set.public String getValueModifier()
public void setValueModifier(String valueModifier)
valueModifier
- The valueModifier to set.public Double getValueNumeric()
public void setValueNumeric(Double valueNumeric)
valueNumeric
- The valueNumeric to set.public String getValueText()
public void setValueText(String valueText)
valueText
- The valueText to set.public boolean isComplex()
public String getValueComplex()
getValueAsString()
. The URI is the location where the ComplexData is stored.public void setValueComplex(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 String getAccessionNumber()
public void setAccessionNumber(String accessionNumber)
accessionNumber
- The accessionNumber to set.public Date getDateStarted()
public void setDateStarted(Date dateStarted)
dateStarted
- The dateStarted to set.public Date getDateStopped()
public void setDateStopped(Date dateStopped)
dateStopped
- The dateStopped to set.public String getValueAsString(Locale locale)
locale
- locale for locale-specific depictions of valuepublic void setValueAsString(String s) throws ParseException
s
- the string to coerce to a booleanParseException
public Map<Locale,String> getValueAsString()
public String toString()
toString
in class Object
Object.toString()
public Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
Copyright © 2018 OpenMRS LLC.. All Rights Reserved.