public class PatientSetServiceImpl extends BaseOpenmrsService implements PatientSetService
PatientSetService.BooleanOperator, PatientSetService.GroupMethod, PatientSetService.Modifier, PatientSetService.PatientLocationMethod, PatientSetService.TimeModifier
Modifier and Type | Field and Description |
---|---|
org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
PatientSetServiceImpl() |
Modifier and Type | Method and Description |
---|---|
Cohort |
convertPatientIdentifier(java.util.List<java.lang.String> identifiers)
TODO write something here
|
java.lang.String |
exportXml(Cohort ps)
Export a set of patients to an XML
|
java.lang.String |
exportXml(java.lang.Integer patientId) |
Cohort |
getAllPatients() |
java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.Object>> |
getCharacteristics(Cohort patients)
TODO write something here
|
java.lang.Integer |
getCountOfPatients() |
java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> |
getCurrentDrugOrders(Cohort ps,
Concept drugSet) |
java.util.Map<java.lang.Integer,PatientProgram> |
getCurrentPatientPrograms(Cohort ps,
Program program) |
java.util.Map<java.lang.Integer,PatientState> |
getCurrentStates(Cohort ps,
ProgramWorkflow wf)
Gets statistical information about current states of patients within given cohort for specific program workflow
|
java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> |
getDrugOrders(Cohort ps,
Concept drugSet) |
java.util.Map<java.lang.Integer,java.lang.Object> |
getEncounterAttrsByType(Cohort patients,
java.util.List<EncounterType> encTypes,
java.lang.String attr)
TODO write something here
|
java.util.Map<java.lang.Integer,Encounter> |
getEncounters(Cohort patients)
This method returns a map of patients matched against their most recent encounters given a
Cohort of patients, see
EncounterService.getAllEncounters(Cohort) which gets a map of
patient matched against lists of all their encounters. |
java.util.List<Encounter> |
getEncountersByForm(Cohort patients,
java.util.List<Form> forms)
Gets a list of encounters associated with the given form, filtered by the given patient set.
|
java.util.Map<java.lang.Integer,Encounter> |
getEncountersByType(Cohort patients,
EncounterType encType)
TODO write something here
|
java.util.Map<java.lang.Integer,Encounter> |
getEncountersByType(Cohort patients,
java.util.List<EncounterType> types)
TODO write something here
|
java.util.Map<java.lang.Integer,java.lang.Object> |
getFirstEncounterAttrsByType(Cohort patients,
java.util.List<EncounterType> encTypes,
java.lang.String attr)
TODO write something here
|
java.util.Map<java.lang.Integer,Encounter> |
getFirstEncountersByType(Cohort patients,
EncounterType encType)
TODO write something here
|
java.util.Map<java.lang.Integer,Encounter> |
getFirstEncountersByType(Cohort patients,
java.util.List<EncounterType> types)
TODO write something here
|
Cohort |
getInverseOfCohort(Cohort cohort)
Equivalent to Cohort.subtract(PatientSetService.getAllPatients(), cohort) but may eventually
perform faster by delegating to the database.
|
java.util.Map<java.lang.Integer,java.util.List<Obs>> |
getObservations(Cohort patients,
Concept concept) |
java.util.Map<java.lang.Integer,java.util.List<Obs>> |
getObservations(Cohort patients,
Concept concept,
java.util.Date fromDate,
java.util.Date toDate)
Date range is inclusive of both endpoints
|
java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> |
getObservationsValues(Cohort patients,
Concept c)
TODO write something here
|
java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> |
getObservationsValues(Cohort patients,
Concept c,
java.util.List<java.lang.String> attributes)
Deprecated.
|
java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> |
getObservationsValues(Cohort patients,
Concept c,
java.util.List<java.lang.String> attributes,
java.lang.Integer limit,
boolean showMostRecentFirst)
Returns a mapping from patient id to obs for concept
c |
java.util.Map<java.lang.Integer,java.lang.Object> |
getPatientAttributes(Cohort patients,
java.lang.String classNameDotProperty,
boolean returnAll)
TODO write something here
|
java.util.Map<java.lang.Integer,java.lang.Object> |
getPatientAttributes(Cohort patients,
java.lang.String className,
java.lang.String property,
boolean returnAll)
TODO write something here
|
java.util.Map<java.lang.Integer,PatientIdentifier> |
getPatientIdentifiersByType(Cohort patients,
PatientIdentifierType type)
The PatientIdentifer object in the returned map now ONLY contains the identifier string, no
other data is available
|
java.util.Map<java.lang.Integer,java.lang.String> |
getPatientIdentifierStringsByType(Cohort patients,
PatientIdentifierType type)
Gets a map of patient identifiers values by identifier type, indexed by patient primary key.
|
java.util.Map<java.lang.Integer,PatientProgram> |
getPatientPrograms(Cohort ps,
Program program)
Gets program enrollment data for the given cohort in the given program.
|
java.util.List<Patient> |
getPatients(java.util.Collection<java.lang.Integer> patientIds)
TODO write something here
|
Cohort |
getPatients(java.lang.Integer start,
java.lang.Integer size)
Get a batch of patients that are not voided in the database
|
Cohort |
getPatientsByCharacteristics(java.lang.String gender,
java.util.Date minBirthdate,
java.util.Date maxBirthdate) |
Cohort |
getPatientsByCharacteristics(java.lang.String gender,
java.util.Date minBirthdate,
java.util.Date maxBirthdate,
java.lang.Integer minAge,
java.lang.Integer maxAge,
java.lang.Boolean aliveOnly,
java.lang.Boolean deadOnly)
Get patients by specified gender, birthdate range, age range, and alive status (all optional)
|
Cohort |
getPatientsByCharacteristics(java.lang.String gender,
java.util.Date minBirthdate,
java.util.Date maxBirthdate,
java.lang.Integer minAge,
java.lang.Integer maxAge,
java.lang.Boolean aliveOnly,
java.lang.Boolean deadOnly,
java.util.Date effectiveDate)
Get patients by specified gender, birthdate range, age range, and alive status (all optional)
|
Cohort |
getPatientsByProgramAndState(Program program,
java.util.List<ProgramWorkflowState> stateList,
java.util.Date fromDate,
java.util.Date toDate)
Gets patients who are enrolled in the given program or in the given state(s) at the specified
time
|
Cohort |
getPatientsHavingDateObs(java.lang.Integer conceptId,
java.util.Date startTime,
java.util.Date endTime) |
Cohort |
getPatientsHavingDrugOrder(java.util.Collection<java.lang.Integer> patientIds,
java.util.Collection<java.lang.Integer> takingIds,
java.util.Date onDate)
Returns a PatientSet of patient who had drug orders for a set of drugs active on a certain
date.
|
Cohort |
getPatientsHavingDrugOrder(java.util.Collection<java.lang.Integer> patientIds,
java.util.Collection<java.lang.Integer> drugIds,
PatientSetService.GroupMethod groupMethod,
java.util.Date fromDate,
java.util.Date toDate)
Returns a Cohort of patient who had drug orders for a set of drugs active between a pair of
dates.
|
Cohort |
getPatientsHavingDrugOrder(java.util.List<Drug> drug,
java.util.List<Concept> drugConcept,
java.util.Date startDateFrom,
java.util.Date startDateTo,
java.util.Date stopDateFrom,
java.util.Date stopDateTo,
java.lang.Boolean discontinued,
java.util.List<Concept> discontinuedReason) |
Cohort |
getPatientsHavingEncounters(EncounterType encounterType,
Location location,
Form form,
java.util.Date fromDate,
java.util.Date toDate,
java.lang.Integer minCount,
java.lang.Integer maxCount)
Searches for patients who have encounters as described by the arguments to this method
|
Cohort |
getPatientsHavingEncounters(java.util.List<EncounterType> encounterTypeList,
Location location,
Form form,
java.util.Date fromDate,
java.util.Date toDate,
java.lang.Integer minCount,
java.lang.Integer maxCount)
Gets patients who have encounters as described by the parameters specified (all optional)
|
Cohort |
getPatientsHavingLocation(java.lang.Integer locationId) |
Cohort |
getPatientsHavingLocation(java.lang.Integer locationId,
PatientSetService.PatientLocationMethod method) |
Cohort |
getPatientsHavingLocation(Location loc) |
Cohort |
getPatientsHavingLocation(Location loc,
PatientSetService.PatientLocationMethod method) |
Cohort |
getPatientsHavingNumericObs(java.lang.Integer conceptId,
PatientSetService.TimeModifier timeModifier,
PatientSetService.Modifier modifier,
java.lang.Number value,
java.util.Date fromDate,
java.util.Date toDate) |
Cohort |
getPatientsHavingObs(java.lang.Integer conceptId,
PatientSetService.TimeModifier timeModifier,
PatientSetService.Modifier modifier,
java.lang.Object value,
java.util.Date fromDate,
java.util.Date toDate)
Searches for patients who have observations as described by the arguments to this method
|
Cohort |
getPatientsHavingPersonAttribute(PersonAttributeType attribute,
java.lang.String value)
At least one of attribute and value must be non-null
|
Cohort |
getPatientsHavingTextObs(Concept concept,
java.lang.String value,
PatientSetService.TimeModifier timeModifier) |
Cohort |
getPatientsHavingTextObs(java.lang.Integer conceptId,
java.lang.String value,
PatientSetService.TimeModifier timeModifier) |
Cohort |
getPatientsInProgram(Program program,
java.util.Date fromDate,
java.util.Date toDate) |
java.util.Map<java.lang.Integer,java.lang.Object> |
getPersonAttributes(Cohort patients,
java.lang.String attributeName,
java.lang.String joinClass,
java.lang.String joinProperty,
java.lang.String outputColumn,
boolean returnAll) |
java.util.Map<java.lang.Integer,java.util.List<Relationship>> |
getRelationships(Cohort ps,
RelationshipType relType) |
java.util.Map<java.lang.Integer,java.util.List<Person>> |
getRelatives(Cohort ps,
RelationshipType relType,
boolean forwards) |
java.util.Map<java.lang.Integer,java.lang.String> |
getShortPatientDescriptions(java.util.Collection<java.lang.Integer> patientIds) |
void |
onShutdown()
Clean up after this class.
|
void |
setPatientSetDAO(PatientSetDAO dao) |
onStartup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onStartup
public void setPatientSetDAO(PatientSetDAO dao)
setPatientSetDAO
in interface PatientSetService
public void onShutdown()
onShutdown
in interface OpenmrsService
onShutdown
in class BaseOpenmrsService
BaseOpenmrsService.onShutdown()
public java.lang.String exportXml(Cohort ps)
PatientSetService
exportXml
in interface PatientSetService
ps
- The set you want to export as XMLpublic java.lang.String exportXml(java.lang.Integer patientId)
exportXml
in interface PatientSetService
public Cohort getAllPatients() throws DAOException
getAllPatients
in interface PatientSetService
DAOException
public Cohort getInverseOfCohort(Cohort cohort)
PatientSetService
getInverseOfCohort
in interface PatientSetService
public Cohort getPatientsByCharacteristics(java.lang.String gender, java.util.Date minBirthdate, java.util.Date maxBirthdate) throws DAOException
getPatientsByCharacteristics
in interface PatientSetService
DAOException
public Cohort getPatientsByCharacteristics(java.lang.String gender, java.util.Date minBirthdate, java.util.Date maxBirthdate, java.lang.Integer minAge, java.lang.Integer maxAge, java.lang.Boolean aliveOnly, java.lang.Boolean deadOnly) throws DAOException
PatientSetService
getPatientsByCharacteristics
in interface PatientSetService
DAOException
public Cohort getPatientsByCharacteristics(java.lang.String gender, java.util.Date minBirthdate, java.util.Date maxBirthdate, java.lang.Integer minAge, java.lang.Integer maxAge, java.lang.Boolean aliveOnly, java.lang.Boolean deadOnly, java.util.Date effectiveDate) throws DAOException
PatientSetService
getPatientsByCharacteristics
in interface PatientSetService
DAOException
public Cohort getPatientsHavingDateObs(java.lang.Integer conceptId, java.util.Date startTime, java.util.Date endTime)
getPatientsHavingDateObs
in interface PatientSetService
public Cohort getPatientsHavingNumericObs(java.lang.Integer conceptId, PatientSetService.TimeModifier timeModifier, PatientSetService.Modifier modifier, java.lang.Number value, java.util.Date fromDate, java.util.Date toDate)
getPatientsHavingNumericObs
in interface PatientSetService
public Cohort getPatientsHavingObs(java.lang.Integer conceptId, PatientSetService.TimeModifier timeModifier, PatientSetService.Modifier modifier, java.lang.Object value, java.util.Date fromDate, java.util.Date toDate)
PatientSetService
getPatientsHavingObs
in interface PatientSetService
public Cohort getPatientsHavingEncounters(EncounterType encounterType, Location location, Form form, java.util.Date fromDate, java.util.Date toDate, java.lang.Integer minCount, java.lang.Integer maxCount)
PatientSetService
getPatientsHavingEncounters
in interface PatientSetService
public Cohort getPatientsHavingEncounters(java.util.List<EncounterType> encounterTypeList, Location location, Form form, java.util.Date fromDate, java.util.Date toDate, java.lang.Integer minCount, java.lang.Integer maxCount)
PatientSetService
getPatientsHavingEncounters
in interface PatientSetService
public Cohort getPatientsByProgramAndState(Program program, java.util.List<ProgramWorkflowState> stateList, java.util.Date fromDate, java.util.Date toDate)
PatientSetService
getPatientsByProgramAndState
in interface PatientSetService
public Cohort getPatientsInProgram(Program program, java.util.Date fromDate, java.util.Date toDate)
getPatientsInProgram
in interface PatientSetService
public Cohort getPatientsHavingTextObs(Concept concept, java.lang.String value, PatientSetService.TimeModifier timeModifier)
getPatientsHavingTextObs
in interface PatientSetService
public Cohort getPatientsHavingTextObs(java.lang.Integer conceptId, java.lang.String value, PatientSetService.TimeModifier timeModifier)
getPatientsHavingTextObs
in interface PatientSetService
public Cohort getPatientsHavingLocation(Location loc)
getPatientsHavingLocation
in interface PatientSetService
public Cohort getPatientsHavingLocation(Location loc, PatientSetService.PatientLocationMethod method)
getPatientsHavingLocation
in interface PatientSetService
public Cohort getPatientsHavingLocation(java.lang.Integer locationId)
getPatientsHavingLocation
in interface PatientSetService
public Cohort getPatientsHavingLocation(java.lang.Integer locationId, PatientSetService.PatientLocationMethod method)
getPatientsHavingLocation
in interface PatientSetService
public Cohort getPatientsHavingDrugOrder(java.util.Collection<java.lang.Integer> patientIds, java.util.Collection<java.lang.Integer> takingIds, java.util.Date onDate)
getPatientsHavingDrugOrder
in interface PatientSetService
patientIds
- Collection of patientIds you're interested in. NULL means all patients.takingIds
- Collection of drugIds the patient is taking. (Or the empty set to mean
"any drug" or NULL to mean "no drugs")onDate
- Which date to look at the patients' drug orders. (NULL defaults to now().)public Cohort getPatientsHavingDrugOrder(java.util.Collection<java.lang.Integer> patientIds, java.util.Collection<java.lang.Integer> drugIds, PatientSetService.GroupMethod groupMethod, java.util.Date fromDate, java.util.Date toDate)
PatientSetService
getPatientsHavingDrugOrder
in interface PatientSetService
patientIds
- Collection of patientIds you're interested in. NULL means all patients.drugIds
- Collection of drugIds the patient is taking. (Or the empty set to mean
"any drug" or NULL to mean "no drugs")groupMethod
- whether to do NONE, ALL, or ANY of the list of specified ids.fromDate
- Beginning of date range to look at (NULL defaults to toDate if that isn't
null, or now() if it is.)toDate
- End of date range to look at (NULL defaults to fromDate if that isn't null, or
now() if it is.)public Cohort getPatientsHavingDrugOrder(java.util.List<Drug> drug, java.util.List<Concept> drugConcept, java.util.Date startDateFrom, java.util.Date startDateTo, java.util.Date stopDateFrom, java.util.Date stopDateTo, java.lang.Boolean discontinued, java.util.List<Concept> discontinuedReason)
getPatientsHavingDrugOrder
in interface PatientSetService
public Cohort getPatientsHavingPersonAttribute(PersonAttributeType attribute, java.lang.String value)
PatientSetService
getPatientsHavingPersonAttribute
in interface PatientSetService
attribute
- if not null, look for this attributevalue
- if not null, look for this valuepublic java.util.Map<java.lang.Integer,java.lang.String> getShortPatientDescriptions(java.util.Collection<java.lang.Integer> patientIds)
getShortPatientDescriptions
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<Obs>> getObservations(Cohort patients, Concept concept)
getObservations
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<Obs>> getObservations(Cohort patients, Concept concept, java.util.Date fromDate, java.util.Date toDate)
getObservations
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> getObservationsValues(Cohort patients, Concept c)
PatientSetService
getObservationsValues
in interface PatientSetService
@Deprecated public java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> getObservationsValues(Cohort patients, Concept c, java.util.List<java.lang.String> attributes)
getObservationsValues
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<java.util.List<java.lang.Object>>> getObservationsValues(Cohort patients, Concept c, java.util.List<java.lang.String> attributes, java.lang.Integer limit, boolean showMostRecentFirst)
PatientSetService
c
The returned List< attribute value > is [obs value, attr value, attr value, attr value...]
The returned List> represents the obs rows
getObservationsValues
in interface PatientSetService
patients
- the cohort to restrict to. if null, then all patients are fetchedc
- the concept to look for in obs.concept_idattributes
- list of attributeslimit
- the number of patients to limit the results to. If null or less than zero,
return allshowMostRecentFirst
- if true, obs with the highest obsDatetime will be first in the
ListMap>>
public java.util.Map<java.lang.Integer,Encounter> getEncountersByType(Cohort patients, EncounterType encType)
PatientSetService
getEncountersByType
in interface PatientSetService
patients
- Cohort of patients to searchencType
- the type of the encounterpublic java.util.Map<java.lang.Integer,java.lang.Object> getEncounterAttrsByType(Cohort patients, java.util.List<EncounterType> encTypes, java.lang.String attr)
PatientSetService
getEncounterAttrsByType
in interface PatientSetService
patients
- Cohort of patients to searchencTypes
- Listattr
- String
of attributes to getpublic java.util.Map<java.lang.Integer,Encounter> getEncountersByType(Cohort patients, java.util.List<EncounterType> types)
PatientSetService
getEncountersByType
in interface PatientSetService
patients
- Cohort of patients to searchtypes
- Listpublic java.util.Map<java.lang.Integer,Encounter> getEncounters(Cohort patients)
PatientSetService
EncounterService.getAllEncounters(Cohort)
which gets a map of
patient matched against lists of all their encounters.getEncounters
in interface PatientSetService
patients
- Cohort of patients to searchEncounterService.getAllEncounters(Cohort)
public java.util.Map<java.lang.Integer,Encounter> getFirstEncountersByType(Cohort patients, EncounterType encType)
PatientSetService
getFirstEncountersByType
in interface PatientSetService
patients
- Cohort of patients to searchpublic java.util.Map<java.lang.Integer,java.lang.Object> getFirstEncounterAttrsByType(Cohort patients, java.util.List<EncounterType> encTypes, java.lang.String attr)
PatientSetService
getFirstEncounterAttrsByType
in interface PatientSetService
patients
- Cohort of patients to searchencTypes
- Listpublic java.util.Map<java.lang.Integer,Encounter> getFirstEncountersByType(Cohort patients, java.util.List<EncounterType> types)
PatientSetService
getFirstEncountersByType
in interface PatientSetService
patients
- Cohort of patients to searchtypes
- Listpublic java.util.Map<java.lang.Integer,java.lang.Object> getPatientAttributes(Cohort patients, java.lang.String className, java.lang.String property, boolean returnAll)
PatientSetService
getPatientAttributes
in interface PatientSetService
patients
- Cohort of patients to searchPatientSetService.getPatientAttributes(Cohort, String, String, boolean)
public java.util.Map<java.lang.Integer,java.lang.Object> getPatientAttributes(Cohort patients, java.lang.String classNameDotProperty, boolean returnAll)
PatientSetService
getPatientAttributes
in interface PatientSetService
public java.util.Map<java.lang.Integer,PatientIdentifier> getPatientIdentifiersByType(Cohort patients, PatientIdentifierType type)
PatientSetService
getPatientIdentifiersByType
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.lang.String> getPatientIdentifierStringsByType(Cohort patients, PatientIdentifierType type)
PatientSetService
getPatientIdentifierStringsByType
in interface PatientSetService
patients
- Cohort of patients to look uptype
- PatientIdentifierType to retrievepublic java.util.Map<java.lang.Integer,java.lang.Object> getPersonAttributes(Cohort patients, java.lang.String attributeName, java.lang.String joinClass, java.lang.String joinProperty, java.lang.String outputColumn, boolean returnAll)
getPersonAttributes
in interface PatientSetService
PatientSetService.getPersonAttributes(org.openmrs.Cohort,
java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
public java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.Object>> getCharacteristics(Cohort patients)
PatientSetService
getCharacteristics
in interface PatientSetService
patients
- Cohort of patients to look uppublic Cohort convertPatientIdentifier(java.util.List<java.lang.String> identifiers)
PatientSetService
convertPatientIdentifier
in interface PatientSetService
identifiers
- List of String patient identifierspublic java.util.List<Patient> getPatients(java.util.Collection<java.lang.Integer> patientIds)
PatientSetService
getPatients
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<Relationship>> getRelationships(Cohort ps, RelationshipType relType)
getRelationships
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<Person>> getRelatives(Cohort ps, RelationshipType relType, boolean forwards)
getRelatives
in interface PatientSetService
public java.util.Map<java.lang.Integer,PatientState> getCurrentStates(Cohort ps, ProgramWorkflow wf)
PatientSetService
getCurrentStates
in interface PatientSetService
ps
- the patient's cohort objectwf
- the program workflow instancepublic java.util.Map<java.lang.Integer,PatientProgram> getCurrentPatientPrograms(Cohort ps, Program program)
getCurrentPatientPrograms
in interface PatientSetService
public java.util.Map<java.lang.Integer,PatientProgram> getPatientPrograms(Cohort ps, Program program)
PatientSetService
getPatientPrograms
in interface PatientSetService
ps
- the cohort to get data forprogram
- the program to look for enrollments inpublic java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getCurrentDrugOrders(Cohort ps, Concept drugSet)
getCurrentDrugOrders
in interface PatientSetService
public java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getDrugOrders(Cohort ps, Concept drugSet)
getDrugOrders
in interface PatientSetService
public java.util.List<Encounter> getEncountersByForm(Cohort patients, java.util.List<Form> forms)
getEncountersByForm
in interface PatientSetService
patients
- the patients to filter by (null will return all encounters for all patients)forms
- the forms to filter bypublic java.lang.Integer getCountOfPatients()
getCountOfPatients
in interface PatientSetService
public Cohort getPatients(java.lang.Integer start, java.lang.Integer size)
PatientSetService
getPatients
in interface PatientSetService
start
- the starting indexsize
- the number of patients to get in this batchCopyright © 2018 OpenMRS Inc.. All Rights Reserved.