本文整理了Java中org.openmrs.Order.setOrderType()
方法的一些代码示例,展示了Order.setOrderType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.setOrderType()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:setOrderType
[英]Set the org.openmrs.OrderType
[中]设置组织。openmrs。订单类型
代码示例来源:origin: openmrs/openmrs-core
public OrderBuilder withOrderType(Integer orderTypeID) {
order.setOrderType(orderService.getOrderType(orderTypeID));
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#isType(OrderType)
*/
@Test
public void isType_shouldFalseIfItNeitherTheSameNorASubtype() throws Exception {
Order order = new Order();
order.setOrderType(new OrderType());
assertFalse(order.isType(new OrderType()));
}
代码示例来源:origin: openmrs/openmrs-core
private void ensureOrderTypeIsSet(Order order, OrderContext orderContext) {
if (order.getOrderType() != null) {
return;
}
OrderType orderType = null;
if (orderContext != null) {
orderType = orderContext.getOrderType();
}
if (orderType == null) {
orderType = getOrderTypeByConcept(order.getConcept());
}
if (orderType == null && order instanceof DrugOrder) {
orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID);
}
if (orderType == null && order instanceof TestOrder) {
orderType = Context.getOrderService().getOrderTypeByUuid(OrderType.TEST_ORDER_TYPE_UUID);
}
if (orderType == null) {
throw new OrderEntryException("Order.type.cannot.determine");
}
Order previousOrder = order.getPreviousOrder();
if (previousOrder != null && !orderType.equals(previousOrder.getOrderType())) {
throw new OrderEntryException("Order.type.does.not.match");
}
order.setOrderType(orderType);
}
代码示例来源: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, 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_shouldSetTheOrderNumberReturnedByTheConfiguredGenerator() {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID,
"orderEntry.OrderNumberGenerator");
Context.getAdministrationService().saveGlobalProperty(gp);
Order order = new TestOrder();
order.setPatient(patientService.getPatient(7));
order.setConcept(conceptService.getConcept(5497));
order.setOrderer(providerService.getProvider(1));
order.setCareSetting(orderService.getCareSetting(1));
order.setOrderType(orderService.getOrderType(2));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
order = orderService.saveOrder(order, null);
assertTrue(order.getOrderNumber().startsWith(TimestampOrderNumberGenerator.ORDER_NUMBER_PREFIX));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isType(OrderType)
*/
@Test
public void isType_shouldTrueIfItIsTheSameOrIsASubtype() throws Exception {
Order order = new Order();
OrderType orderType = new OrderType();
OrderType subType1 = new OrderType();
OrderType subType2 = new OrderType();
subType2.setParent(subType1);
subType1.setParent(orderType);
order.setOrderType(subType2);
assertTrue(order.isType(subType2));
assertTrue(order.isType(subType1));
assertTrue(order.isType(orderType));
}
代码示例来源:origin: openmrs/openmrs-core
originalOrder.setOrderer(orderService.getOrder(1).getOrderer());
originalOrder.setEncounter(encounterService.getEncounter(3));
originalOrder.setOrderType(orderService.getOrderType(17));
originalOrder.setDateActivated(new Date());
originalOrder.setScheduledDate(DateUtils.addMonths(new Date(), 2));
代码示例来源: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
@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
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldSetOrderNumberSpecifiedInTheContextIfSpecified() {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID,
"orderEntry.OrderNumberGenerator");
Context.getAdministrationService().saveGlobalProperty(gp);
Order order = new TestOrder();
order.setEncounter(encounterService.getEncounter(6));
order.setPatient(patientService.getPatient(7));
order.setConcept(conceptService.getConcept(5497));
order.setOrderer(providerService.getProvider(1));
order.setCareSetting(orderService.getCareSetting(1));
order.setOrderType(orderService.getOrderType(2));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
OrderContext orderCtxt = new OrderContext();
final String expectedOrderNumber = "Testing";
orderCtxt.setAttribute(TimestampOrderNumberGenerator.NEXT_ORDER_NUMBER, expectedOrderNumber);
order = orderService.saveOrder(order, orderCtxt);
assertEquals(expectedOrderNumber, order.getOrderNumber());
}
代码示例来源: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);
}
代码示例来源:origin: openmrs/openmrs-core
target.setConcept(getConcept());
target.setPatient(getPatient());
target.setOrderType(getOrderType());
target.setScheduledDate(getScheduledDate());
target.setInstructions(getInstructions());
代码示例来源:origin: openmrs/openmrs-core
order.setEncounter(encounterService.getEncounter(3));
order.setEncounter(encounterService.getEncounter(3));
order.setOrderType(orderService.getOrderType(17));
order.setDateActivated(new Date());
order.setScheduledDate(DateUtils.addMonths(new Date(), 2));
代码示例来源:origin: openmrs/openmrs-core
order.setEncounter(encounterService.getEncounter(3));
order.setEncounter(encounterService.getEncounter(3));
order.setOrderType(orderService.getOrderType(17));
order.setDateActivated(new Date());
order.setScheduledDate(DateUtils.addMonths(new Date(), 2));
代码示例来源:origin: openmrs/openmrs-core
anOrder.setCareSetting(new CareSetting());
anOrder.setConcept(new Concept());
anOrder.setOrderType(new OrderType());
代码示例来源:origin: openmrs/openmrs-core
target.setOrderType(getOrderType());
target.setConcept(getConcept());
target.setInstructions(getInstructions());
内容来源于网络,如有侵权,请联系作者删除!