Class EMediplan<E extends EMediplanObject,G extends EMediplanGender,M extends EMediplanMedicament<E>,I extends EMediplanIdentifier>
java.lang.Object
org.projecthusky.fhir.emed.ch.epr.model.emediplan.EMediplan<E,G,M,I>
- Type Parameters:
E- The type of eMediplan extension used by this document.G- The type of eMediplan patient gender enum used by this document.M- The type of eMediplan medicament object used by this document.I- The type of patient identifier object used by this document.
- All Implemented Interfaces:
EMediplanExtendable<E>,EMediplanObject
- Direct Known Subclasses:
ChMed16AEMediplan,ChMed23AEMediplan
public abstract class EMediplan<E extends EMediplanObject,G extends EMediplanGender,M extends EMediplanMedicament<E>,I extends EMediplanIdentifier>
extends Object
implements EMediplanExtendable<E>
Base class to model an eMediplan document object, be it of CHMED16A or CHMED23A specs.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMedicament(@NonNull M medicament) Convenience method to add a medication to the eMediplan document.protected static byte[]compressJson(String rawJson) Compresses the serialized eMediplan (JSON) using GZIP, as specified by CHMED23A and, optionally, CHMED16A.abstract Stringabstract Stringabstract @Nullable StringgetId()abstract EMediplanPatient<E, G, I> abstract @Nullable Stringabstract Instantabstract @Nullable EMediplanTypegetType()abstract EMediplanTypeResolves the eMediplan type, which can be missing for ChMed23A eMediplan objects authored by a patient, because a Medication Plan is assumed (since they are not allowed to author prescriptions).Converts the eMediplan format to the ChTransmissionFormat specified by the relevant ChMed specification.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.protected static byte[]uncompressJson(byte[] compressed) Uncompresses a received serialized eMediplan (JSON) normally conveyed via ChTransmissionFormat, as specified by eMediplan.Validates the eMediplan object, without any further context than its JSON path and its own content, against the eMediplan specs.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
-
Field Details
-
EMEDIPLAN_TIMEZONE
- See Also:
-
-
Constructor Details
-
EMediplan
public EMediplan()
-
-
Method Details
-
getEmediplanVersion
-
getChTransmissionFormatPrefix
-
getPatient
-
getMedicaments
-
getType
-
getId
-
getTimestamp
-
getRemark
-
resolveType
Resolves the eMediplan type, which can be missing for ChMed23A eMediplan objects authored by a patient, because a Medication Plan is assumed (since they are not allowed to author prescriptions).- Returns:
- The resolved
EMediplanType.
-
addMedicament
Convenience method to add a medication to the eMediplan document.- Parameters:
medicament- The eMediplan medicament object to be added.
-
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.
-
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
-
toChTransmissionFormat
Converts the eMediplan format to the ChTransmissionFormat specified by the relevant ChMed specification. This is useful for data transmission as well as used for the QR code to be embedded in the eMediplan paper/PDF format.Although ChMed16A supports non-compressed content within the transmission format, this implementation supports only compressed content.
- Returns:
- The ChTransmissionFormat string with the eMediplan object information.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- The eMediplan object could not be serialized to JSON.IOException- The eMediplan object could not be serialized and compressed to ChTransmissionFormat.
-
compressJson
Compresses the serialized eMediplan (JSON) using GZIP, as specified by CHMED23A and, optionally, CHMED16A.- Parameters:
rawJson- The raw JSON to be compressed.- Returns:
- The GZIP compressed byte array.
- Throws:
IOException- In case of error compressing the JSON content.
-
uncompressJson
Uncompresses a received serialized eMediplan (JSON) normally conveyed via ChTransmissionFormat, as specified by eMediplan.- Parameters:
compressed- The compressed content, as a byte array.- Returns:
- The uncompressed content, as a byte array.
- Throws:
IOException- In case of an I/O exception while uncompressing the received content.
-