Class ChMed16ABaseConverter<M extends ChMed16AMedicament,E extends ChMed16AEMediplan<M>>

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.service.converter.emediplan.ChMed16ABaseConverter<M,E>
All Implemented Interfaces:
EMediplanConverter
Direct Known Subclasses:
ChMed16AConverter, EPrescriptionConverter

public abstract non-sealed class ChMed16ABaseConverter<M extends ChMed16AMedicament,E extends ChMed16AEMediplan<M>> extends Object implements EMediplanConverter
Utility class to convert CH EMED EPR documents to an eMediplan object equivalent according to the CHMED16A specifications.
  • Constructor Details

    • ChMed16ABaseConverter

      public ChMed16ABaseConverter()
  • Method Details

    • toEMediplan

      @ExpectsValidResource @Nonnull public E toEMediplan(ChEmedEprDocumentPmlc pmlc)
      Converts the received PMLC document to an eMediplan object according to the CHMED16A specifications.
      Specified by:
      toEMediplan in interface EMediplanConverter
      Parameters:
      pmlc - The PMLC document to be converted.
      Returns:
      A best-effort equivalent eMediplan object.
    • toEMediplan

      @ExpectsValidResource @Nonnull public E toEMediplan(ChEmedEprDocumentPre pre)
      Description copied from interface: EMediplanConverter
      Converts the received PRE document to an eMediplan object.
      Specified by:
      toEMediplan in interface EMediplanConverter
      Parameters:
      pre - The PRE document to be converted.
      Returns:
      A best-effort equivalent eMediplan object.
    • setPrescriptionAuthor

      @ExpectsValidResource protected E setPrescriptionAuthor(E emediplan, Author lastMedicalAuthor)
    • toMedicament

      public M toMedicament(ChEmedEprMedicationStatementPmlc statement)
      Converts a CH EMED EPR PMLC medication statement to a CHMED16A medicament object.
      Parameters:
      statement - The original CH EMED EPR PMLC medication statement to be converted.
      Returns:
      The converted CHMED16A medicament object.
    • toMedicament

      protected M toMedicament(ChEmedEprMedicationRequestPre request)
    • toMedicament

      @ExpectsValidResource protected M toMedicament(ChEmedEprMedication medication, ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, @Nullable String treatmentReason, Author medicalAuthor, SubstanceAdministrationSubstitutionCode substitutionCode, @Nullable org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent dispenseRequest, EMediplanType mediplanType)
    • toPosology

      public @Nullable ChMed16APosology toPosology(ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, ChMed16AMedicament medicament, EMediplanType mediplanType)
      Converts the list of Dosage objects of a CH EMED EPR resource (either medication statement or medication request) to an ChMed16APosology object.
      Parameters:
      baseDosage - The CH EMED EPR resource base dosage.
      additionalDosages - The CH EMED EPR list of additional dosages (if split dose). It can be empty.
      medicament - The medication for which this dosage is being added. The medication object might be changed: this method might have to set or alter the application instructions if the CH EMED EPR dosage is expressed as free text or if it cannot be converted to the CHMED16A structure.
      mediplanType - The type of eMediplan document.
      Returns:
      The equivalent eMediplan posology object.
    • toPlanPosology

      protected ChMed16APosology toPlanPosology(ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, ChMed16AMedicament medicament)
      Converts the list of Dosage objects of a CH EMED EPR resource (either medication statement or medication request) to a ChMed16APosology object assumed to belong to a medication plan document.
      Parameters:
      baseDosage - The CH EMED EPR resource base dosage.
      additionalDosages - The CH EMED EPR list of additional dosages (if split dose). It can be empty.
      medicament - The medication for which this dosage is being added. The medication object might be changed: this method might have to set or alter the application instructions if the CH EMED EPR dosage is expressed as free text or if it cannot be converted to the CHMED16A structure.
      Returns:
      The equivalent eMediplan posology object.
    • toPrescriptionPosology

      protected @Nullable ChMed16APosology toPrescriptionPosology(ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, ChMed16AMedicament medicament)
      Converts the list of Dosage objects of a CH EMED EPR resource (either medication statement or medication request) to a ChMed16APosology object assumed to belong to a prescription document.
      Parameters:
      baseDosage - The CH EMED EPR resource base dosage.
      additionalDosages - The CH EMED EPR list of additional dosages (if split dose). It can be empty.
      medicament - The medication for which this dosage is being added. The medication object might be changed: this method might have to set or alter the application instructions if the CH EMED EPR dosage is expressed as free text or if it cannot be converted to the CHMED16A structure.
      Returns:
      The equivalent eMediplan posology object.
    • getEMediplanTakingTimeFromChEmedEprDose

      protected ChMed16ATakingTime getEMediplanTakingTimeFromChEmedEprDose(Dose chEmedEprDose, TimingEventAmbu timingEvent, boolean inReserve, @Nullable AmountQuantity maxDosePerAdministration)
      Converts a CH EMED EPR Dose to the appropriate ChMed16ATakingTime object.

      Note that the unit of the dose is ignored. The aim of this method is just to convert the quantity part of the dose object, since the unit is specified at a higher level in the eMediplan model.

      Parameters:
      chEmedEprDose - The CH EMED EPR dose to be converted.
      Returns:
      The resulting ChMed16ATakingTime object.
    • appendToApplicationInstructions

      protected void appendToApplicationInstructions(ChMed16AMedicament med, String extraContent)
    • getNewMedicamentInstance

      protected abstract M getNewMedicamentInstance()
    • getNewEmediplanInstance

      protected abstract E getNewEmediplanInstance()