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)
|
List<Obs> |
findObsByGroupId(Integer obsGroupId)
Deprecated.
-- should use obs.getGroupMembers
|
List<Obs> |
findObservations(String search,
boolean includeVoided,
Integer personType)
Deprecated.
|
List<MimeType> |
getAllMimeTypes()
Deprecated.
|
List<MimeType> |
getAllMimeTypes(boolean includeRetired)
Deprecated.
|
Obs |
getComplexObs(Integer obsId,
String view)
Get a complex observation.
|
ComplexObsHandler |
getHandler(Obs obs)
Convenience method to get the ComplexObsHandler associated with a complex Obs.
|
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)
Deprecated.
|
MimeType |
getMimeType(Integer mimeTypeId)
Deprecated.
|
List<MimeType> |
getMimeTypes()
Deprecated.
|
List<Object[]> |
getNumericAnswersForConcept(Concept question,
Boolean sortByValue,
Integer personType,
boolean includeVoided)
Deprecated.
|
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)
Deprecated.
|
List<Obs> |
getObservations(Concept c,
Location loc,
String sort,
Integer personType,
boolean includeVoided)
Deprecated.
|
List<Obs> |
getObservations(Concept question,
String sort,
Integer personType,
boolean includeVoided)
Deprecated.
|
Set<Obs> |
getObservations(Encounter whichEncounter)
Deprecated.
use org.openmrs.Encounter#getObs()
|
List<Obs> |
getObservations(List<Concept> concepts,
Date fromDate,
Date toDate)
Deprecated.
|
List<Obs> |
getObservations(List<Concept> concepts,
Date fromDate,
Date toDate,
boolean includeVoided)
Deprecated.
|
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 implementation queries the obs table comparing the given
searchString with
the patient's identifier, encounterId, and obsId |
List<Obs> |
getObservationsAnsweredByConcept(Concept answer,
Integer personType,
boolean includeVoided)
Deprecated.
|
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()
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(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
ObsService.registerHandler(String, ComplexObsHandler) |
void |
removeHandler(String key)
Remove the handler associated with the key from list of available handlers
|
MimeType |
saveMimeType(MimeType mimeType)
Deprecated.
|
Obs |
saveObs(Obs obs,
String changeMessage)
Save the given obs to the database.
|
void |
setHandlers(Map<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,
String reason)
Deprecated.
|
Obs |
voidObs(Obs obs,
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, 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(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, 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 List<MimeType> getMimeTypes() throws APIException
getAllMimeTypes()
getMimeTypes
in interface ObsService
APIException
ObsService.getMimeTypes()
@Deprecated public List<MimeType> getAllMimeTypes() throws APIException
ObsService
getAllMimeTypes
in interface ObsService
APIException
ObsService.getAllMimeTypes()
@Deprecated public 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, 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(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 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
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 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
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 List<Obs> getObservations(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 List<Obs> getObservationsByPerson(Person who)
ObsService
getObservationsByPerson
in interface ObsService
who
- the user to match onObsService.getObservationsByPerson(org.openmrs.Person)
@Deprecated public Set<Obs> getObservations(Person who, boolean includeVoided)
getObservationsByPerson(Person)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Person, boolean includeVoided)
@Deprecated public List<Obs> getObservations(Concept c, Location loc, String sort, 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 Set<Obs> getObservations(Person who, Concept question, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Person, org.openmrs.Concept,
boolean)
public 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 List<Obs> getLastNObservations(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 List<Obs> getObservations(Concept question, String sort, Integer personType, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Concept, java.lang.String,
java.lang.Integer, boolean includeVoided)
@Deprecated public List<Obs> getObservationsAnsweredByConcept(Concept answer, Integer personType, boolean includeVoided)
getObservationsAnsweredByConcept
in interface ObsService
ObsService.getObservationsAnsweredByConcept(org.openmrs.Concept,
java.lang.Integer, boolean includeVoided)
@Deprecated public List<Object[]> getNumericAnswersForConcept(Concept question, Boolean sortByValue, 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 Set<Obs> getObservations(Encounter whichEncounter)
getObservations
in interface ObsService
ObsService.getObservations(org.openmrs.Encounter)
@Deprecated public List<Obs> getVoidedObservations()
getVoidedObservations
in interface ObsService
ObsService.getVoidedObservations()
@Deprecated public List<Obs> findObservations(String search, boolean includeVoided, Integer personType)
findObservations
in interface ObsService
ObsService.findObservations(java.lang.String, boolean,
java.lang.Integer)
@Deprecated public List<Obs> findObsByGroupId(Integer obsGroupId)
findObsByGroupId
in interface ObsService
ObsService.findObsByGroupId(java.lang.Integer)
public Obs getObsByUuid(String uuid) throws APIException
ObsService
getObsByUuid
in interface ObsService
APIException
ObsService.getObsByUuid(java.lang.String)
@Deprecated public List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate, boolean includeVoided)
getObservations
in interface ObsService
ObsService.getObservations(List, Date, Date, boolean)
@Deprecated public List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate)
getObservations
in interface ObsService
ObsService.getObservations(List, Date, Date)
@Deprecated public List<Obs> getObservations(Cohort patients, List<Concept> concepts, Date fromDate, Date toDate)
getObservations
in interface ObsService
ObsService.getObservations(Cohort, List, Date, Date)
public Obs getComplexObs(Integer obsId, 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(String key)
ObsService
getHandler
in interface ObsService
key
- that has been registered with a handler classObsService.getHandler(java.lang.String)
public void setHandlers(Map<String,ComplexObsHandler> newHandlers) throws APIException
ObsService
setHandlers
in interface ObsService
newHandlers
- Map of class to handler objectAPIException
ObsService.setHandlers(Map)
,
registerHandler(String, ComplexObsHandler)
public Map<String,ComplexObsHandler> getHandlers() throws APIException
ObsService
getHandlers
in interface ObsService
APIException
ObsService.getHandlers()
public void registerHandler(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(String key, 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 Integer getObservationCount(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(String key)
ObsService
removeHandler
in interface ObsService
key
- the key of the handler to unregisterObsService.removeHandler(java.lang.String)
Copyright © 2018 OpenMRS LLC.. All Rights Reserved.