本文整理了Java中org.openmrs.Order.getOrderType()
方法的一些代码示例,展示了Order.getOrderType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getOrderType()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getOrderType
[英]Get the org.openmrs.OrderType
[中]获取组织。openmrs。订单类型
代码示例来源:origin: openmrs/openmrs-core
private void failOnOrderTypeMismatch(Order order) {
if (!order.getOrderType().getJavaClass().isAssignableFrom(order.getClass())) {
throw new OrderEntryException("Order.type.class.does.not.match", new Object[] {
order.getOrderType().getJavaClass(), order.getClass().getName() });
}
}
代码示例来源:origin: openmrs/openmrs-core
private void validateOrderTypeClass(Order order, Errors errors) {
OrderType orderType = order.getOrderType();
if (orderType != null && !orderType.getJavaClass().isAssignableFrom(order.getClass())) {
errors.rejectValue("orderType", "Order.error.orderTypeClassMismatchesOrderClass");
}
}
代码示例来源:origin: openmrs/openmrs-core
private void requireNoActiveOrderOfSameType(Patient patient1, Patient patient2) {
String messageKey = "Patient.merge.cannotHaveSameTypeActiveOrders";
List<Order> ordersByPatient1 = Context.getOrderService().getAllOrdersByPatient(patient1);
List<Order> ordersByPatient2 = Context.getOrderService().getAllOrdersByPatient(patient2);
ordersByPatient1.forEach((Order order1) -> ordersByPatient2.forEach((Order order2) -> {
if (order1.isActive() && order2.isActive() && order1.getOrderType().equals(order2.getOrderType())) {
Object[] parameters = { patient1.getPatientId(), patient2.getPatientId(), order1.getOrderType() };
String message = Context.getMessageSourceService().getMessage(messageKey, parameters,
Context.getLocale());
log.debug(message);
throw new APIException(message);
}
}));
}
代码示例来源:origin: openmrs/openmrs-core
private boolean hasActiveOrderOfType(Patient patient, String orderTypeName) {
OrderType drugOrder = Context.getOrderService().getOrderTypeByName(orderTypeName);
List<Order> preferredPatientOrders = Context.getOrderService().getAllOrdersByPatient(patient).stream()
.filter(Order::isActive)
.filter(order -> Objects.equals(drugOrder, order.getOrderType()))
.collect(Collectors.toList());
return !preferredPatientOrders.isEmpty();
}
代码示例来源:origin: openmrs/openmrs-core
private void voidOrdersForType(Collection<Patient> patients, OrderType ot) {
patients.forEach(patient -> Context.getOrderService().getAllOrdersByPatient(patient).forEach(order -> {
if(order.getOrderType().equals(ot)){
order.setVoided(true);
}
}));
}
代码示例来源:origin: openmrs/openmrs-core
private boolean areDrugOrdersOfSameOrderableAndOverlappingSchedule(Order firstOrder, Order secondOrder) {
return firstOrder.hasSameOrderableAs(secondOrder)
&& !OpenmrsUtil.nullSafeEquals(firstOrder.getPreviousOrder(), secondOrder)
&& OrderUtil.checkScheduleOverlap(firstOrder, secondOrder)
&& firstOrder.getOrderType().equals(
Context.getOrderService().getOrderTypeByUuid(OrderType.DRUG_ORDER_TYPE_UUID));
}
代码示例来源: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
/**
* 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
} else if (!order.getOrderType().equals(previousOrder.getOrderType())) {
throw new EditedOrderDoesNotMatchPreviousException("Order.type.doesnot.match");
} else if (!order.getCareSetting().equals(previousOrder.getCareSetting())) {
代码示例来源: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
/**
* @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
asOfDate = order.getDateActivated();
List<? extends Order> orders = getActiveOrders(order.getPatient(), order.getOrderType(), order.getCareSetting(),
asOfDate);
boolean isDrugOrderAndHasADrug = isDrugOrder(order)
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldDefaultToCareSettingAndOrderTypeDefinedInTheOrderContextIfNull() {
Order order = new TestOrder();
order.setPatient(patientService.getPatient(7));
Concept trimune30 = conceptService.getConcept(792);
order.setConcept(trimune30);
order.setOrderer(providerService.getProvider(1));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
OrderType expectedOrderType = orderService.getOrderType(2);
CareSetting expectedCareSetting = orderService.getCareSetting(1);
OrderContext orderContext = new OrderContext();
orderContext.setOrderType(expectedOrderType);
orderContext.setCareSetting(expectedCareSetting);
order = orderService.saveOrder(order, orderContext);
assertFalse(expectedOrderType.getConceptClasses().contains(trimune30.getConceptClass()));
assertEquals(expectedOrderType, order.getOrderType());
assertEquals(expectedCareSetting, order.getCareSetting());
}
代码示例来源:origin: openmrs/openmrs-core
assertEquals(anOrder.getOrderType(), orderThatCanDiscontinueTheOrder.getOrderType());
代码示例来源:origin: openmrs/openmrs-core
target.setConcept(getConcept());
target.setPatient(getPatient());
target.setOrderType(getOrderType());
target.setScheduledDate(getScheduledDate());
target.setInstructions(getInstructions());
代码示例来源:origin: openmrs/openmrs-core
/**
* @see TestOrder#cloneForDiscontinuing()
*/
@Test
public void cloneForDiscontinuing_shouldSetAllTheRelevantFields() {
TestOrder anOrder = new TestOrder();
anOrder.setPatient(new Patient());
anOrder.setCareSetting(new CareSetting());
anOrder.setConcept(new Concept());
anOrder.setOrderType(new OrderType());
Order orderThatCanDiscontinueTheOrder = anOrder.cloneForDiscontinuing();
assertEquals(anOrder.getPatient(), orderThatCanDiscontinueTheOrder.getPatient());
assertEquals(anOrder.getConcept(), orderThatCanDiscontinueTheOrder.getConcept());
assertEquals("should set previous order to anOrder", anOrder, orderThatCanDiscontinueTheOrder.getPreviousOrder());
assertEquals("should set new order action to new", orderThatCanDiscontinueTheOrder.getAction(),
Order.Action.DISCONTINUE);
assertEquals(anOrder.getCareSetting(), orderThatCanDiscontinueTheOrder.getCareSetting());
assertEquals(anOrder.getOrderType(), orderThatCanDiscontinueTheOrder.getOrderType());
}
代码示例来源:origin: openmrs/openmrs-core
target.setOrderType(getOrderType());
target.setConcept(getConcept());
target.setInstructions(getInstructions());
内容来源于网络,如有侵权,请联系作者删除!