Class EMediplanPatient<E extends EMediplanObject,G extends EMediplanGender,I extends EMediplanIdentifier>

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplanPatient<E,G,I>
Type Parameters:
E - The specific type of eMediplan extension.
G - The specific type of eMediplan Gender enum.
I - The specific type of patient identifier object.
All Implemented Interfaces:
EMediplanExtendable<E>, EMediplanObject
Direct Known Subclasses:
ChMed16APatient, ChMed23APatient

public abstract class EMediplanPatient<E extends EMediplanObject,G extends EMediplanGender,I extends EMediplanIdentifier> extends Object implements EMediplanExtendable<E>
Base class for modelling an eMediplan patient object, be it for CHMED16A or CHMED23A.
  • Constructor Details

    • EMediplanPatient

      public EMediplanPatient()
  • Method Details

    • getLanguageFieldName

      protected abstract String getLanguageFieldName()
    • getIdsFieldName

      protected abstract String getIdsFieldName()
    • getMedicalDataFieldName

      protected abstract String getMedicalDataFieldName()
    • getPhonesFieldName

      protected abstract String getPhonesFieldName()
    • getEmailsFieldName

      protected abstract String getEmailsFieldName()
    • getFirstName

      public abstract @Nullable String getFirstName()
    • getLastName

      public abstract @Nullable String getLastName()
    • getBirthDate

      public abstract @Nullable LocalDate getBirthDate()
    • getGender

      public abstract @Nullable G getGender()
    • getAddress

      public abstract @Nullable EMediplanPostalAddress getAddress()
    • getLanguageCode

      public abstract @Nullable String getLanguageCode()
    • getMedicalData

      public abstract @Nullable EMediplanPatientMedicalData<E> getMedicalData()
    • getPhones

      public abstract List<@NonNull String> getPhones()
    • getEmails

      public abstract List<@NonNull String> getEmails()
    • getIds

      public abstract @Nullable List<@NonNull I> getIds()
    • validateBase

      protected ValidationResult validateBase(@Nullable String basePath, boolean contextAwareCaller)
      Base validation that performs or skips certain validation checks depending on whether the caller is context-aware or not. This prevents redundant validation checks when the caller is context-aware and will also call children context-aware validation methods instead of their basic counterparts, that will be skipped by this method.
      Parameters:
      basePath - The object's JSON path.
      contextAwareCaller - Whether caller is context aware or not. If true, some validation checks might be skipped.
      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, Instant timestamp)
      Validates the patient object taking into account which type of eMediplan document it belongs to. It performs the basic check done by validate(String) plus extra validation taking into account the document type.
      Parameters:
      basePath - The base path of the JSON object.
      mediplanType - The type of eMediplan document.
      timestamp - The timestamp of the eMediplan document creation.
      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
    • fhirLanguageCodeToEMediplanLanguageCode

      public static @Nullable String fhirLanguageCodeToEMediplanLanguageCode(String code)
      Translates a code value from a FHIR language coding to an eMediplan language code.

      It expects a language code that would be either a 2-character ISO language code or one of the 5 characters long Swiss variants (e.g. fr-CH). Matching is not case-sensitive. A 5-character language code will be shortened to a 2 character code to comply with eMediplan specifications.

      Parameters:
      code - The language code.
      Returns:
      The eMediplan language code.
    • validatePhone

      protected ValidationResult validatePhone(@Nullable String basePath, String fieldName, int index, String phone)
    • validateEmailAddress

      protected ValidationResult validateEmailAddress(@Nullable String basePath, String fieldName, int index, String email)
    • toFhir

      Gets the CH EMED EPR FHIR representation of the eMediplan patient object.
      Returns:
      The CH EMED EPR patient object.
      Throws:
      InvalidEmedContentException - if it is not possible to get a valid CH EMED EPR patient from the eMediplan object.