本文整理了Java中org.openmrs.Order.getVoided()
方法的一些代码示例,展示了Order.getVoided()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getVoided()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getVoided
暂无
代码示例来源:origin: openmrs/openmrs-core
throw new APIException("Order.error.invalidDateStoppedAndAutoExpireDate", (Object[]) null);
if (getVoided()) {
return false;
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#voidOrder(org.openmrs.Order, String)
*/
@Test
public void voidOrder_shouldVoidAnOrder() {
Order order = orderService.getOrder(1);
assertFalse(order.getVoided());
assertNull(order.getDateVoided());
assertNull(order.getVoidedBy());
assertNull(order.getVoidReason());
orderService.voidOrder(order, "None");
assertTrue(order.getVoided());
assertNotNull(order.getDateVoided());
assertNotNull(order.getVoidedBy());
assertNotNull(order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* Convenience method to determine if the order is started as of the specified date, returns
* true only if the order has been activated. In case of scheduled orders, the scheduledDate
* becomes the effective start date that gets used to determined if it is started.
*
* @param checkDate - the date on which to check order. if null, will use current date
* @return boolean indicating whether the order is started as of the check date
* @since 1.10.1
* @should return false for a voided order
* @should return false if dateActivated is null
* @should return false if the order is not yet activated as of the check date
* @should return false if the order was scheduled to start after the check date
* @should return true if the order was scheduled to start on the check date
* @should return true if the order was scheduled to start before the check date
* @should return true if the order is started and not scheduled
*/
public boolean isStarted(Date aCheckDate) {
if (getVoided()) {
return false;
}
if (getEffectiveStartDate() == null) {
return false;
}
Date checkDate = aCheckDate == null ? new Date() : aCheckDate;
return !checkDate.before(getEffectiveStartDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldUnvoidAnOrder() {
Order order = orderService.getOrder(8);
assertTrue(order.getVoided());
assertNotNull(order.getDateVoided());
assertNotNull(order.getVoidedBy());
assertNotNull(order.getVoidReason());
orderService.unvoidOrder(order);
assertFalse(order.getVoided());
assertNull(order.getDateVoided());
assertNull(order.getVoidedBy());
assertNull(order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
throw new APIException("Order.error.invalidDateStoppedAndAutoExpireDate", (Object[]) null);
if (getVoided()) {
return false;
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#voidOrder(org.openmrs.Order, String)
*/
@Test
public void shouldVoidAnOrderAndFlushSuccessfully() {
Order order = orderService.getOrder(1);
assertFalse(order.getVoided());
assertNull(order.getDateVoided());
assertNull(order.getVoidedBy());
assertNull(order.getVoidReason());
orderService.voidOrder(order, "None");
//forces hibernate interceptors to get invoked
Context.flushSession();
assertTrue(order.getVoided());
assertNotNull(order.getDateVoided());
assertNotNull(order.getVoidedBy());
assertNotNull(order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* Convenience method to determine if the order is active as of the specified date
*
* @param checkDate - the date on which to check order. if null, will use current date
* @return boolean indicating whether the order was active on the check date
* @since 1.10.1
* @should return true if an order expired on the check date
* @should return true if an order was discontinued on the check date
* @should return true if an order was activated on the check date
* @should return true if an order was activated on the check date but scheduled for the future
* @should return false for a voided order
* @should return false for a discontinued order
* @should return false for an expired order
* @should return false for an order activated after the check date
* @should return false for a discontinuation order
*/
public boolean isActive(Date aCheckDate) {
if (getVoided() || action == Action.DISCONTINUE) {
return false;
}
Date checkDate = aCheckDate == null ? new Date() : aCheckDate;
return isActivated(checkDate) && !isDiscontinued(checkDate) && !isExpired(checkDate);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void shouldUnvoidAnOrderAndFlushSuccessfully() {
Order order = orderService.getOrder(8);
assertTrue(order.getVoided());
assertNotNull(order.getDateVoided());
assertNotNull(order.getVoidedBy());
assertNotNull(order.getVoidReason());
orderService.unvoidOrder(order);
Context.flushSession();
assertFalse(order.getVoided());
assertNull(order.getDateVoided());
assertNull(order.getVoidedBy());
assertNull(order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
if (!o.getVoided()) {
orderService.voidOrder(o, reason);
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#voidOrder(org.openmrs.Order, String)
*/
@Test
public void voidOrder_shouldUnsetDateStoppedOfThePreviousOrderIfTheSpecifiedOrderIsARevision() {
Order order = orderService.getOrder(111);
assertEquals(Action.REVISE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
orderService.voidOrder(order, "None");
Context.flushSession();
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#voidOrder(org.openmrs.Order, String)
*/
@Test
public void voidOrder_shouldUnsetDateStoppedOfThePreviousOrderIfTheSpecifiedOrderIsADiscontinuation() {
Order order = orderService.getOrder(22);
assertEquals(Action.DISCONTINUE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
orderService.voidOrder(order, "None");
//Ensures order interceptor is okay with all the changes
Context.flushSession();
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldStopThePreviousOrderIfTheSpecifiedOrderIsARevision() {
Order order = orderService.getOrder(111);
assertEquals(Action.REVISE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the revise order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
Context.flushSession();
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
orderService.unvoidOrder(order);
Context.flushSession();
assertFalse(order.getVoided());
assertNotNull(previousOrder.getDateStopped());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldStopThePreviousOrderIfTheSpecifiedOrderIsADiscontinuation() {
Order order = orderService.getOrder(22);
assertEquals(Action.DISCONTINUE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the DC order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
Context.flushSession();
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
orderService.unvoidOrder(order);
Context.flushSession();
assertFalse(order.getVoided());
assertNotNull(previousOrder.getDateStopped());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#discontinueOrder(org.openmrs.Order, String, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Test
public void discontinueOrder_shouldFailForAVoidedOrder() {
Order orderToDiscontinue = orderService.getOrder(8);
Encounter encounter = encounterService.getEncounter(3);
assertTrue(orderToDiscontinue.getVoided());
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.discontinueOrder(orderToDiscontinue, "testing", null, null, encounter);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see EncounterService#voidEncounter(Encounter,String)
*/
@Test
public void voidEncounter_shouldCascadeToOrders() {
EncounterService encounterService = Context.getEncounterService();
// get a nonvoided encounter that has some obs
Encounter encounter = encounterService.getEncounter(1);
encounterService.voidEncounter(encounter, "Just Testing");
Order order = Context.getOrderService().getOrder(1);
assertTrue(order.getVoided());
assertEquals("Just Testing", order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see EncounterService#unvoidEncounter(Encounter)
*/
@Test
public void unvoidEncounter_shouldCascadeUnvoidToOrders() {
EncounterService encounterService = Context.getEncounterService();
// get a voided encounter that has some voided obs
Encounter encounter = encounterService.getEncounter(2);
encounterService.unvoidEncounter(encounter);
Order order = Context.getOrderService().getOrder(2);
assertFalse(order.getVoided());
assertNull(order.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws InterruptedException
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldFailForADiscontinuationOrderIfThePreviousOrderIsInactive() throws InterruptedException {
Order order = orderService.getOrder(22);
assertEquals(Action.DISCONTINUE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the DC order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
//stop the order with a different DC order
orderService.discontinueOrder(previousOrder, "Testing", null, previousOrder.getOrderer(),
previousOrder.getEncounter());
Thread.sleep(10);
expectedException.expect(CannotUnvoidOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.action.cannot.unvoid", new Object[] { "discontinuation" },
null));
orderService.unvoidOrder(order);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotAllowRevisingAVoidedOrder() {
Order originalOrder = orderService.getOrder(8);
assertTrue(originalOrder.getVoided());
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setEncounter(encounterService.getEncounter(6));
revisedOrder.setInstructions("Take after a meal");
revisedOrder.setOrderer(providerService.getProvider(1));
revisedOrder.setDateActivated(new Date());
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.saveOrder(revisedOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws InterruptedException
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldFailForAReviseOrderIfThePreviousOrderIsInactive() throws InterruptedException {
Order order = orderService.getOrder(111);
assertEquals(Action.REVISE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the DC order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
//stop the order with a different REVISE order
Order revise = previousOrder.cloneForRevision();
revise.setOrderer(order.getOrderer());
revise.setEncounter(order.getEncounter());
orderService.saveOrder(revise, null);
Thread.sleep(10);
expectedException.expect(CannotUnvoidOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.action.cannot.unvoid", new Object[] { "revision" }, null));
orderService.unvoidOrder(order);
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void shouldAllowEditingADiscontinuationOrder() {
Order originalDCOrder = orderService.getOrder(22);
assertEquals(Order.Action.DISCONTINUE, originalDCOrder.getAction());
List<Order> originalPatientOrders = orderService.getAllOrdersByPatient(originalDCOrder.getPatient());
final Order previousOrder = originalDCOrder.getPreviousOrder();
assertNotNull(previousOrder);
final Date newStartDate = originalDCOrder.getEncounter().getEncounterDatetime();
Order newDcOrder = originalDCOrder.cloneForRevision();
newDcOrder.setEncounter(originalDCOrder.getEncounter());
newDcOrder.setOrderer(originalDCOrder.getOrderer());
newDcOrder.setDateActivated(newStartDate);
orderService.voidOrder(originalDCOrder, "To be replace with a new one");
assertNull(originalDCOrder.getDateStopped());
orderService.saveOrder(newDcOrder, null);
//We need to flush so that we ensure the interceptor is okay with all this
Context.flushSession();
assertTrue(originalDCOrder.getVoided());
List<Order> newPatientOrders = orderService.getAllOrdersByPatient(originalDCOrder.getPatient());
assertEquals(originalPatientOrders.size() + 1, newPatientOrders.size());
Collection<Order> newOrders = CollectionUtils.disjunction(originalPatientOrders, newPatientOrders);
assertEquals(1, newOrders.size());
assertEquals(newOrders.iterator().next().getPreviousOrder(), previousOrder);
}
内容来源于网络,如有侵权,请联系作者删除!