本文整理了Java中org.openmrs.Order.getAutoExpireDate()
方法的一些代码示例,展示了Order.getAutoExpireDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getAutoExpireDate()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getAutoExpireDate
暂无
代码示例来源:origin: openmrs/openmrs-core
/**
* A convenience method to return end of the schedule for order.
*
* @since 1.10
* @should return dateStopped if dateStopped is not null
* @should return autoExpireDate if dateStopped is null
*/
public Date getEffectiveStopDate() {
return this.getDateStopped() != null ? this.getDateStopped() : this.getAutoExpireDate();
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#discontinueOrder(org.openmrs.Order, org.openmrs.Concept, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Test
public void discontinueOrder_shouldFailForAnExpiredOrder() {
Order orderToDiscontinue = orderService.getOrder(6);
Encounter encounter = encounterService.getEncounter(3);
assertNotNull(orderToDiscontinue.getAutoExpireDate());
assertTrue(orderToDiscontinue.getAutoExpireDate().before(new Date()));
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.discontinueOrder(orderToDiscontinue, Context.getConceptService().getConcept(1), null, null, encounter);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotAllowRevisingAnExpiredOrder() {
Order originalOrder = orderService.getOrder(6);
assertNotNull(originalOrder.getAutoExpireDate());
assertTrue(originalOrder.getAutoExpireDate().before(new Date()));
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setEncounter(encounterService.getEncounter(6));
revisedOrder.setInstructions("Take after a meal");
revisedOrder.setOrderer(providerService.getProvider(1));
revisedOrder.setDateActivated(new Date());
revisedOrder.setAutoExpireDate(new Date());
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.saveOrder(revisedOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws ParseException
* @see OrderUtil#checkScheduleOverlap(org.openmrs.Order, org.openmrs.Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfBothOrdersStartAndEndOnSameDates() throws ParseException {
DateFormat df = new SimpleDateFormat("dd/MM/yyy");
Order order1 = new Order();
order1.setDateActivated(df.parse("05/08/2014"));
order1.setAutoExpireDate(df.parse("13/08/2014"));
Order order2 = new Order();
order2.setDateActivated(order1.getDateActivated());
order2.setDateActivated(order1.getAutoExpireDate());
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1));
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws ParseException
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotChangeTheAutoExpireDateIfItHasATimeComponent() throws ParseException {
Order order = new TestOrder();
order.setPatient(patientService.getPatient(2));
order.setCareSetting(orderService.getCareSetting(2));
order.setConcept(conceptService.getConcept(5089));
order.setEncounter(encounterService.getEncounter(6));
order.setOrderer(providerService.getProvider(1));
order.setDateActivated(new Date());
DateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
order.setDateActivated(dateformat.parse("14/08/2014 10:00:00"));
Date autoExpireDate = dateformat.parse("18/08/2014 10:00:00");
order.setAutoExpireDate(autoExpireDate);
orderService.saveOrder(order, null);
assertEquals(autoExpireDate, order.getAutoExpireDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnFalseIfDateActivatedIsNull() throws Exception {
Order order = new Order();
assertNull(order.getDateActivated());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnFalseIfAutoExpireDateIsNullAndDateStoppedIsEqualToCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
Date checkDate = DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT);
OrderUtilTest.setDateStopped(order, checkDate);
assertNull(order.getAutoExpireDate());
assertFalse(order.isDiscontinued(checkDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActivated(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(Date)
*/
@Test
public void isActive_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDateButScheduledForTheFuture() throws Exception {
Order order = new Order();
order.setUrgency(Urgency.ON_SCHEDULED_DATE);
Date scheduledDateInFuture = DateUtils.addMonths(new Date(), 2);
order.setScheduledDate(scheduledDateInFuture);
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfDateStoppedAndAutoExpireDateAreBothNull() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnFalseIfDateStoppedAndAutoExpireDateAreBothNull() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedBeforeTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActivated(DateUtils.addMonths(activationDate, 2)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForADiscontinuationOrder() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
order.setAction(Order.Action.DISCONTINUE);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnFalseIfAutoExpireDateIsNullAndDateStoppedIsAfterCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
assertNull(order.getAutoExpireDate());
assertFalse(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnTrueIfAutoExpireDateIsNullAndDateStoppedIsBeforeCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertNull(order.getAutoExpireDate());
assertTrue(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForAnOrderActivatedAfterTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(DateUtils.parseDate("2014-11-01 11:11:09", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnFalseForAVoidedOrder() throws Exception {
Order order = new Order();
order.setVoided(true);
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertNull(order.getAutoExpireDate());
assertFalse(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnFalseForAnOrderActivatedAfterTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActivated(DateUtils.addMonths(order.getDateActivated(), -2)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForAVoidedOrder() throws Exception {
Order order = new Order();
order.setVoided(true);
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
内容来源于网络,如有侵权,请联系作者删除!