@Transactional public interface ObsService extends OpenmrsService
ObsService obsService = Context.getObsService(); // get the obs for patient with internal identifier of 1235 List<Obs> someObsList = obsService.getObservationsByPerson(new Patient(1235));There are also a number of convenience methods for extracting obs pertaining to certain Concepts, people, or encounters
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
PATIENT
Deprecated.
Use OpenmrsConstants#PERSON_TYPE.PATIENT
|
static java.lang.Integer |
PERSON
Deprecated.
Use org.openmrs.util.OpenmrsConstants#PERSON_TYPE.PATIENT
|
static java.lang.Integer |
USER
Deprecated.
Use OpenmrsConstants.PERSON_TYPE.USER
|
Modifier and Type | Method and Description |
---|---|
void |
createObs(Obs obs)
Deprecated.
|
void |
createObsGroup(Obs[] obs)
Deprecated.
This method should no longer need to be called on the api. This was meant as
temporary until we created a true ObsGroup pojo. Replaced by
saveObs(Obs, String) |
void |
deleteObs(Obs obs)
Deprecated.
use #purgeObs(Obs)
|
java.util.List<Obs> |
findObsByGroupId(java.lang.Integer obsGroupId)
|
java.util.List<Obs> |
findObservations(java.lang.String search,
boolean includeVoided,
java.lang.Integer personType)
Deprecated.
|
java.util.List<MimeType> |
getAllMimeTypes()
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
java.util.List<MimeType> |
getAllMimeTypes(boolean includeRetired)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
Obs |
getComplexObs(java.lang.Integer obsId,
java.lang.String view)
Get a complex observation.
|
ComplexObsHandler |
getHandler(java.lang.String key)
Get the ComplexObsHandler that has been registered with the given key
|
java.util.Map<java.lang.String,ComplexObsHandler> |
getHandlers()
Gets the handlers map registered
|
java.util.List<Obs> |
getLastNObservations(java.lang.Integer n,
Person who,
Concept question,
boolean includeVoided)
|
MimeType |
getMimeType(java.lang.Integer mimeTypeId)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
java.util.List<MimeType> |
getMimeTypes()
Deprecated.
|
java.util.List<java.lang.Object[]> |
getNumericAnswersForConcept(Concept answer,
java.lang.Boolean sortByValue,
java.lang.Integer personType,
boolean includeVoided)
|
Obs |
getObs(java.lang.Integer obsId)
Get an observation
|
Obs |
getObsByUuid(java.lang.String uuid)
Get Obs by its UUID
|
java.lang.Integer |
getObservationCount(java.util.List<ConceptName> conceptNames,
boolean includeVoided)
Gets the number of observations(including voided ones) that are using the specified
conceptNames as valueCodedName answers
|
java.lang.Integer |
getObservationCount(java.util.List<Person> whom,
java.util.List<Encounter> encounters,
java.util.List<Concept> questions,
java.util.List<Concept> answers,
java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
java.util.List<Location> locations,
java.lang.Integer obsGroupId,
java.util.Date fromDate,
java.util.Date toDate,
boolean includeVoidedObs)
This method fetches the count of observations according to the criteria in the given
arguments.
|
java.util.List<Obs> |
getObservations(Cohort patients,
java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate)
|
java.util.List<Obs> |
getObservations(Concept c,
Location loc,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
|
java.util.List<Obs> |
getObservations(Concept question,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
|
java.util.Set<Obs> |
getObservations(Encounter whichEncounter)
Deprecated.
use
org.openmrs |
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate)
|
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate,
boolean includeVoided)
|
java.util.List<Obs> |
getObservations(java.util.List<Person> whom,
java.util.List<Encounter> encounters,
java.util.List<Concept> questions,
java.util.List<Concept> answers,
java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes,
java.util.List<Location> locations,
java.util.List<java.lang.String> sort,
java.lang.Integer mostRecentN,
java.lang.Integer obsGroupId,
java.util.Date fromDate,
java.util.Date toDate,
boolean includeVoidedObs)
This method fetches observations according to the criteria in the given arguments.
|
java.util.Set<Obs> |
getObservations(Person who,
boolean includeVoided)
Deprecated.
|
java.util.Set<Obs> |
getObservations(Person who,
Concept question,
boolean includeVoided)
Deprecated.
|
java.util.List<Obs> |
getObservations(java.lang.String searchString)
This method searches the obs table based on the given
searchString . |
java.util.List<Obs> |
getObservationsAnsweredByConcept(Concept answer,
java.lang.Integer personType,
boolean includeVoided)
|
java.util.List<Obs> |
getObservationsByPerson(Person who)
Get all Observations for the given person, sorted by obsDatetime ascending.
|
java.util.List<Obs> |
getObservationsByPersonAndConcept(Person who,
Concept question)
Get all nonvoided observations for the given patient with the given concept as the question
concept (conceptId)
|
java.util.List<Obs> |
getVoidedObservations()
|
void |
purgeMimeType(MimeType mimeType)
Deprecated.
MimeTypes are no longer used. See
ConceptComplex and its use
of handlers |
void |
purgeObs(Obs obs)
Completely remove an observation from the database.
|
void |
purgeObs(Obs obs,
boolean cascade)
Completely remove an observation from the database.
|
void |
registerHandler(java.lang.String key,
ComplexObsHandler handler)
Registers the given handler with the given key If the given String key exists, that handler
is overwritten with the given handler
|
void |
registerHandler(java.lang.String key,
java.lang.String handlerClass)
Convenience method for
registerHandler(String, ComplexObsHandler) |
void |
removeHandler(java.lang.String key)
Remove the handler associated with the key from list of available handlers
|
MimeType |
saveMimeType(MimeType mimeType)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
Obs |
saveObs(Obs obs,
java.lang.String changeMessage)
Save the given obs to the database.
|
void |
setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> handlers)
Add the given map to this service's handlers.
|
void |
setObsDAO(ObsDAO dao)
Set the given
dao on this obs service. |
Obs |
unvoidObs(Obs obs)
Revive an observation (pull a Lazarus)
|
void |
updateObs(Obs obs)
Deprecated.
|
MimeType |
voidMimeType(MimeType mimeType,
java.lang.String reason)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
Obs |
voidObs(Obs obs,
java.lang.String reason)
Equivalent to deleting an observation
|
onShutdown, onStartup
@Deprecated static final java.lang.Integer PERSON
OpenmrsConstants
@Deprecated static final java.lang.Integer PATIENT
OpenmrsConstants
@Deprecated static final java.lang.Integer USER
OpenmrsConstants
void setObsDAO(ObsDAO dao)
dao
on this obs service. The dao will act as the conduit through
with all obs calls get to the databasedao
- specific ObsDAO to use for this service@Deprecated @Authorized(value="Add Observations") void createObs(Obs obs) throws APIException
saveObs(Obs, String)
obs
- APIException
@Deprecated @Authorized(value="Add Observations") void createObsGroup(Obs[] obs) throws APIException
saveObs(Obs, String)
Obs.getObsGroupId()
The proper use is:
Obs obsGroup = new Obs();
for (Obs member : obs) {
obsGroup.addGroupMember(obs);
}
pass obsGroup to createObs(Obs)
obs
- - array of observations to be groupedAPIException
@Transactional(readOnly=true) @Authorized(value="View Observations") Obs getObs(java.lang.Integer obsId) throws APIException
obsId
- integer obsId of observation desiredAPIException
@Transactional(readOnly=true) @Authorized(value="View Observations") Obs getObsByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Deprecated @Authorized(value="Edit Observations") void updateObs(Obs obs) throws APIException
saveObs(Obs, String)
obs
- APIException
@Authorized(value={"Add Observations","Edit Observations"}) Obs saveObs(Obs obs, java.lang.String changeMessage) throws APIException
obs
to the database. This acts as both the initial save and an update kind of save. The returned
obs will be the same as the obs passed in. It is included for chaining. If this is an initial
save, the obsId on the given obs
object will be updated to reflect the auto
numbering from the database. The obsId on the returned obs will also have this number. If
there is already an obsId on the given obs
object, the given obs will be voided
and a new row in the database will be created that has a new obs id.obs
- the Obs to save to the databasechangeMessage
- String explaining why obs
is being changed. If
obs
is a new obs, changeMessage is nullable, or if it is being
updated, it would be requiredAPIException
@Authorized(value="Edit Observations") Obs voidObs(Obs obs, java.lang.String reason) throws APIException
obs
- Obs to voidreason
- String reason it's being voidedAPIException
@Authorized(value="Edit Observations") Obs unvoidObs(Obs obs) throws APIException
obs
- Obs to unvoidAPIException
@Deprecated @Authorized(value="Delete Observations") void deleteObs(Obs obs) throws APIException
purgeObs(Obs)
or
voidObs(Obs,String)
obs
- APIException
@Authorized(value="Delete Observations") void purgeObs(Obs obs) throws APIException
obs
- APIException
purgeObs(Obs, boolean)
@Authorized(value="Delete Observations") void purgeObs(Obs obs, boolean cascade) throws APIException
obs
- the observation to remove from the databasecascade
- true/false whether or not to cascade down to other things that link to this
observation (like Orders and ObsGroups)APIException
purgeObs(Obs, boolean)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Mime Types") java.util.List<MimeType> getMimeTypes() throws APIException
getAllMimeTypes()
APIException
@Deprecated @Authorized(value="View Mime Types") java.util.List<MimeType> getAllMimeTypes() throws APIException
APIException
getAllMimeTypes(boolean)
@Deprecated @Authorized(value="View Mime Types") java.util.List<MimeType> getAllMimeTypes(boolean includeRetired) throws APIException
includeRetired
is trueincludeRetired
- true/false of whether to also return the retired onesAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Mime Types") MimeType getMimeType(java.lang.Integer mimeTypeId) throws APIException
mimeTypeId
- APIException
@Deprecated @Authorized(value="Manage Mime Types") MimeType saveMimeType(MimeType mimeType) throws APIException
mimeType
to the database. If mimeType is not null, the mimeType
is updated in the database. If mimeType is null, a new mimeType is added to the databasemimeType
- mimeTypeAPIException
@Deprecated @Authorized(value="Manage Mime Types") MimeType voidMimeType(MimeType mimeType, java.lang.String reason) throws APIException
mimeType
- the MimeType to removereason
- the reason this mimeType is being voidedAPIException
createObs(Obs)
@Deprecated @Authorized(value="Purge Mime Types") void purgeMimeType(MimeType mimeType) throws APIException
ConceptComplex
and its use
of handlersMimeType
from the database. If data has been
stored already that points at this mimeType an exception is thrownmimeType
- the MimeType to removeAPIException
purgeMimeType(MimeType)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.Set<Obs> getObservations(Person who, boolean includeVoided)
getObservationsByPerson(Person)
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservationsByPerson(Person who)
who
- the user to match ongetObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date,
boolean)
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.util.List<java.lang.String> sort, java.lang.Integer mostRecentN, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs) throws APIException
location
and a
fromDate
are given, only Obs that are both at that Location and after the
fromDate are returned). whom
has elements, personType
is ignored whom
- Listencounters
- Listquestions
- Listanswers
- ListpersonTypes
- Listwhom
is an empty list (optional)locations
- The org.openmrs.Location objects to restrict to (optional)sort
- list of column names to sort on (obsId, obsDatetime, etc) if null, defaults to
obsDatetime (optional)mostRecentN
- restrict the number of obs returned to this size (optional)obsGroupId
- the Obs.getObsGroupId() to this integer (optional)fromDate
- the earliest Obs date to get (optional)toDate
- the latest Obs date to get (optional)includeVoidedObs
- true/false whether to also include the voided obs (required)APIException
@Transactional(readOnly=true) @Authorized(value="View Observations") java.lang.Integer getObservationCount(java.util.List<Person> whom, java.util.List<Encounter> encounters, java.util.List<Concept> questions, java.util.List<Concept> answers, java.util.List<OpenmrsConstants.PERSON_TYPE> personTypes, java.util.List<Location> locations, java.lang.Integer obsGroupId, java.util.Date fromDate, java.util.Date toDate, boolean includeVoidedObs) throws APIException
location
and a fromDate
are given, only Obs that are both at
that Location and after the fromDate are returned). whom
has elements, personType
is ignored whom
- Listencounters
- Listquestions
- Listanswers
- ListpersonTypes
- Listwhom
is an empty list (optional)locations
- The org.openmrs.Location objects to restrict to (optional) obsDatetime
(optional)obsGroupId
- the Obs.getObsGroupId() to this integer (optional)fromDate
- the earliest Obs date to get (optional)toDate
- the latest Obs date to get (optional)includeVoidedObs
- true/false whether to also include the voided obs (required)APIException
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(java.lang.String searchString) throws APIException
searchString
.searchString
- The string to search onAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(Concept c, Location loc, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
getObservationsByPersonAndConcept(Person, Concept)
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservationsByPersonAndConcept(Person who, Concept question) throws APIException
who
- person to match onquestion
- conceptId to match onAPIException
getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date,
boolean)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getLastNObservations(java.lang.Integer n, Person who, Concept question, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(Concept question, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer, java.lang.Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept answer, java.lang.Boolean sortByValue, java.lang.Integer personType, boolean includeVoided)
getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)
answer
- sortByValue
- true/false if sorting by valueNumeric. If false, will sort by obsDatetimepersonType
- @Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.Set<Obs> getObservations(Encounter whichEncounter)
org.openmrs
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getVoidedObservations()
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> findObservations(java.lang.String search, boolean includeVoided, java.lang.Integer personType)
getObservations(String)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservations(Cohort patients, java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
@Transactional(readOnly=true) @Authorized(value="View Observations") Obs getComplexObs(java.lang.Integer obsId, java.lang.String view) throws APIException
obsId
- APIException
@Transactional(readOnly=true) ComplexObsHandler getHandler(java.lang.String key) throws APIException
key
- that has been registered with a handler classAPIException
void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> handlers) throws APIException
handlers
- Map of class to handler objectAPIException
@Transactional(readOnly=true) java.util.Map<java.lang.String,ComplexObsHandler> getHandlers() throws APIException
APIException
void registerHandler(java.lang.String key, ComplexObsHandler handler) throws APIException
key
- the key name to use for this handlerhandler
- the class to register with this keyAPIException
void registerHandler(java.lang.String key, java.lang.String handlerClass) throws APIException
registerHandler(String, ComplexObsHandler)
key
- the key name to use for this handlerhandlerClass
- the class to register with this keyAPIException
void removeHandler(java.lang.String key) throws APIException
key
- the key of the handler to unregisterAPIException
@Transactional(readOnly=true) @Authorized(value="View Observations") java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames, boolean includeVoided)
conceptNames
- the conceptNames to be searched againstincludeVoided
- whether voided observation should be includedCopyright © 2018 OpenMRS Inc.. All Rights Reserved.