public class Cohort extends BaseChangeableOpenmrsData
| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID |
creator| Constructor and Description |
|---|
Cohort() |
Cohort(Collection<?> patientsOrIds)
This constructor does not check whether the database contains patients with the given ids,
but
CohortService.saveCohort(Cohort) will. |
Cohort(Integer cohortId)
Convenience constructor to create a Cohort object that has an primarykey/internal identifier
of
cohortId |
Cohort(String commaSeparatedIds)
Convenience constructor taking in a string that is a list of comma separated patient ids This
constructor does not check whether the database contains patients with the given ids, but
CohortService.saveCohort(Cohort) will. |
Cohort(String name,
String description,
Collection<?> patientsOrIds)
This constructor does not check whether the database contains patients with the given ids,
but
CohortService.saveCohort(Cohort) will. |
Cohort(String name,
String description,
Integer[] ids)
This constructor does not check whether the database contains patients with the given ids,
but
CohortService.saveCohort(Cohort) will. |
Cohort(String name,
String description,
Patient[] patients)
This constructor does not check whether the database contains patients with the given ids,
but
CohortService.saveCohort(Cohort) will. |
| Modifier and Type | Method and Description |
|---|---|
int |
activeMembershipSize() |
void |
addMember(Integer memberId) |
boolean |
addMembership(CohortMembership cohortMembership) |
boolean |
contains(Integer patientId) |
CohortMembership |
getActiveMembership(Patient patient) |
Collection<CohortMembership> |
getActiveMemberships() |
Collection<CohortMembership> |
getActiveMemberships(Date asOfDate) |
Integer |
getCohortId() |
String |
getCommaSeparatedPatientIds()
Deprecated.
since 2.1.0 cohorts are more complex than just a set of patient ids, so there is no one-line replacement
|
String |
getDescription() |
Integer |
getId() |
Set<Integer> |
getMemberIds()
Deprecated.
since 2.1.0 cohorts are more complex than just a set of patient ids, so there is no one-line replacement
|
Collection<CohortMembership> |
getMemberships() |
Collection<CohortMembership> |
getMemberships(boolean includeVoided) |
String |
getName() |
int |
getSize()
Deprecated.
use
size() |
boolean |
hasActiveMembership(int patientId) |
boolean |
hasNoActiveMemberships() |
static Cohort |
intersect(Cohort a,
Cohort b)
Returns the intersection of two cohorts, treating null as an empty cohort
|
boolean |
isEmpty() |
boolean |
removeMembership(CohortMembership cohortMembership) |
void |
setCohortId(Integer cohortId) |
void |
setDescription(String description) |
void |
setId(Integer id) |
void |
setMemberIds(Set<Integer> memberIds)
Deprecated.
since 2.1.0 cohorts are more complex than just a set of patient ids, so there is no one-line replacement
|
void |
setMemberships(Collection<CohortMembership> members) |
void |
setName(String name) |
int |
size() |
static Cohort |
subtract(Cohort a,
Cohort b)
Subtracts a cohort from a cohort
|
String |
toString()
Returns a string equal to the value of: ClassName{hashCode=...,
uuid=...}
|
static Cohort |
union(Cohort a,
Cohort b)
Returns the union of two cohorts
|
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReasonequals, getUuid, hashCode, setUuidclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetUuid, setUuidpublic static final long serialVersionUID
public Cohort()
public Cohort(Integer cohortId)
cohortIdcohortId - the internal identifier for this cohortpublic Cohort(String name, String description, Integer[] ids)
CohortService.saveCohort(Cohort) will.name - description - optional descriptionids - option array of Integer idspublic Cohort(String name, String description, Patient[] patients)
CohortService.saveCohort(Cohort) will.name - description - optional descriptionpatients - optional array of patientspublic Cohort(Collection<?> patientsOrIds)
CohortService.saveCohort(Cohort) will.patientsOrIds - optional collection which may contain Patients, or patientIds which may
be Integers, Strings, or anything whose toString() can be parsed to an Integer.public Cohort(String name, String description, Collection<?> patientsOrIds)
CohortService.saveCohort(Cohort) will.name - description - optional descriptionpatientsOrIds - optional collection which may contain Patients, or patientIds which may
be Integers, Strings, or anything whose toString() can be parsed to an Integer.public Cohort(String commaSeparatedIds)
CohortService.saveCohort(Cohort) will.commaSeparatedIds - @Deprecated public String getCommaSeparatedPatientIds()
public boolean contains(Integer patientId)
public String toString()
BaseOpenmrsObjectClassName{hashCode=..., uuid=...}
If the uuid field is null, it returns:
ClassName{hashCode=...}Should include hashCode if uuid is null Should include uuid if not null
toString in class BaseOpenmrsObjectpublic void addMember(Integer memberId)
public boolean addMembership(CohortMembership cohortMembership)
public boolean removeMembership(CohortMembership cohortMembership)
public Collection<CohortMembership> getMemberships(boolean includeVoided)
includeVoided - boolean true/false to include/exclude voided membershipspublic Collection<CohortMembership> getMemberships()
public Collection<CohortMembership> getActiveMemberships(Date asOfDate)
asOfDate - date used to return active membershipspublic Collection<CohortMembership> getActiveMemberships()
public CohortMembership getActiveMembership(Patient patient)
public int size()
@Deprecated public int getSize()
size()public boolean isEmpty()
public static Cohort union(Cohort a, Cohort b)
a - The first Cohortb - The second Cohortpublic static Cohort intersect(Cohort a, Cohort b)
a - The first Cohortb - The second Cohortpublic static Cohort subtract(Cohort a, Cohort b)
a - the original Cohortb - the Cohort to subtractpublic Integer getCohortId()
public void setCohortId(Integer cohortId)
public String getDescription()
public void setDescription(String description)
public String getName()
public void setName(String name)
@Deprecated public Set<Integer> getMemberIds()
@Deprecated public void setMemberIds(Set<Integer> memberIds)
memberIds - public void setMemberships(Collection<CohortMembership> members)
public Integer getId()
OpenmrsObject.getId()public void setId(Integer id)
id - - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)public boolean hasActiveMembership(int patientId)
patientId - is the patientid that should be checked for activity in cohortpublic int activeMembershipSize()
public boolean hasNoActiveMemberships()
Copyright © 2024 OpenMRS Inc.. All rights reserved.