Class EMediplanMedicament<E extends EMediplanObject>

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplanMedicament<E>
Type Parameters:
E - The type of extension object.
All Implemented Interfaces:
EMediplanExtendable<E>, EMediplanObject
Direct Known Subclasses:
ChMed16AMedicament, ChMed23AMedicament

public abstract class EMediplanMedicament<E extends EMediplanObject> extends Object implements EMediplanExtendable<E>
A base class for an eMediplan medicament object.
  • Field Details

    • DEFAULT_NUMBER_OF_PACKAGES

      public static final Double DEFAULT_NUMBER_OF_PACKAGES
  • Constructor Details

    • EMediplanMedicament

      public EMediplanMedicament()
  • Method Details

    • getId

      public abstract String getId()
    • getIdType

      public abstract MedicamentIdType getIdType()
    • getReason

      public abstract @Nullable String getReason()
    • getPrescriber

      public abstract @Nullable String getPrescriber()
    • getNumberOfPackages

      public abstract @Nullable Double getNumberOfPackages()
    • getIdFieldName

      protected abstract String getIdFieldName()
    • getIdTypeFieldName

      protected abstract String getIdTypeFieldName()
    • isSelfMedication

      @ExpectsValidResource public abstract boolean isSelfMedication()
    • isSubstitutionForbidden

      public abstract boolean isSubstitutionForbidden()
    • forbidSubstitution

      public abstract void forbidSubstitution(@Nullable Boolean selfMedication)
    • resolveNumberOfPackages

      public Double resolveNumberOfPackages()
      Resolves the actual number of packages, taking into account that the default is 1 if the actual number is not specified.

      Note that it makes no sense to call this method in the context of a medication plan, since this is purely a prescription and dispense matter. A call to this method in the context of a medication plan will still yield a number (by default, 1), because this method is not context-aware.

      Returns:
      The number of packages to be delivered when redeeming the prescription.
    • validateBase

      protected ValidationResult validateBase(@Nullable String basePath, boolean contextAwareCaller)
      Parameters:
      basePath - The object's JSON path.
      contextAwareCaller - Whether the method was called from a basic object validation (i.e. validate(String)) or with context (i.e. validate(String, EMediplanType)). This allows avoiding redundant checks, if the context-aware caller will also invoke children validation that are context-aware, thus the basic validator will skip those.
      Returns:
      The validation result.
    • validate

      public ValidationResult validate(@Nullable String basePath)
      Description copied from interface: EMediplanObject
      Validates the eMediplan object, without any further context than its JSON path and its own content, against the eMediplan specs.
      Specified by:
      validate in interface EMediplanObject
      Parameters:
      basePath - The JSON path of this object. If null, the object is considered to be root. Any validation issues produced by the validation will use this path as a base for each issue's path.
      Returns:
      The validation result containing all the encountered validation issues, if any.
    • validate

      public ValidationResult validate(@Nullable String basePath, EMediplanType mediplanType)
      Context-aware validation, that takes into account whether the eMediplan document is a treatment plan or a prescription.
      Parameters:
      basePath - The object's JSON path.
      mediplanType - The eMediplan document type.
      Returns:
      The validation result.
    • trim

      public void trim()
      Description copied from interface: EMediplanObject
      Trims the eMediplan object, that is, removes any redundant info and sets to null values that match the default assumed value by the specs, to shorten the serialized result.
      Specified by:
      trim in interface EMediplanExtendable<E extends EMediplanObject>
      Specified by:
      trim in interface EMediplanObject