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 PatientSetDAO
DAOException
PatientSetDAO.exportXml(org.openmrs.Cohort)
public java.lang.String exportXml(java.lang.Integer patientId) throws DAOException
exportXml
in interface PatientSetDAO
DAOException
public Cohort getAllPatients()
getAllPatients
in interface PatientSetDAO
public Cohort getPatientsByProgramAndState(Program program, java.util.List<ProgramWorkflowState> stateList, java.util.Date fromDate, java.util.Date toDate)
getPatientsByProgramAndState
in interface PatientSetDAO
program
- 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 PatientSetDAO
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)
getPatientsHavingObs
in interface PatientSetDAO
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)
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 PatientSetDAO
public Cohort getPatientsHavingDateObs(java.lang.Integer conceptId, java.util.Date startTime, java.util.Date endTime)
startTime
and endTime
getPatientsHavingDateObs
in interface PatientSetDAO
conceptId
- 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 PatientSetDAO
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
getPatientsByCharacteristics
in interface PatientSetDAO
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
getPatientsByCharacteristics
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,java.lang.String> getShortPatientDescriptions(java.util.Collection<java.lang.Integer> patientIds) throws DAOException
getShortPatientDescriptions
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.lang.Object>> getCharacteristics(Cohort patients) throws DAOException
getCharacteristics
in interface PatientSetDAO
DAOException
public 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 PatientSetDAO
DAOException
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)
getObservationsValues
in interface PatientSetDAO
public 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 PatientSetDAO
public java.util.List<Encounter> getEncountersByForm(Cohort patients, java.util.List<Form> forms)
getEncountersByForm
in interface PatientSetDAO
patients
- 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 PatientSetDAO
public java.util.Map<java.lang.Integer,Encounter> getEncounters(Cohort patients)
getEncounters
in interface PatientSetDAO
public java.util.Map<java.lang.Integer,Encounter> getFirstEncountersByType(Cohort patients, java.util.List<EncounterType> types)
getFirstEncountersByType
in interface PatientSetDAO
public 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 PatientSetDAO
DAOException
public 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 PatientSetDAO
DAOException
public Cohort getPatientsHavingLocation(java.lang.Integer locationId, PatientSetService.PatientLocationMethod method)
getPatientsHavingLocation
in interface PatientSetDAO
public Cohort convertPatientIdentifier(java.util.List<java.lang.String> identifiers) throws DAOException
convertPatientIdentifier
in interface PatientSetDAO
DAOException
public java.util.List<Patient> getPatients(java.util.Collection<java.lang.Integer> patientIds) throws DAOException
getPatients
in interface PatientSetDAO
DAOException
public 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 PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,PatientState> getCurrentStates(Cohort ps, ProgramWorkflow wf) throws DAOException
getCurrentStates
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,PatientProgram> getPatientPrograms(Cohort ps, Program program, boolean includeVoided, boolean includePast) throws DAOException
getPatientPrograms
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getCurrentDrugOrders(Cohort patients, java.util.List<Concept> drugConcepts) throws DAOException
getCurrentDrugOrders
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,java.util.List<DrugOrder>> getDrugOrders(Cohort patients, java.util.List<Concept> drugConcepts) throws DAOException
getDrugOrders
in interface PatientSetDAO
DAOException
public java.util.Map<java.lang.Integer,java.util.List<Person>> getRelatives(Cohort patients, RelationshipType relType, boolean forwards)
getRelatives
in interface PatientSetDAO
public java.util.Map<java.lang.Integer,java.util.List<Relationship>> getRelationships(Cohort patients, RelationshipType relType)
getRelationships
in interface PatientSetDAO
public Cohort getPatientsHavingPersonAttribute(PersonAttributeType attribute, java.lang.String value)
getPatientsHavingPersonAttribute
in interface PatientSetDAO
public 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 PatientSetDAO
public java.util.Map<java.lang.Integer,java.lang.String> getPatientIdentifierByType(Cohort patients, java.util.List<PatientIdentifierType> types)
getPatientIdentifierByType
in interface PatientSetDAO
patients
- types
- ListPatientIdentifier
spublic Cohort getPatientsByRelationship(RelationshipType relType, boolean includeAtoB, boolean includeBtoA, Person target)
getPatientsByRelationship
in interface PatientSetDAO
PatientSetDAO.getPatientsByRelationship(org.openmrs.RelationshipType,
boolean, boolean, org.openmrs.Person)
public java.lang.Integer getCountOfPatients()
getCountOfPatients
in interface PatientSetDAO
public Cohort getPatients(java.lang.Integer start, java.lang.Integer size)
getPatients
in interface PatientSetDAO
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.