/** * @see DosingInstructions#setDosingInstructions(DrugOrder) */ @Override public void setDosingInstructions(DrugOrder order) { order.setDosingType(this.getClass()); order.setDose(this.dose); order.setDoseUnits(this.doseUnits); order.setRoute(this.route); order.setFrequency(this.frequency); order.setDuration(this.duration); order.setDurationUnits(this.durationUnits); order.setAsNeeded(this.asNeeded); order.setAsNeededCondition(this.asNeededCondition); order.setDosingInstructions(this.administrationInstructions); }
/** * @see DrugOrderValidator#validate(Object, org.springframework.validation.Errors) */ @Test public void validate_shouldFailValidationIfRouteIsNullForSimpleDosingInstructionsDosingType() { DrugOrder order = new DrugOrder(); order.setDosingType(SimpleDosingInstructions.class); order.setRoute(null); Errors errors = new BindException(order, "order"); new DrugOrderValidator().validate(order, errors); Assert.assertTrue(errors.hasFieldErrors("route")); }
private DrugOrder createValidDrugOrder() { DrugOrder drugOrder = new DrugOrder(); drugOrder.setDose(10.0); drugOrder.setDoseUnits(createConceptWithName("ml")); drugOrder.setRoute(createConceptWithName("IV")); OrderFrequency frequency = new OrderFrequency(); frequency.setConcept(createConceptWithName("Twice a day")); drugOrder.setFrequency(frequency); return drugOrder; }
/** * @see DrugOrderValidator#validate(Object, org.springframework.validation.Errors) */ @Test public void validate_shouldFailIfRouteIsNotAValidConcept() { Concept concept = Context.getConceptService().getConcept(3); assertThat(concept, not(isIn(Context.getOrderService().getDrugRoutes()))); DrugOrder order = new DrugOrder(); order.setDosingType(FreeTextDosingInstructions.class); order.setDuration(5); order.setDurationUnits(concept); order.setDose(1.0); order.setDoseUnits(concept); order.setQuantity(30.0); order.setQuantityUnits(concept); order.setRoute(concept); Errors errors = new BindException(order, "order"); new DrugOrderValidator().validate(order, errors); Assert.assertTrue(errors.hasFieldErrors("route")); Assert.assertEquals("DrugOrder.error.routeNotAmongAllowedConcepts", errors.getFieldError("route").getCode()); }
order.setQuantityUnits(conceptService.getConcept(51)); order.setFrequency(orderService.getOrderFrequency(3000)); order.setRoute(conceptService.getConcept(22)); order.setNumRefills(10);
/** * @see org.openmrs.Order#copyHelper(Order) */ protected DrugOrder copyHelper(DrugOrder target) { super.copyHelper(target); target.setDose(getDose()); target.setDoseUnits(getDoseUnits()); target.setFrequency(getFrequency()); target.setAsNeeded(getAsNeeded()); target.setAsNeededCondition(getAsNeededCondition()); target.setQuantity(getQuantity()); target.setQuantityUnits(getQuantityUnits()); target.setDrug(getDrug()); target.setDosingType(getDosingType()); target.setDosingInstructions(getDosingInstructions()); target.setDuration(getDuration()); target.setDurationUnits(getDurationUnits()); target.setNumRefills(getNumRefills()); target.setRoute(getRoute()); target.setBrandName(getBrandName()); target.setDispenseAsWritten(getDispenseAsWritten()); target.setDrugNonCoded(getDrugNonCoded()); return target; }
/** * @see Order#cloneForRevisionHelper(Order) */ protected DrugOrder cloneForRevisionHelper(DrugOrder target) { super.cloneForRevisionHelper(target); target.setDose(getDose()); target.setDoseUnits(getDoseUnits()); target.setFrequency(getFrequency()); target.setAsNeeded(getAsNeeded()); target.setAsNeededCondition(getAsNeededCondition()); target.setQuantity(getQuantity()); target.setQuantityUnits(getQuantityUnits()); target.setDrug(getDrug()); target.setDosingType(getDosingType()); target.setDosingInstructions(getDosingInstructions()); target.setDuration(getDuration()); target.setDurationUnits(getDurationUnits()); target.setRoute(getRoute()); target.setNumRefills(getNumRefills()); target.setBrandName(getBrandName()); target.setDispenseAsWritten(getDispenseAsWritten()); target.setDrugNonCoded(getDrugNonCoded()); return target; }
order.setDose(duplicateOrder.getDose()); order.setDoseUnits(duplicateOrder.getDoseUnits()); order.setRoute(duplicateOrder.getRoute()); order.setFrequency(duplicateOrder.getFrequency()); order.setQuantity(duplicateOrder.getQuantity());
order.setQuantityUnits(conceptService.getConcept(51)); order.setFrequency(orderService.getOrderFrequency(1)); order.setRoute(conceptService.getConcept(22)); order.setDuration(10); order.setDurationUnits(conceptService.getConcept(1001)); order2.setQuantityUnits(conceptService.getConcept(51)); order2.setFrequency(orderService.getOrderFrequency(1)); order2.setRoute(conceptService.getConcept(22)); order2.setDuration(20); order2.setDurationUnits(conceptService.getConcept(1001));
order.setDose(orderToDiscontinue.getDose()); order.setDoseUnits(orderToDiscontinue.getDoseUnits()); order.setRoute(orderToDiscontinue.getRoute()); order.setFrequency(orderToDiscontinue.getFrequency()); order.setQuantity(orderToDiscontinue.getQuantity());
order.setDoseUnits(conceptService.getConcept(50)); order.setFrequency(orderService.getOrderFrequency(1)); order.setRoute(conceptService.getConcept(22)); order.setNumRefills(10); order.setQuantity(20.0);
order.setDoseUnits(conceptService.getConcept(50)); order.setFrequency(orderService.getOrderFrequency(1)); order.setRoute(conceptService.getConcept(22)); order.setNumRefills(10); order.setQuantity(20.0);
drugOrder.setDose(duplicateOrder.getDose()); drugOrder.setDoseUnits(duplicateOrder.getDoseUnits()); drugOrder.setRoute(duplicateOrder.getRoute()); drugOrder.setFrequency(duplicateOrder.getFrequency()); drugOrder.setQuantity(duplicateOrder.getQuantity());
@Test public void saveOrder_shouldSetAutoExpireDateOfDrugOrderIfAutoExpireDateIsNotSet() throws ParseException { executeDataSet("org/openmrs/api/include/OrderServiceTest-drugOrderAutoExpireDate.xml"); Drug drug = conceptService.getDrug(3000); DrugOrder drugOrder = new DrugOrder(); Encounter encounter = encounterService.getEncounter(3); drugOrder.setEncounter(encounter); drugOrder.setPatient(patientService.getPatient(7)); drugOrder.setCareSetting(orderService.getCareSetting(1)); drugOrder.setOrderer(Context.getProviderService().getProvider(1)); drugOrder.setDrug(drug); drugOrder.setDosingType(SimpleDosingInstructions.class); drugOrder.setDose(300.0); drugOrder.setDoseUnits(conceptService.getConcept(50)); drugOrder.setQuantity(20.0); drugOrder.setQuantityUnits(conceptService.getConcept(51)); drugOrder.setFrequency(orderService.getOrderFrequency(3)); drugOrder.setRoute(conceptService.getConcept(22)); drugOrder.setNumRefills(0); drugOrder.setOrderType(null); drugOrder.setDateActivated(TestUtil.createDateTime("2014-08-03")); drugOrder.setDuration(20);// 20 days drugOrder.setDurationUnits(conceptService.getConcept(1001)); Order savedOrder = orderService.saveOrder(drugOrder, null); Order loadedOrder = orderService.getOrder(savedOrder.getId()); Assert.assertEquals(TestUtil.createDateTime("2014-08-22 23:59:59"), loadedOrder.getAutoExpireDate()); }
drugOrder.setQuantityUnits(conceptService.getConcept(51)); drugOrder.setFrequency(orderService.getOrderFrequency(3)); drugOrder.setRoute(conceptService.getConcept(22)); drugOrder.setNumRefills(10); drugOrder.setOrderType(null);
dor.setDose(Double.valueOf(ds.getDose())); dor.setDoseUnits(conceptService.getConceptByName(ds.getUnits())); dor.setRoute(Context.getConceptService().getConceptByName("UNKNOWN")); dor.setDateActivated(startDate); dor.setPatient(patient);
revisedOrder.setDuration(orderTag.duration); revisedOrder.setDurationUnits(orderTag.durationUnits); revisedOrder.setRoute(orderTag.route); revisedOrder.setCareSetting(Context.getOrderService().getCareSetting(orderTag.careSettingId)); OrderFrequency orderFrequency = Context.getOrderService().getOrderFrequency(Integer.valueOf(orderTag.frequency));
drugOrder.setDuration(orderTag.duration); drugOrder.setDurationUnits(orderTag.durationUnits); drugOrder.setRoute(orderTag.route); drugOrder.setCareSetting(Context.getOrderService().getCareSetting(orderTag.careSettingId)); OrderFrequency orderFrequency = Context.getOrderService().getOrderFrequency(Integer.valueOf(orderTag.frequency));