本文整理了Java中org.openmrs.Order.cloneForDiscontinuing()
方法的一些代码示例,展示了Order.cloneForDiscontinuing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.cloneForDiscontinuing()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:cloneForDiscontinuing
[英]Creates a discontinuation order for this order, sets the previousOrder and action fields, note that the discontinuation order needs to be saved for the discontinuation to take effect
[中]为此订单创建中止订单,设置previousOrder和action字段,请注意,需要保存中止订单才能使中止生效
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.OrderService#discontinueOrder(org.openmrs.Order, String, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Override
public Order discontinueOrder(Order orderToDiscontinue, String reasonNonCoded, Date discontinueDate, Provider orderer,
Encounter encounter) {
if (discontinueDate == null) {
discontinueDate = aMomentBefore(new Date());
}
stopOrder(orderToDiscontinue, discontinueDate, false);
Order newOrder = orderToDiscontinue.cloneForDiscontinuing();
newOrder.setOrderReasonNonCoded(reasonNonCoded);
newOrder.setOrderer(orderer);
newOrder.setEncounter(encounter);
newOrder.setDateActivated(discontinueDate);
return saveOrderInternal(newOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.OrderService#discontinueOrder(org.openmrs.Order, org.openmrs.Concept,
* java.util.Date, org.openmrs.Provider, org.openmrs.Encounter)
*/
@Override
public Order discontinueOrder(Order orderToDiscontinue, Concept reasonCoded, Date discontinueDate, Provider orderer,
Encounter encounter) {
if (discontinueDate == null) {
discontinueDate = aMomentBefore(new Date());
}
stopOrder(orderToDiscontinue, discontinueDate, false);
Order newOrder = orderToDiscontinue.cloneForDiscontinuing();
newOrder.setOrderReason(reasonCoded);
newOrder.setOrderer(orderer);
newOrder.setEncounter(encounter);
newOrder.setDateActivated(discontinueDate);
return saveOrderInternal(newOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void saveRetrospectiveOrder_shouldDiscontinueOrderInRetrospectiveEntry() throws ParseException {
executeDataSet("org/openmrs/api/include/OrderServiceTest-ordersWithAutoExpireDate.xml");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");
Date originalOrderDateActivated = dateFormat.parse("2008-11-19 09:24:10.0");
Date discontinuationOrderDate = DateUtils.addDays(originalOrderDateActivated, 2);
Order originalOrder = orderService.getOrder(201);
assertNull(originalOrder.getDateStopped());
assertEquals(dateFormat.parse("2008-11-23 09:24:09.0"), originalOrder.getAutoExpireDate());
assertFalse(originalOrder.isActive());
assertTrue(originalOrder.isActive(discontinuationOrderDate));
Order discontinueationOrder = originalOrder.cloneForDiscontinuing();
discontinueationOrder.setPreviousOrder(originalOrder);
discontinueationOrder.setEncounter(encounterService.getEncounter(17));
discontinueationOrder.setOrderer(providerService.getProvider(1));
discontinueationOrder.setDateActivated(discontinuationOrderDate);
orderService.saveRetrospectiveOrder(discontinueationOrder, null);
assertNotNull(originalOrder.getDateStopped());
assertEquals(discontinueationOrder.getAutoExpireDate(), discontinueationOrder.getDateActivated());
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void saveRetrospectiveOrder_shouldDiscontinueAndStopActiveOrderInRetrospectiveEntry() throws ParseException {
executeDataSet("org/openmrs/api/include/OrderServiceTest-ordersWithAutoExpireDate.xml");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");
Date originalOrderDateActivated = dateFormat.parse("2008-11-19 09:24:10.0");
Date discontinuationOrderDate = DateUtils.addDays(originalOrderDateActivated, 2);
Order originalOrder = orderService.getOrder(202);
assertNull(originalOrder.getDateStopped());
assertEquals(dateFormat.parse("2008-11-23 09:24:09.0"), originalOrder.getAutoExpireDate());
assertFalse(originalOrder.isActive());
assertTrue(originalOrder.isActive(discontinuationOrderDate));
Order discontinuationOrder = originalOrder.cloneForDiscontinuing();
discontinuationOrder.setPreviousOrder(null);
discontinuationOrder.setEncounter(encounterService.getEncounter(17));
discontinuationOrder.setOrderer(providerService.getProvider(1));
discontinuationOrder.setDateActivated(discontinuationOrderDate);
orderService.saveRetrospectiveOrder(discontinuationOrder, null);
assertNotNull(originalOrder.getDateStopped());
assertEquals(discontinuationOrder.getAutoExpireDate(), discontinuationOrder.getDateActivated());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldFailIfConceptInPreviousOrderDoesNotMatchThisConcept() {
Order previousOrder = orderService.getOrder(7);
assertTrue(OrderUtilTest.isActiveOrder(previousOrder, null));
Order order = previousOrder.cloneForDiscontinuing();
order.setDateActivated(new Date());
order.setOrderReasonNonCoded("Discontinue this");
order.setEncounter(encounterService.getEncounter(6));
order.setOrderer(providerService.getProvider(1));
Concept newConcept = conceptService.getConcept(5089);
assertFalse(previousOrder.getConcept().equals(newConcept));
order.setConcept(newConcept);
expectedException.expect(EditedOrderDoesNotMatchPreviousException.class);
expectedException.expectMessage("The orderable of the previous order and the new one order don't match");
orderService.saveOrder(order, null);
}
代码示例来源:origin: openmrs/openmrs-core
Order discontinuationOrder = thirdOrderToDiscontinue.cloneForDiscontinuing();
discontinuationOrder.setOrderer(orderer);
discontinuationOrder.setEncounter(encounterService.getEncounter(6));
代码示例来源:origin: openmrs/openmrs-module-htmlformentry
private Order newDiscontinuationOrder(Date discontinuedDate, String discontinuedReasonStr, Order o) {
Order discontinuationOrder;
discontinuationOrder = o.cloneForDiscontinuing();
discontinuationOrder.setDateActivated(discontinuedDate);
if (!StringUtils.isEmpty(discontinuedReasonStr)) {
discontinuationOrder.setOrderReason(HtmlFormEntryUtil.getConcept(discontinuedReasonStr));
}
return discontinuationOrder;
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldFailIfTheCareSettingOfThePreviousOrderDoesNotMatch() {
Order order = orderService.getOrder(7);
assertTrue(OrderUtilTest.isActiveOrder(order, null));
Order discontinuationOrder = order.cloneForDiscontinuing();
CareSetting careSetting = orderService.getCareSetting(2);
assertNotEquals(discontinuationOrder.getCareSetting(), careSetting);
discontinuationOrder.setCareSetting(careSetting);
discontinuationOrder.setOrderer(Context.getProviderService().getProvider(1));
discontinuationOrder.setEncounter(Context.getEncounterService().getEncounter(6));
expectedException.expect(EditedOrderDoesNotMatchPreviousException.class);
expectedException.expectMessage(mss.getMessage("Order.care.setting.doesnot.match"));
orderService.saveOrder(discontinuationOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldFailIfTheOrderTypeOfThePreviousOrderDoesNotMatch() {
Order order = orderService.getOrder(7);
assertTrue(OrderUtilTest.isActiveOrder(order, null));
Order discontinuationOrder = order.cloneForDiscontinuing();
OrderType orderType = orderService.getOrderType(7);
assertNotEquals(discontinuationOrder.getOrderType(), orderType);
assertTrue(OrderUtil.isType(discontinuationOrder.getOrderType(), orderType));
discontinuationOrder.setOrderType(orderType);
discontinuationOrder.setOrderer(Context.getProviderService().getProvider(1));
discontinuationOrder.setEncounter(Context.getEncounterService().getEncounter(6));
expectedException.expect(EditedOrderDoesNotMatchPreviousException.class);
expectedException.expectMessage(mss.getMessage("Order.type.doesnot.match"));
orderService.saveOrder(discontinuationOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
anOrder.setOrderType(new OrderType());
Order orderThatCanDiscontinueTheOrder = anOrder.cloneForDiscontinuing();
内容来源于网络,如有侵权,请联系作者删除!