public class ObsServiceImpl extends BaseOpenmrsService implements ObsService
ObsService
Modifier and Type | Field and Description |
---|---|
protected ObsDAO |
dao
The data access object for the obs service
|
PATIENT, PERSON, USER
Constructor and Description |
---|
ObsServiceImpl()
Default empty constructor for this obs service
|
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.
|
void |
deleteObs(Obs obs)
Deprecated.
use #purgeObs(Obs)
|
java.util.List<Obs> |
findObsByGroupId(java.lang.Integer obsGroupId)
Deprecated.
-- should use obs.getGroupMembers
|
java.util.List<Obs> |
findObservations(java.lang.String search,
boolean includeVoided,
java.lang.Integer personType)
Deprecated.
|
java.util.List<MimeType> |
getAllMimeTypes()
Deprecated.
|
java.util.List<MimeType> |
getAllMimeTypes(boolean includeRetired)
Deprecated.
|
Obs |
getComplexObs(java.lang.Integer obsId,
java.lang.String view)
Get a complex observation.
|
ComplexObsHandler |
getHandler(Obs obs)
Convenience method to get the ComplexObsHandler associated with a complex Obs.
|
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)
Deprecated.
|
MimeType |
getMimeType(java.lang.Integer mimeTypeId)
Deprecated.
|
java.util.List<MimeType> |
getMimeTypes()
Deprecated.
|
java.util.List<java.lang.Object[]> |
getNumericAnswersForConcept(Concept question,
java.lang.Boolean sortByValue,
java.lang.Integer personType,
boolean includeVoided)
Deprecated.
|
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)
Deprecated.
|
java.util.List<Obs> |
getObservations(Concept c,
Location loc,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
Deprecated.
|
java.util.List<Obs> |
getObservations(Concept question,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
Deprecated.
|
java.util.Set<Obs> |
getObservations(Encounter whichEncounter)
Deprecated.
use org.openmrs.Encounter#getObs()
|
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate)
Deprecated.
|
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate,
boolean includeVoided)
Deprecated.
|
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 implementation queries the obs table comparing the given
searchString with
the patient's identifier, encounterId, and obsId |
java.util.List<Obs> |
getObservationsAnsweredByConcept(Concept answer,
java.lang.Integer personType,
boolean includeVoided)
Deprecated.
|
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()
Deprecated.
|
void |
onShutdown()
Clean up after this class.
|
protected boolean |
purgeComplexData(Obs obs)
Internal method to remove ComplexData when an Obs is purged.
|
void |
purgeMimeType(MimeType mimeType)
Deprecated.
|
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
ObsService.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.
|
Obs |
saveObs(Obs obs,
java.lang.String changeMessage)
Save the given obs to the database.
|
void |
setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> newHandlers)
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)
Unvoids an Obs
|
void |
updateObs(Obs obs)
Deprecated.
|
MimeType |
voidMimeType(MimeType mimeType,
java.lang.String reason)
Deprecated.
|
Obs |
voidObs(Obs obs,
java.lang.String reason)
Voids an Obs If the Obs argument is an obsGroup, all group members will be voided.
|
onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onStartup
protected ObsDAO dao
public ObsServiceImpl()
public void setObsDAO(ObsDAO dao)
ObsService
dao
on this obs service. The dao will act as the conduit through
with all obs calls get to the databasesetObsDAO
in interface ObsService
dao
- specific ObsDAO to use for this serviceObsService.setObsDAO(org.openmrs.api.db.ObsDAO)
public void onShutdown()
onShutdown
in interface OpenmrsService
onShutdown
in class BaseOpenmrsService
BaseOpenmrsService.onShutdown()
public Obs saveObs(Obs obs, java.lang.String changeMessage) throws APIException
ObsService
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.saveObs
in interface ObsService
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
ObsService.saveObs(org.openmrs.Obs, String)
public Obs getObs(java.lang.Integer obsId) throws APIException
ObsService
getObs
in interface ObsService
obsId
- integer obsId of observation desiredAPIException
ObsService.getObs(java.lang.Integer)
@Deprecated public void updateObs(Obs obs) throws APIException
ObsService
updateObs
in interface ObsService
APIException
ObsService.updateObs(org.openmrs.Obs)
public Obs voidObs(Obs obs, java.lang.String reason) throws APIException
voidObs
in interface ObsService
obs
- the Obs to voidreason
- the void reasonAPIException
ObsService.voidObs(org.openmrs.Obs, java.lang.String)
public Obs unvoidObs(Obs obs) throws APIException
If the Obs argument is an obsGroup, all group members with the same dateVoided will also be unvoided.
unvoidObs
in interface ObsService
obs
- the Obs to unvoidAPIException
ObsService.unvoidObs(org.openmrs.Obs)
public void purgeObs(Obs obs, boolean cascade) throws APIException
ObsService
purgeObs
in interface ObsService
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
ObsService.purgeObs(org.openmrs.Obs, boolean)
public void purgeObs(Obs obs) throws APIException
ObsService
purgeObs
in interface ObsService
APIException
ObsService.purgeObs(org.openmrs.Obs)
@Deprecated public java.util.List<MimeType> getMimeTypes() throws APIException
getAllMimeTypes()
getMimeTypes
in interface ObsService
APIException
ObsService.getMimeTypes()
@Deprecated public java.util.List<MimeType> getAllMimeTypes() throws APIException
ObsService
getAllMimeTypes
in interface ObsService
APIException
ObsService.getAllMimeTypes()
@Deprecated public java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
ObsService
includeRetired
is truegetAllMimeTypes
in interface ObsService
includeRetired
- true/false of whether to also return the retired onesObsService.getAllMimeTypes(boolean)
@Deprecated public MimeType saveMimeType(MimeType mimeType) throws APIException
ObsService
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 databasesaveMimeType
in interface ObsService
mimeType
- mimeTypeAPIException
ObsService.saveMimeType(org.openmrs.MimeType)
@Deprecated public MimeType voidMimeType(MimeType mimeType, java.lang.String reason) throws APIException
ObsService
voidMimeType
in interface ObsService
mimeType
- the MimeType to removereason
- the reason this mimeType is being voidedAPIException
ObsService.voidMimeType(org.openmrs.MimeType, java.lang.String)
@Deprecated public MimeType getMimeType(java.lang.Integer mimeTypeId) throws APIException
ObsService
getMimeType
in interface ObsService
APIException
ObsService.getMimeType(java.lang.Integer)
@Deprecated public void purgeMimeType(MimeType mimeType)
ObsService
MimeType
from the database. If data has been
stored already that points at this mimeType an exception is thrownpurgeMimeType
in interface ObsService
mimeType
- the MimeType to removeObsService.purgeMimeType(org.openmrs.MimeType)
public 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
ObsService
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 getObservations
in interface ObsService
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
ObsService.getObservations(java.util.List, java.util.List,
java.util.List, java.util.List, List, List, java.util.List, java.lang.Integer,
java.lang.Integer, java.util.Date, java.util.Date, boolean)
public 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
ObsService
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 getObservationCount
in interface ObsService
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
ObsService.getObservationCount(java.util.List, java.util.List,
java.util.List, java.util.List, java.util.List, java.util.List, java.lang.Integer,
java.util.Date, java.util.Date, boolean)
public java.util.List<Obs> getObservations(java.lang.String searchString)
searchString
with
the patient's identifier, encounterId, and obsIdgetObservations
in interface ObsService
searchString
- The string to search onObsService.getObservations(java.lang.String)
@Deprecated public void createObs(Obs obs) throws APIException
ObsService
createObs
in interface ObsService
APIException
ObsService.createObs(org.openmrs.Obs)
@Deprecated public void createObsGroup(Obs[] obs) throws APIException
Obs parent = new Obs(); Obs child1 = new Obs(); Obs child2 = new Obs(); parent.addGroupMember(child1); parent.addGroupMember(child2);
createObsGroup
in interface ObsService
obs
- - array of observations to be groupedAPIException
ObsService.createObsGroup(org.openmrs.Obs[])
@Deprecated public void deleteObs(Obs obs) throws APIException
ObsService
ObsService.purgeObs(Obs)
or
ObsService.voidObs(Obs,String)
deleteObs
in interface ObsService
APIException
ObsService.deleteObs(org.openmrs.Obs)
public java.util.List<Obs> getObservationsByPerson(Person who)
ObsService
getObservationsByPerson
in interface ObsService
who
- the user to match onObsService.getObservationsByPerson(org.openmrs.Person)
@Deprecated public java.util.Set<Obs> getObservations(Person who, boolean includeVoided)
getObservationsByPerson(Person)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Person, boolean includeVoided)
@Deprecated public java.util.List<Obs> getObservations(Concept c, Location loc, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Concept, org.openmrs.Location,
java.lang.String, java.lang.Integer, boolean includeVoided)
@Deprecated public java.util.Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Person, org.openmrs.Concept,
boolean)
public java.util.List<Obs> getObservationsByPersonAndConcept(Person who, Concept question) throws APIException
ObsService
getObservationsByPersonAndConcept
in interface ObsService
who
- person to match onquestion
- conceptId to match onAPIException
ObsService.getObservationsByPersonAndConcept(org.openmrs.Person,
org.openmrs.Concept)
@Deprecated public java.util.List<Obs> getLastNObservations(java.lang.Integer n, Person who, Concept question, boolean includeVoided)
getLastNObservations
in interface ObsService
ObsService.getLastNObservations(java.lang.Integer, org.openmrs.Person,
org.openmrs.Concept, boolean includeVoided)
@Deprecated public java.util.List<Obs> getObservations(Concept question, java.lang.String sort, java.lang.Integer personType, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Concept, java.lang.String,
java.lang.Integer, boolean includeVoided)
@Deprecated public java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer, java.lang.Integer personType, boolean includeVoided)
getObservationsAnsweredByConcept
in interface ObsService
ObsService.getObservationsAnsweredByConcept(org.openmrs.Concept,
java.lang.Integer, boolean includeVoided)
@Deprecated public java.util.List<java.lang.Object[]> getNumericAnswersForConcept(Concept question, java.lang.Boolean sortByValue, java.lang.Integer personType, boolean includeVoided)
ObsService
getNumericAnswersForConcept
in interface ObsService
sortByValue
- true/false if sorting by valueNumeric. If false, will sort by obsDatetimeObsService.getNumericAnswersForConcept(org.openmrs.Concept,
java.lang.Boolean, java.lang.Integer, boolean includeVoided)
@Deprecated public java.util.Set<Obs> getObservations(Encounter whichEncounter)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Encounter)
@Deprecated public java.util.List<Obs> getVoidedObservations()
getVoidedObservations
in interface ObsService
ObsService.getVoidedObservations()
@Deprecated public java.util.List<Obs> findObservations(java.lang.String search, boolean includeVoided, java.lang.Integer personType)
findObservations
in interface ObsService
ObsService.findObservations(java.lang.String, boolean,
java.lang.Integer)
@Deprecated public java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
findObsByGroupId
in interface ObsService
ObsService.findObsByGroupId(java.lang.Integer)
public Obs getObsByUuid(java.lang.String uuid) throws APIException
ObsService
getObsByUuid
in interface ObsService
APIException
ObsService.getObsByUuid(java.lang.String)
@Deprecated public java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(List, Date, Date, boolean)
@Deprecated public java.util.List<Obs> getObservations(java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
getObservations
in interface ObsService
ObsService.getObservations(List, Date, Date)
@Deprecated public java.util.List<Obs> getObservations(Cohort patients, java.util.List<Concept> concepts, java.util.Date fromDate, java.util.Date toDate)
getObservations
in interface ObsService
ObsService.getObservations(Cohort, List, Date, Date)
public Obs getComplexObs(java.lang.Integer obsId, java.lang.String view) throws APIException
ObsService
getComplexObs
in interface ObsService
APIException
ObsService.getComplexObs(Integer, String)
protected boolean purgeComplexData(Obs obs) throws APIException
APIException
public ComplexObsHandler getHandler(Obs obs) throws APIException
obs
- A complex Obs.APIException
public ComplexObsHandler getHandler(java.lang.String key)
ObsService
getHandler
in interface ObsService
key
- that has been registered with a handler classObsService.getHandler(java.lang.String)
public void setHandlers(java.util.Map<java.lang.String,ComplexObsHandler> newHandlers) throws APIException
ObsService
setHandlers
in interface ObsService
newHandlers
- Map of class to handler objectAPIException
ObsService.setHandlers(Map)
,
registerHandler(String, ComplexObsHandler)
public java.util.Map<java.lang.String,ComplexObsHandler> getHandlers() throws APIException
ObsService
getHandlers
in interface ObsService
APIException
ObsService.getHandlers()
public void registerHandler(java.lang.String key, ComplexObsHandler handler) throws APIException
ObsService
registerHandler
in interface ObsService
key
- the key name to use for this handlerhandler
- the class to register with this keyAPIException
ObsService.registerHandler(String, ComplexObsHandler)
public void registerHandler(java.lang.String key, java.lang.String handlerClass) throws APIException
ObsService
ObsService.registerHandler(String, ComplexObsHandler)
registerHandler
in interface ObsService
key
- the key name to use for this handlerhandlerClass
- the class to register with this keyAPIException
ObsService.registerHandler(String, String)
public java.lang.Integer getObservationCount(java.util.List<ConceptName> conceptNames, boolean includeVoided)
ObsService
getObservationCount
in interface ObsService
conceptNames
- the conceptNames to be searched againstincludeVoided
- whether voided observation should be includedObsService.getObservationCount(java.util.List, boolean)
public void removeHandler(java.lang.String key)
ObsService
removeHandler
in interface ObsService
key
- the key of the handler to unregisterObsService.removeHandler(java.lang.String)
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.