Class EPrescriptionConverter
- All Implemented Interfaces:
EMediplanConverter
EPrescription).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EMediplanMedicationResolverprotected final TreatmentPlanResolver -
Constructor Summary
ConstructorsConstructorDescriptionConvenience constructor that uses aEMediplanMedicationResolver.NoOpMedicationResolverand a no-op treatment resolver.EPrescriptionConverter(EMediplanMedicationResolver medicationResolver, TreatmentPlanResolver treatmentPlanResolver) Constructor of an ePrescription converter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDose(TimingEventAmbu timing, double value, UnitCode unit, List<@NonNull org.hl7.fhir.r4.model.Dosage> dosage) Adds a single dose information to the dosage instructions list.protected List<@NonNull org.hl7.fhir.r4.model.Dosage> getDosage(EPrescriptionMedicament medicament) Gets the CH EMED EPR dosage instructions, i.e. the list ofDosageobjects, for a medication entry of an eMediplan ePrescription.protected EPrescriptionprotected EPrescriptionMedicamentprotected EPrescriptionsetPrescriptionAuthor(EPrescription ePrescription, Author lastMedicalAuthor) toChEmedEprPrescription(EPrescription ePrescription, LanguageCode language, byte[] pdf) Converts an ePrescription to a CH EMED EPR PRE document.Not supported.Converts the received PRE document to an eMediplan object.protected EPrescriptionMedicamenttoMedicament(ChEmedEprMedication medication, ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, @Nullable String treatmentReason, Author medicalAuthor, SubstanceAdministrationSubstitutionCode substitutionCode, @Nullable org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent dispenseRequest, EMediplanType mediplanType) protected ChEmedEprMedicationRequestPretoMedicationRequest(EPrescriptionMedicament medicament, ChEmedEprPatient patient, ChEmedEprPractitionerRole requester, Instant timestamp, LanguageCode language) Gets the CH EMED EPR MedicationRequest representation of a received medication from an eMediplan ePrescription.Methods inherited from class org.projecthusky.fhir.emed.ch.epr.service.converter.emediplan.ChMed16ABaseConverter
appendToApplicationInstructions, getEMediplanTakingTimeFromChEmedEprDose, toMedicament, toMedicament, toPlanPosology, toPosology, toPrescriptionPosologyMethods 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.service.converter.emediplan.EMediplanConverter
medicalAuthorToPrescriber
-
Field Details
-
medicationResolver
-
treatmentPlanResolver
-
-
Constructor Details
-
EPrescriptionConverter
public EPrescriptionConverter()Convenience constructor that uses aEMediplanMedicationResolver.NoOpMedicationResolverand a no-op treatment resolver. Note that resulting PRE documents will not be valid because its medication requests will be missing the treatment plan extension.See
EPrescriptionConverter(EMediplanMedicationResolver, TreatmentPlanResolver) -
EPrescriptionConverter
public EPrescriptionConverter(EMediplanMedicationResolver medicationResolver, TreatmentPlanResolver treatmentPlanResolver) Constructor of an ePrescription converter.- Parameters:
medicationResolver- The resolver that can get a FHIR medication resource from a eMediplan medication id and id type.treatmentPlanResolver- The resolver that can get to which treatment plan to attach new medication requests.
-
-
Method Details
-
toEMediplan
Not supported.- Specified by:
toEMediplanin interfaceEMediplanConverter- Overrides:
toEMediplanin classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription> - Parameters:
pmlc- The PMLC document to be converted.- Returns:
- A best-effort equivalent eMediplan object.
- Throws:
UnsupportedOperationException- always.
-
toEMediplan
Description copied from interface:EMediplanConverterConverts the received PRE document to an eMediplan object.- Specified by:
toEMediplanin interfaceEMediplanConverter- Overrides:
toEMediplanin classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription> - Parameters:
pre- The PRE document to be converted.- Returns:
- A best-effort equivalent eMediplan object.
-
getNewMedicamentInstance
- Specified by:
getNewMedicamentInstancein classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription>
-
getNewEmediplanInstance
- Specified by:
getNewEmediplanInstancein classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription>
-
setPrescriptionAuthor
@ExpectsValidResource protected EPrescription setPrescriptionAuthor(EPrescription ePrescription, Author lastMedicalAuthor) - Overrides:
setPrescriptionAuthorin classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription>
-
toMedicament
@ExpectsValidResource protected EPrescriptionMedicament toMedicament(ChEmedEprMedication medication, ChEmedEprDosage baseDosage, List<@NonNull ChEmedEprDosage> additionalDosages, @Nullable String treatmentReason, Author medicalAuthor, SubstanceAdministrationSubstitutionCode substitutionCode, @Nullable org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent dispenseRequest, EMediplanType mediplanType) - Overrides:
toMedicamentin classChMed16ABaseConverter<EPrescriptionMedicament,EPrescription>
-
toChEmedEprPrescription
@ExpectsValidResource public ChEmedEprDocumentPre toChEmedEprPrescription(EPrescription ePrescription, LanguageCode language, byte[] pdf) Converts an ePrescription to a CH EMED EPR PRE document. No pre-validation is performed before conversion.Note that the method might result in exceptions if the provided ePrescription content is not valid or cannot be converted to CH EMED EPR. However, the lack of exceptions does not mean the resulting PRE is outright valid. This converter might produce PRE documents that are still missing needed elements to pass CH EMED EPR validation. This allows client systems to complete PRE documents with their own business logic and/or specific needs.
- Parameters:
ePrescription- The ePrescription document to be converted.language- The language to which to set the resulting FHIR document. Note that ePrescription does not have such a field.pdf- The original PDF in Base64. Note that the PDF should be PDF/A1 or PDF/A2 conformant, but this method will not run any checks on this.- Returns:
- The resulting CH EMED EPR PRE document object.
-
toMedicationRequest
@ExpectsValidResource protected ChEmedEprMedicationRequestPre toMedicationRequest(EPrescriptionMedicament medicament, ChEmedEprPatient patient, ChEmedEprPractitionerRole requester, Instant timestamp, LanguageCode language) Gets the CH EMED EPR MedicationRequest representation of a received medication from an eMediplan ePrescription.- Parameters:
medicament- The medicament entry from the eMediplan ePrescription to be converted.patient- The prescription's patient.requester- The prescriber.timestamp- The timestamp of the prescription.language- The prescription's language.- Returns:
- The resulting CH EMED EPR medication request if conversion is successful. Note that successful conversion does not mean that the medication request is complete and would pass validation. This depends on the completeness of the received eMediplan medicament object as well as this converter's configuration, notably regarding the treatment plan resolver and the medication resolver.
-
getDosage
@ExpectsValidResource protected List<@NonNull org.hl7.fhir.r4.model.Dosage> getDosage(EPrescriptionMedicament medicament) Gets the CH EMED EPR dosage instructions, i.e. the list ofDosageobjects, for a medication entry of an eMediplan ePrescription.Note that at present this method has several caveats:
- It will not fill the
textelement of the base dosage. There is no eMediplan equivalent and although foreseen, a generator has yet to be implemented. See issue #348 for more information. - eMediplan ePrescription allow for a medication entry to be conveyed without either text patient
instructions or a posology object. CH EMED EPR requires at least either of them. An eMediplan entry
missing both will result in an
InvalidEmedContentException. - Other incompatibilities (like unmapped units like
CdTyp9.UNKNOWN) may result in a runtime exception.
- Parameters:
medicament- The eMediplan ePrescription medication [request] entry.- Returns:
- The resulting list of FHIR dosage objects.
- It will not fill the
-
addDose
@ExpectsValidResource protected void addDose(TimingEventAmbu timing, double value, UnitCode unit, List<@NonNull org.hl7.fhir.r4.model.Dosage> dosage) Adds a single dose information to the dosage instructions list.This method will add the dose to an existing
ChEmedEprDosageobject within the dosage instructions list, if appropriate, or add is a new one to the list otherwise. For instance: if there is already a base dosage with 1 tablet to be taken in the morning, a second dosage with 2 tablets to be taken at noon, and the method is called with a dose of 1 tablet to be taken in the evening, the method will simply add the new timing to the base dosage object. Should the method then be called with 3 tablets in the night, a new dosage object will be added to the dosage instructions list and the sequence element set accordingly.- Parameters:
timing- The dosage timing.value- The dose quantity value.unit- The dose quantity unit.dosage- The dosage instructions list. Note that the list might be mutated by the method.
-