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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringTranslates a code value from a FHIR language coding to an eMediplan language code.abstract @Nullable EMediplanPostalAddressabstract @Nullable LocalDateprotected abstract Stringabstract @Nullable Stringabstract @Nullable GgetIds()protected abstract Stringabstract @Nullable Stringprotected abstract Stringabstract @Nullable Stringabstract @Nullable EMediplanPatientMedicalData<E> protected abstract Stringprotected abstract StringtoFhir()Gets the CH EMED EPR FHIR representation of the eMediplan patient object.voidtrim()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.Validates the eMediplan object, without any further context than its JSON path and its own content, against the eMediplan specs.validate(@Nullable String basePath, EMediplanType mediplanType, Instant timestamp) Validates the patient object taking into account which type of eMediplan document it belongs to.protected ValidationResultvalidateBase(@Nullable String basePath, boolean contextAwareCaller) Base validation that performs or skips certain validation checks depending on whether the caller is context-aware or not.protected ValidationResultvalidateEmailAddress(@Nullable String basePath, String fieldName, int index, String email) protected ValidationResultvalidatePhone(@Nullable String basePath, String fieldName, int index, String phone) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplanExtendable
addExtension, getExtensions, getExtensionsFieldName, validateExtensionsMethods inherited from interface org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplanObject
getFieldValidationPath, getFieldValidationPath, getIgnoredFieldValidationIssue, getRequiredFieldValidationIssue, getValidationIssue, hasExtensions, validate
-
Constructor Details
-
EMediplanPatient
public EMediplanPatient()
-
-
Method Details
-
getLanguageFieldName
-
getIdsFieldName
-
getMedicalDataFieldName
-
getPhonesFieldName
-
getEmailsFieldName
-
getFirstName
-
getLastName
-
getBirthDate
-
getGender
-
getAddress
-
getLanguageCode
-
getMedicalData
-
getPhones
-
getEmails
-
getIds
-
validateBase
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
Description copied from interface:EMediplanObjectValidates the eMediplan object, without any further context than its JSON path and its own content, against the eMediplan specs.- Specified by:
validatein interfaceEMediplanObject- Parameters:
basePath- The JSON path of this object. Ifnull, 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 byvalidate(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:EMediplanObjectTrims 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:
trimin interfaceEMediplanExtendable<E extends EMediplanObject>- Specified by:
trimin interfaceEMediplanObject
-
fhirLanguageCodeToEMediplanLanguageCode
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.
-