@Transactional public class CohortServiceImpl extends BaseOpenmrsService implements CohortService
| Constructor and Description |
|---|
CohortServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
Cohort |
addPatientToCohort(Cohort cohort,
Patient patient)
Adds a new patient to a Cohort.
|
CohortMembership |
endCohortMembership(CohortMembership cohortMembership,
Date onDate)
Ends the specified CohortMembership i.e. sets its end date to the current date
|
List<Cohort> |
getAllCohorts()
Gets all Cohorts (not including voided ones)
|
List<Cohort> |
getAllCohorts(boolean includeVoided)
Gets all Cohorts, possibly including the voided ones
|
Cohort |
getCohort(Integer id)
Gets a Cohort by its database primary key
|
Cohort |
getCohort(String name) |
Cohort |
getCohortByName(String name)
Gets a non voided Cohort by its name
|
Cohort |
getCohortByUuid(String uuid)
Get Cohort by its UUID
|
CohortMembership |
getCohortMembershipByUuid(String uuid)
Get CohortMembership by its UUID
|
List<CohortMembership> |
getCohortMemberships(Integer patientId,
Date activeOnDate,
boolean includeVoided)
Gets memberships for the given patient, optionally active on a specific date
|
List<Cohort> |
getCohorts(String nameFragment)
Returns Cohorts whose names match the given string.
|
List<Cohort> |
getCohortsContainingPatient(Patient patient) |
List<Cohort> |
getCohortsContainingPatientId(Integer patientId)
Find all Cohorts that contain the given patientId right now.
|
void |
notifyPatientUnvoided(Patient patient,
User originallyVoidedBy,
Date originalDateVoided)
NOTE: CLIENT CODE SHOULD NEVER CALL THIS METHOD.
|
void |
notifyPatientVoided(Patient patient)
NOTE: CLIENT CODE SHOULD NEVER CALL THIS METHOD.
|
Cohort |
purgeCohort(Cohort cohort)
Completely removes a Cohort from the database (not reversible)
|
void |
purgeCohortMembership(CohortMembership cohortMembership)
Removes a CohortMembership from its parent Cohort
|
Cohort |
removePatientFromCohort(Cohort cohort,
Patient patient)
Removes a patient from a Cohort, by voiding their membership.
|
Cohort |
saveCohort(Cohort cohort)
Save a cohort to the database (create if new, or update if changed) This method will throw an
exception if any patientIds in the Cohort don't exist.
|
void |
setCohortDAO(CohortDAO dao)
Sets the CohortDAO for this service to use
|
Cohort |
voidCohort(Cohort cohort,
String reason)
Voids the given cohort, deleting it from the perspective of the typical end user.
|
CohortMembership |
voidCohortMembership(CohortMembership cohortMembership,
String reason)
Marks the specified CohortMembership as voided
|
onShutdown, onStartupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, onStartuppublic void setCohortDAO(CohortDAO dao)
CohortServicesetCohortDAO in interface CohortServiceCohortService.setCohortDAO(org.openmrs.api.db.CohortDAO)public Cohort saveCohort(Cohort cohort) throws APIException
CohortServicesaveCohort in interface CohortServicecohort - the cohort to be saved to the databaseAPIException - Should create new cohorts
Should update an existing cohortCohortService.saveCohort(org.openmrs.Cohort)@Transactional(readOnly=true) public Cohort getCohort(Integer id)
CohortServicegetCohort in interface CohortServiceCohortService.getCohort(java.lang.Integer)public Cohort voidCohort(Cohort cohort, String reason)
CohortServicevoidCohort in interface CohortServicecohort - the cohort to deletereason - the reason this cohort is being retiredCohortService.voidCohort(org.openmrs.Cohort, java.lang.String)@Transactional(readOnly=true) public Cohort getCohortByUuid(String uuid)
CohortServicegetCohortByUuid in interface CohortServiceCohortService.getCohortByUuid(java.lang.String)@Transactional(readOnly=true) public CohortMembership getCohortMembershipByUuid(String uuid)
CohortServicegetCohortMembershipByUuid in interface CohortServiceCohortService.getCohortMembershipByUuid(java.lang.String)public Cohort addPatientToCohort(Cohort cohort, Patient patient)
CohortServiceaddPatientToCohort in interface CohortServicecohort - the cohort to receive the given patientpatient - the patient to insert into the cohortCohortService.addPatientToCohort(org.openmrs.Cohort,
org.openmrs.Patient)public Cohort removePatientFromCohort(Cohort cohort, Patient patient)
CohortServiceremovePatientFromCohort in interface CohortServicecohort - the cohort containing the given patientpatient - the patient to remove from the given cohortCohortService.removePatientFromCohort(org.openmrs.Cohort,
org.openmrs.Patient)@Transactional(readOnly=true) public List<Cohort> getCohortsContainingPatient(Patient patient)
getCohortsContainingPatient in interface CohortServicepatient - patient used to find the cohorts@Transactional(readOnly=true) public List<Cohort> getCohortsContainingPatientId(Integer patientId)
CohortServicegetCohortsContainingPatientId in interface CohortServicepatientId - patient id used to find the cohorts@Transactional(readOnly=true) public List<Cohort> getCohorts(String nameFragment) throws APIException
CohortServicegetCohorts in interface CohortServiceAPIException - Should never return null
Should match cohorts by partial nameCohortService.getCohorts(java.lang.String)@Transactional(readOnly=true) public List<Cohort> getAllCohorts() throws APIException
CohortServicegetAllCohorts in interface CohortServiceAPIException - Should get all nonvoided cohorts in database
Should not return any voided cohortsCohortService.getAllCohorts()@Transactional(readOnly=true) public List<Cohort> getAllCohorts(boolean includeVoided) throws APIException
CohortServicegetAllCohorts in interface CohortServiceincludeVoided - whether or not to include voided CohortsAPIException - Should return all cohorts and voidedCohortService.getAllCohorts(boolean)@Transactional(readOnly=true) public Cohort getCohortByName(String name) throws APIException
CohortServicegetCohortByName in interface CohortServiceAPIException - Should get cohort given a name
Should get the nonvoided cohort if two exist with same name
Should only get non voided cohorts by nameCohortService.getCohortByName(java.lang.String)@Transactional(readOnly=true) public Cohort getCohort(String name) throws APIException
getCohort in interface CohortServiceAPIExceptionCohortService.getCohort(java.lang.String)public Cohort purgeCohort(Cohort cohort) throws APIException
CohortServicepurgeCohort in interface CohortServicecohort - the Cohort to completely remove from the databaseAPIException - Should delete cohort from databaseCohortService.purgeCohort(org.openmrs.Cohort)public void purgeCohortMembership(CohortMembership cohortMembership) throws APIException
CohortServicepurgeCohortMembership in interface CohortServicecohortMembership - membership that will be removed from cohortAPIExceptionCohortService.purgeCohortMembership(CohortMembership)public CohortMembership voidCohortMembership(CohortMembership cohortMembership, String reason)
CohortServicevoidCohortMembership in interface CohortServicecohortMembership - the CohortMembership to voidreason - void reasonCohortService.voidCohortMembership(CohortMembership, String)public CohortMembership endCohortMembership(CohortMembership cohortMembership, Date onDate)
CohortServiceendCohortMembership in interface CohortServicecohortMembership - the CohortMembership to endonDate - when to end the membership (optional, defaults to now)CohortService.endCohortMembership(CohortMembership, Date)public void notifyPatientVoided(Patient patient) throws APIException
CohortServicenotifyPatientVoided in interface CohortServicepatient - patient that was voided
Should void the membership for the patient that was passed inAPIExceptionCohortService.notifyPatientVoided(org.openmrs.Patient)public void notifyPatientUnvoided(Patient patient, User originallyVoidedBy, Date originalDateVoided) throws APIException
CohortServicenotifyPatientUnvoided in interface CohortServicepatient - patient that was unvoidedoriginalDateVoided - Should unvoid the membership for the patient that was passed inAPIExceptionCohortService.notifyPatientUnvoided(Patient, User, Date)public List<CohortMembership> getCohortMemberships(Integer patientId, Date activeOnDate, boolean includeVoided)
CohortServicegetCohortMemberships in interface CohortServiceCopyright © 2024 OpenMRS Inc.. All rights reserved.