public class HibernatePatientSetDAO extends 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(List<String> identifiers) |
String |
exportXml(Cohort ps)
Deprecated.
|
String |
exportXml(Integer patientId)
Deprecated.
|
static List<String> |
findObsValueColumnName(Concept c) |
Map<Integer,Collection<Integer>> |
getActiveDrugIds(Collection<Integer> patientIds,
Date fromDate,
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() |
Map<Integer,Map<String,Object>> |
getCharacteristics(Cohort patients) |
Integer |
getCountOfPatients() |
Map<Integer,List<DrugOrder>> |
getCurrentDrugOrders(Cohort patients,
List<Concept> drugConcepts) |
Map<Integer,PatientState> |
getCurrentStates(Cohort ps,
ProgramWorkflow wf) |
Map<Integer,List<DrugOrder>> |
getDrugOrders(Cohort patients,
List<Concept> drugConcepts) |
Map<Integer,Object> |
getEncounterAttrsByType(Cohort patients,
List<EncounterType> encTypes,
String attr,
Boolean earliestFirst) |
Map<Integer,Encounter> |
getEncounters(Cohort patients) |
List<Encounter> |
getEncountersByForm(Cohort patients,
List<Form> forms)
Gets a list of encounters associated with the given form, filtered by the given patient set.
|
Map<Integer,Encounter> |
getEncountersByType(Cohort patients,
List<EncounterType> encTypes) |
Map<Integer,Encounter> |
getFirstEncountersByType(Cohort patients,
List<EncounterType> types) |
Map<Integer,List<Obs>> |
getObservations(Cohort patients,
Concept concept,
Date fromDate,
Date toDate) |
Map<Integer,List<List<Object>>> |
getObservationsValues(Cohort patients,
Concept c,
List<String> attributes,
Integer limit,
boolean showMostRecentFirst) |
Map<Integer,Object> |
getPatientAttributes(Cohort patients,
String className,
String property,
boolean returnAll) |
Map<Integer,String> |
getPatientIdentifierByType(Cohort patients,
List<PatientIdentifierType> types) |
Map<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.
|
List<Patient> |
getPatients(Collection<Integer> patientIds) |
Cohort |
getPatients(Integer start,
Integer size) |
Cohort |
getPatientsByCharacteristics(String gender,
Date minBirthdate,
Date maxBirthdate,
Integer minAge,
Integer maxAge,
Boolean aliveOnly,
Boolean deadOnly) |
Cohort |
getPatientsByCharacteristics(String gender,
Date minBirthdate,
Date maxBirthdate,
Integer minAge,
Integer maxAge,
Boolean aliveOnly,
Boolean deadOnly,
Date effectiveDate) |
Cohort |
getPatientsByProgramAndState(Program program,
List<ProgramWorkflowState> stateList,
Date fromDate,
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(Integer conceptId,
Date startTime,
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(List<Drug> drugList,
List<Concept> drugConceptList,
Date startDateFrom,
Date startDateTo,
Date stopDateFrom,
Date stopDateTo,
Boolean discontinued,
List<Concept> discontinuedReason) |
Cohort |
getPatientsHavingEncounters(List<EncounterType> encounterTypeList,
Location location,
Form form,
Date fromDate,
Date toDate,
Integer minCount,
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(Integer locationId,
PatientSetService.PatientLocationMethod method) |
Cohort |
getPatientsHavingNumericObs(Integer conceptId,
PatientSetService.TimeModifier timeModifier,
PatientSetService.Modifier modifier,
Number value,
Date fromDate,
Date toDate) |
Cohort |
getPatientsHavingObs(Integer conceptId,
PatientSetService.TimeModifier timeModifier,
PatientSetService.Modifier modifier,
Object value,
Date fromDate,
Date toDate) |
Cohort |
getPatientsHavingPersonAttribute(PersonAttributeType attribute,
String value) |
Cohort |
getPatientsHavingTextObs(Integer conceptId,
String value,
PatientSetService.TimeModifier timeModifier) |
Cohort |
getPatientsInProgram(Integer programId,
Date fromDate,
Date toDate)
TODO: Don't return voided patients Returns the set of patients that were ever in enrolled in
a given program.
|
Map<Integer,Object> |
getPersonAttributes(Cohort patients,
String attributeTypeName,
String joinClass,
String joinProperty,
String outputColumn,
boolean returnAll) |
Map<Integer,List<Relationship>> |
getRelationships(Cohort patients,
RelationshipType relType) |
Map<Integer,List<Person>> |
getRelatives(Cohort patients,
RelationshipType relType,
boolean forwards) |
Map<Integer,String> |
getShortPatientDescriptions(Collection<Integer> patientIds) |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Set sessionFactory.getCurrentSession() factory
|
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory
- SessionFactory to setpublic String exportXml(Cohort ps) throws DAOException
exportXml
in interface PatientSetDAO
DAOException
PatientSetDAO.exportXml(org.openmrs.Cohort)
public String exportXml(Integer patientId) throws DAOException
exportXml
in interface PatientSetDAO
DAOException
public Cohort getAllPatients()
getAllPatients
in interface PatientSetDAO
public Cohort getPatientsByProgramAndState(Program program, List<ProgramWorkflowState> stateList, Date fromDate, 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(Integer programId, Date fromDate, Date toDate)
getPatientsInProgram
in interface PatientSetDAO
public Cohort getPatientsHavingObs(Integer conceptId, PatientSetService.TimeModifier timeModifier, PatientSetService.Modifier modifier, Object value, Date fromDate, Date toDate)
getPatientsHavingObs
in interface PatientSetDAO
public Cohort getPatientsHavingEncounters(List<EncounterType> encounterTypeList, Location location, Form form, Date fromDate, Date toDate, Integer minCount, 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(Integer conceptId, Date startTime, Date endTime)
startTime
and endTime
getPatientsHavingDateObs
in interface PatientSetDAO
conceptId
- startTime
- endTime
- public Cohort getPatientsHavingNumericObs(Integer conceptId, PatientSetService.TimeModifier timeModifier, PatientSetService.Modifier modifier, Number value, Date fromDate, Date toDate)
getPatientsHavingNumericObs
in interface PatientSetDAO
public Cohort getPatientsByCharacteristics(String gender, Date minBirthdate, Date maxBirthdate, Integer minAge, Integer maxAge, Boolean aliveOnly, Boolean deadOnly) throws DAOException
getPatientsByCharacteristics
in interface PatientSetDAO
DAOException
public Cohort getPatientsByCharacteristics(String gender, Date minBirthdate, Date maxBirthdate, Integer minAge, Integer maxAge, Boolean aliveOnly, Boolean deadOnly, Date effectiveDate) throws DAOException
getPatientsByCharacteristics
in interface PatientSetDAO
DAOException
public Map<Integer,String> getShortPatientDescriptions(Collection<Integer> patientIds) throws DAOException
getShortPatientDescriptions
in interface PatientSetDAO
DAOException
public Map<Integer,Map<String,Object>> getCharacteristics(Cohort patients) throws DAOException
getCharacteristics
in interface PatientSetDAO
DAOException
public Map<Integer,List<Obs>> getObservations(Cohort patients, Concept concept, Date fromDate, Date toDate) throws DAOException
getObservations
in interface PatientSetDAO
DAOException
public Map<Integer,List<List<Object>>> getObservationsValues(Cohort patients, Concept c, List<String> attributes, Integer limit, boolean showMostRecentFirst)
getObservationsValues
in interface PatientSetDAO
public Map<Integer,Encounter> getEncountersByType(Cohort patients, List<EncounterType> encTypes)
getEncountersByType
in interface PatientSetDAO
public List<Encounter> getEncountersByForm(Cohort patients, 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 Map<Integer,Object> getEncounterAttrsByType(Cohort patients, List<EncounterType> encTypes, String attr, Boolean earliestFirst)
getEncounterAttrsByType
in interface PatientSetDAO
public Map<Integer,Encounter> getEncounters(Cohort patients)
getEncounters
in interface PatientSetDAO
public Map<Integer,Encounter> getFirstEncountersByType(Cohort patients, List<EncounterType> types)
getFirstEncountersByType
in interface PatientSetDAO
public Map<Integer,Object> getPatientAttributes(Cohort patients, String className, String property, boolean returnAll) throws DAOException
getPatientAttributes
in interface PatientSetDAO
DAOException
public Map<Integer,Object> getPersonAttributes(Cohort patients, String attributeTypeName, String joinClass, String joinProperty, String outputColumn, boolean returnAll)
public Cohort getPatientsHavingTextObs(Integer conceptId, String value, PatientSetService.TimeModifier timeModifier) throws DAOException
getPatientsHavingTextObs
in interface PatientSetDAO
DAOException
public Cohort getPatientsHavingLocation(Integer locationId, PatientSetService.PatientLocationMethod method)
getPatientsHavingLocation
in interface PatientSetDAO
public Cohort convertPatientIdentifier(List<String> identifiers) throws DAOException
convertPatientIdentifier
in interface PatientSetDAO
DAOException
public List<Patient> getPatients(Collection<Integer> patientIds) throws DAOException
getPatients
in interface PatientSetDAO
DAOException
public Map<Integer,Collection<Integer>> getActiveDrugIds(Collection<Integer> patientIds, Date fromDate, Date toDate) throws DAOException
getActiveDrugIds
in interface PatientSetDAO
DAOException
public Map<Integer,PatientState> getCurrentStates(Cohort ps, ProgramWorkflow wf) throws DAOException
getCurrentStates
in interface PatientSetDAO
DAOException
public Map<Integer,PatientProgram> getPatientPrograms(Cohort ps, Program program, boolean includeVoided, boolean includePast) throws DAOException
getPatientPrograms
in interface PatientSetDAO
DAOException
public Map<Integer,List<DrugOrder>> getCurrentDrugOrders(Cohort patients, List<Concept> drugConcepts) throws DAOException
getCurrentDrugOrders
in interface PatientSetDAO
DAOException
public Map<Integer,List<DrugOrder>> getDrugOrders(Cohort patients, List<Concept> drugConcepts) throws DAOException
getDrugOrders
in interface PatientSetDAO
DAOException
public Map<Integer,List<Person>> getRelatives(Cohort patients, RelationshipType relType, boolean forwards)
getRelatives
in interface PatientSetDAO
public Map<Integer,List<Relationship>> getRelationships(Cohort patients, RelationshipType relType)
getRelationships
in interface PatientSetDAO
public Cohort getPatientsHavingPersonAttribute(PersonAttributeType attribute, String value)
getPatientsHavingPersonAttribute
in interface PatientSetDAO
public Cohort getPatientsHavingDrugOrder(List<Drug> drugList, List<Concept> drugConceptList, Date startDateFrom, Date startDateTo, Date stopDateFrom, Date stopDateTo, Boolean discontinued, List<Concept> discontinuedReason)
getPatientsHavingDrugOrder
in interface PatientSetDAO
public Map<Integer,String> getPatientIdentifierByType(Cohort patients, 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 Integer getCountOfPatients()
getCountOfPatients
in interface PatientSetDAO
public Cohort getPatients(Integer start, Integer size)
getPatients
in interface PatientSetDAO
Copyright © 2018 OpenMRS LLC.. All Rights Reserved.