@Test public void testFillInfusionRateFromFormula2() { final VariableComplexTherapyDto therapy = new VariableComplexTherapyDto(); therapy.setContinuousInfusion(false); final TimedComplexDoseElementDto timedComplexDoseElement1 = new TimedComplexDoseElementDto(); therapy.getTimedDoseElements().add(timedComplexDoseElement1); final ComplexDoseElementDto doseElement1 = new ComplexDoseElementDto(); timedComplexDoseElement1.setDoseElement(doseElement1); doseElement1.setRateFormulaUnit("mg/kg/h"); doseElement1.setRateFormula(2.0); final TimedComplexDoseElementDto timedComplexDoseElement2 = new TimedComplexDoseElementDto(); therapy.getTimedDoseElements().add(timedComplexDoseElement2); final ComplexDoseElementDto doseElement2 = new ComplexDoseElementDto(); timedComplexDoseElement2.setDoseElement(doseElement2); doseElement2.setRateFormulaUnit("mg/kg/h"); doseElement2.setRateFormula(4.0); final InfusionIngredientDto ingredient = new InfusionIngredientDto(); therapy.getIngredientsList().add(ingredient); ingredient.setQuantityUnit("mg"); ingredient.setQuantity(10.0); ingredient.setQuantityDenominator(5.0); final MedicationDto medication = new MedicationDto(); ingredient.setMedication(medication); medication.setMedicationType(MedicationTypeEnum.MEDICATION); medicationsBo.fillInfusionRateFromFormula(therapy, 10.0, 70.0); assertEquals(new Double(10.0), therapy.getTimedDoseElements().get(0).getDoseElement().getRate()); assertEquals(new Double(20.0), therapy.getTimedDoseElements().get(1).getDoseElement().getRate()); }
@Override public void fillInfusionRateFromFormula( final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight) { final InfusionRateCalculationDto calculationData = getInfusionRateCalculationData(therapy); if (calculationData != null && calculationData.getQuantity() != null && calculationData.getQuantityDenominator() != null) { if (therapy instanceof ConstantComplexTherapyDto) { final ConstantComplexTherapyDto constantTherapy = (ConstantComplexTherapyDto)therapy; final ComplexDoseElementDto doseElement = constantTherapy.getDoseElement(); if (doseElement != null && doseElement.getRateFormula() != null && doseElement.getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( doseElement.getRateFormula(), doseElement.getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { doseElement.setRate(rate); } } } else { final VariableComplexTherapyDto variableTherapy = (VariableComplexTherapyDto)therapy; for (final TimedComplexDoseElementDto timedDoseElement : variableTherapy.getTimedDoseElements()) { if (timedDoseElement.getDoseElement() != null && timedDoseElement.getDoseElement().getRateFormula() != null && timedDoseElement.getDoseElement().getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( timedDoseElement.getDoseElement().getRateFormula(), timedDoseElement.getDoseElement().getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { timedDoseElement.getDoseElement().setRate(rate); } } } } } }
DefaultMedicationsBo implements MedicationsBo, MedicationFromEhrConverter.MedicationDataProvider { @Override public void fillInfusionRateFromFormula( final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight) { final InfusionRateCalculationDto calculationData = getInfusionRateCalculationData(therapy); if (calculationData != null && calculationData.getQuantity() != null && calculationData.getQuantityDenominator() != null) { if (therapy instanceof ConstantComplexTherapyDto) { final ConstantComplexTherapyDto constantTherapy = (ConstantComplexTherapyDto)therapy; final ComplexDoseElementDto doseElement = constantTherapy.getDoseElement(); if (doseElement != null && doseElement.getRateFormula() != null && doseElement.getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( doseElement.getRateFormula(), doseElement.getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { doseElement.setRate(rate); } } } else { final VariableComplexTherapyDto variableTherapy = (VariableComplexTherapyDto)therapy; for (final TimedComplexDoseElementDto timedDoseElement : variableTherapy.getTimedDoseElements()) { if (timedDoseElement.getDoseElement() != null && timedDoseElement.getDoseElement().getRateFormula() != null && timedDoseElement.getDoseElement().getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( timedDoseElement.getDoseElement().getRateFormula(), timedDoseElement.getDoseElement().getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { timedDoseElement.getDoseElement().setRate(rate); } } } } } } }
DefaultMedicationsBo implements MedicationsBo, MedicationFromEhrConverter.MedicationDataProvider { @Override public void fillInfusionRateFromFormula( final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight) { final InfusionRateCalculationDto calculationData = getInfusionRateCalculationData(therapy); if (calculationData != null && calculationData.getQuantity() != null && calculationData.getQuantityDenominator() != null) { if (therapy instanceof ConstantComplexTherapyDto) { final ConstantComplexTherapyDto constantTherapy = (ConstantComplexTherapyDto)therapy; final ComplexDoseElementDto doseElement = constantTherapy.getDoseElement(); if (doseElement != null && doseElement.getRateFormula() != null && doseElement.getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( doseElement.getRateFormula(), doseElement.getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { doseElement.setRate(rate); } } } else { final VariableComplexTherapyDto variableTherapy = (VariableComplexTherapyDto)therapy; for (final TimedComplexDoseElementDto timedDoseElement : variableTherapy.getTimedDoseElements()) { if (timedDoseElement.getDoseElement() != null && timedDoseElement.getDoseElement().getRateFormula() != null && timedDoseElement.getDoseElement().getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( timedDoseElement.getDoseElement().getRateFormula(), timedDoseElement.getDoseElement().getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { timedDoseElement.getDoseElement().setRate(rate); } } } } } }  }
DefaultMedicationsBo implements MedicationsBo, MedicationFromEhrConverter.MedicationDataProvider { @Override public void fillInfusionRateFromFormula( final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight) { final InfusionRateCalculationDto calculationData = getInfusionRateCalculationData(therapy); if (calculationData != null && calculationData.getQuantity() != null && calculationData.getQuantityDenominator() != null) { if (therapy instanceof ConstantComplexTherapyDto) { final ConstantComplexTherapyDto constantTherapy = (ConstantComplexTherapyDto)therapy; final ComplexDoseElementDto doseElement = constantTherapy.getDoseElement(); if (doseElement != null && doseElement.getRateFormula() != null && doseElement.getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( doseElement.getRateFormula(), doseElement.getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { doseElement.setRate(rate); } } } else { final VariableComplexTherapyDto variableTherapy = (VariableComplexTherapyDto)therapy; for (final TimedComplexDoseElementDto timedDoseElement : variableTherapy.getTimedDoseElements()) { if (timedDoseElement.getDoseElement() != null && timedDoseElement.getDoseElement().getRateFormula() != null && timedDoseElement.getDoseElement().getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( timedDoseElement.getDoseElement().getRateFormula(), timedDoseElement.getDoseElement().getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { timedDoseElement.getDoseElement().setRate(rate); } } } } } }  @Autowired void setMedicationsOpenEhrDao(final MedicationsOpenEhrDao medicationsOpenEhrDao); @Autowired void setMedicationsDao(final MedicationsDao medicationsDao); @Autowired void setTaggingOpenEhrDao(final TaggingOpenEhrDao taggingOpenEhrDao); @Autowired void setTherapyDisplayProvider(final TherapyDisplayProvider therapyDisplayProvider); @Autowired void setMedicationsValueHolder(final ValueHolder<Map<Long, MedicationHolderDto>> medicationsValueHolder); @Autowired void setMedicationRoutesValueHolder(final ValueHolder<Map<Long, MedicationRouteDto>> medicationRoutesValueHolder); @Autowired void setMedicationHolderDtoMapper(final MedicationHolderDtoMapper medicationHolderDtoMapper); @Autowired void setMedicationsTasksProvider(final MedicationsTasksProvider medicationsTasksProvider); @Autowired void setMedicationOnAdmissionHandler(final MedicationOnAdmissionHandler medicationOnAdmissionHandler); @Autowired void setAdministrationProvider(final AdministrationProvider administrationProvider); @Override Map<Long, MedicationDataForTherapyDto> getMedicationDataForTherapies(
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> instructionsList,
      @Nullable final String careProviderId); @Override boolean isTherapyModifiedFromLastReview(
      @Nonnull final MedicationInstructionInstruction instruction,
      @Nonnull final List<MedicationActionAction> actionsList,
      @Nonnull final DateTime compositionCreatedTime); @Override int getTherapyConsecutiveDay(
      final DateTime therapyStart,
      final DateTime therapyDay,
      final DateTime currentTime,
      final Integer pastDaysOfTherapy); @Override DateTime getOriginalTherapyStart(
      @Nonnull final String patientId,
      @Nonnull final MedicationOrderComposition composition); @Override Pair<MedicationOrderComposition, MedicationInstructionInstruction> getInstructionFromLink(
      @Nonnull final String patientId,
      @Nonnull final MedicationInstructionInstruction instruction,
      @Nonnull final EhrLinkType linkType,
      final boolean getLatestVersion); @Override Pair<MedicationOrderComposition, MedicationInstructionInstruction> getInstructionFromLink(
      final String patientId,
      final Link link,
      final boolean getLatestVersion); @Override boolean isTherapySuspended(final List<MedicationActionAction> actionsList); @Override void sortTherapyTemplates(final TherapyTemplatesDto templates); @Override int compareTherapiesForSort(final TherapyDto firstTherapy, final TherapyDto secondTherapy, final Collator collator); @Override boolean areInstructionsLinkedByUpdate(
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> instructionPair,
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> compareInstructionPair); @Override boolean doesInstructionHaveLinkToCompareInstruction(
      final MedicationInstructionInstruction instruction,
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> compareInstructionPair,
      final EhrLinkType linkType); @Override List<Long> getMedicationIds(final OrderActivity orderActivity); @Override List<Long> getMedicationIds(final MedicationActionAction medicationAction); @Override Long getMainMedicationId(final OrderActivity orderActivity); @Override boolean isMentalHealthMedication(final long medicationId); @Override boolean isTherapyActive(
      final List<String> daysOfWeek,
      final Integer dosingDaysFrequency,
      final Interval therapyInterval,
      final DateTime when); @Override boolean isTherapySuspended(final MedicationOrderComposition composition, final MedicationInstructionInstruction instruction); @Override TherapyChangeReasonDto getTherapySuspendReason(
      @Nonnull final MedicationOrderComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction); @Override boolean isTherapyCancelledOrAborted(
      final MedicationOrderComposition composition, final MedicationInstructionInstruction instruction); @Override boolean isMedicationTherapyCompleted(
      final MedicationOrderComposition composition,
      final MedicationInstructionInstruction instruction); @Override MedicationActionAction getInstructionAction(
      final MedicationOrderComposition composition,
      final MedicationInstructionInstruction instruction,
      final MedicationActionEnum searchActionEnum,
      @Nullable final Interval searchInterval); @Override String getTherapyFormattedDisplay(
      final String patientId, final String therapyId, final DateTime when, final Locale locale); @Override TherapyDto getTherapy(
      final String patientId, final String compositionId, final String ehrOrderName, final DateTime when, final Locale locale); @Override TherapyDto convertInstructionToTherapyDto(
      @Nonnull final IspekComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction,
      final DateTime currentTime); @Override TherapyDto convertInstructionToTherapyDtoWithDisplayValues(
      @Nonnull final IspekComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction,
      final Double referenceWeight,
      final Double patientHeight,
      final DateTime currentTime,
      final boolean isToday,
      final Locale locale); @Override void fillDisplayValues(
      @Nonnull final TherapyDto therapy,
      final Double referenceWeight,
      final Double patientHeight,
      final boolean isToday,
      final Locale locale); @Override void fillInfusionFormulaFromRate(
      final ComplexTherapyDto therapy,
      final Double referenceWeight,
      final Double patientHeight); @Override void fillInfusionRateFromFormula(
      final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight); @Override double calculateBodySurfaceArea(final double heightInCm, final double weightInKg); @Override List<MedicationForWarningsSearchDto> getTherapiesForWarningsSearch(final String patientId, final DateTime when); @Override List<TherapyDto> getTherapies(
      final String patientId,
      final String centralCaseId,
      final Double referenceWeight,
      @Nullable final Locale locale,
      final DateTime when); @Override List<TherapyDto> getTherapies(
      final String patientId,
      final Interval searchInterval,
      final Double referenceWeight,
      final Double patientHeight,
      @Nullable final Locale locale,
      final DateTime when); @Override List<MedicationOnDischargeGroupDto> getMedicationOnDischargeGroups(
      final String patientId,
      final DateTime lastHospitalizationStart,
      @Nullable final Interval searchInterval,
      final Double referenceWeight,
      final Double patientHeight, // is this @Nullable ?
      @Nullable final Locale locale,
      final DateTime when); @Override List<MentalHealthTherapyDto> getMentalHealthTherapies(
      final String patientId,
      final Interval searchInterval,
      final DateTime when,
      final Locale locale); @Override List<TherapyDto> getLinkTherapyCandidates(
      @Nonnull final String patientId,
      @Nonnull final Double referenceWeight,
      final Double patientHeight,
      @Nonnull final DateTime when,
      @Nonnull final Locale locale); @Override List<TherapySurgeryReportElementDto> getTherapySurgeryReportElements(
      @Nonnull final String patientId,
      final Double patientHeight,
      @Nonnull final DateTime searchStart,
      @Nonnull final RoundsIntervalDto roundsIntervalDto,
      @Nonnull final Locale locale,
      @Nonnull final DateTime when); @Override List<MedicationForWarningsSearchDto> extractWarningsSearchDtos(
      @Nonnull final List<MedicationOrderComposition> compositions); @Override MedicationDto getMedication(final Long medicationId); @Override DoseFormDto getDoseForm(final String doseFormCode, final DateTime when); @Override DoseFormDto getMedicationDoseForm(final long medicationId); @Override MedicationRouteDto getMedicationRoute(final long routeId); @Override String getOriginalTherapyId(final String patientId, final String compositionUid); @Override String getOriginalTherapyId(@Nonnull final MedicationOrderComposition composition); @Override MedicationReferenceWeightComposition buildReferenceWeightComposition(
      final double weight,
      final DateTime when); @Override void sortTherapiesByMedicationTimingStart(
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> therapies, final boolean descending); @Override void deleteAdministration(final String patientId, final String compositionId, final String comment); @Override DocumentationTherapiesDto findTherapyGroupsForDocumentation(
      final String patientId,
      final String centralCaseId,
      final Interval centralCaseEffective,
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> instructionPairs,
      final boolean isOutpatient,
      final DateTime when,
      final Locale locale); @Override @Transactional @ServiceMethod(auditing = @Auditing(level = Level.FULL)) DateTime findPreviousTaskForTherapy(
      final String patientId,
      final String compositionUid,
      final String ehrOrderName,
      final DateTime when); }
DefaultMedicationsBo implements MedicationsBo, MedicationFromEhrConverter.MedicationDataProvider { @Override public void fillInfusionRateFromFormula( final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight) { final InfusionRateCalculationDto calculationData = getInfusionRateCalculationData(therapy); if (calculationData != null && calculationData.getQuantity() != null && calculationData.getQuantityDenominator() != null) { if (therapy instanceof ConstantComplexTherapyDto) { final ConstantComplexTherapyDto constantTherapy = (ConstantComplexTherapyDto)therapy; final ComplexDoseElementDto doseElement = constantTherapy.getDoseElement(); if (doseElement != null && doseElement.getRateFormula() != null && doseElement.getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( doseElement.getRateFormula(), doseElement.getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { doseElement.setRate(rate); } } } else { final VariableComplexTherapyDto variableTherapy = (VariableComplexTherapyDto)therapy; for (final TimedComplexDoseElementDto timedDoseElement : variableTherapy.getTimedDoseElements()) { if (timedDoseElement.getDoseElement() != null && timedDoseElement.getDoseElement().getRateFormula() != null && timedDoseElement.getDoseElement().getRateFormulaUnit() != null) { final Double rate = calculateInfusionRateFromFormula( timedDoseElement.getDoseElement().getRateFormula(), timedDoseElement.getDoseElement().getRateFormulaUnit(), calculationData, referenceWeight, patientHeight); if (rate != null) { timedDoseElement.getDoseElement().setRate(rate); } } } } } }  @Autowired void setMedicationsOpenEhrDao(final MedicationsOpenEhrDao medicationsOpenEhrDao); @Autowired void setMedicationsDao(final MedicationsDao medicationsDao); @Autowired void setTaggingOpenEhrDao(final TaggingOpenEhrDao taggingOpenEhrDao); @Autowired void setTherapyDisplayProvider(final TherapyDisplayProvider therapyDisplayProvider); @Autowired void setMedicationsValueHolder(final ValueHolder<Map<Long, MedicationHolderDto>> medicationsValueHolder); @Autowired void setMedicationRoutesValueHolder(final ValueHolder<Map<Long, MedicationRouteDto>> medicationRoutesValueHolder); @Autowired void setMedicationHolderDtoMapper(final MedicationHolderDtoMapper medicationHolderDtoMapper); @Autowired void setMedicationsTasksProvider(final MedicationsTasksProvider medicationsTasksProvider); @Autowired void setMedicationOnAdmissionHandler(final MedicationOnAdmissionHandler medicationOnAdmissionHandler); @Autowired void setAdministrationProvider(final AdministrationProvider administrationProvider); @Override Map<Long, MedicationDataForTherapyDto> getMedicationDataForTherapies(
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> instructionsList,
      @Nullable final String careProviderId); @Override boolean isTherapyModifiedFromLastReview(
      @Nonnull final MedicationInstructionInstruction instruction,
      @Nonnull final List<MedicationActionAction> actionsList,
      @Nonnull final DateTime compositionCreatedTime); @Override int getTherapyConsecutiveDay(
      final DateTime therapyStart,
      final DateTime therapyDay,
      final DateTime currentTime,
      final Integer pastDaysOfTherapy); @Override DateTime getOriginalTherapyStart(
      @Nonnull final String patientId,
      @Nonnull final MedicationOrderComposition composition); @Override Pair<MedicationOrderComposition, MedicationInstructionInstruction> getInstructionFromLink(
      @Nonnull final String patientId,
      @Nonnull final MedicationInstructionInstruction instruction,
      @Nonnull final EhrLinkType linkType,
      final boolean getLatestVersion); @Override Pair<MedicationOrderComposition, MedicationInstructionInstruction> getInstructionFromLink(
      final String patientId,
      final Link link,
      final boolean getLatestVersion); @Override boolean isTherapySuspended(final List<MedicationActionAction> actionsList); @Override void sortTherapyTemplates(final TherapyTemplatesDto templates); @Override int compareTherapiesForSort(final TherapyDto firstTherapy, final TherapyDto secondTherapy, final Collator collator); @Override boolean areInstructionsLinkedByUpdate(
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> instructionPair,
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> compareInstructionPair); @Override boolean doesInstructionHaveLinkToCompareInstruction(
      final MedicationInstructionInstruction instruction,
      final Pair<MedicationOrderComposition, MedicationInstructionInstruction> compareInstructionPair,
      final EhrLinkType linkType); @Override List<Long> getMedicationIds(final OrderActivity orderActivity); @Override List<Long> getMedicationIds(final MedicationActionAction medicationAction); @Override Long getMainMedicationId(final OrderActivity orderActivity); @Override boolean isMentalHealthMedication(final long medicationId); @Override boolean isTherapyActive(
      final List<String> daysOfWeek,
      final Integer dosingDaysFrequency,
      final Interval therapyInterval,
      final DateTime when); @Override boolean isTherapySuspended(final MedicationOrderComposition composition, final MedicationInstructionInstruction instruction); @Override TherapyChangeReasonDto getTherapySuspendReason(
      @Nonnull final MedicationOrderComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction); @Override boolean isTherapyCancelledOrAborted(
      final MedicationOrderComposition composition, final MedicationInstructionInstruction instruction); @Override boolean isMedicationTherapyCompleted(
      final MedicationOrderComposition composition,
      final MedicationInstructionInstruction instruction); @Override MedicationActionAction getInstructionAction(
      final MedicationOrderComposition composition,
      final MedicationInstructionInstruction instruction,
      final MedicationActionEnum searchActionEnum,
      @Nullable final Interval searchInterval); @Override String getTherapyFormattedDisplay(
      final String patientId, final String therapyId, final DateTime when, final Locale locale); @Override TherapyDto getTherapy(
      final String patientId, final String compositionId, final String ehrOrderName, final DateTime when, final Locale locale); @Override TherapyDto convertInstructionToTherapyDto(
      @Nonnull final IspekComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction,
      final DateTime currentTime); @Override TherapyDto convertInstructionToTherapyDtoWithDisplayValues(
      @Nonnull final IspekComposition composition,
      @Nonnull final MedicationInstructionInstruction instruction,
      final Double referenceWeight,
      final Double patientHeight,
      final DateTime currentTime,
      final boolean isToday,
      final Locale locale); @Override void fillDisplayValues(
      @Nonnull final TherapyDto therapy,
      final Double referenceWeight,
      final Double patientHeight,
      final boolean isToday,
      final Locale locale); @Override void fillInfusionFormulaFromRate(
      final ComplexTherapyDto therapy,
      final Double referenceWeight,
      final Double patientHeight); @Override void fillInfusionRateFromFormula(
      final ComplexTherapyDto therapy, final Double referenceWeight, final Double patientHeight); @Override double calculateBodySurfaceArea(final double heightInCm, final double weightInKg); @Override List<MedicationForWarningsSearchDto> getTherapiesForWarningsSearch(final String patientId, final DateTime when); @Override List<TherapyDto> getTherapies(
      final String patientId,
      final String centralCaseId,
      final Double referenceWeight,
      @Nullable final Locale locale,
      final DateTime when); @Override List<TherapyDto> getTherapies(
      final String patientId,
      final Interval searchInterval,
      final Double referenceWeight,
      final Double patientHeight,
      @Nullable final Locale locale,
      final DateTime when); @Override List<MedicationOnDischargeGroupDto> getMedicationOnDischargeGroups(
      final String patientId,
      final DateTime lastHospitalizationStart,
      @Nullable final Interval searchInterval,
      final Double referenceWeight,
      final Double patientHeight, // is this @Nullable ?
      @Nullable final Locale locale,
      final DateTime when); @Override List<MentalHealthTherapyDto> getMentalHealthTherapies(
      final String patientId,
      final Interval searchInterval,
      final DateTime when,
      final Locale locale); @Override List<TherapyDto> getLinkTherapyCandidates(
      @Nonnull final String patientId,
      @Nonnull final Double referenceWeight,
      final Double patientHeight,
      @Nonnull final DateTime when,
      @Nonnull final Locale locale); @Override List<TherapySurgeryReportElementDto> getTherapySurgeryReportElements(
      @Nonnull final String patientId,
      final Double patientHeight,
      @Nonnull final DateTime searchStart,
      @Nonnull final RoundsIntervalDto roundsIntervalDto,
      @Nonnull final Locale locale,
      @Nonnull final DateTime when); @Override List<MedicationForWarningsSearchDto> extractWarningsSearchDtos(
      @Nonnull final List<MedicationOrderComposition> compositions); @Override MedicationDto getMedication(final Long medicationId); @Override DoseFormDto getDoseForm(final String doseFormCode, final DateTime when); @Override DoseFormDto getMedicationDoseForm(final long medicationId); @Override MedicationRouteDto getMedicationRoute(final long routeId); @Override String getOriginalTherapyId(final String patientId, final String compositionUid); @Override String getOriginalTherapyId(@Nonnull final MedicationOrderComposition composition); @Override MedicationReferenceWeightComposition buildReferenceWeightComposition(
      final double weight,
      final DateTime when); @Override void sortTherapiesByMedicationTimingStart(
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> therapies, final boolean descending); @Override void deleteAdministration(final String patientId, final String compositionId, final String comment); @Override DocumentationTherapiesDto findTherapyGroupsForDocumentation(
      final String patientId,
      final String centralCaseId,
      final Interval centralCaseEffective,
      final List<Pair<MedicationOrderComposition, MedicationInstructionInstruction>> instructionPairs,
      final boolean isOutpatient,
      final DateTime when,
      final Locale locale); @Override @Transactional @ServiceMethod(auditing = @Auditing(level = Level.FULL)) DateTime findPreviousTaskForTherapy(
      final String patientId,
      final String compositionUid,
      final String ehrOrderName,
      final DateTime when);  }