本文整理了Java中org.openmrs.Order.setOrderer()
方法的一些代码示例,展示了Order.setOrderer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.setOrderer()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:setOrderer
暂无
代码示例来源:origin: openmrs/openmrs-core
public OrderBuilder withOrderer(Integer orderID) {
order.setOrderer(orderService.getOrder(orderID).getOrderer());
return this;
}
代码示例来源: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 OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotSaveOrderIfOrderDoesntValidate() {
Order order = new Order();
order.setPatient(null);
order.setOrderer(null);
expectedException.expect(APIException.class);
expectedException.expectMessage("failed to validate with reason:");
orderService.saveOrder(order, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfDateActivatedAfterAutoExpireDate() {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
order.setDateActivated(new Date());
order.setAutoExpireDate(cal.getTime());
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("dateActivated"));
Assert.assertTrue(errors.hasFieldErrors("autoExpireDate"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws Exception
* @see OrderValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfDateActivatedAfterDateStopped() throws Exception {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1);
order.setDateActivated(new Date());
OrderUtilTest.setDateStopped(order, cal.getTime());
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("dateActivated"));
Assert.assertTrue(errors.hasFieldErrors("dateStopped"));
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void saveOrder_shouldNotRevisePreviousIfAlreadyStopped() throws ParseException {
executeDataSet("org/openmrs/api/include/OrderServiceTest-ordersWithAutoExpireDate.xml");
Order previousOrder = orderService.getOrder(203);
Date dateActivated = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2008-10-19 13:00:00");
Order order = previousOrder.cloneForRevision();
order.setDateActivated(dateActivated);
order.setOrderer(providerService.getProvider(1));
order.setEncounter(encounterService.getEncounter(18));
order.setPreviousOrder(previousOrder);
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.saveRetrospectiveOrder(order, null);
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void shouldReviseAnOrderAndFlushSuccessfully() {
Order originalOrder = orderService.getOrder(111);
assertTrue(OrderUtilTest.isActiveOrder(originalOrder, null));
final Patient patient = originalOrder.getPatient();
List<Order> originalActiveOrders = orderService.getActiveOrders(patient, null, null, null);
final int originalOrderCount = originalActiveOrders.size();
assertTrue(originalActiveOrders.contains(originalOrder));
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setInstructions("Take after a meal");
revisedOrder.setDateActivated(new Date());
revisedOrder.setOrderer(providerService.getProvider(1));
revisedOrder.setEncounter(encounterService.getEncounter(3));
orderService.saveOrder(revisedOrder, null);
Context.flushSession();
List<Order> activeOrders = orderService.getActiveOrders(patient, null, null, null);
assertEquals(originalOrderCount, activeOrders.size());
assertFalse(OrderUtilTest.isActiveOrder(originalOrder, null));
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void shouldReviseAnOrder() {
Order originalOrder = orderService.getOrder(111);
assertTrue(OrderUtilTest.isActiveOrder(originalOrder, null));
final Patient patient = originalOrder.getPatient();
List<Order> originalActiveOrders = orderService.getActiveOrders(patient, null, null, null);
final int originalOrderCount = originalActiveOrders.size();
assertTrue(originalActiveOrders.contains(originalOrder));
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setInstructions("Take after a meal");
revisedOrder.setDateActivated(new Date());
revisedOrder.setOrderer(providerService.getProvider(1));
revisedOrder.setEncounter(encounterService.getEncounter(3));
orderService.saveOrder(revisedOrder, null);
List<Order> activeOrders = orderService.getActiveOrders(patient, null, null, null);
assertEquals(originalOrderCount, activeOrders.size());
assertEquals(revisedOrder.getDateActivated(), DateUtils.addSeconds(originalOrder.getDateStopped(), 1));
assertFalse(OrderUtilTest.isActiveOrder(originalOrder, null));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotAllowRevisingAStoppedOrder() {
Order originalOrder = orderService.getOrder(1);
assertNotNull(originalOrder.getDateStopped());
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setEncounter(encounterService.getEncounter(4));
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
/**
* @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
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldFailIfOrderTypeIsNullAndNotMappedToTheConceptClass() {
Order order = new Order();
order.setPatient(patientService.getPatient(7));
order.setConcept(conceptService.getConcept(9));
order.setOrderer(providerService.getProvider(1));
order.setCareSetting(orderService.getCareSetting(1));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
expectedException.expect(OrderEntryException.class);
expectedException.expectMessage("Order.type.cannot.determine");
orderService.saveOrder(order, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldNotAllowRevisingAnOrderWithNoPreviousOrder() {
Order originalOrder = orderService.getOrder(111);
assertTrue(originalOrder.isActive());
Order revisedOrder = originalOrder.cloneForRevision();
revisedOrder.setEncounter(encounterService.getEncounter(5));
revisedOrder.setInstructions("Take after a meal");
revisedOrder.setPreviousOrder(null);
revisedOrder.setOrderer(providerService.getProvider(1));
revisedOrder.setDateActivated(new Date());
expectedException.expect(MissingRequiredPropertyException.class);
expectedException.expectMessage(mss.getMessage("Order.previous.required"));
orderService.saveOrder(revisedOrder, null);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldFailValidationIfOrderTypejavaClassDoesNotMatchOrderclass() {
Order order = new DrugOrder();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
order.setOrderType(Context.getOrderService().getOrderTypeByName("Test order"));
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("orderType"));
Assert.assertTrue(Arrays.asList(errors.getFieldError("orderType").getCodes()).contains(
"Order.error.orderTypeClassMismatchesOrderClass"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldFailIfConceptInPreviousOrderDoesNotMatchThatOfTheRevisedOrder() {
Order previousOrder = orderService.getOrder(7);
Order order = previousOrder.cloneForRevision();
order.setDateActivated(new Date());
order.setOrderer(providerService.getProvider(1));
order.setEncounter(encounterService.getEncounter(6));
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
/**
* @see OrderValidator#validate(Object, org.springframework.validation.Errors)
*/
@Test
public void validate_shouldFailValidationIfDateActivatedIsBeforeEncountersEncounterDatetime() {
Date encounterDate = new Date();
Date orderDate = DateUtils.addDays(encounterDate, -1);
Encounter encounter = Context.getEncounterService().getEncounter(3);
encounter.setEncounterDatetime(encounterDate);
Order order = new Order();
order.setDateActivated(orderDate);
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setEncounter(encounter);
order.setOrderer(Context.getProviderService().getProvider(1));
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("dateActivated"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfOrderAndEncounterHaveDifferentPatients() {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setPatient(Context.getPatientService().getPatient(2));
order.setEncounter(Context.getEncounterService().getEncounter(3));
order.setOrderer(Context.getProviderService().getProvider(1));
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertTrue(errors.hasFieldErrors("encounter"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfPatientIsNull() {
Order order = new Order();
order.setConcept(Context.getConceptService().getConcept(88));
order.setOrderer(Context.getProviderService().getProvider(1));
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertFalse(errors.hasFieldErrors("discontinued"));
Assert.assertFalse(errors.hasFieldErrors("concept"));
Assert.assertTrue(errors.hasFieldErrors("patient"));
Assert.assertFalse(errors.hasFieldErrors("orderer"));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfConceptIsNull() {
Order order = new Order();
order.setPatient(Context.getPatientService().getPatient(2));
order.setOrderer(Context.getProviderService().getProvider(1));
Errors errors = new BindException(order, "order");
new OrderValidator().validate(order, errors);
Assert.assertFalse(errors.hasFieldErrors("discontinued"));
Assert.assertTrue(errors.hasFieldErrors("concept"));
Assert.assertFalse(errors.hasFieldErrors("patient"));
Assert.assertFalse(errors.hasFieldErrors("orderer"));
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!