public class HibernatePatientSetDAO extends java.lang.Object implements PatientSetDAO
Context,
PatientSetService,
PatientSetDAO| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
HibernatePatientSetDAO() |
| Modifier and Type | Method and Description |
|---|---|
Cohort |
convertPatientIdentifier(java.util.List<java.lang.String> identifiers) |
java.lang.String |
exportXml(Cohort ps)
Deprecated.
|
java.lang.String |
exportXml(java.lang.Integer patientId)
Deprecated.
|
static java.util.List<java.lang.String> |
findObsValueColumnName(Concept c) |
java.util.Map<java.lang.Integer,java.util.Collection<java.lang.Integer>> |
getActiveDrugIds(java.util.Collection<java.lang.Integer> patientIds,
java.util.Date fromDate,
java.util.Date toDate)
Returns a Map from patientId to a Collection of drugIds for drugs active for the patients on
that date If patientIds is null then do this for all patients Does not return anything for
voided patients
|
Cohort |
getAllPatients() |
java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.Object>> |
getCharacteristics(Cohort patients) |
java.lang.Integer |
getCountOfPatients() |
java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> |
getCurrentDrugOrders(Cohort patients,
java.util.List<Concept> drugConcepts) |
java.util.Map<java.lang.Integer,PatientState> |
getCurrentStates(Cohort ps,
ProgramWorkflow wf) |
java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> |
getDrugOrders(Cohort patients,
java.util.List<Concept> drugConcepts) |
java.util.Map<java.lang.Integer,java.lang.Object> |
getEncounterAttrsByType(Cohort patients,
java.util.List<EncounterType> encTypes,
java.lang.String attr,
java.lang.Boolean earliestFirst) |
java.util.Map<java.lang.Integer,Encounter> |
getEncounters(Cohort patients) |
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,
java.util.List<EncounterType> encTypes) |
java.util.Map<java.lang.Integer,Encounter> |
getFirstEncountersByType(Cohort patients,
java.util.List<EncounterType> types) |
java.util.Map<java.lang.Integer,java.util.List<Obs>> |
getObservations(Cohort patients,
Concept concept,
java.util.Date fromDate,
java.util.Date toDate) |
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) |
java.util.Map<java.lang.Integer,java.lang.Object> |
getPatientAttributes(Cohort patients,
java.lang.String className,
java.lang.String property,
boolean returnAll) |
java.util.Map<java.lang.Integer,java.lang.String> |
getPatientIdentifierByType(Cohort patients,
java.util.List<PatientIdentifierType> types) |
java.util.Map<java.lang.Integer,PatientProgram> |
getPatientPrograms(Cohort ps,
Program program,
boolean includeVoided,
boolean includePast)
This method assumes the patient is not simultaneously enrolled in the program more than once.
|
java.util.List<Patient> |
getPatients(java.util.Collection<java.lang.Integer> patientIds) |
Cohort |
getPatients(java.lang.Integer start,
java.lang.Integer size) |
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) |
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) |
Cohort |
getPatientsByProgramAndState(Program program,
java.util.List<ProgramWorkflowState> stateList,
java.util.Date fromDate,
java.util.Date toDate)
TODO: Fails to leave out patients who are voided Returns the set of patients that were in a
given program, workflow, and state, within a given date range
|
Cohort |
getPatientsByRelationship(RelationshipType relType,
boolean includeAtoB,
boolean includeBtoA,
Person target)
TODO get rid of the potentially-expensive call to getAllPatients()
|
Cohort |
getPatientsHavingDateObs(java.lang.Integer conceptId,
java.util.Date startTime,
java.util.Date endTime)
TODO: don't return voided patients Gets all patients with an obs's value_date column value
within
startTime and endTime |
Cohort |
getPatientsHavingDrugOrder(java.util.List<Drug> drugList,
java.util.List<Concept> drugConceptList,
java.util.Date startDateFrom,
java.util.Date startDateTo,
java.util.Date stopDateFrom,
java.util.Date stopDateTo,
java.lang.Boolean discontinued,
java.util.List<Concept> orderReason) |
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)
Returns the set of patients that have encounters, with several optional parameters:
of type encounterType
at a given location
from filling out a specific form
on or after fromDate
on or before toDate
patients with at least minCount of the given encounters
patients with up to maxCount of the given encounters
|
Cohort |
getPatientsHavingLocation(java.lang.Integer locationId,
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) |
Cohort |
getPatientsHavingPersonAttribute(PersonAttributeType attribute,
java.lang.String value) |
Cohort |
getPatientsHavingTextObs(java.lang.Integer conceptId,
java.lang.String value,
PatientSetService.TimeModifier timeModifier) |
Cohort |
getPatientsInProgram(java.lang.Integer programId,
java.util.Date fromDate,
java.util.Date toDate)
TODO: Don't return voided patients Returns the set of patients that were ever in enrolled in
a given program.
|
java.util.Map<java.lang.Integer,java.lang.Object> |
getPersonAttributes(Cohort patients,
java.lang.String attributeTypeName,
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 patients,
RelationshipType relType) |
java.util.Map<java.lang.Integer,java.util.List<Person>> |
getRelatives(Cohort patients,
RelationshipType relType,
boolean forwards) |
java.util.Map<java.lang.Integer,java.lang.String> |
getShortPatientDescriptions(java.util.Collection<java.lang.Integer> patientIds) |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set sessionFactory.getCurrentSession() factory
|
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory - SessionFactory to setpublic java.lang.String exportXml(Cohort ps) throws DAOException
exportXml in interface PatientSetDAODAOExceptionPatientSetDAO.exportXml(org.openmrs.Cohort)public java.lang.String exportXml(java.lang.Integer patientId)
throws DAOException
exportXml in interface PatientSetDAODAOExceptionpublic Cohort getAllPatients()
getAllPatients in interface PatientSetDAOpublic Cohort getPatientsByProgramAndState(Program program, java.util.List<ProgramWorkflowState> stateList, java.util.Date fromDate, java.util.Date toDate)
getPatientsByProgramAndState in interface PatientSetDAOprogram - The program the patient must have been instateList - List of states the patient must have been in (implies a workflow) (can be
null)fromDate - If not null, then only patients in the given program/workflow/state on or
after this datetoDate - If not null, then only patients in the given program/workflow/state on or
before this datepublic Cohort getPatientsInProgram(java.lang.Integer programId, java.util.Date fromDate, java.util.Date toDate)
getPatientsInProgram in interface PatientSetDAOpublic Cohort getPatientsHavingObs(java.lang.Integer conceptId, PatientSetService.TimeModifier timeModifier, PatientSetService.Modifier modifier, java.lang.Object value, java.util.Date fromDate, java.util.Date toDate)
getPatientsHavingObs in interface PatientSetDAOpublic 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)
Returns the set of patients that have encounters, with several optional parameters: of type encounterType at a given location from filling out a specific form on or after fromDate on or before toDate patients with at least minCount of the given encounters patients with up to maxCount of the given encounters
getPatientsHavingEncounters in interface PatientSetDAOpublic Cohort getPatientsHavingDateObs(java.lang.Integer conceptId, java.util.Date startTime, java.util.Date endTime)
startTime and endTimegetPatientsHavingDateObs in interface PatientSetDAOconceptId - startTime - endTime - 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 PatientSetDAOpublic 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
getPatientsByCharacteristics in interface PatientSetDAODAOExceptionpublic 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
getPatientsByCharacteristics in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.lang.String> getShortPatientDescriptions(java.util.Collection<java.lang.Integer> patientIds)
throws DAOException
getShortPatientDescriptions in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.Object>> getCharacteristics(Cohort patients) throws DAOException
getCharacteristics in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.List<Obs>> getObservations(Cohort patients, Concept concept, java.util.Date fromDate, java.util.Date toDate) throws DAOException
getObservations in interface PatientSetDAODAOExceptionpublic 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)
getObservationsValues in interface PatientSetDAOpublic static java.util.List<java.lang.String> findObsValueColumnName(Concept c)
public java.util.Map<java.lang.Integer,Encounter> getEncountersByType(Cohort patients, java.util.List<EncounterType> encTypes)
getEncountersByType in interface PatientSetDAOpublic java.util.List<Encounter> getEncountersByForm(Cohort patients, java.util.List<Form> forms)
getEncountersByForm in interface PatientSetDAOpatients - the patients to filter by (null will return all encounters for all patients)forms - the forms to filter bypublic java.util.Map<java.lang.Integer,java.lang.Object> getEncounterAttrsByType(Cohort patients, java.util.List<EncounterType> encTypes, java.lang.String attr, java.lang.Boolean earliestFirst)
getEncounterAttrsByType in interface PatientSetDAOpublic java.util.Map<java.lang.Integer,Encounter> getEncounters(Cohort patients)
getEncounters in interface PatientSetDAOpublic java.util.Map<java.lang.Integer,Encounter> getFirstEncountersByType(Cohort patients, java.util.List<EncounterType> types)
getFirstEncountersByType in interface PatientSetDAOpublic java.util.Map<java.lang.Integer,java.lang.Object> getPatientAttributes(Cohort patients, java.lang.String className, java.lang.String property, boolean returnAll) throws DAOException
getPatientAttributes in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.lang.Object> getPersonAttributes(Cohort patients, java.lang.String attributeTypeName, java.lang.String joinClass, java.lang.String joinProperty, java.lang.String outputColumn, boolean returnAll)
public Cohort getPatientsHavingTextObs(java.lang.Integer conceptId, java.lang.String value, PatientSetService.TimeModifier timeModifier) throws DAOException
getPatientsHavingTextObs in interface PatientSetDAODAOExceptionpublic Cohort getPatientsHavingLocation(java.lang.Integer locationId, PatientSetService.PatientLocationMethod method)
getPatientsHavingLocation in interface PatientSetDAOpublic Cohort convertPatientIdentifier(java.util.List<java.lang.String> identifiers) throws DAOException
convertPatientIdentifier in interface PatientSetDAODAOExceptionpublic java.util.List<Patient> getPatients(java.util.Collection<java.lang.Integer> patientIds) throws DAOException
getPatients in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.Collection<java.lang.Integer>> getActiveDrugIds(java.util.Collection<java.lang.Integer> patientIds,
java.util.Date fromDate,
java.util.Date toDate)
throws DAOException
getActiveDrugIds in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,PatientState> getCurrentStates(Cohort ps, ProgramWorkflow wf) throws DAOException
getCurrentStates in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,PatientProgram> getPatientPrograms(Cohort ps, Program program, boolean includeVoided, boolean includePast) throws DAOException
getPatientPrograms in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getCurrentDrugOrders(Cohort patients, java.util.List<Concept> drugConcepts) throws DAOException
getCurrentDrugOrders in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getDrugOrders(Cohort patients, java.util.List<Concept> drugConcepts) throws DAOException
getDrugOrders in interface PatientSetDAODAOExceptionpublic java.util.Map<java.lang.Integer,java.util.List<Person>> getRelatives(Cohort patients, RelationshipType relType, boolean forwards)
getRelatives in interface PatientSetDAOpublic java.util.Map<java.lang.Integer,java.util.List<Relationship>> getRelationships(Cohort patients, RelationshipType relType)
getRelationships in interface PatientSetDAOpublic Cohort getPatientsHavingPersonAttribute(PersonAttributeType attribute, java.lang.String value)
getPatientsHavingPersonAttribute in interface PatientSetDAOpublic Cohort getPatientsHavingDrugOrder(java.util.List<Drug> drugList, java.util.List<Concept> drugConceptList, java.util.Date startDateFrom, java.util.Date startDateTo, java.util.Date stopDateFrom, java.util.Date stopDateTo, java.lang.Boolean discontinued, java.util.List<Concept> orderReason)
getPatientsHavingDrugOrder in interface PatientSetDAOpublic java.util.Map<java.lang.Integer,java.lang.String> getPatientIdentifierByType(Cohort patients, java.util.List<PatientIdentifierType> types)
getPatientIdentifierByType in interface PatientSetDAOpatients - types - ListPatientIdentifierspublic Cohort getPatientsByRelationship(RelationshipType relType, boolean includeAtoB, boolean includeBtoA, Person target)
getPatientsByRelationship in interface PatientSetDAOPatientSetDAO.getPatientsByRelationship(org.openmrs.RelationshipType,
boolean, boolean, org.openmrs.Person)public java.lang.Integer getCountOfPatients()
getCountOfPatients in interface PatientSetDAOpublic Cohort getPatients(java.lang.Integer start, java.lang.Integer size)
getPatients in interface PatientSetDAOCopyright © 2018 OpenMRS Inc.. All Rights Reserved.