public class PatientProgram extends BaseChangeableOpenmrsData implements Customizable<PatientProgramAttribute>
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
creator
Constructor and Description |
---|
PatientProgram()
Default Constructor
|
PatientProgram(Integer patientProgramId)
Constructor with id
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(PatientProgramAttribute attribute)
Adds an attribute.
|
PatientProgram |
copy()
Does a mostly-shallow copy of this PatientProgram.
|
protected PatientProgram |
copyHelper(PatientProgram target)
The purpose of this method is to allow subclasses of PatientProgram to delegate a portion of
their copy() method back to the superclass, in case the base class implementation changes.
|
boolean |
getActive()
|
boolean |
getActive(Date onDate)
|
Collection<PatientProgramAttribute> |
getActiveAttributes() |
List<PatientProgramAttribute> |
getActiveAttributes(CustomValueDescriptor ofType) |
Set<PatientProgramAttribute> |
getAttributes() |
PatientState |
getCurrentState(ProgramWorkflow programWorkflow)
|
Set<PatientState> |
getCurrentStates()
Returns a Set<PatientState> of all current
PatientState s for the
PatientProgram |
Date |
getDateCompleted() |
Date |
getDateEnrolled() |
Integer |
getId() |
Location |
getLocation() |
Set<PatientState> |
getMostRecentStateInEachWorkflow()
Returns a Set<PatientState> of all recent
PatientState s for each workflow of the
PatientProgram |
Concept |
getOutcome() |
Patient |
getPatient() |
Integer |
getPatientProgramId() |
PatientState |
getPatientState(Integer patientStateId)
Returns the
PatientState associated with this PatientProgram that has an id that
matches the passed patientStateId |
Program |
getProgram() |
Set<PatientState> |
getStates() |
void |
setAttribute(PatientProgramAttribute attribute) |
void |
setAttributes(Set<PatientProgramAttribute> attributes) |
void |
setDateCompleted(Date dateCompleted) |
void |
setDateEnrolled(Date dateEnrolled) |
void |
setId(Integer id) |
void |
setLocation(Location location) |
void |
setOutcome(Concept concept) |
void |
setPatient(Patient patient) |
void |
setPatientProgramId(Integer patientProgramId) |
void |
setProgram(Program program) |
void |
setStates(Set<PatientState> states) |
List<PatientState> |
statesInWorkflow(ProgramWorkflow programWorkflow,
boolean includeVoided)
Returns a List<PatientState> of all
PatientState s in the passed
ProgramWorkflow for the PatientProgram |
String |
toString()
Returns a string equal to the value of: ClassName{hashCode=...,
uuid=...}
|
void |
transitionToState(ProgramWorkflowState programWorkflowState,
Date onDate)
Attempts to transition the PatientProgram to the passed
ProgramWorkflowState on the
passed Date by ending the most recent PatientState in the
PatientProgram and creating a new one with the passed ProgramWorkflowState
This will throw an IllegalArgumentException if the transition is invalid |
void |
voidLastState(ProgramWorkflow workflow,
User voidBy,
Date voidDate,
String voidReason)
Attempts to void the latest
PatientState in the PatientProgram If earlier
PatientStates exist, it will try to reset the endDate to null so that the next latest state
becomes the current PatientState |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
equals, getUuid, hashCode, setUuid
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
public PatientProgram()
public PatientProgram(Integer patientProgramId)
public PatientProgram copy()
protected PatientProgram copyHelper(PatientProgram target)
target
- a PatientProgram that will have the state of this
copied into itpublic boolean getActive(Date onDate)
public boolean getActive()
public PatientState getPatientState(Integer patientStateId)
PatientState
associated with this PatientProgram that has an id that
matches the passed patientStateId
patientStateId
- - The identifier to use to lookup a PatientState
patientStateId
public void transitionToState(ProgramWorkflowState programWorkflowState, Date onDate)
ProgramWorkflowState
on the
passed Date
by ending the most recent PatientState
in the
PatientProgram
and creating a new one with the passed ProgramWorkflowState
This will throw an IllegalArgumentException if the transition is invalidprogramWorkflowState
- - The ProgramWorkflowState
to transition toonDate
- - The Date
of the transitionIllegalArgumentException
public void voidLastState(ProgramWorkflow workflow, User voidBy, Date voidDate, String voidReason)
PatientState
in the PatientProgram
If earlier
PatientStates exist, it will try to reset the endDate to null so that the next latest state
becomes the current PatientState
workflow
- - The ProgramWorkflow
whose last PatientState
within the
current PatientProgram
we want to voidvoidBy
- - The user who is voiding the PatientState
voidDate
- - The date to void the PatientState
voidReason
- - The reason for voiding the PatientState
Should void state with endDate null if startDates equalpublic PatientState getCurrentState(ProgramWorkflow programWorkflow)
programWorkflow
- The ProgramWorkflow whose current PatientState
we want to
retrievePatientState
for the passed ProgramWorkflow
within this PatientProgram
public Set<PatientState> getCurrentStates()
PatientState
s for the
PatientProgram
PatientState
s for the PatientProgram
public Set<PatientState> getMostRecentStateInEachWorkflow()
PatientState
s for each workflow of the
PatientProgram
PatientState
s for the PatientProgram
public List<PatientState> statesInWorkflow(ProgramWorkflow programWorkflow, boolean includeVoided)
PatientState
s in the passed
ProgramWorkflow
for the PatientProgram
programWorkflow
- - The ProgramWorkflow
to checkincludeVoided
- - If true, return voided PatientState
s in the returned
List
PatientState
s in the passed ProgramWorkflow
for the PatientProgram
public String toString()
BaseOpenmrsObject
ClassName{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 BaseOpenmrsObject
Object.toString()
public Concept getOutcome()
public void setOutcome(Concept concept)
public Date getDateCompleted()
public void setDateCompleted(Date dateCompleted)
public Date getDateEnrolled()
public void setDateEnrolled(Date dateEnrolled)
public Patient getPatient()
public void setPatient(Patient patient)
public Integer getPatientProgramId()
public void setPatientProgramId(Integer patientProgramId)
public Program getProgram()
public void setProgram(Program program)
public Set<PatientState> getStates()
public void setStates(Set<PatientState> states)
public Integer getId()
getId
in interface OpenmrsObject
OpenmrsObject.getId()
public void setId(Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectOpenmrsObject.setId(java.lang.Integer)
public Location getLocation()
public void setLocation(Location location)
location
- the location to setpublic Set<PatientProgramAttribute> getAttributes()
getAttributes
in interface Customizable<PatientProgramAttribute>
public Collection<PatientProgramAttribute> getActiveAttributes()
getActiveAttributes
in interface Customizable<PatientProgramAttribute>
public List<PatientProgramAttribute> getActiveAttributes(CustomValueDescriptor ofType)
getActiveAttributes
in interface Customizable<PatientProgramAttribute>
public void addAttribute(PatientProgramAttribute attribute)
Customizable
addAttribute
in interface Customizable<PatientProgramAttribute>
public void setAttributes(Set<PatientProgramAttribute> attributes)
public void setAttribute(PatientProgramAttribute attribute)
Copyright © 2024 OpenMRS Inc.. All rights reserved.