use of org.openmrs.OrderType in project openmrs-core by openmrs.
the class OrderUtilTest method isType_shouldTrueIfOrderType2IsTheSameOrIsASubtypeOfOrderType1.
/**
* @see OrderUtil#isType(org.openmrs.OrderType, org.openmrs.OrderType)
*/
@Test
public void isType_shouldTrueIfOrderType2IsTheSameOrIsASubtypeOfOrderType1() {
OrderType orderType = new OrderType();
OrderType subType1 = new OrderType();
OrderType subType2 = new OrderType();
subType2.setParent(subType1);
subType1.setParent(orderType);
assertTrue(OrderUtil.isType(subType2, subType2));
assertTrue(OrderUtil.isType(subType1, subType2));
assertTrue(OrderUtil.isType(orderType, subType2));
}
use of org.openmrs.OrderType in project openmrs-core by openmrs.
the class HibernateOrderDAO method getOrderTypeByName.
/**
* @see OrderDAO#getOrderTypeByName
*/
@Override
public OrderType getOrderTypeByName(String orderTypeName) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(OrderType.class);
criteria.add(Restrictions.eq("name", orderTypeName));
return (OrderType) criteria.uniqueResult();
}
use of org.openmrs.OrderType in project openmrs-core by openmrs.
the class OrderServiceTest method getOrderTypeByName_shouldReturnTheOrderTypeThatMatchesTheSpecifiedName.
/**
* @see OrderService#getOrderTypeByName(String)
*/
@Test
public void getOrderTypeByName_shouldReturnTheOrderTypeThatMatchesTheSpecifiedName() {
OrderType orderType = orderService.getOrderTypeByName("Drug order");
assertEquals("131168f4-15f5-102d-96e4-000c29c2a5d7", orderType.getUuid());
}
use of org.openmrs.OrderType in project openmrs-core by openmrs.
the class OrderServiceTest method getOrders_shouldIncludeVoidedMatchesIfIncludeVoidedIsSetToTrue.
/**
* @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
* org.openmrs.OrderType, boolean)
*/
@Test
public void getOrders_shouldIncludeVoidedMatchesIfIncludeVoidedIsSetToTrue() {
Patient patient = patientService.getPatient(2);
CareSetting outPatient = orderService.getCareSetting(1);
OrderType testOrderType = orderService.getOrderType(2);
assertEquals(4, orderService.getOrders(patient, outPatient, testOrderType, true).size());
}
use of org.openmrs.OrderType in project openmrs-core by openmrs.
the class OrderServiceTest method getOrders_shouldIncludeOrdersForSubTypesIfOrderTypeIsSpecified.
/**
* @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
* org.openmrs.OrderType, boolean)
*/
@Test
public void getOrders_shouldIncludeOrdersForSubTypesIfOrderTypeIsSpecified() {
executeDataSet("org/openmrs/api/include/OrderServiceTest-otherOrders.xml");
Patient patient = patientService.getPatient(2);
OrderType testOrderType = orderService.getOrderType(2);
CareSetting outPatient = orderService.getCareSetting(1);
List<Order> orders = orderService.getOrders(patient, outPatient, testOrderType, false);
assertEquals(7, orders.size());
Order[] expectedOrder1 = { orderService.getOrder(6), orderService.getOrder(7), orderService.getOrder(9), orderService.getOrder(101), orderService.getOrder(102), orderService.getOrder(103), orderService.getOrder(104) };
assertThat(orders, hasItems(expectedOrder1));
OrderType labTestOrderType = orderService.getOrderType(7);
orders = orderService.getOrders(patient, outPatient, labTestOrderType, false);
assertEquals(3, orderService.getOrders(patient, outPatient, labTestOrderType, false).size());
Order[] expectedOrder2 = { orderService.getOrder(101), orderService.getOrder(103), orderService.getOrder(104) };
assertThat(orders, hasItems(expectedOrder2));
}
Aggregations