/** * @see OrderServiceImpl#discontinueExistingOrdersIfNecessary() */ @Test(expected = AmbiguousOrderException.class) public void saveOrder_shouldThrowAmbiguousOrderExceptionIfDisconnectingMultipleActiveOrdersForTheGivenConcepts() { executeDataSet("org/openmrs/api/include/OrderServiceTest-discontinueAmbiguousOrderByConcept.xml"); DrugOrder order = new DrugOrder(); order.setAction(Order.Action.DISCONTINUE); order.setOrderReasonNonCoded("Discontinue this"); order.setConcept(conceptService.getConcept(88)); order.setEncounter(encounterService.getEncounter(7)); order.setPatient(patientService.getPatient(9)); order.setOrderer(providerService.getProvider(1)); order.setCareSetting(orderService.getCareSetting(1)); order = (DrugOrder) orderService.saveOrder(order, null); }
/** * @see OrderServiceImpl#discontinueExistingOrdersIfNecessary() */ @Test(expected = AmbiguousOrderException.class) public void saveOrder_shouldThrowAmbiguousOrderExceptionIfDisconnectingMultipleActiveDrugOrdersWithTheSameDrug() { executeDataSet("org/openmrs/api/include/OrderServiceTest-ambiguousDrugOrders.xml"); DrugOrder order = new DrugOrder(); order.setAction(Order.Action.DISCONTINUE); order.setOrderReasonNonCoded("Discontinue this"); order.setDrug(conceptService.getDrug(3)); order.setEncounter(encounterService.getEncounter(7)); order.setPatient(patientService.getPatient(9)); order.setOrderer(providerService.getProvider(1)); order.setCareSetting(orderService.getCareSetting(1)); order = (DrugOrder) orderService.saveOrder(order, null); }
/** * @see OrderService#saveOrder(org.openmrs.Order, OrderContext) */ @Test public void saveOrder_shouldFailIfTheExistingDrugOrderMatchesTheConceptAndNotDrugOfTheDCOrder() { final DrugOrder orderToDiscontinue = (DrugOrder) orderService.getOrder(5); assertTrue(OrderUtilTest.isActiveOrder(orderToDiscontinue, null)); //create a different test drug Drug discontinuationOrderDrug = new Drug(); discontinuationOrderDrug.setConcept(orderToDiscontinue.getConcept()); discontinuationOrderDrug = conceptService.saveDrug(discontinuationOrderDrug); assertNotEquals(discontinuationOrderDrug, orderToDiscontinue.getDrug()); assertNotNull(orderToDiscontinue.getDrug()); DrugOrder order = orderToDiscontinue.cloneForRevision(); order.setDateActivated(new Date()); order.setOrderer(providerService.getProvider(1)); order.setEncounter(encounterService.getEncounter(6)); order.setDrug(discontinuationOrderDrug); order.setOrderReasonNonCoded("Discontinue this"); expectedException.expect(EditedOrderDoesNotMatchPreviousException.class); expectedException.expectMessage("The orderable of the previous order and the new one order don't match"); orderService.saveOrder(order, null); }
order.setOrderer(providerService.getProvider(1)); order.setEncounter(encounterService.getEncounter(3)); order.setOrderReasonNonCoded("Discontinue this");
order.setOrderType(orderService.getOrderTypeByName("Drug order")); order.setAction(Order.Action.DISCONTINUE); order.setOrderReasonNonCoded("Discontinue this"); order.setPatient(orderToDiscontinue.getPatient()); order.setConcept(orderToDiscontinue.getConcept());
order.setOrderReasonNonCoded("Discontinue this"); order.setDrug(conceptService.getDrug(3)); order.setEncounter(encounterService.getEncounter(5));
DrugOrder order = new DrugOrder(); order.setAction(Order.Action.DISCONTINUE); order.setOrderReasonNonCoded("Discontinue this"); order.setDrug(conceptService.getDrug(3)); order.setEncounter(encounterService.getEncounter(5));