public interface OrderService extends OpenmrsService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PARALLEL_ORDERS |
Modifier and Type | Method and Description |
---|---|
Order |
discontinueOrder(Order orderToDiscontinue,
Concept reasonCoded,
java.util.Date discontinueDate,
Provider orderer,
Encounter encounter)
Discontinues an order.
|
Order |
discontinueOrder(Order orderToDiscontinue,
java.lang.String reasonNonCoded,
java.util.Date discontinueDate,
Provider orderer,
Encounter encounter)
Discontinues an order.
|
java.util.List<Order> |
getActiveOrders(Patient patient,
OrderType orderType,
CareSetting careSetting,
java.util.Date asOfDate)
Gets all active orders for the specified patient matching the specified CareSetting,
OrderType as of the specified date.
|
java.util.List<Order> |
getAllOrdersByPatient(Patient patient)
Gets all orders for the specified patient including discontinuation orders
|
CareSetting |
getCareSetting(java.lang.Integer careSettingId)
Retrieve care setting
|
CareSetting |
getCareSettingByName(java.lang.String name)
Gets the CareSetting with the specified name
|
CareSetting |
getCareSettingByUuid(java.lang.String uuid)
Gets the CareSetting with the specified uuid
|
java.util.List<CareSetting> |
getCareSettings(boolean includeRetired)
Gets all non retired CareSettings if includeRetired is set to true otherwise retired ones are
included too
|
Order |
getDiscontinuationOrder(Order order)
Get discontinuation order for the given order, it is the un voided discontinuation order with
a previousOrder that matches the specified order.
|
java.util.List<Concept> |
getDrugDispensingUnits()
Gets the possible units of dispensing, i.e the set members for the concept that matches the
uuid specified as the value for the global property
OpenmrsConstants.GP_DRUG_DISPENSING_UNITS_CONCEPT_UUID |
java.util.List<Concept> |
getDrugDosingUnits()
Gets the possible drug dosing units, i.e the set members for the concept that matches the
uuid specified as the value for the global property
OpenmrsConstants.GP_DRUG_DOSING_UNITS_CONCEPT_UUID |
java.util.List<Concept> |
getDrugRoutes()
Gets the possible drug routes, i.e the set members for the concept that matches the uuid
specified as the value for the global property
OpenmrsConstants.GP_DRUG_ROUTES_CONCEPT_UUID |
java.util.List<Concept> |
getDurationUnits()
Gets the possible units of duration, i.e the set members for the concept that matches the
uuid specified as the value for the global property
OpenmrsConstants.GP_DURATION_UNITS_CONCEPT_UUID |
java.lang.Long |
getNextOrderNumberSeedSequenceValue()
Gets the next available order number seed
|
Order |
getOrder(java.lang.Integer orderId)
Get order by internal primary key identifier
|
Order |
getOrderByOrderNumber(java.lang.String orderNumber)
Gets the order identified by a given order number
|
Order |
getOrderByUuid(java.lang.String uuid)
Get Order by its UUID
|
java.util.List<OrderFrequency> |
getOrderFrequencies(boolean includeRetired)
Gets all order frequencies
|
java.util.List<OrderFrequency> |
getOrderFrequencies(java.lang.String searchPhrase,
java.util.Locale locale,
boolean exactLocale,
boolean includeRetired)
Gets all non retired order frequencies associated to concepts that match the specified search
phrase
|
OrderFrequency |
getOrderFrequency(java.lang.Integer orderFrequencyId)
Gets OrderFrequency that matches the specified orderFrequencyId
|
OrderFrequency |
getOrderFrequencyByConcept(Concept concept)
Gets an OrderFrequency that matches the specified concept
|
OrderFrequency |
getOrderFrequencyByUuid(java.lang.String uuid)
Gets OrderFrequency that matches the specified uuid
|
java.util.List<Order> |
getOrderHistoryByConcept(Patient patient,
Concept concept)
Gets all Order objects that use this Concept for a given patient.
|
java.util.List<Order> |
getOrderHistoryByOrderNumber(java.lang.String orderNumber)
Gets the order matching the specified order number and its previous orders in the ordering
they occurred, i.e if this order has a previous order, fetch it and if it also has a previous
order then fetch it until the original one with no previous order is reached
|
java.util.List<Order> |
getOrders(Patient patient,
CareSetting careSetting,
OrderType orderType,
boolean includeVoided)
Gets all Orders that match the specified parameters excluding discontinuation orders
|
OrderType |
getOrderType(java.lang.Integer orderTypeId)
Get OrderType by orderTypeId
|
OrderType |
getOrderTypeByConcept(Concept concept)
Gets the order type mapped to a given concept
|
OrderType |
getOrderTypeByConceptClass(ConceptClass conceptClass)
Gets the order type mapped to a given concept class
|
OrderType |
getOrderTypeByName(java.lang.String orderTypeName)
Gets OrderType that matches the specified name
|
OrderType |
getOrderTypeByUuid(java.lang.String uuid)
Get OrderType by uuid
|
java.util.List<OrderType> |
getOrderTypes(boolean includeRetired)
Get all order types, if includeRetired is set to true then retired ones will be included
otherwise not
|
Order |
getRevisionOrder(Order order)
Get revision order for the given order, it is the order with the changes that was created as
a replacement for the specified order.
|
java.util.List<OrderType> |
getSubtypes(OrderType orderType,
boolean includeRetired)
Returns all descendants of a given order type for example Given TEST will get back LAB TEST
and RADIOLOGY TEST; and Given LAB TEST, will might get back SEROLOGY, MICROBIOLOGY, and
CHEMISTRY
|
java.util.List<Concept> |
getTestSpecimenSources()
Gets the possible test specimen sources, i.e the set members for the concept that matches the
uuid specified as the value for the global property
OpenmrsConstants.GP_TEST_SPECIMEN_SOURCES_CONCEPT_UUID |
void |
purgeOrder(Order order)
Completely delete an order from the database.
|
void |
purgeOrder(Order order,
boolean cascade)
Completely delete an order from the database.
|
void |
purgeOrderFrequency(OrderFrequency orderFrequency)
Completely removes an order frequency from the database
|
void |
purgeOrderType(OrderType orderType)
Completely removes an order type from the database
|
OrderFrequency |
retireOrderFrequency(OrderFrequency orderFrequency,
java.lang.String reason)
Retires the given order frequency in the database
|
OrderType |
retireOrderType(OrderType orderType,
java.lang.String reason)
Retires the given order type in the database
|
Order |
saveOrder(Order order,
OrderContext orderContext)
Save or update the given
order in the database. |
OrderFrequency |
saveOrderFrequency(OrderFrequency orderFrequency)
Creates or updates the given order frequency in the database
|
OrderType |
saveOrderType(OrderType orderType)
Creates or updates the given order type in the database
|
void |
setOrderDAO(OrderDAO dao)
Setter for the Order data access object.
|
OrderFrequency |
unretireOrderFrequency(OrderFrequency orderFrequency)
Restores an order frequency that was previously retired in the database
|
OrderType |
unretireOrderType(OrderType orderType)
Restores an order type that was previously retired in the database
|
Order |
unvoidOrder(Order order)
Unvoid order record.
|
Order |
voidOrder(Order order,
java.lang.String voidReason)
Mark an order as voided.
|
onShutdown, onStartup
static final java.lang.String PARALLEL_ORDERS
void setOrderDAO(OrderDAO dao)
dao
- The data access object to use@Authorized(value={"Edit Orders","Add Orders"}) Order saveOrder(Order order, OrderContext orderContext) throws APIException
order
in the database. If the OrderType for the order
is not specified, then it will be set to the one set on the OrderContext if any, if none
exists on the orderContext, then it will be set to the one associated to the ConceptClass of
the ordered concept otherwise the save fails. If the CareSetting field of the order is not
specified then it will default to the one set on the passed in OrderContext if any otherwise
the save fails.order
- the Order to saveorderContext
- the OrderContext objectAPIException
@Authorized(value="Purge Orders") void purgeOrder(Order order) throws APIException
voidOrder(Order, String)
order
- The Order to remove from the systemAPIException
@Authorized(value="Purge Orders") void purgeOrder(Order order, boolean cascade) throws APIException
voidOrder(Order, String)
This method is different from purgeOrder(Order order) above: If param cascade is false will
completely delete an order from the database period If param cascade is true will completely
delete an order from the database and delete any Obs that references the Order.order
- The Order to remove from the systemcascade
- APIException
@Authorized(value="Delete Orders") Order voidOrder(Order order, java.lang.String voidReason) throws APIException
voidReason
- String reasonorder
- Order to voidAPIException
@Authorized(value="View Orders") Order getOrder(java.lang.Integer orderId) throws APIException
orderId
- internal order identifierAPIException
@Authorized(value="View Orders") Order getOrderByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
Order getDiscontinuationOrder(Order order) throws APIException
order
- APIException
Order getRevisionOrder(Order order) throws APIException
order
- APIException
@Authorized(value="View Orders") java.util.List<Order> getOrders(Patient patient, CareSetting careSetting, OrderType orderType, boolean includeVoided)
patient
- the patient to match oncareSetting
- the CareSetting to match onorderType
- The OrderType to match onincludeVoided
- Specifies whether voided orders should be included or not@Authorized(value="View Orders") java.util.List<Order> getAllOrdersByPatient(Patient patient)
patient
- the patient to match onOrder
@Authorized(value="Delete Orders") Order unvoidOrder(Order order) throws APIException
voidOrder(Order, String)
order
- order to be unvoidedAPIException
@Authorized(value="View Orders") Order getOrderByOrderNumber(java.lang.String orderNumber)
orderNumber
- the order number@Authorized(value="View Orders") java.util.List<Order> getOrderHistoryByConcept(Patient patient, Concept concept)
patient
- the patient.concept
- the concept.@Authorized(value="Add Orders") java.lang.Long getNextOrderNumberSeedSequenceValue()
@Authorized(value="View Orders") java.util.List<Order> getOrderHistoryByOrderNumber(java.lang.String orderNumber)
orderNumber
- the order number whose history to get@Authorized(value="View Orders") java.util.List<Order> getActiveOrders(Patient patient, OrderType orderType, CareSetting careSetting, java.util.Date asOfDate)
- Not voided - Not a discontinuation Order i.e one where action != Action#DISCONTINUE - dateActivated is before or equal to asOfDate - dateStopped and autoExpireDate are both null OR if it has dateStopped, then it should be after asOfDate OR if it has autoExpireDate, then it should be after asOfDate. NOTE: If both dateStopped and autoExpireDate are set then dateStopped wins because an order can never expire and then stopped later i.e. you stop an order that hasn't yet expired
patient
- the patientorderType
- The OrderType to matchcareSetting
- the care setting, returns all ignoring care setting if value is nullasOfDate
- defaults to current time@Authorized(value="Get Care Settings") CareSetting getCareSetting(java.lang.Integer careSettingId)
careSettingId
- @Authorized(value="Get Care Settings") CareSetting getCareSettingByUuid(java.lang.String uuid)
uuid
- the uuid to match on@Authorized(value="Get Care Settings") CareSetting getCareSettingByName(java.lang.String name)
name
- the name to match on@Authorized(value="Get Care Settings") java.util.List<CareSetting> getCareSettings(boolean includeRetired)
includeRetired
- specifies whether retired care settings should be returned or not@Authorized(value="View Order Types") OrderType getOrderTypeByName(java.lang.String orderTypeName)
orderTypeName
- the name to match against@Authorized(value="Get Order Frequencies") OrderFrequency getOrderFrequency(java.lang.Integer orderFrequencyId)
orderFrequencyId
- the id to match against@Authorized(value="Get Order Frequencies") OrderFrequency getOrderFrequencyByUuid(java.lang.String uuid)
uuid
- the uuid to match against@Authorized(value="Get Order Frequencies") OrderFrequency getOrderFrequencyByConcept(Concept concept)
concept
- the concept to match against@Authorized(value="Get Order Frequencies") java.util.List<OrderFrequency> getOrderFrequencies(boolean includeRetired)
includeRetired
- specifies whether retired ones should be included or not@Authorized(value="Get Order Frequencies") java.util.List<OrderFrequency> getOrderFrequencies(java.lang.String searchPhrase, java.util.Locale locale, boolean exactLocale, boolean includeRetired)
searchPhrase
- The string to match onlocale
- The locale to match on when searching in associated concept namesexactLocale
- If false then order frequencies associated to concepts with names in a
broader locale will be matched e.g in case en_GB is passed in then en will be
matchedincludeRetired
- Specifies if retired order frequencies that match should be included or
not@Authorized(value="Add Orders") Order discontinueOrder(Order orderToDiscontinue, Concept reasonCoded, java.util.Date discontinueDate, Provider orderer, Encounter encounter) throws java.lang.Exception
orderToDiscontinue
- reasonCoded
- discontinueDate
- orderer
- encounter
- APIException
- if the action
of orderToDiscontinue is
Order.Action.DISCONTINUE
java.lang.Exception
@Authorized(value="Add Orders") Order discontinueOrder(Order orderToDiscontinue, java.lang.String reasonNonCoded, java.util.Date discontinueDate, Provider orderer, Encounter encounter) throws java.lang.Exception
orderToDiscontinue
- reasonNonCoded
- discontinueDate
- orderer
- encounter
- APIException
- if the action
of orderToDiscontinue is
Order.Action.DISCONTINUE
java.lang.Exception
@Authorized(value="Manage Order Frequencies") OrderFrequency saveOrderFrequency(OrderFrequency orderFrequency) throws APIException
orderFrequency
- the order frequency to saveAPIException
@Authorized(value="Manage Order Frequencies") OrderFrequency retireOrderFrequency(OrderFrequency orderFrequency, java.lang.String reason)
orderFrequency
- the order frequency to retirereason
- the retire reason@Authorized(value="Manage Order Frequencies") OrderFrequency unretireOrderFrequency(OrderFrequency orderFrequency)
orderFrequency
- the order frequency to unretire@Authorized(value="Purge Order Frequencies") void purgeOrderFrequency(OrderFrequency orderFrequency) throws APIException
orderFrequency
- the order frequency to purgeAPIException
@Authorized(value="View Order Types") OrderType getOrderType(java.lang.Integer orderTypeId)
orderTypeId
- the orderTypeId to match on@Authorized(value="View Order Types") OrderType getOrderTypeByUuid(java.lang.String uuid)
uuid
- the uuid to match on@Authorized(value="View Order Types") java.util.List<OrderType> getOrderTypes(boolean includeRetired)
includeRetired
- boolean flag which indicate search needs to look at retired order types
or not@Authorized(value="Manage Order Types") OrderType saveOrderType(OrderType orderType)
orderType
- the order type to save@Authorized(value="Purge Order Types") void purgeOrderType(OrderType orderType) throws APIException
orderType
- the order type to purgeAPIException
@Authorized(value="Manage Order Types") OrderType retireOrderType(OrderType orderType, java.lang.String reason)
orderType
- the order type to retirereason
- the retire reason@Authorized(value="Manage Order Types") OrderType unretireOrderType(OrderType orderType)
orderType
- the order type to unretire@Authorized(value="Manage Order Types") java.util.List<OrderType> getSubtypes(OrderType orderType, boolean includeRetired)
orderType
- the order type which needs to search for its' dependenciesincludeRetired
- boolean flag for include retired order types or not@Authorized(value="View Order Types") OrderType getOrderTypeByConceptClass(ConceptClass conceptClass)
conceptClass
- the concept class@Authorized(value="View Order Types") OrderType getOrderTypeByConcept(Concept concept)
concept
- the concept@Authorized(value="View Concepts") java.util.List<Concept> getDrugRoutes()
OpenmrsConstants.GP_DRUG_ROUTES_CONCEPT_UUID
@Authorized(value="View Concepts") java.util.List<Concept> getDrugDosingUnits()
OpenmrsConstants.GP_DRUG_DOSING_UNITS_CONCEPT_UUID
@Authorized(value="View Concepts") java.util.List<Concept> getDrugDispensingUnits()
OpenmrsConstants.GP_DRUG_DISPENSING_UNITS_CONCEPT_UUID
@Authorized(value="View Concepts") java.util.List<Concept> getDurationUnits()
OpenmrsConstants.GP_DURATION_UNITS_CONCEPT_UUID
@Authorized(value="View Concepts") java.util.List<Concept> getTestSpecimenSources()
OpenmrsConstants.GP_TEST_SPECIMEN_SOURCES_CONCEPT_UUID
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.