本文整理了Java中org.openmrs.Order.setScheduledDate()
方法的一些代码示例,展示了Order.setScheduledDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.setScheduledDate()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:setScheduledDate
暂无
代码示例来源:origin: openmrs/openmrs-core
public OrderBuilder withScheduledDate(Date date) {
order.setScheduledDate(date);
return this;
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#getEffectiveStartDate()
*/
@Test
public void getEffectiveStartDate_shouldReturnScheduledDateIfUrgencyIsScheduled() throws Exception {
Order order = new Order();
Date date = DateUtils.addDays(new Date(), 2);
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setScheduledDate(date);
order.setDateActivated(new Date());
assertEquals(date, order.getEffectiveStartDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#getEffectiveStartDate()
*/
@Test
public void getEffectiveStartDate_shouldReturnDateActivatedIfUrgencyIsNotScheduled() throws Exception {
Order order = new Order();
Date date = new Date();
order.setScheduledDate(DateUtils.addDays(date, 2));
order.setDateActivated(date);
assertEquals(date, order.getEffectiveStartDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfOrder1AndOrder2DoNotHaveEndDate() {
Date date = new Date();
Order order1 = new Order();
order1.setScheduledDate(DateUtils.addDays(date, 4)); //Order1 scheduled after 4 days without stop date
order1.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
Order order2 = new Order();
order2.setDateActivated(date);
order2.setScheduledDate(DateUtils.addDays(date, 6)); //Order2 scheduled after 6 days without stop date
order2.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1)); //Checks vice versa
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfOrder1AndOrder2HaveSameStartDates() {
Date date = new Date();
Order order1 = new Order();
order1.setDateActivated(date);
order1.setScheduledDate(DateUtils.addDays(date, 6)); //Order1 scheduled after 6 days
order1.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
Order order2 = new Order();
order2.setDateActivated(date);
order2.setScheduledDate(DateUtils.addDays(date, 6)); //Order2 also scheduled after 6 days
order2.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order2));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfOrder1StartsBeforeOrder2AndEndsAfterOrder2() {
Date date = new Date();
Order order1 = new Order();
order1.setScheduledDate(DateUtils.addDays(date, 4)); //Order1 scheduled after 4 days getting expired after 14 days
order1.setAutoExpireDate(DateUtils.addDays(date, 14));
order1.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
Order order2 = new Order();
order2.setDateActivated(date);
order2.setScheduledDate(DateUtils.addDays(date, 6)); //Order2 scheduled after 6 days getting expired after 10 days
order2.setAutoExpireDate(DateUtils.addDays(date, 10));
order2.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isStarted(java.util.Date)
*/
@Test
public void isStarted_shouldReturnTrueIfTheOrderWasScheduledToStartOnTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setScheduledDate(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertTrue(order.isStarted(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isStarted(java.util.Date)
*/
@Test
public void isStarted_shouldReturnTrueIfTheOrderWasScheduledToStartBeforeTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setScheduledDate(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertTrue(order.isStarted(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isStarted(java.util.Date)
*/
@Test
public void isStarted_shouldReturnFalseIfTheOrderWasScheduledToStartAfterTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setScheduledDate(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
assertFalse(order.isStarted(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfOrder1StartsWhenTheOrder2IsActive() {
Date date = new Date();
Order order1 = new Order();
order1.setScheduledDate(DateUtils.addDays(date, 3)); //Order1 scheduled after 3 days
order1.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
Order order2 = new Order();
order2.setDateActivated(date); //Order2 scheduled today getting expired after 4 days
order2.setAutoExpireDate(DateUtils.addDays(date, 4));
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnFalseIfOrder1StartsAfterOrder2() {
Date date = new Date();
Order order1 = new Order();
order1.setScheduledDate(DateUtils.addDays(date, 11)); //Order1 getting started after existing order's stop
order1.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
Order order2 = new Order();
order2.setDateActivated(date);
order2.setAutoExpireDate(DateUtils.addDays(date, 2)); //Order2 expiring after 2 days
assertFalse(OrderUtil.checkScheduleOverlap(order1, order2));
assertFalse(OrderUtil.checkScheduleOverlap(order2, order1));
}
代码示例来源: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 OrderValidator#validate(Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldFailValidationIfScheduledDateIsSetAndUrgencyIsNotSetAsON_SCHEDULED_DATE() {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
order.setScheduledDate(new Date());
order.setUrgency(Order.Urgency.ROUTINE);
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("urgency"));
order.setScheduledDate(new Date());
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertFalse(errors.hasFieldErrors("urgency"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnFalseIfOrder1EndsBeforeOrder2Starts() {
Date date = new Date();
Order order1 = new Order();
order1.setDateActivated(date);
order1.setAutoExpireDate(DateUtils.addDays(date, 2)); //Order1 getting expired after 2 days
Order order2 = new Order();
order2.setDateActivated(date);
order2.setScheduledDate(DateUtils.addDays(date, 4)); //Order2 scheduled after 4 days
order2.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
assertFalse(OrderUtil.checkScheduleOverlap(order1, order2));
assertFalse(OrderUtil.checkScheduleOverlap(order2, order1));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* versa
* @see OrderUtil#checkScheduleOverlap(Order,Order)
*/
@Test
public void checkScheduleOverlap_shouldReturnTrueIfOrder1StopsAfterTheOrder2HasAlreadyBeenActivated() {
Date date = new Date();
Order order1 = new Order();
order1.setDateActivated(date); //Order1 scheduled today getting expired after 5 days
order1.setAutoExpireDate(DateUtils.addDays(date, 5));
Order order2 = new Order();
order2.setDateActivated(date);
order2.setScheduledDate(DateUtils.addDays(date, 4)); //Order2 scheduled after 4 days
order2.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
assertTrue(OrderUtil.checkScheduleOverlap(order1, order2));
assertTrue(OrderUtil.checkScheduleOverlap(order2, order1));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(Date)
*/
@Test
public void isDiscontinued_shouldReturnTrueIfTheOrderIsScheduledForTheFutureAndActivatedOnCheckDateButTheCheckDateIsAfterDateStopped()
throws Exception {
// tests the case when a scheduled order is revised:
// in that case its original order is stopped.
// the stopped date of the original order is set to a moment before the activated date of the revised order.
// the order here represents such an original order
Order order = new Order();
order.setUrgency(Urgency.ON_SCHEDULED_DATE);
Date today = new Date();
Date scheduledDateInFuture = DateUtils.addMonths(today, 2);
order.setScheduledDate(scheduledDateInFuture);
Date activationDate = DateUtils.addDays(today, -2);
order.setDateActivated(activationDate);
Date stopDate = new Date();
OrderUtilTest.setDateStopped(order, stopDate);
assertNotNull(order.getDateActivated());
assertNotNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isDiscontinued(DateUtils.addSeconds(stopDate, 1)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldFailValidationIfScheduledDateIsNullWhenUrgencyIsON_SCHEDULED_DATE() {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setScheduledDate(null);
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("scheduledDate"));
order.setScheduledDate(new Date());
order.setUrgency(Order.Urgency.STAT);
errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertFalse(errors.hasFieldErrors("scheduledDate"));
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void saveOrderWithScheduledDate_shouldAddANewOrderWithScheduledDateToTheDatabase() {
Date scheduledDate = new Date();
Order order = new Order();
order.setAction(Action.NEW);
order.setPatient(Context.getPatientService().getPatient(7));
order.setConcept(Context.getConceptService().getConcept(5497));
order.setCareSetting(orderService.getCareSetting(1));
order.setOrderer(orderService.getOrder(1).getOrderer());
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
order.setScheduledDate(scheduledDate);
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order.setEncounter(encounterService.getEncounter(3));
order.setOrderType(orderService.getOrderType(17));
order = orderService.saveOrder(order, null);
Order newOrder = orderService.getOrder(order.getOrderId());
assertNotNull(order);
assertEquals(DateUtil.truncateToSeconds(scheduledDate), order.getScheduledDate());
assertNotNull(newOrder);
assertEquals(DateUtil.truncateToSeconds(scheduledDate), newOrder.getScheduledDate());
}
代码示例来源:origin: openmrs/openmrs-core
order.setOrderType(orderService.getOrderType(17));
order.setDateActivated(new Date());
order.setScheduledDate(DateUtils.addMonths(new Date(), 2));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order = orderService.saveOrder(order, null);
代码示例来源:origin: openmrs/openmrs-core
order.setOrderType(orderService.getOrderType(17));
order.setDateActivated(new Date());
order.setScheduledDate(DateUtils.addMonths(new Date(), 2));
order.setUrgency(Order.Urgency.ON_SCHEDULED_DATE);
order = orderService.saveOrder(order, null);
内容来源于网络,如有侵权,请联系作者删除!