org.openmrs
Class Order

java.lang.Object
  extended by org.openmrs.BaseOpenmrsObject
      extended by org.openmrs.BaseOpenmrsData
          extended by org.openmrs.Order
All Implemented Interfaces:
java.io.Serializable, Auditable, OpenmrsData, OpenmrsObject, Voidable
Direct Known Subclasses:
DrugOrder

public class Order
extends BaseOpenmrsData
implements java.io.Serializable

Dates should be interpreted as follows: If startDate is null then the order has been going on "since the beginning of time" Otherwise the order starts on startDate If discontinued is non-null and true, then the following fields should be ignored: autoExpireDate if discontinuedDate is null then the order was discontinued "the instant after it began" otherwise it was given from its starting date until discontinuedDate Otherwise (discontinued is null or false) if autoExpireDate is null, the order is set to go forever otherwise the order goes until autoExpireDate the following fields should be ignored: discontinuedBy discontinuedDate discontinuedReason It is an error to have discontinued be true and have discontinuedDate be after autoExpireDate. However this is not checked for in the database or the application.

Version:
1.0
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class org.openmrs.BaseOpenmrsData
creator
 
Constructor Summary
Order()
          default constructor
Order(java.lang.Integer orderId)
          constructor with id
 
Method Summary
 Order copy()
          Performs a shallow copy of this Order.
protected  Order copyHelper(Order target)
          The purpose of this method is to allow subclasses of Order to delegate a portion of their copy() method back to the superclass, in case the base class implementation changes.
 boolean equals(java.lang.Object obj)
          Compares two objects for similarity
 java.lang.String getAccessionNumber()
           
 java.util.Date getAutoExpireDate()
           
 Concept getConcept()
           
 java.lang.Boolean getDiscontinued()
           
 User getDiscontinuedBy()
           
 java.util.Date getDiscontinuedDate()
           
 Concept getDiscontinuedReason()
           
 java.lang.String getDiscontinuedReasonNonCoded()
           
 Encounter getEncounter()
           
 java.lang.Integer getId()
           
 java.lang.String getInstructions()
           
 User getOrderer()
           
 java.lang.Integer getOrderId()
           
 OrderType getOrderType()
           
 Patient getPatient()
           
 java.util.Date getStartDate()
           
 int hashCode()
           
 boolean isCurrent()
           
 boolean isCurrent(java.util.Date checkDate)
          Convenience method to determine if order is current
 boolean isDiscontinued(java.util.Date checkDate)
          Convenience method to determine if order is discontinued at a given time
 boolean isDiscontinuedRightNow()
           
 boolean isDrugOrder()
          true/false whether or not this is a drug order overridden in extending class drugOrders.
 boolean isFuture()
           
 boolean isFuture(java.util.Date checkDate)
           
 void setAccessionNumber(java.lang.String accessionNumber)
           
 void setAutoExpireDate(java.util.Date autoExpireDate)
           
 void setConcept(Concept concept)
           
 void setDiscontinued(java.lang.Boolean discontinued)
           
 void setDiscontinuedBy(User discontinuedBy)
           
 void setDiscontinuedDate(java.util.Date discontinuedDate)
           
 void setDiscontinuedReason(Concept discontinuedReason)
           
 void setDiscontinuedReasonNonCoded(java.lang.String discontinuedReasonNonCoded)
           
 void setEncounter(Encounter encounter)
           
 void setId(java.lang.Integer id)
           
 void setInstructions(java.lang.String instructions)
           
 void setOrderer(User orderer)
           
 void setOrderId(java.lang.Integer orderId)
           
 void setOrderType(OrderType orderType)
           
 void setPatient(Patient patient)
           
 void setStartDate(java.util.Date startDate)
           
 java.lang.String toString()
           
 
Methods inherited from class org.openmrs.BaseOpenmrsData
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
 
Methods inherited from class org.openmrs.BaseOpenmrsObject
getUuid, setUuid
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openmrs.OpenmrsObject
getUuid, setUuid
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Order

public Order()
default constructor


Order

public Order(java.lang.Integer orderId)
constructor with id

Method Detail

copy

public Order copy()
Performs a shallow copy of this Order. Does NOT copy orderId.

Returns:
a shallow copy of this Order

copyHelper

protected Order copyHelper(Order target)
The purpose of this method is to allow subclasses of Order to delegate a portion of their copy() method back to the superclass, in case the base class implementation changes.

Parameters:
target - an Order that will have the state of this copied into it
Returns:
Returns the Order that was passed in, with state copied into it

equals

public boolean equals(java.lang.Object obj)
Compares two objects for similarity

Overrides:
equals in class java.lang.Object
Parameters:
obj -
Returns:
boolean true/false whether or not they are the same objects

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isDrugOrder

public boolean isDrugOrder()
true/false whether or not this is a drug order overridden in extending class drugOrders.


getAutoExpireDate

public java.util.Date getAutoExpireDate()
Returns:
Returns the autoExpireDate.

setAutoExpireDate

public void setAutoExpireDate(java.util.Date autoExpireDate)
Parameters:
autoExpireDate - The autoExpireDate to set.

getConcept

public Concept getConcept()
Returns:
Returns the concept.

setConcept

public void setConcept(Concept concept)
Parameters:
concept - The concept to set.

getDiscontinued

public java.lang.Boolean getDiscontinued()
Returns:
Returns the discontinued status.
Expected behavior:
get discontinued property

setDiscontinued

public void setDiscontinued(java.lang.Boolean discontinued)
Parameters:
discontinued - The discontinued status to set.

getDiscontinuedBy

public User getDiscontinuedBy()
Returns:
Returns the discontinuedBy.

setDiscontinuedBy

public void setDiscontinuedBy(User discontinuedBy)
Parameters:
discontinuedBy - The discontinuedBy to set.

getDiscontinuedDate

public java.util.Date getDiscontinuedDate()
Returns:
Returns the discontinuedDate.

setDiscontinuedDate

public void setDiscontinuedDate(java.util.Date discontinuedDate)
Parameters:
discontinuedDate - The discontinuedDate to set.

getDiscontinuedReason

public Concept getDiscontinuedReason()
Returns:
Returns the discontinuedReason.

setDiscontinuedReason

public void setDiscontinuedReason(Concept discontinuedReason)
Parameters:
discontinuedReason - The discontinuedReason to set.

getEncounter

public Encounter getEncounter()
Returns:
Returns the encounter.

setEncounter

public void setEncounter(Encounter encounter)
Parameters:
encounter - The encounter to set.

getInstructions

public java.lang.String getInstructions()
Returns:
Returns the instructions.

setInstructions

public void setInstructions(java.lang.String instructions)
Parameters:
instructions - The instructions to set.

getAccessionNumber

public java.lang.String getAccessionNumber()
Returns:
Returns the accessionNumber.

setAccessionNumber

public void setAccessionNumber(java.lang.String accessionNumber)
Parameters:
accessionNumber - The accessionNumber to set.

getOrderer

public User getOrderer()
Returns:
Returns the orderer.

setOrderer

public void setOrderer(User orderer)
Parameters:
orderer - The orderer to set.

getOrderId

public java.lang.Integer getOrderId()
Returns:
Returns the orderId.

setOrderId

public void setOrderId(java.lang.Integer orderId)
Parameters:
orderId - The orderId to set.

getOrderType

public OrderType getOrderType()
Returns:
Returns the orderType.

setOrderType

public void setOrderType(OrderType orderType)
Parameters:
orderType - The orderType to set.

getStartDate

public java.util.Date getStartDate()
Returns:
Returns the startDate.

setStartDate

public void setStartDate(java.util.Date startDate)
Parameters:
startDate - The startDate to set.

getDiscontinuedReasonNonCoded

public java.lang.String getDiscontinuedReasonNonCoded()
Returns:
the discontinuedReasonNonCoded

setDiscontinuedReasonNonCoded

public void setDiscontinuedReasonNonCoded(java.lang.String discontinuedReasonNonCoded)
Parameters:
discontinuedReasonNonCoded - the discontinuedReasonNonCoded to set

isCurrent

public boolean isCurrent(java.util.Date checkDate)
Convenience method to determine if order is current

Parameters:
checkDate - - the date on which to check order. if null, will use current date
Returns:
boolean indicating whether the order was current on the input date

isCurrent

public boolean isCurrent()

isFuture

public boolean isFuture(java.util.Date checkDate)

isFuture

public boolean isFuture()

isDiscontinued

public boolean isDiscontinued(java.util.Date checkDate)
Convenience method to determine if order is discontinued at a given time

Parameters:
checkDate - - the date on which to check order. if null, will use current date
Returns:
boolean indicating whether the order was discontinued on the input date

isDiscontinuedRightNow

public boolean isDiscontinuedRightNow()

getPatient

public Patient getPatient()

setPatient

public void setPatient(Patient patient)

getId

public java.lang.Integer getId()
Specified by:
getId in interface OpenmrsObject
Returns:
id - The unique Identifier for the object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

setId

public void setId(java.lang.Integer id)
Specified by:
setId in interface OpenmrsObject
Parameters:
id - - The unique Identifier for the object
Since:
1.5
See Also:
OpenmrsObject.setId(java.lang.Integer)

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change