|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.BaseOpenmrsObject org.openmrs.BaseOpenmrsData org.openmrs.Obs
public class Obs
An observation is a single unit of clinical information.
Observations are collected and grouped together into one Encounter (one visit). Obs can be
grouped in a hierarchical fashion.
The 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_Primer
Encounter
,
Serialized FormField Summary | |
---|---|
protected java.lang.String |
accessionNumber
|
protected java.lang.String |
comment
|
protected ComplexData |
complexData
|
protected Concept |
concept
|
protected java.util.Date |
dateStarted
|
protected java.util.Date |
dateStopped
|
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
|
Fields inherited from class org.openmrs.BaseOpenmrsData |
---|
creator |
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
void |
addGroupMember(Obs member)
Convenience method to add the given obs to this grouping. |
boolean |
equals(java.lang.Object obj)
Compares two Obs for similarity. |
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 |
java.util.Date |
getDateStarted()
|
java.util.Date |
getDateStopped()
|
Encounter |
getEncounter()
|
java.util.Set<Obs> |
getGroupMembers()
Get the members of the 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. |
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 |
getValueDatetime()
|
Drug |
getValueDrug()
|
java.lang.Integer |
getValueGroupId()
|
java.lang.String |
getValueModifier()
|
java.lang.Double |
getValueNumeric()
|
java.lang.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(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 |
setDateStarted(java.util.Date dateStarted)
|
void |
setDateStopped(java.util.Date dateStopped)
|
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 |
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 |
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)
|
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 |
---|
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
protected java.util.Date dateStarted
protected java.util.Date dateStopped
Constructor Detail |
---|
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)
Method Detail |
---|
public static Obs newInstance(Obs obsToCopy)
obsToCopy
with a null obs id
obsToCopy
- The Obs that is going to be copied
public boolean equals(java.lang.Object obj)
obs
object. If either has a null obsId, then they are not equal
equals
in class java.lang.Object
obj
-
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
@Deprecated public void setRequiredProperties(User creator, java.util.Date dateCreated)
SaveHandler
, et al.
SaveHandler
,
OpenmrsObjectSaveHandler
,
AuditableSaveHandler
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 used
getObsGroup()
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()
public java.util.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(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 grouper
member
- 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 reasons
protected 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.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.util.Date getDateStarted()
public void setDateStarted(java.util.Date dateStarted)
dateStarted
- The dateStarted to set.public java.util.Date getDateStopped()
public void setDateStopped(java.util.Date dateStopped)
dateStopped
- The dateStopped 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 boolean
java.text.ParseException
public java.util.Map<java.util.Locale,java.lang.String> getValueAsString()
public java.lang.String toString()
toString
in class java.lang.Object
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)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |