|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
@Transactional public interface ObsService
The ObsService deals with saving and getting Obs to/from the database Usage:
ObsService obsService = Context.getObsService(); // get the obs for patient with internal identifier of 1235 ListThere are also a number of convenience methods for extracting obs pertaining to certain Concepts, people, or encounterssomeObsList = obsService.getObservationsByPerson(new Patient(1235));
Obs,
ComplexObs,
MimeType,
Context| Field Summary | |
|---|---|
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 |
| Method Summary | |
|---|---|
void |
createObs(Obs obs)
Deprecated. use saveObs(Obs, String) |
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 #createObsGroup(Obs, List) |
void |
deleteObs(Obs obs)
Deprecated. use #purgeObs(Obs) |
java.util.List<Obs> |
findObsByGroupId(java.lang.Integer obsGroupId)
Deprecated. should use Obs.getGroupMembers() or #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.List<Obs> |
findObservations(java.lang.String search,
boolean includeVoided,
java.lang.Integer personType)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.List<MimeType> |
getAllMimeTypes()
Gets all mime types (including retired ones) |
java.util.List<MimeType> |
getAllMimeTypes(boolean includeRetired)
Gets all mime types and disregards the retired ones if includeRetired is true |
java.util.List<Obs> |
getLastNObservations(java.lang.Integer n,
Person who,
Concept question,
boolean includeVoided)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
MimeType |
getMimeType(java.lang.Integer mimeTypeId)
Get mimeType by internal identifier |
java.util.List<MimeType> |
getMimeTypes()
Deprecated. use getAllMimeTypes() |
java.util.List<java.lang.Object[]> |
getNumericAnswersForConcept(Concept answer,
java.lang.Boolean sortByValue,
java.lang.Integer personType,
boolean includeVoided)
Deprecated. use #getObservations(List, Encounter, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
Obs |
getObs(java.lang.Integer obsId)
Get an observation |
java.util.List<Obs> |
getObservations(Cohort patients,
java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.List<Obs> |
getObservations(Concept c,
Location loc,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
Deprecated. use #getObservations(List, Encounter, List, List, List, List, String, Integer, Integer, Date, Date, boolean) |
java.util.List<Obs> |
getObservations(Concept question,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.Set<Obs> |
getObservations(Encounter whichEncounter)
Deprecated. use org.openmrs.Encounter.getObservations() |
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.List<Obs> |
getObservations(java.util.List<Concept> concepts,
java.util.Date fromDate,
java.util.Date toDate,
boolean includeVoided)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
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. use getObservationsByPerson(Person) |
java.util.Set<Obs> |
getObservations(Person who,
Concept question,
boolean includeVoided)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
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)
Deprecated. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
java.util.List<Obs> |
getObservationsByPerson(Person who)
Get all Observations for the given person. |
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. use #getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean) |
void |
purgeMimeType(MimeType mimeType)
This completely removes the given MimeType from the database. |
void |
purgeObs(Obs obs)
Completely remove an observation from the database. |
void |
purgeObs(Obs obs,
boolean cascade)
Completely remove an observation from the database. |
MimeType |
saveMimeType(MimeType mimeType)
Save the given mimeType to the database. |
Obs |
saveObs(Obs obs,
java.lang.String changeMessage)
Save the given obs to the database. |
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. use saveObs(Obs, String) |
MimeType |
voidMimeType(MimeType mimeType,
java.lang.String reason)
This effectively removes the given mimeType from the system. |
Obs |
voidObs(Obs obs,
java.lang.String reason)
Equivalent to deleting an observation |
| Methods inherited from interface org.openmrs.api.OpenmrsService |
|---|
onShutdown, onStartup |
| Field Detail |
|---|
static final java.lang.Integer PERSON
OpenmrsConstantsstatic final java.lang.Integer PATIENT
OpenmrsConstantsstatic final java.lang.Integer USER
OpenmrsConstants| Method Detail |
|---|
void setObsDAO(ObsDAO dao)
dao on this obs service.
The dao will act as the conduit through with all obs
calls get to the database
dao - specific ObsDAO to use for this service
@Authorized(value="Add Observations")
void createObs(Obs obs)
throws APIException
saveObs(Obs, String)
Obs -
APIException
@Authorized(value="Add Observations")
void createObsGroup(Obs[] obs)
throws APIException
#createObsGroup(Obs, List)
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 grouped
APIException#createObsGroup(Obs, List)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
Obs getObs(java.lang.Integer obsId)
throws APIException
integer - obsId of observation desired
APIException
@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 required
APIException
@Authorized(value="Edit Observations")
Obs voidObs(Obs obs,
java.lang.String reason)
throws APIException
Obs - obs to voidString - reason
APIException
@Authorized(value="Edit Observations")
Obs unvoidObs(Obs obs)
throws APIException
Obs -
APIException
@Authorized(value="Delete Observations")
void deleteObs(Obs obs)
throws APIException
purgeObs(Obs) or
#voidObs(Obs)
Obs -
APIException
@Authorized(value="Delete Observations")
void purgeObs(Obs obs)
throws APIException
Obs -
APIException
@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)
APIExceptionpurgeObs(Obs, boolean)
@Transactional(readOnly=true)
@Authorized(value="View Mime Types")
java.util.List<MimeType> getMimeTypes()
throws APIException
getAllMimeTypes()
APIException
@Authorized(value="View Mime Types")
java.util.List<MimeType> getAllMimeTypes()
throws APIException
APIExceptiongetAllMimeTypes(boolean)
@Authorized(value="View Mime Types")
java.util.List<MimeType> getAllMimeTypes(boolean includeRetired)
throws APIException
includeRetired is true
includeRetired - true/false of whether to also return the retired ones
APIException
@Transactional(readOnly=true)
@Authorized(value="View Mime Types")
MimeType getMimeType(java.lang.Integer mimeTypeId)
throws APIException
mimeType - id
APIException
@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 database
mimeType - mimeType
APIException
@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 voided
APIException#createObs(Obs)}
@Authorized(value="Purge Mime Types")
void purgeMimeType(MimeType mimeType)
throws APIException
MimeType from the database.
If data has been stored already that points at this mimeType an
exception is thrown
mimeType - the MimeType to remove
APIException#purgeMimeType(MimeType)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.Set<Obs> getObservations(Person who,
boolean includeVoided)
getObservationsByPerson(Person)
org.openmrs.Person#getObservations()}@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getObservationsByPerson(Person who)
who - the user to match on
#getObservations(List, List, List, List, List, List, String, 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).
Note: If whom has elements, personType is ignored
whom - Listencounters - Listquestions - Listanswers - ListpersonType - PERSON_TYPE objects to restrict this to. Only used if whom not 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.util.List<Obs> getObservations(java.lang.String searchString)
throws APIException
searchString.
searchString - The string to search on
APIException
@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)
#getObservations(List, Encounter, List, List, List, List, String, Integer, Integer, Date, Date, boolean)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.Set<Obs> getObservations(Person who,
Concept question,
boolean includeVoided)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
java.util.List<Obs> getObservationsByPersonAndConcept(Person who,
Concept question)
throws APIException
who - person to match onquestion - conceptId to match on
APIException#getObservations(List, List, List, List, List, List, List, Integer, Integer, Date, Date, boolean)}
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getLastNObservations(java.lang.Integer n,
Person who,
Concept question,
boolean includeVoided)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservations(Concept question,
java.lang.String sort,
java.lang.Integer personType,
boolean includeVoided)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> getObservationsAnsweredByConcept(Concept answer,
java.lang.Integer personType,
boolean includeVoided)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@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, Encounter, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
concept - sortByValue - true/false if sorting by valueNumeric. If false, will
sort by obsDatetimepersonType -
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.Set<Obs> getObservations(Encounter whichEncounter)
org.openmrs.Encounter.getObservations()}@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> getVoidedObservations()
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@Transactional(readOnly=true)
@Authorized(value="View Observations")
java.util.List<Obs> findObservations(java.lang.String search,
boolean includeVoided,
java.lang.Integer personType)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@Transactional(readOnly=true) @Authorized(value="View Observations") java.util.List<Obs> findObsByGroupId(java.lang.Integer obsGroupId)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@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)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@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)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
@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)
#getObservations(List, List, List, org.openmrs.api.ObsService.PERSON_TYPE, Location, String, Integer, Integer, Date, Date, boolean)
|
OpenMRS-trunk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||