org.openmrs.api
Interface OrderService

All Superinterfaces:
OpenmrsService
All Known Implementing Classes:
OrderServiceImpl

@Transactional
public interface OrderService
extends OpenmrsService

Contains methods pertaining to creating/deleting/voiding Orders and DrugOrders Use:

   Order order = new Order();
   order.set___(___);
   ...etc
   Context.getOrderService().saveOrder(order);
 


Nested Class Summary
static class OrderService.ORDER_STATUS
          The type of status to match on an order.
 
Field Summary
static int SHOW_ALL
          Deprecated. use OrderService.ORDER_STATUS.ANY
static int SHOW_COMPLETE
          Deprecated. use OrderService.ORDER_STATUS.COMPLETE
static int SHOW_CURRENT
          Deprecated. use OrderService.ORDER_STATUS.CURRENT
static int SHOW_NOTVOIDED
          Deprecated. use OrderService.ORDER_STATUS.NOTVOIDED
 
Method Summary
 void createOrder(Order order)
          Deprecated. use #saveOrder(Order)
 void createOrdersAndEncounter(Patient p, java.util.Collection<Order> orders)
          Creates a collection of orders and an encounter to hold them.
 void createOrderType(OrderType orderType)
          Deprecated. use #saveOrderType(OrderType)
 void deleteOrder(Order order)
          Deprecated. use #purgeOrder(Order)
 void deleteOrderType(OrderType orderType)
          Deprecated. use #purgeOrderType(OrderType)
 void discontinueAllOrders(Patient patient, Concept discontinueReason, java.util.Date discontinueDate)
          Deprecated. use OrderUtil.discontinueAllOrders(Patient, Concept, Date)
 void discontinueDrugSet(Patient patient, java.lang.String drugSetId, Concept discontinueReason, java.util.Date discontinueDate)
          Deprecated. use OrderUtil.discontinueDrugSet(Patient, String, Concept, Date)
 Order discontinueOrder(Order order, Concept discontinueReason, java.util.Date discontinueDate)
          Mark the given order as discontinued.
 java.util.List<OrderType> getAllOrderTypes()
          Get all order types, including retired ones
 java.util.List<OrderType> getAllOrderTypes(boolean includeRetired)
          Get all order types, only showing ones not marked as retired if includeRetired is true
 DrugOrder getDrugOrder(java.lang.Integer drugOrderId)
          Deprecated. use getOrder(Integer, Class) with DrugOrder.class as second parameter instead
 java.util.List<DrugOrder> getDrugOrders()
          Deprecated. this method would return a very large list for most systems and doesn't make sense to be used. If _all_ Orders are really what is wanted, use getOrders(Class, List, List, org.openmrs.api.OrderService.ORDER_STATUS, List, List, List) with empty parameters
 java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient)
          Get all orders for the given patient
 java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient, int whatToShow)
          Deprecated. use getDrugOrdersByPatient(Patient, org.openmrs.api.OrderService.ORDER_STATUS)
 java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient, int whatToShow, boolean includeVoided)
          Deprecated. use getDrugOrdersByPatient(Patient, org.openmrs.api.OrderService.ORDER_STATUS, boolean)
 java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient, OrderService.ORDER_STATUS orderStatus)
          Get drug orders for a given patient, not including voided orders
 java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient, OrderService.ORDER_STATUS orderStatus, boolean includeVoided)
          Get drug orders for a given patient
 java.util.Map<java.lang.String,java.lang.String> getDrugSetHeadersByDrugSetIdList(java.lang.String drugSetIds)
          Deprecated. use OrderUtil.getDrugSetHeadersByDrugSetIdList(String)
 java.util.Map<Concept,java.util.List<DrugOrder>> getDrugSetsByConcepts(java.util.List<DrugOrder> drugOrders, java.util.List<Concept> drugSets)
          Deprecated. use OrderUtil.getDrugSetsByConcepts(List, List)
 java.util.Map<java.lang.String,java.util.List<DrugOrder>> getDrugSetsByDrugSetIdList(java.util.List<DrugOrder> orderList, java.lang.String drugSetIdList, java.lang.String delimiter)
          Deprecated. use OrderUtil.getDrugSetsByDrugSetIdList(List, String, String)
 Order getOrder(java.lang.Integer orderId)
          Get order by internal primary key identifier
<Ord extends Order>
Ord
getOrder(java.lang.Integer orderId, java.lang.Class<Ord> orderClassType)
          Gets the order with the associated order id
 Order getOrderByUuid(java.lang.String uuid)
          Get Order by its UUID
 java.util.List<Order> getOrders()
          Deprecated. this method would return a very large list for most systems and doesn't make sense to be used. If _all_ Orders are really what is wanted, use getOrders(Class, List, List, org.openmrs.api.OrderService.ORDER_STATUS, List, List, List) with empty parameters
<Ord extends Order>
java.util.List<Ord>
getOrders(java.lang.Class<Ord> orderClassType, java.util.List<Patient> patients, java.util.List<Concept> concepts, OrderService.ORDER_STATUS status, java.util.List<User> orderers, java.util.List<Encounter> encounters, java.util.List<OrderType> orderTypes)
          This searches for orders given the parameters.
 java.util.List<Order> getOrdersByEncounter(Encounter encounter)
          Gets all orders contained in an encounter
 java.util.List<Order> getOrdersByPatient(Patient patient)
          Get all orders by Patient
 java.util.List<Order> getOrdersByUser(User user)
          Get all orders by the User that is marked as their orderer
 OrderType getOrderType(java.lang.Integer orderTypeId)
          Get orderType by internal identifier
 OrderType getOrderTypeByUuid(java.lang.String uuid)
          Get OrderType by its UUID
 java.util.List<OrderType> getOrderTypes()
          Deprecated. use #getAllOrderTypes()
 java.util.List<RegimenSuggestion> getStandardRegimens()
          The standard regimens are currently stored in the application context file.
 void purgeOrder(Order order)
          Completely delete an order from the database.
 void purgeOrderType(OrderType orderType)
          Completely delete the order type from the system.
 OrderType retireOrderType(OrderType orderType, java.lang.String reason)
          This method essentially takes the given orderType out of active use in OpenMRS.
 Order saveOrder(Order order)
          Save or update the given order in the database
 OrderType saveOrderType(OrderType orderType)
          Save or update the given orderType in the database
 void setOrderDAO(OrderDAO dao)
          Setter for the Order data access object.
 Order undiscontinueOrder(Order order)
          Un-discontinue order record.
 OrderType unretireOrderType(OrderType orderType)
          This will bring back a previously decommissioned OrderType
 Order unvoidOrder(Order order)
          Unvoid order record.
 void updateOrder(Order order)
          Deprecated. use #saveOrder(Order)
 void updateOrderType(OrderType orderType)
          Deprecated. use #saveOrderType(OrderType)
 void voidDrugSet(Patient patient, java.lang.String drugSetId, java.lang.String voidReason, int whatToVoid)
          Deprecated. use OrderUtil.voidDrugSet(Patient, String, String, org.openmrs.api.OrderService.ORDER_STATUS)
 Order voidOrder(Order order, java.lang.String voidReason)
          Mark an order as voided.
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Field Detail

SHOW_CURRENT

static final int SHOW_CURRENT
Deprecated. use OrderService.ORDER_STATUS.CURRENT
See Also:
Constant Field Values

SHOW_ALL

static final int SHOW_ALL
Deprecated. use OrderService.ORDER_STATUS.ANY
See Also:
Constant Field Values

SHOW_COMPLETE

static final int SHOW_COMPLETE
Deprecated. use OrderService.ORDER_STATUS.COMPLETE
See Also:
Constant Field Values

SHOW_NOTVOIDED

static final int SHOW_NOTVOIDED
Deprecated. use OrderService.ORDER_STATUS.NOTVOIDED
See Also:
Constant Field Values
Method Detail

setOrderDAO

void setOrderDAO(OrderDAO dao)
Setter for the Order data access object. The dao is used for saving and getting orders to/from the database

Parameters:
dao - The data access object to use

createOrder

@Authorized(value="Add Orders")
void createOrder(Order order)
                 throws APIException
Deprecated. use #saveOrder(Order)

Throws:
APIException

updateOrder

@Authorized(value="Edit Orders")
void updateOrder(Order order)
                 throws APIException
Deprecated. use #saveOrder(Order)

Throws:
APIException

saveOrder

@Authorized(value={"Edit Orders","Add Orders"})
Order saveOrder(Order order)
                throws APIException
Save or update the given order in the database

Parameters:
order - the Order to save
Returns:
the Order that was saved
Throws:
APIException
Expected behavior:
not save order if order doesnt validate, save discontinued reason non coded

deleteOrder

@Authorized(value="Delete Orders")
void deleteOrder(Order order)
                 throws APIException
Deprecated. use #purgeOrder(Order)

Throws:
APIException

purgeOrder

@Authorized(value="Purge Orders")
void purgeOrder(Order order)
                throws APIException
Completely delete an order from the database. This should not typically be used unless desperately needed. Most orders should just be voided. See voidOrder(Order, String)

Parameters:
order - The Order to remove from the system
Throws:
APIException

voidOrder

@Authorized(value="Delete Orders")
Order voidOrder(Order order,
                                java.lang.String voidReason)
                throws APIException
Mark an order as voided. This functionally removes the Order from the system while keeping a semblance

Parameters:
voidReason - String reason
order - Order to void
Returns:
the Order that was voided
Throws:
APIException

discontinueOrder

@Authorized(value="Edit Orders")
Order discontinueOrder(Order order,
                                       Concept discontinueReason,
                                       java.util.Date discontinueDate)
                       throws APIException
Mark the given order as discontinued. This should be used when patients are no longer on this Order. If this is was invalid Order, the voidOrder(Order, String) method should probably be used.

Parameters:
discontinueReason - String reason for discontinuing this order
order - Order to discontinue
Returns:
The Order that was discontinued
Throws:
APIException

createOrdersAndEncounter

@Authorized(value={"Add Orders","Add Encounters"},
            requireAll=true)
void createOrdersAndEncounter(Patient p,
                                                        java.util.Collection<Order> orders)
                              throws APIException
Creates a collection of orders and an encounter to hold them. orders[i].encounter will be set to the new encounter. If there's an EncounterType with name "Regimen Change", then the newly-created encounter will have that type

Parameters:
p - the patient to add Orders to
orders - The Orders to add to the Patient (and to the makeshift Encounter)
Throws:
APIException - if there is no User with username Unknown or no Location with name Unknown or Unknown Location, or if there's no encounter type with name 'Regimen Change'

getOrder

@Transactional(readOnly=true)
@Authorized(value="View Orders")
Order getOrder(java.lang.Integer orderId)
               throws APIException
Get order by internal primary key identifier

Parameters:
orderId - internal order identifier
Returns:
order with given internal identifier
Throws:
APIException
See Also:
getOrder(Integer, Class)

getOrderByUuid

@Transactional(readOnly=true)
Order getOrderByUuid(java.lang.String uuid)
                     throws APIException
Get Order by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getOrder

@Authorized(value="View Orders")
<Ord extends Order> Ord getOrder(java.lang.Integer orderId,
                                                 java.lang.Class<Ord> orderClassType)
                           throws APIException
Gets the order with the associated order id

Type Parameters:
Ord - An Order type. Currently only org.openmrs.Order or org.openmrs.DrugOrder
Parameters:
orderId - the primary key of the Order
orderClassType - The class of Order to fetch (Currently only org.openmrs.Order or org.openmrs.DrugOrder)
Returns:
The Order in the system corresponding to given primary key id
Throws:
APIException

getDrugOrder

@Transactional(readOnly=true)
@Authorized(value="View Orders")
DrugOrder getDrugOrder(java.lang.Integer drugOrderId)
                       throws APIException
Deprecated. use getOrder(Integer, Class) with DrugOrder.class as second parameter instead

Throws:
APIException

getOrders

@Authorized(value="View Orders")
<Ord extends Order> java.util.List<Ord> getOrders(java.lang.Class<Ord> orderClassType,
                                                                  java.util.List<Patient> patients,
                                                                  java.util.List<Concept> concepts,
                                                                  OrderService.ORDER_STATUS status,
                                                                  java.util.List<User> orderers,
                                                                  java.util.List<Encounter> encounters,
                                                                  java.util.List<OrderType> orderTypes)
This searches for orders given the parameters. Most arguments are optional (nullable). If multiple arguments are given, the returned orders will match on all arguments.

Parameters:
orderClassType - The type of Order to get (currently only options are Order and DrugOrder)
patients - The patients to get orders for
concepts - The concepts in order.getConcept to get orders for
status - The ORDER_STATUS of the orders for its patient
orderers - The users/orderers of the
encounters - The encounters that the orders are assigned to
orderTypes - The OrderTypes to match on
Returns:
list of Orders matching the parameters

getOrders

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<Order> getOrders()
                                throws APIException
Deprecated. this method would return a very large list for most systems and doesn't make sense to be used. If _all_ Orders are really what is wanted, use getOrders(Class, List, List, org.openmrs.api.OrderService.ORDER_STATUS, List, List, List) with empty parameters

Throws:
APIException

getDrugOrders

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrders()
                                        throws APIException
Deprecated. this method would return a very large list for most systems and doesn't make sense to be used. If _all_ Orders are really what is wanted, use getOrders(Class, List, List, org.openmrs.api.OrderService.ORDER_STATUS, List, List, List) with empty parameters

Throws:
APIException

getOrdersByUser

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<Order> getOrdersByUser(User user)
                                      throws APIException
Get all orders by the User that is marked as their orderer

Returns:
orders list
Throws:
APIException

getOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<Order> getOrdersByPatient(Patient patient)
                                         throws APIException
Get all orders by Patient

Returns:
orders list
Throws:
APIException

getDrugOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient,
                                                                               int whatToShow)
Deprecated. use getDrugOrdersByPatient(Patient, org.openmrs.api.OrderService.ORDER_STATUS)


getDrugOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient,
                                                                               OrderService.ORDER_STATUS orderStatus)
Get drug orders for a given patient, not including voided orders

Parameters:
patient -
orderStatus -
Returns:
List of drug orders, for the given patient, not including voided orders
See Also:
getDrugOrdersByPatient(Patient, org.openmrs.api.OrderService.ORDER_STATUS, boolean)

getDrugOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient,
                                                                               int whatToShow,
                                                                               boolean includeVoided)
Deprecated. use getDrugOrdersByPatient(Patient, org.openmrs.api.OrderService.ORDER_STATUS, boolean)


getDrugOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient,
                                                                               OrderService.ORDER_STATUS orderStatus,
                                                                               boolean includeVoided)
Get drug orders for a given patient

Parameters:
patient - the owning Patient of the returned orders
orderStatus - the status of the orders returned
includeVoided - true/false whether or not to include voided drug orders
Returns:
List of drug orders for the given patient

undiscontinueOrder

@Authorized(value="Edit Orders")
Order undiscontinueOrder(Order order)
                         throws APIException
Un-discontinue order record. Reverse a previous call to discontinueOrder(Order, Concept, Date)

Parameters:
order - order to be un-discontinued
Returns:
The Order that was undiscontinued
Throws:
APIException
See Also:
discontinueOrder(Order, Concept, Date)

unvoidOrder

@Authorized(value="Delete Orders")
Order unvoidOrder(Order order)
                  throws APIException
Unvoid order record. Reverse a previous call to voidOrder(Order, String)

Parameters:
order - order to be unvoided
Returns:
the Order that was unvoided
Throws:
APIException

saveOrderType

@Authorized(value="Manage Order Types")
OrderType saveOrderType(OrderType orderType)
                        throws APIException
Save or update the given orderType in the database

Parameters:
orderType - The OrderType to save in the database
Returns:
the freshly saved OrderType
Throws:
APIException

purgeOrderType

@Authorized(value="Purge Order Types")
void purgeOrderType(OrderType orderType)
                    throws APIException
Completely delete the order type from the system. If data has been stored using this orderType, an exception will be thrown. In that case, consider using the #retiredOrderType(OrderType, String) method

Parameters:
orderType -
Throws:
APIException

createOrderType

@Authorized(value="Manage Order Types")
void createOrderType(OrderType orderType)
                     throws APIException
Deprecated. use #saveOrderType(OrderType)

Throws:
APIException

updateOrderType

@Authorized(value="Manage Order Types")
void updateOrderType(OrderType orderType)
                     throws APIException
Deprecated. use #saveOrderType(OrderType)

Throws:
APIException

deleteOrderType

@Authorized(value="Purge Order Types")
void deleteOrderType(OrderType orderType)
                     throws APIException
Deprecated. use #purgeOrderType(OrderType)

Throws:
APIException

retireOrderType

@Authorized(value="Manage Order Types")
OrderType retireOrderType(OrderType orderType,
                                          java.lang.String reason)
                          throws APIException
This method essentially takes the given orderType out of active use in OpenMRS. All references to this order type will remain in place. Future use of this order type are discouraged.

Parameters:
orderType - the order type to retired
reason - The reason this order type is being taken our of commission.
Returns:
the retired order type
Throws:
APIException

unretireOrderType

@Authorized(value="Manage Order Types")
OrderType unretireOrderType(OrderType orderType)
                            throws APIException
This will bring back a previously decommissioned OrderType

Parameters:
orderType - the order type to unretire
Returns:
the retired order type
Throws:
APIException

getOrderTypes

@Transactional(readOnly=true)
@Authorized(value="View Order Types")
java.util.List<OrderType> getOrderTypes()
                                        throws APIException
Deprecated. use #getAllOrderTypes()

Get all order types

Returns:
order types list
Throws:
APIException

getAllOrderTypes

@Transactional(readOnly=true)
@Authorized(value="View Order Types")
java.util.List<OrderType> getAllOrderTypes()
                                           throws APIException
Get all order types, including retired ones

Returns:
order types list
Throws:
APIException
See Also:
getAllOrderTypes(boolean)

getAllOrderTypes

@Transactional(readOnly=true)
@Authorized(value="View Order Types")
java.util.List<OrderType> getAllOrderTypes(boolean includeRetired)
                                           throws APIException
Get all order types, only showing ones not marked as retired if includeRetired is true

Parameters:
includeRetired - true/false whether to include retired orderTypes in this list
Returns:
order types list
Throws:
APIException

getOrderType

@Transactional(readOnly=true)
@Authorized(value="View Order Types")
OrderType getOrderType(java.lang.Integer orderTypeId)
                       throws APIException
Get orderType by internal identifier

Parameters:
orderTypeId -
Returns:
orderType with given internal identifier
Throws:
APIException

getOrderTypeByUuid

@Transactional(readOnly=true)
OrderType getOrderTypeByUuid(java.lang.String uuid)
                             throws APIException
Get OrderType by its UUID

Parameters:
uuid -
Returns:
Throws:
APIException
Expected behavior:
find object given valid uuid, return null if no object found with given uuid

getDrugOrdersByPatient

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<DrugOrder> getDrugOrdersByPatient(Patient patient)
                                                 throws APIException
Get all orders for the given patient

Returns:
orders list
Throws:
APIException

getDrugSetsByConcepts

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.Map<Concept,java.util.List<DrugOrder>> getDrugSetsByConcepts(java.util.List<DrugOrder> drugOrders,
                                                                                                     java.util.List<Concept> drugSets)
                                                                       throws APIException
Deprecated. use OrderUtil.getDrugSetsByConcepts(List, List)

Throws:
APIException

getStandardRegimens

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.List<RegimenSuggestion> getStandardRegimens()
The standard regimens are currently stored in the application context file. See xml elements after the "STANDARD REGIMENS" comment in the web spring servlet: /web/WEB-INF/openmrs-servlet.xml (These really should be in the non-web spring app context: /metadata/api/spring/applicationContext.xml)

Returns:
list of RegimenSuggestion objects that have been predefined

getDrugSetsByDrugSetIdList

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.Map<java.lang.String,java.util.List<DrugOrder>> getDrugSetsByDrugSetIdList(java.util.List<DrugOrder> orderList,
                                                                                                                   java.lang.String drugSetIdList,
                                                                                                                   java.lang.String delimiter)
Deprecated. use OrderUtil.getDrugSetsByDrugSetIdList(List, String, String)


getDrugSetHeadersByDrugSetIdList

@Transactional(readOnly=true)
@Authorized(value="View Orders")
java.util.Map<java.lang.String,java.lang.String> getDrugSetHeadersByDrugSetIdList(java.lang.String drugSetIds)
Deprecated. use OrderUtil.getDrugSetHeadersByDrugSetIdList(String)


discontinueDrugSet

@Authorized(value="Edit Orders")
void discontinueDrugSet(Patient patient,
                                        java.lang.String drugSetId,
                                        Concept discontinueReason,
                                        java.util.Date discontinueDate)
Deprecated. use OrderUtil.discontinueDrugSet(Patient, String, Concept, Date)


voidDrugSet

@Authorized(value="Delete Orders")
void voidDrugSet(Patient patient,
                                 java.lang.String drugSetId,
                                 java.lang.String voidReason,
                                 int whatToVoid)
Deprecated. use OrderUtil.voidDrugSet(Patient, String, String, org.openmrs.api.OrderService.ORDER_STATUS)


discontinueAllOrders

@Authorized(value="Edit Orders")
void discontinueAllOrders(Patient patient,
                                          Concept discontinueReason,
                                          java.util.Date discontinueDate)
                          throws APIException
Deprecated. use OrderUtil.discontinueAllOrders(Patient, Concept, Date)

Throws:
APIException

getOrdersByEncounter

@Transactional(readOnly=true)
java.util.List<Order> getOrdersByEncounter(Encounter encounter)
Gets all orders contained in an encounter

Parameters:
encounter - the encounter in which to search for orders
Returns:
orders contained in the given encounter

OpenMRS-1.7.x

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