本文整理了Java中org.openmrs.Order.getPatient()
方法的一些代码示例,展示了Order.getPatient()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getPatient()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getPatient
暂无
代码示例来源:origin: openmrs/openmrs-core
private void validateSamePatientInOrderAndEncounter(Order order, Errors errors) {
if (order.getEncounter() != null && order.getPatient() != null
&& !order.getEncounter().getPatient().equals(order.getPatient())) {
errors.rejectValue("encounter", "Order.error.encounterPatientMismatch");
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.handler.SaveHandler#handle(org.openmrs.OpenmrsObject, org.openmrs.User,
* java.util.Date, java.lang.String)
*/
@Override
public void handle(Order order, User creator, Date dateCreated, String other) {
if (order.getPatient() == null && order.getEncounter() != null) {
order.setPatient(order.getEncounter().getPatient());
}
}
}
代码示例来源:origin: openmrs/openmrs-core
private void validateOrderGroupPatient(Order order, Errors errors) {
if (order.getOrderGroup() != null && !(order.getPatient().equals(order.getOrderGroup().getPatient()))) {
errors.rejectValue("patient", "Order.error.orderPatientAndOrderGroupPatientMismatch");
}
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see EncounterService#saveEncounter(Encounter)
*/
@Test
public void saveEncounter_shouldCascadePatientToOrdersInTheEncounter() {
Encounter enc = Context.getEncounterService().getEncounter(15);
Order existing = enc.getOrders().iterator().next();
// for some reason the xml for the existing encounter has already given
// this order a different patient than the encounter that it's contained
// in, but let's verify that:
Assert.assertNotSame(enc.getPatient().getId(), existing.getPatient().getId());
Context.getEncounterService().saveEncounter(enc);
Assert.assertEquals(enc.getPatient().getId(), existing.getPatient().getId());
}
代码示例来源: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
@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 shouldAllowEditingADiscontinuationOrder() {
Order originalDCOrder = orderService.getOrder(22);
assertEquals(Order.Action.DISCONTINUE, originalDCOrder.getAction());
List<Order> originalPatientOrders = orderService.getAllOrdersByPatient(originalDCOrder.getPatient());
final Order previousOrder = originalDCOrder.getPreviousOrder();
assertNotNull(previousOrder);
final Date newStartDate = originalDCOrder.getEncounter().getEncounterDatetime();
Order newDcOrder = originalDCOrder.cloneForRevision();
newDcOrder.setEncounter(originalDCOrder.getEncounter());
newDcOrder.setOrderer(originalDCOrder.getOrderer());
newDcOrder.setDateActivated(newStartDate);
orderService.voidOrder(originalDCOrder, "To be replace with a new one");
assertNull(originalDCOrder.getDateStopped());
orderService.saveOrder(newDcOrder, null);
//We need to flush so that we ensure the interceptor is okay with all this
Context.flushSession();
assertTrue(originalDCOrder.getVoided());
List<Order> newPatientOrders = orderService.getAllOrdersByPatient(originalDCOrder.getPatient());
assertEquals(originalPatientOrders.size() + 1, newPatientOrders.size());
Collection<Order> newOrders = CollectionUtils.disjunction(originalPatientOrders, newPatientOrders);
assertEquals(1, newOrders.size());
assertEquals(newOrders.iterator().next().getPreviousOrder(), previousOrder);
}
代码示例来源:origin: openmrs/openmrs-core
asOfDate = order.getDateActivated();
List<Order> activeOrders = getActiveOrders(order.getPatient(), null, order.getCareSetting(), asOfDate);
List<String> parallelOrders = Collections.emptyList();
if (orderContext != null && orderContext.getAttribute(PARALLEL_ORDERS) != 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
if (!p.equals(o.getPatient())) {
o.setPatient(p);
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldSaveARevisedOrder() {
Order originalOrder = orderService.getOrder(111);
assertTrue(originalOrder.isActive());
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.setEncounter(encounterService.getEncounter(5));
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(originalOrder.isActive());
}
代码示例来源:origin: openmrs/openmrs-core
Encounter encounter = encounterService.getEncounter(3);
assertTrue(OrderUtilTest.isActiveOrder(firstOrderToDiscontinue, null));
Patient patient = firstOrderToDiscontinue.getPatient();
int ordersCount = orderService.getActiveOrders(patient, null, null, null).size();
assertEquals(patient, secondOrderToDiscontinue.getPatient());
assertTrue(OrderUtilTest.isActiveOrder(secondOrderToDiscontinue, null));
Order discontinuationOrder2 = orderService.discontinueOrder(secondOrderToDiscontinue, "Testing", null, orderer,
代码示例来源: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
assertEquals(anOrder.getPatient(), orderThatCanDiscontinueTheOrder.getPatient());
代码示例来源:origin: openmrs/openmrs-core
final Patient patient = originalOrder.getPatient();
List<Order> originalActiveOrders = orderService.getActiveOrders(patient, null, null, null);
final int originalOrderCount = originalActiveOrders.size();
代码示例来源: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
target.setPatient(getPatient());
target.setOrderType(getOrderType());
target.setScheduledDate(getScheduledDate());
代码示例来源: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.setPatient(getPatient());
target.setOrderType(getOrderType());
target.setConcept(getConcept());
代码示例来源:origin: openmrs/openmrs-module-webservices.rest
@Test
public void shouldDiscontinueAnActiveOrder() throws Exception {
Order orderToDiscontinue = orderService.getOrder(7);
Patient patient = orderToDiscontinue.getPatient();
List<Order> originalActiveOrders = orderService.getActiveOrders(patient, null, null, null);
assertTrue(originalActiveOrders.contains(orderToDiscontinue));
assertNotNull(PropertyUtils.getProperty(savedDCOrder, "orderNumber"));
assertEquals(dcOrder.get("action"), Util.getByPath(savedDCOrder, "action"));
assertEquals(orderToDiscontinue.getPatient().getUuid(), Util.getByPath(savedDCOrder, "patient/uuid"));
assertEquals(orderToDiscontinue.getCareSetting().getUuid(), Util.getByPath(savedDCOrder, "careSetting/uuid"));
assertEquals(dcOrder.get("previousOrder"), Util.getByPath(savedDCOrder, "previousOrder/uuid"));
内容来源于网络,如有侵权,请联系作者删除!