public class ObsServiceImpl extends BaseOpenmrsService implements ObsService
ObsService| Modifier and Type | Field and Description | 
|---|---|
| protected ObsDAO | daoThe 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  searchStringwith
 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  daoon 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. | 
onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonStartupprotected ObsDAO dao
public ObsServiceImpl()
public void setObsDAO(ObsDAO dao)
ObsServicedao on this obs service. The dao will act as the conduit through
 with all obs calls get to the databasesetObsDAO in interface ObsServicedao - specific ObsDAO to use for this serviceObsService.setObsDAO(org.openmrs.api.db.ObsDAO)public void onShutdown()
onShutdown in interface OpenmrsServiceonShutdown in class BaseOpenmrsServiceBaseOpenmrsService.onShutdown()public Obs saveObs(Obs obs, String changeMessage) throws APIException
ObsServiceobs
 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 ObsServiceobs - 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 requiredAPIExceptionObsService.saveObs(org.openmrs.Obs, String)public Obs getObs(Integer obsId) throws APIException
ObsServicegetObs in interface ObsServiceobsId - integer obsId of observation desiredAPIExceptionObsService.getObs(java.lang.Integer)@Deprecated public void updateObs(Obs obs) throws APIException
ObsServiceupdateObs in interface ObsServiceAPIExceptionObsService.updateObs(org.openmrs.Obs)public Obs voidObs(Obs obs, String reason) throws APIException
voidObs in interface ObsServiceobs - the Obs to voidreason - the void reasonAPIExceptionObsService.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 ObsServiceobs - the Obs to unvoidAPIExceptionObsService.unvoidObs(org.openmrs.Obs)public void purgeObs(Obs obs, boolean cascade) throws APIException
ObsServicepurgeObs in interface ObsServiceobs - 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)APIExceptionObsService.purgeObs(org.openmrs.Obs, boolean)public void purgeObs(Obs obs) throws APIException
ObsServicepurgeObs in interface ObsServiceAPIExceptionObsService.purgeObs(org.openmrs.Obs)@Deprecated public List<MimeType> getMimeTypes() throws APIException
getAllMimeTypes()getMimeTypes in interface ObsServiceAPIExceptionObsService.getMimeTypes()@Deprecated public List<MimeType> getAllMimeTypes() throws APIException
ObsServicegetAllMimeTypes in interface ObsServiceAPIExceptionObsService.getAllMimeTypes()@Deprecated public List<MimeType> getAllMimeTypes(boolean includeRetired)
ObsServiceincludeRetired is truegetAllMimeTypes in interface ObsServiceincludeRetired - true/false of whether to also return the retired onesObsService.getAllMimeTypes(boolean)@Deprecated public MimeType saveMimeType(MimeType mimeType) throws APIException
ObsServicemimeType 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 ObsServicemimeType - mimeTypeAPIExceptionObsService.saveMimeType(org.openmrs.MimeType)@Deprecated public MimeType voidMimeType(MimeType mimeType, String reason) throws APIException
ObsServicevoidMimeType in interface ObsServicemimeType - the MimeType to removereason - the reason this mimeType is being voidedAPIExceptionObsService.voidMimeType(org.openmrs.MimeType, java.lang.String)@Deprecated public MimeType getMimeType(Integer mimeTypeId) throws APIException
ObsServicegetMimeType in interface ObsServiceAPIExceptionObsService.getMimeType(java.lang.Integer)@Deprecated public void purgeMimeType(MimeType mimeType)
ObsServiceMimeType from the database. If data has been
 stored already that points at this mimeType an exception is thrownpurgeMimeType in interface ObsServicemimeType - 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
ObsServicelocation 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 ObsServicewhom - 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)APIExceptionObsService.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
ObsServicelocation 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 ObsServicewhom - 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)APIExceptionObsService.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 ObsServicesearchString - The string to search onObsService.getObservations(java.lang.String)@Deprecated public void createObs(Obs obs) throws APIException
ObsServicecreateObs in interface ObsServiceAPIExceptionObsService.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 ObsServiceobs - - array of observations to be groupedAPIExceptionObsService.createObsGroup(org.openmrs.Obs[])@Deprecated public void deleteObs(Obs obs) throws APIException
ObsServiceObsService.purgeObs(Obs) or
 ObsService.voidObs(Obs,String)deleteObs in interface ObsServiceAPIExceptionObsService.deleteObs(org.openmrs.Obs)public List<Obs> getObservationsByPerson(Person who)
ObsServicegetObservationsByPerson in interface ObsServicewho - the user to match onObsService.getObservationsByPerson(org.openmrs.Person)@Deprecated public Set<Obs> getObservations(Person who, boolean includeVoided)
getObservationsByPerson(Person)getObservations in interface ObsServiceObsService.getObservations(org.openmrs.Person, boolean includeVoided)@Deprecated public List<Obs> getObservations(Concept c, Location loc, String sort, Integer personType, boolean includeVoided)
getObservations in interface ObsServiceObsService.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 ObsServiceObsService.getObservations(org.openmrs.Person, org.openmrs.Concept,
      boolean)public List<Obs> getObservationsByPersonAndConcept(Person who, Concept question) throws APIException
ObsServicegetObservationsByPersonAndConcept in interface ObsServicewho - person to match onquestion - conceptId to match onAPIExceptionObsService.getObservationsByPersonAndConcept(org.openmrs.Person,
      org.openmrs.Concept)@Deprecated public List<Obs> getLastNObservations(Integer n, Person who, Concept question, boolean includeVoided)
getLastNObservations in interface ObsServiceObsService.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 ObsServiceObsService.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 ObsServiceObsService.getObservationsAnsweredByConcept(org.openmrs.Concept,
      java.lang.Integer, boolean includeVoided)@Deprecated public List<Object[]> getNumericAnswersForConcept(Concept question, Boolean sortByValue, Integer personType, boolean includeVoided)
ObsServicegetNumericAnswersForConcept in interface ObsServicesortByValue - 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 ObsServiceObsService.getObservations(org.openmrs.Encounter)@Deprecated public List<Obs> getVoidedObservations()
getVoidedObservations in interface ObsServiceObsService.getVoidedObservations()@Deprecated public List<Obs> findObservations(String search, boolean includeVoided, Integer personType)
findObservations in interface ObsServiceObsService.findObservations(java.lang.String, boolean,
      java.lang.Integer)@Deprecated public List<Obs> findObsByGroupId(Integer obsGroupId)
findObsByGroupId in interface ObsServiceObsService.findObsByGroupId(java.lang.Integer)public Obs getObsByUuid(String uuid) throws APIException
ObsServicegetObsByUuid in interface ObsServiceAPIExceptionObsService.getObsByUuid(java.lang.String)@Deprecated public List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate, boolean includeVoided)
getObservations in interface ObsServiceObsService.getObservations(List, Date, Date, boolean)@Deprecated public List<Obs> getObservations(List<Concept> concepts, Date fromDate, Date toDate)
getObservations in interface ObsServiceObsService.getObservations(List, Date, Date)@Deprecated public List<Obs> getObservations(Cohort patients, List<Concept> concepts, Date fromDate, Date toDate)
getObservations in interface ObsServiceObsService.getObservations(Cohort, List, Date, Date)public Obs getComplexObs(Integer obsId, String view) throws APIException
ObsServicegetComplexObs in interface ObsServiceAPIExceptionObsService.getComplexObs(Integer, String)protected boolean purgeComplexData(Obs obs) throws APIException
APIExceptionpublic ComplexObsHandler getHandler(Obs obs) throws APIException
obs - A complex Obs.APIExceptionpublic ComplexObsHandler getHandler(String key)
ObsServicegetHandler in interface ObsServicekey - that has been registered with a handler classObsService.getHandler(java.lang.String)public void setHandlers(Map<String,ComplexObsHandler> newHandlers) throws APIException
ObsServicesetHandlers in interface ObsServicenewHandlers - Map of class to handler objectAPIExceptionObsService.setHandlers(Map), 
registerHandler(String, ComplexObsHandler)public Map<String,ComplexObsHandler> getHandlers() throws APIException
ObsServicegetHandlers in interface ObsServiceAPIExceptionObsService.getHandlers()public void registerHandler(String key, ComplexObsHandler handler) throws APIException
ObsServiceregisterHandler in interface ObsServicekey - the key name to use for this handlerhandler - the class to register with this keyAPIExceptionObsService.registerHandler(String, ComplexObsHandler)public void registerHandler(String key, String handlerClass) throws APIException
ObsServiceObsService.registerHandler(String, ComplexObsHandler)registerHandler in interface ObsServicekey - the key name to use for this handlerhandlerClass - the class to register with this keyAPIExceptionObsService.registerHandler(String, String)public Integer getObservationCount(List<ConceptName> conceptNames, boolean includeVoided)
ObsServicegetObservationCount in interface ObsServiceconceptNames - the conceptNames to be searched againstincludeVoided - whether voided observation should be includedObsService.getObservationCount(java.util.List, boolean)public void removeHandler(String key)
ObsServiceremoveHandler in interface ObsServicekey - the key of the handler to unregisterObsService.removeHandler(java.lang.String)Copyright © 2018 OpenMRS LLC.. All Rights Reserved.