Class EMediplanPatient

java.lang.Object
org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplanPatient
All Implemented Interfaces:
EMediplanExtendable, EMediplanObject

public class EMediplanPatient extends Object implements EMediplanExtendable, EMediplanObject
  • Field Details

    • MEDICAL_DATA_FIELD_NAME

      protected static final String MEDICAL_DATA_FIELD_NAME
      See Also:
    • firstName

      protected String firstName
      First name.
    • lastName

      protected String lastName
      Last name.
    • birthDate

      protected LocalDate birthDate
      Date of birth, day precision. Format: yyyy-mm-dd (ISO 86013 Date)
    • gender

      protected Gender gender
      Gender of the patient. The terms gender and sex are considered synonyms in ChMed23A.
    • address

      protected EMediplanPostalAddress address
      Postal address of the patient.
    • languageCode

      protected String languageCode
      The patient's language (ISO 639-16 language code) (e.g. de). Note that while the lowercase version is preferred, the codes are also valid in uppercase (e.g. DE).
    • ids

      protected List<EMediplanPatientId> ids
      List of patient identifiers.
    • extensions

      protected @Nullable List<@NonNull EMediplanExtension> extensions
      The list of extensions. Optional if empty.
    • medicalData

      protected @Nullable EMediplanPatientMedicalData medicalData
      Medical data information.
    • phones

      protected List<@NonNull String> phones
      List of phone numbers.
    • emails

      protected List<@NonNull String> emails
      List of email addresses.
  • Constructor Details

    • EMediplanPatient

      public EMediplanPatient()
  • Method Details

    • getExtensions

      public List<@NonNull EMediplanExtension> getExtensions()
      Description copied from interface: EMediplanExtendable
      Gets the list of this object's extensions.
      Specified by:
      getExtensions in interface EMediplanExtendable
      Returns:
      The list of extensions.
    • 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.
    • 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, 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 EMediplanObject
    • fromEprFhir

      public static EMediplanPatient fromEprFhir(ChCorePatientEpr eprFhirPatient, @Nullable org.hl7.fhir.r4.model.Observation weightObservation)
      Gets an EMediplanPatient from an CH EPR patient.
      Parameters:
      eprFhirPatient - The CH EPR patient to be converted.
      Returns:
      The eMediplan patient.
    • 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.