org.openmrs.order
Class OrderUtil

java.lang.Object
  extended by org.openmrs.order.OrderUtil

public class OrderUtil
extends java.lang.Object

Contains convenience methods for working with Orders.


Constructor Summary
OrderUtil()
           
 
Method Summary
static void discontinueAllOrders(Patient patient, Concept discontinueReason, java.util.Date discontinueDate)
          Discontinues all current orders for the given patient
static void discontinueDrugSet(Patient patient, java.lang.String drugSetId, Concept discontinueReason, java.util.Date discontinueDate)
          Discontinue orders for the given patient with the given drug sets ...
static java.util.Map<java.lang.String,java.lang.String> getDrugSetHeadersByDrugSetIdList(java.lang.String drugSetIds)
          Associates the concept id of a drug set to a name of the drug set in the current locale
static java.util.Map<Concept,java.util.List<DrugOrder>> getDrugSetsByConcepts(java.util.List<DrugOrder> drugOrders, java.util.List<Concept> drugSets)
          Splits the drug orders into sublists based on which drug set the order's drug belongs to
static java.util.Map<java.lang.String,java.util.List<DrugOrder>> getDrugSetsByDrugSetIdList(java.util.List<DrugOrder> orderList, java.lang.String drugSetIdList, java.lang.String delimiter)
          Gets a map of DrugOrders that belong to a DrugSet concept ID
static void voidDrugSet(Patient patient, java.lang.String drugSetId, java.lang.String voidReason, OrderService.ORDER_STATUS status)
          Void all DrugOrders for drugs whose concepts are in the given set, and that have the given status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderUtil

public OrderUtil()
Method Detail

discontinueAllOrders

public static void discontinueAllOrders(Patient patient,
                                        Concept discontinueReason,
                                        java.util.Date discontinueDate)
Discontinues all current orders for the given patient

Parameters:
patient -
discontinueReason -
discontinueDate -
See Also:
OrderService.discontinueOrder(org.openmrs.Order, Concept, Date)
Expected behavior:
discontinue all orders for the given patient if none are yet discontinued, not affect orders that were already discontinued on the specified date, not affect orders that end before the specified date, not affect orders that start after the specified date

voidDrugSet

public static void voidDrugSet(Patient patient,
                               java.lang.String drugSetId,
                               java.lang.String voidReason,
                               OrderService.ORDER_STATUS status)
Void all DrugOrders for drugs whose concepts are in the given set, and that have the given status. An end-user would think of this method as "delete all drug orders of the given type".

Parameters:
patient -
drugSetId -
voidReason -
status -
Expected behavior:
void all drug orders of the given type when status is null, void drug orders of the given type for status of CURRENT, void drug orders of the given type for status of COMPLETE, not affect drug orders that are already voided

discontinueDrugSet

public static void discontinueDrugSet(Patient patient,
                                      java.lang.String drugSetId,
                                      Concept discontinueReason,
                                      java.util.Date discontinueDate)
Discontinue orders for the given patient with the given drug sets ...

Parameters:
patient -
drugSetId -
discontinueReason -
discontinueDate -
Expected behavior:
discontinue all orders of the given type for the given patient if none are yet discontinued, not affect orders that were already discontinued on the specified date, not affect orders that end before the specified date, not affect orders that start after the specified date

getDrugSetHeadersByDrugSetIdList

public static java.util.Map<java.lang.String,java.lang.String> getDrugSetHeadersByDrugSetIdList(java.lang.String drugSetIds)
Associates the concept id of a drug set to a name of the drug set in the current locale

Parameters:
drugSetIds - a comma separated list with the concept id of the drug sets
Returns:
Map of the drug headers for the given drugSetIds
Expected behavior:
get map from concept id as string to concept name

getDrugSetsByDrugSetIdList

public static java.util.Map<java.lang.String,java.util.List<DrugOrder>> getDrugSetsByDrugSetIdList(java.util.List<DrugOrder> orderList,
                                                                                                   java.lang.String drugSetIdList,
                                                                                                   java.lang.String delimiter)
Gets a map of DrugOrders that belong to a DrugSet concept ID

Parameters:
orderList - the Drug Order list
drugSetIdList - a 'delimiter' separated list of drug sets
delimiter - the delimiter of drug sets (defaults to a comma if set to null)
Returns:
Map> of DrugOrders that belong to a DrugSet concept_id
Expected behavior:
get a map from concept id as string to drug orders that belong to that drug set, treat an asterisk as all other drugs

getDrugSetsByConcepts

public static java.util.Map<Concept,java.util.List<DrugOrder>> getDrugSetsByConcepts(java.util.List<DrugOrder> drugOrders,
                                                                                     java.util.List<Concept> drugSets)
                                                                              throws APIException
Splits the drug orders into sublists based on which drug set the order's drug belongs to

Parameters:
drugOrders - List of drugOrders
drugSets - List of drugSets concept
Returns:
Map> of a sublist of drug orders mapped by the drug set concept that they belong
Throws:
APIException
Expected behavior:
get a map from concept to drugs orders in that drug set

OpenMRS-1.7.x

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