@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 Integer |
PATIENT
Deprecated.
Use OpenmrsConstants#PERSON_TYPE.PATIENT
|
static Integer |
PERSON
Deprecated.
Use org.openmrs.util.OpenmrsConstants#PERSON_TYPE.PATIENT
|
static 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)
|
List<Obs> |
findObsByGroupId(Integer obsGroupId)
|
List<Obs> |
findObservations(String search,
boolean includeVoided,
Integer personType)
Deprecated.
|
List<MimeType> |
getAllMimeTypes()
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
List<MimeType> |
getAllMimeTypes(boolean includeRetired)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
Obs |
getComplexObs(Integer obsId,
String view)
Get a complex observation.
|
ComplexObsHandler |
getHandler(String key)
Get the ComplexObsHandler that has been registered with the given key
|
Map<String,ComplexObsHandler> |
getHandlers()
Gets the handlers map registered
|
List<Obs> |
getLastNObservations(Integer n,
Person who,
Concept question,
boolean includeVoided)
|
MimeType |
getMimeType(Integer mimeTypeId)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
List<MimeType> |
getMimeTypes()
Deprecated.
|
List<Object[]> |
getNumericAnswersForConcept(Concept answer,
Boolean sortByValue,
Integer personType,
boolean includeVoided)
|
Obs |
getObs(Integer obsId)
Get an observation
|
Obs |
getObsByUuid(String uuid)
Get Obs by its UUID
|
Integer |
getObservationCount(List<ConceptName> conceptNames,
boolean includeVoided)
Gets the number of observations(including voided ones) that are using the specified
conceptNames as valueCodedName answers
|
Integer |
getObservationCount(List<Person> whom,
List<Encounter> encounters,
List<Concept> questions,
List<Concept> answers,
List<OpenmrsConstants.PERSON_TYPE> personTypes,
List<Location> locations,
Integer obsGroupId,
Date fromDate,
Date toDate,
boolean includeVoidedObs)
This method fetches the count of observations according to the criteria in the given
arguments.
|
List<Obs> |
getObservations(Cohort patients,
List<Concept> concepts,
Date fromDate,
Date toDate)
|
List<Obs> |
getObservations(Concept c,
Location loc,
String sort,
Integer personType,
boolean includeVoided)
|
List<Obs> |
getObservations(Concept question,
String sort,
Integer personType,
boolean includeVoided)
|
Set<Obs> |
getObservations(Encounter whichEncounter)
Deprecated.
use
org.openmrs |
List<Obs> |
getObservations(List<Concept> concepts,
Date fromDate,
Date toDate)
|
List<Obs> |
getObservations(List<Concept> concepts,
Date fromDate,
Date toDate,
boolean includeVoided)
|
List<Obs> |
getObservations(List<Person> whom,
List<Encounter> encounters,
List<Concept> questions,
List<Concept> answers,
List<OpenmrsConstants.PERSON_TYPE> personTypes,
List<Location> locations,
List<String> sort,
Integer mostRecentN,
Integer obsGroupId,
Date fromDate,
Date toDate,
boolean includeVoidedObs)
This method fetches observations according to the criteria in the given arguments.
|
Set<Obs> |
getObservations(Person who,
boolean includeVoided)
Deprecated.
|
Set<Obs> |
getObservations(Person who,
Concept question,
boolean includeVoided)
Deprecated.
|
List<Obs> |
getObservations(String searchString)
This method searches the obs table based on the given
searchString . |
List<Obs> |
getObservationsAnsweredByConcept(Concept answer,
Integer personType,
boolean includeVoided)
|
List<Obs> |
getObservationsByPerson(Person who)
Get all Observations for the given person, sorted by obsDatetime ascending.
|
List<Obs> |
getObservationsByPersonAndConcept(Person who,
Concept question)
Get all nonvoided observations for the given patient with the given concept as the question
concept (conceptId)
|
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(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(String key,
String handlerClass)
Convenience method for
registerHandler(String, ComplexObsHandler) |
void |
removeHandler(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,
String changeMessage)
Save the given obs to the database.
|
void |
setHandlers(Map<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,
String reason)
Deprecated.
MimeTypes are no longer used. See ConceptComplex and its use of handlers
|
Obs |
voidObs(Obs obs,
String reason)
Equivalent to deleting an observation
|
onShutdown, onStartup
@Deprecated static final Integer PERSON
OpenmrsConstants
@Deprecated static final Integer PATIENT
OpenmrsConstants
@Deprecated static final 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(Integer obsId) throws APIException
obsId
- integer obsId of observation desiredAPIException
@Transactional(readOnly=true) @Authorized(value="View Observations") Obs getObsByUuid(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, 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, 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") List<MimeType> getMimeTypes() throws APIException
getAllMimeTypes()
APIException
@Deprecated @Authorized(value="View Mime Types") List<MimeType> getAllMimeTypes() throws APIException
APIException
getAllMimeTypes(boolean)
@Deprecated @Authorized(value="View Mime Types") 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(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, 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") Set<Obs> getObservations(Person who, boolean includeVoided)
getObservationsByPerson(Person)
@Transactional(readOnly=true) @Authorized(value="View Observations") 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") List<Obs> getObservations(List<Person> whom, List<Encounter> encounters, List<Concept> questions, List<Concept> answers, List<OpenmrsConstants.PERSON_TYPE> personTypes, List<Location> locations, List<String> sort, Integer mostRecentN, Integer obsGroupId, Date fromDate, 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") Integer getObservationCount(List<Person> whom, List<Encounter> encounters, List<Concept> questions, List<Concept> answers, List<OpenmrsConstants.PERSON_TYPE> personTypes, List<Location> locations, Integer obsGroupId, Date fromDate, 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") List<Obs> getObservations(String searchString) throws APIException
searchString
.searchString
- The string to search onAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservations(Concept c, Location loc, String sort, Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
getObservationsByPersonAndConcept(Person, Concept)
@Transactional(readOnly=true) @Authorized(value="View Observations") 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") List<Obs> getLastNObservations(Integer n, Person who, Concept question, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservations(Concept question, String sort, Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservationsAnsweredByConcept(Concept answer, Integer personType, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Object[]> getNumericAnswersForConcept(Concept answer, Boolean sortByValue, 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") Set<Obs> getObservations(Encounter whichEncounter)
org.openmrs
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getVoidedObservations()
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> findObservations(String search, boolean includeVoided, Integer personType)
getObservations(String)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> findObsByGroupId(Integer obsGroupId)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate, boolean includeVoided)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate)
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Observations") List<Obs> getObservations(Cohort patients, List<Concept> concepts, Date fromDate, Date toDate)
@Transactional(readOnly=true) @Authorized(value="View Observations") Obs getComplexObs(Integer obsId, String view) throws APIException
obsId
- APIException
@Transactional(readOnly=true) ComplexObsHandler getHandler(String key) throws APIException
key
- that has been registered with a handler classAPIException
void setHandlers(Map<String,ComplexObsHandler> handlers) throws APIException
handlers
- Map of class to handler objectAPIException
@Transactional(readOnly=true) Map<String,ComplexObsHandler> getHandlers() throws APIException
APIException
void registerHandler(String key, ComplexObsHandler handler) throws APIException
key
- the key name to use for this handlerhandler
- the class to register with this keyAPIException
void registerHandler(String key, 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(String key) throws APIException
key
- the key of the handler to unregisterAPIException
@Transactional(readOnly=true) @Authorized(value="View Observations") Integer getObservationCount(List<ConceptName> conceptNames, boolean includeVoided)
conceptNames
- the conceptNames to be searched againstincludeVoided
- whether voided observation should be includedCopyright © 2018 OpenMRS LLC.. All Rights Reserved.