org.openmrs.Order.setAction()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中org.openmrs.Order.setAction()方法的一些代码示例,展示了Order.setAction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.setAction()方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:setAction

Order.setAction介绍

[英]Sets the ation
[中]设定目标

代码示例

代码示例来源:origin: openmrs/openmrs-core

public OrderBuilder withAction(Order.Action action) {
  order.setAction(action);
  return this;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * 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
 * 
 * @return the newly created order
 * @since 1.10
 * @should set all the relevant fields
 */
public Order cloneForDiscontinuing() {
  Order newOrder = new Order();
  newOrder.setCareSetting(getCareSetting());
  newOrder.setConcept(getConcept());
  newOrder.setAction(Action.DISCONTINUE);
  newOrder.setPreviousOrder(this);
  newOrder.setPatient(getPatient());
  newOrder.setOrderType(getOrderType());
  
  return newOrder;
}

代码示例来源: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 OrderValidator#validate(Object,Errors)
 */
@Test
public void validate_shouldPassValidationIfAllFieldsAreCorrect() {
  Order order = new DrugOrder();
  Encounter encounter = new Encounter();
  order.setConcept(Context.getConceptService().getConcept(88));
  order.setOrderer(Context.getProviderService().getProvider(1));
  Patient patient = Context.getPatientService().getPatient(2);
  encounter.setPatient(patient);
  order.setPatient(patient);
  Calendar cal = Calendar.getInstance();
  cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
  order.setDateActivated(cal.getTime());
  order.setAutoExpireDate(new Date());
  order.setCareSetting(new CareSetting());
  order.setEncounter(encounter);
  order.setUrgency(Order.Urgency.ROUTINE);
  order.setAction(Order.Action.NEW);
  order.setOrderType(Context.getOrderService().getOrderTypeByName("Drug order"));
  
  Errors errors = new BindException(order, "order");
  new OrderValidator().validate(order, errors);
  
  Assert.assertFalse(errors.hasErrors());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see OrderValidator#validate(Object,Errors)
 */
@Test
public void validate_shouldPassValidationIfFieldLengthsAreCorrect() {
  Order order = new Order();
  Encounter encounter = new Encounter();
  order.setConcept(Context.getConceptService().getConcept(88));
  order.setOrderer(Context.getProviderService().getProvider(1));
  Patient patient = Context.getPatientService().getPatient(2);
  encounter.setPatient(patient);
  order.setPatient(patient);
  Calendar cal = Calendar.getInstance();
  cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
  order.setDateActivated(cal.getTime());
  order.setAutoExpireDate(new Date());
  order.setCareSetting(new CareSetting());
  order.setEncounter(encounter);
  order.setUrgency(Order.Urgency.ROUTINE);
  order.setAction(Order.Action.NEW);
  order.setOrderReasonNonCoded("orderReasonNonCoded");
  order.setAccessionNumber("accessionNumber");
  order.setCommentToFulfiller("commentToFulfiller");
  order.setVoidReason("voidReason");
  Errors errors = new BindException(order, "order");
  new OrderValidator().validate(order, errors);
  Assert.assertFalse(errors.hasErrors());
}

代码示例来源:origin: openmrs/openmrs-core

target.setAction(Action.DISCONTINUE);
  target.setPreviousOrder(getPreviousOrder());
  target.setDateActivated(getDateActivated());
} else {
  target.setAction(Action.REVISE);
  target.setPreviousOrder(this);
  target.setAutoExpireDate(getAutoExpireDate());

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see OrderValidator#validate(Object,Errors)
 */
@Test
public void validate_shouldFailValidationIfActionIsNull() {
  Order order = new Order();
  order.setConcept(Context.getConceptService().getConcept(88));
  order.setPatient(Context.getPatientService().getPatient(2));
  order.setAction(null);
  
  Errors errors = new BindException(order, "order");
  new OrderValidator().validate(order, errors);
  
  Assert.assertTrue(errors.hasFieldErrors("action"));
}

代码示例来源:origin: openmrs/openmrs-core

order.setEncounter(encounter);
order.setUrgency(Order.Urgency.ROUTINE);
order.setAction(Order.Action.NEW);

代码示例来源:origin: openmrs/openmrs-core

public void saveOrder_shouldSaveARevisedOrderForAScheduledOrderWhichIsNotStarted() {
  Order originalOrder = new Order();
  originalOrder.setAction(Action.NEW);
  originalOrder.setPatient(Context.getPatientService().getPatient(7));
  originalOrder.setConcept(Context.getConceptService().getConcept(5497));

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
 */
@Test
public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() {
  Order order = orderService.getOrder(7);
  assertTrue(OrderUtilTest.isActiveOrder(order, null));
  Order discontinuationOrder = new SomeTestOrder();
  discontinuationOrder.setCareSetting(order.getCareSetting());
  discontinuationOrder.setConcept(order.getConcept());
  discontinuationOrder.setAction(Action.DISCONTINUE);
  discontinuationOrder.setPreviousOrder(order);
  discontinuationOrder.setPatient(order.getPatient());
  assertTrue(order.getOrderType().getJavaClass().isAssignableFrom(discontinuationOrder.getClass()));
  discontinuationOrder.setOrderType(order.getOrderType());
  discontinuationOrder.setOrderer(Context.getProviderService().getProvider(1));
  discontinuationOrder.setEncounter(Context.getEncounterService().getEncounter(6));
  
  expectedException.expect(EditedOrderDoesNotMatchPreviousException.class);
  expectedException.expectMessage(mss.getMessage("Order.class.doesnot.match"));
  orderService.saveOrder(discontinuationOrder, null);
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Order#cloneForRevision()
 */
@Test
public void cloneForRevision_shouldSetTheRelevantFieldsForADCOrder() throws Exception {
  Order order = new Order();
  order.setAction(Order.Action.DISCONTINUE);
  Date date = new Date();
  order.setDateActivated(date);
  order.setPreviousOrder(new Order());
  order.setAutoExpireDate(date);
  order.setAccessionNumber("some number");
  OrderUtilTest.setDateStopped(order, date);
  
  Order clone = order.cloneForRevision();
  assertEquals(Order.Action.DISCONTINUE, clone.getAction());
  assertEquals(order.getDateActivated(), clone.getDateActivated());
  assertEquals(order.getPreviousOrder(), clone.getPreviousOrder());
  assertNull(clone.getAutoExpireDate());
  assertNull(clone.getDateStopped());
  assertNull(clone.getAccessionNumber());
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @throws Exception
 * @see DrugOrder#cloneForRevision()
 */
@Test
public void cloneForRevision_shouldSetTheRelevantFieldsForADCOrder() {
  Order order = new DrugOrder();
  order.setAction(Order.Action.DISCONTINUE);
  Date date = new Date();
  order.setDateActivated(date);
  order.setAutoExpireDate(date);
  order.setAccessionNumber("some number");
  OrderUtilTest.setDateStopped(order, date);
  order.setPreviousOrder(new Order());
  
  Order clone = order.cloneForRevision();
  assertEquals(Order.Action.DISCONTINUE, clone.getAction());
  assertEquals(order.getDateActivated(), clone.getDateActivated());
  assertEquals(order.getPreviousOrder(), clone.getPreviousOrder());
  assertNull(clone.getAutoExpireDate());
  assertNull(clone.getDateStopped());
  assertNull(clone.getAccessionNumber());
}

代码示例来源:origin: openmrs/openmrs-core

/**
   * @see TestOrder#cloneForRevision()
   */
  @Test
  public void cloneForRevision_shouldSetTheRelevantFieldsForADCOrder() {
    Order order = new TestOrder();
    order.setAction(Order.Action.DISCONTINUE);
    Date date = new Date();
    order.setDateActivated(date);
    order.setAutoExpireDate(date);
    order.setAccessionNumber("some number");
    OrderUtilTest.setDateStopped(order, date);
    order.setPreviousOrder(new Order());
    
    Order clone = order.cloneForRevision();
    assertEquals(Order.Action.DISCONTINUE, clone.getAction());
    assertEquals(order.getDateActivated(), clone.getDateActivated());
    assertEquals(order.getPreviousOrder(), clone.getPreviousOrder());
    assertNull(clone.getAutoExpireDate());
    assertNull(clone.getDateStopped());
    assertNull(clone.getAccessionNumber());
  }
}

代码示例来源: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.setAction(Action.NEW);
order.setPatient(Context.getPatientService().getPatient(7));
order.setConcept(Context.getConceptService().getConcept(5497));

代码示例来源:origin: openmrs/openmrs-core

order.setAction(Action.NEW);
order.setPatient(Context.getPatientService().getPatient(7));
order.setConcept(Context.getConceptService().getConcept(5497));

相关文章