本文整理了Java中org.openmrs.Order.getEncounter()
方法的一些代码示例,展示了Order.getEncounter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getEncounter()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getEncounter
暂无
代码示例来源: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 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
private void validateOrderGroupEncounter(Order order, Errors errors) {
if (order.getOrderGroup() != null && !(order.getEncounter().equals(order.getOrderGroup().getEncounter()))) {
errors.rejectValue("encounter", "Order.error.orderEncounterAndOrderGroupEncounterMismatch");
}
}
代码示例来源:origin: openmrs/openmrs-core
private void validateDateActivated(Order order, Errors errors) {
Date dateActivated = order.getDateActivated();
if (dateActivated != null) {
if (dateActivated.after(new Date())) {
errors.rejectValue("dateActivated", "Order.error.dateActivatedInFuture");
return;
}
Date dateStopped = order.getDateStopped();
if (dateStopped != null && dateActivated.after(dateStopped)) {
errors.rejectValue("dateActivated", "Order.error.dateActivatedAfterDiscontinuedDate");
errors.rejectValue("dateStopped", "Order.error.dateActivatedAfterDiscontinuedDate");
}
Date autoExpireDate = order.getAutoExpireDate();
if (autoExpireDate != null && dateActivated.after(autoExpireDate)) {
errors.rejectValue("dateActivated", "Order.error.dateActivatedAfterAutoExpireDate");
errors.rejectValue("autoExpireDate", "Order.error.dateActivatedAfterAutoExpireDate");
}
Encounter encounter = order.getEncounter();
if (encounter != null && encounter.getEncounterDatetime() != null
&& encounter.getEncounterDatetime().after(dateActivated)) {
errors.rejectValue("dateActivated", "Order.error.encounterDatetimeAfterDateActivated");
}
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#getDiscontinuationOrder(Order)
*/
@Test
public void getDiscontinuationOrder_shouldReturnDiscontinuationOrderIfOrderHasBeenDiscontinued() {
Order order = orderService.getOrder(111);
Order discontinuationOrder = orderService.discontinueOrder(order, "no reason", new Date(),
providerService.getProvider(1), order.getEncounter());
Order foundDiscontinuationOrder = orderService.getDiscontinuationOrder(order);
assertThat(foundDiscontinuationOrder, is(discontinuationOrder));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Encounter#addOrder(Order)
*/
@Test
public void addOrder_shouldSetEncounterAttribute() {
Encounter encounter = new Encounter();
Order order = new Order();
encounter.addOrder(order);
assertTrue(order.getEncounter().equals(encounter));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#getRevisionOrder(org.openmrs.Order)
*/
@Test
public void getRevisionOrder_shouldNotReturnAVoidedRevisionOrder() {
Order order = orderService.getOrder(7);
Order revision1 = order.cloneForRevision();
revision1.setEncounter(order.getEncounter());
revision1.setOrderer(order.getOrderer());
orderService.saveOrder(revision1, null);
assertEquals(revision1, orderService.getRevisionOrder(order));
orderService.voidOrder(revision1, "Testing");
assertThat(orderService.getRevisionOrder(order), is(nullValue()));
//should return the new unvoided revision
Order revision2 = order.cloneForRevision();
revision2.setEncounter(order.getEncounter());
revision2.setOrderer(order.getOrderer());
orderService.saveOrder(revision2, null);
assertEquals(revision2, orderService.getRevisionOrder(order));
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void shouldAllowRetrospectiveDataEntryOfOrders() {
Order order = new TestOrder();
order.setPatient(patientService.getPatient(2));
order.setCareSetting(orderService.getCareSetting(2));
order.setConcept(conceptService.getConcept(5089));
order.setEncounter(encounterService.getEncounter(6));
order.setOrderer(providerService.getProvider(1));
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_WEEK, -1);
order.setDateActivated(cal.getTime());
orderService.saveOrder(order, null);
cal.add(Calendar.HOUR_OF_DAY, -1);
Date stopDate = cal.getTime();
Order dcOrder = orderService.discontinueOrder(order, "Testing", stopDate, order.getOrderer(), order.getEncounter());
Context.flushSession(); // ensures that order is flushed and that the drop milliseconds interceptor is called
assertEquals(DateUtil.truncateToSeconds(stopDate), order.getDateStopped());
assertEquals(DateUtil.truncateToSeconds(stopDate), dcOrder.getAutoExpireDate());
}
代码示例来源: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
/**
* This test ensures that the getter for previous order field returns objects of the actual sub
* types for subclasses instead proxies that are instances of Order
*
* @throws Exception
*/
@Test
public void shouldNotReturnAProxyForPreviousOrder() {
Order dcOrder = orderService.getOrder(22);
Order previousOrder = dcOrder.getPreviousOrder();
assertNotNull(previousOrder);
Order testOrder = orderService.getOrder(7);
Order dcTestOrder = orderService.discontinueOrder(testOrder, "Testing", null, testOrder.getOrderer(), testOrder
.getEncounter());
Context.flushSession();
Context.clearSession();
dcTestOrder = orderService.getOrder(dcTestOrder.getOrderId()).getPreviousOrder();
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws InterruptedException
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldFailForADiscontinuationOrderIfThePreviousOrderIsInactive() throws InterruptedException {
Order order = orderService.getOrder(22);
assertEquals(Action.DISCONTINUE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the DC order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
//stop the order with a different DC order
orderService.discontinueOrder(previousOrder, "Testing", null, previousOrder.getOrderer(),
previousOrder.getEncounter());
Thread.sleep(10);
expectedException.expect(CannotUnvoidOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.action.cannot.unvoid", new Object[] { "discontinuation" },
null));
orderService.unvoidOrder(order);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @throws InterruptedException
* @see OrderService#unvoidOrder(org.openmrs.Order)
*/
@Test
public void unvoidOrder_shouldFailForAReviseOrderIfThePreviousOrderIsInactive() throws InterruptedException {
Order order = orderService.getOrder(111);
assertEquals(Action.REVISE, order.getAction());
Order previousOrder = order.getPreviousOrder();
assertNotNull(previousOrder.getDateStopped());
assertFalse(order.getVoided());
//void the DC order for testing purposes so we can unvoid it later
orderService.voidOrder(order, "None");
assertTrue(order.getVoided());
assertNull(previousOrder.getDateStopped());
//stop the order with a different REVISE order
Order revise = previousOrder.cloneForRevision();
revise.setOrderer(order.getOrderer());
revise.setEncounter(order.getEncounter());
orderService.saveOrder(revise, null);
Thread.sleep(10);
expectedException.expect(CannotUnvoidOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.action.cannot.unvoid", new Object[] { "revision" }, null));
orderService.unvoidOrder(order);
}
代码示例来源:origin: openmrs/openmrs-core
target.setDateActivated(getDateActivated());
target.setAutoExpireDate(getAutoExpireDate());
target.setEncounter(getEncounter());
target.setOrderer(getOrderer());
target.setCreator(getCreator());
内容来源于网络,如有侵权,请联系作者删除!