Class ChEmedEprMedicationDispense
java.lang.Object
org.hl7.fhir.r4.model.Base
org.hl7.fhir.r4.model.BaseResource
org.hl7.fhir.r4.model.Resource
org.hl7.fhir.r4.model.DomainResource
org.hl7.fhir.r4.model.MedicationDispense
org.projecthusky.fhir.emed.ch.epr.resource.ChEmedEprMedicationDispense
- All Implemented Interfaces:
ca.uhn.fhir.model.api.IElement,Serializable,org.hl7.fhir.instance.model.api.IAnyResource,org.hl7.fhir.instance.model.api.IBase,org.hl7.fhir.instance.model.api.IBaseHasExtensions,org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions,org.hl7.fhir.instance.model.api.IBaseResource,org.hl7.fhir.instance.model.api.IDomainResource,ChEmedEprEntry
- Direct Known Subclasses:
ChEmedEprMedicationDispenseDis,ChEmedEprMedicationDispensePml
public abstract class ChEmedEprMedicationDispense
extends org.hl7.fhir.r4.model.MedicationDispense
implements ChEmedEprEntry
The HAPI custom structure for CH-EMED-EPR MedicationDispense.
- Author:
- Ronaldo Loureiro
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.hl7.fhir.r4.model.MedicationDispense
org.hl7.fhir.r4.model.MedicationDispense.MedicationDispensePerformerComponent, org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus, org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatusEnumFactory, org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Nullable ChEmedExtPharmaceuticalAdviceReference to the pharmaceutical advice.protected @Nullable ChEmedExtPrescriptionReference to the medication prescription.protected @Nullable ChEmedExtTreatmentPlanReference to the medication treatment planprotected @Nullable org.hl7.fhir.r4.model.StringTypeThe treatment reason.Fields inherited from class org.hl7.fhir.r4.model.MedicationDispense
authorizingPrescription, authorizingPrescriptionTarget, category, CODE, context, CONTEXT, contextTarget, daysSupply, destination, DESTINATION, destinationTarget, detectedIssue, detectedIssueTarget, dosageInstruction, eventHistory, eventHistoryTarget, identifier, IDENTIFIER, INCLUDE_CONTEXT, INCLUDE_DESTINATION, INCLUDE_MEDICATION, INCLUDE_PATIENT, INCLUDE_PERFORMER, INCLUDE_PRESCRIPTION, INCLUDE_RECEIVER, INCLUDE_RESPONSIBLEPARTY, INCLUDE_SUBJECT, location, locationTarget, medication, MEDICATION, note, partOf, partOfTarget, PATIENT, performer, PERFORMER, PRESCRIPTION, quantity, receiver, RECEIVER, receiverTarget, RESPONSIBLEPARTY, SP_CODE, SP_CONTEXT, SP_DESTINATION, SP_IDENTIFIER, SP_MEDICATION, SP_PATIENT, SP_PERFORMER, SP_PRESCRIPTION, SP_RECEIVER, SP_RESPONSIBLEPARTY, SP_STATUS, SP_SUBJECT, SP_TYPE, SP_WHENHANDEDOVER, SP_WHENPREPARED, status, STATUS, statusReason, subject, SUBJECT, subjectTarget, substitution, supportingInformation, supportingInformationTarget, type, TYPE, whenHandedOver, WHENHANDEDOVER, whenPrepared, WHENPREPAREDFields inherited from class org.hl7.fhir.r4.model.DomainResource
contained, extension, modifierExtension, textFields inherited from class org.hl7.fhir.r4.model.Resource
id, implicitRules, language, metaFields inherited from interface org.hl7.fhir.instance.model.api.IAnyResource
RES_ID, SP_RES_IDFields inherited from interface org.hl7.fhir.instance.model.api.IBaseResource
INCLUDE_ALL, WILDCARD_ALL_SET -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor for the parser.ChEmedEprMedicationDispense(UUID entryUuid, Instant whenHandedOver) Constructor that pre-populates fields. -
Method Summary
Modifier and TypeMethodDescriptionaddDosageAdditionalEntry(ChEmedEprDosage dosageAdditionalEntry) Adds additional entry of the dosage instruction.org.hl7.fhir.r4.model.MedicationDispenseaddDosageInstruction(org.hl7.fhir.r4.model.Dosage t) voidcopyValues(org.hl7.fhir.r4.model.MedicationDispense dst) List<org.hl7.fhir.r4.model.Dosage>Gets the pharmaceutical advice element.Gets the prescription element.Gets the treatment plan element.org.hl7.fhir.r4.model.StringTypeGets the treatment reason.booleanReturns whether additional entry of the dosage instruction.booleanReturns whether the base entry of the dosage instruction.booleanReturns whether the pharmaceutical advice reference.booleanReturns whether the prescription reference.booleanReturns whether the treatment plan reference.booleanReturns whether the treatment reason.Resolves additional entries of the dosage instruction.Resolves the base entry of the dosage instruction.Converts the main and additional dosages into a read-only model, containing the effective dosage instructions.Resolves the medication dispense UUID or throws.Checks the list of performers and returns the first performer with a final checker function and a valid medical author resource (ChEmedEprPractitionerRole) and sets the time to the value of the whenHandedOver field.Resolves the medication or throws.Resolves the reference to the treatment plan entry.Resolves the performer as aChEmedEprPractitionerRole.@Nullable EmedReferenceResolves the reference to the prescription entry (if any).Resolves the amount of medication that has been dispensed.Resolves the subject as aChCorePatientEpr.Resolves the date/time of when the product was distributed.setDosageBaseEntry(ChEmedEprDosage dosageBaseEntry) Sets the base entry of the dosage instruction.setIdentifier(UUID identifier) Sets the ID of a medication dispense, if it is already exists, it is replaced.setMedicationReference(ChEmedEprMedicationDis chEmedEprMedication) Sets the medication reference.setPharmaceuticalAdviceElement(ChEmedExtPharmaceuticalAdvice pharmaceuticalAdvice) Sets the pharmaceutical advice reference.setPrescriptionElement(ChEmedExtPrescription prescription) Sets the prescription reference.setQuantity(int quantity) Sets the number of packages.setTreatmentPlanElement(ChEmedExtTreatmentPlan treatmentPlan) Sets the treatment plan reference.setTreatmentReason(String treatmentReason) Sets the treatment reason.setWhenHandedOver(Instant whenHandedOver) Sets when product was given out.Methods inherited from class org.hl7.fhir.r4.model.MedicationDispense
addAuthorizingPrescription, addAuthorizingPrescription, addAuthorizingPrescriptionTarget, addChild, addDetectedIssue, addDetectedIssue, addDetectedIssueTarget, addEventHistory, addEventHistory, addEventHistoryTarget, addIdentifier, addIdentifier, addNote, addNote, addPartOf, addPartOf, addPartOfTarget, addPerformer, addPerformer, addReceiver, addReceiver, addSupportingInformation, addSupportingInformation, copy, equalsDeep, equalsShallow, fhirType, getAuthorizingPrescription, getAuthorizingPrescriptionFirstRep, getAuthorizingPrescriptionTarget, getCategory, getContext, getContextTarget, getDaysSupply, getDestination, getDestinationTarget, getDetectedIssue, getDetectedIssueFirstRep, getDetectedIssueTarget, getEventHistory, getEventHistoryFirstRep, getEventHistoryTarget, getIdentifier, getIdentifierFirstRep, getLocation, getLocationTarget, getMedication, getMedicationCodeableConcept, getMedicationReference, getNamedProperty, getNote, getNoteFirstRep, getPartOf, getPartOfFirstRep, getPartOfTarget, getPerformer, getPerformerFirstRep, getProperty, getQuantity, getReceiver, getReceiverFirstRep, getReceiverTarget, getResourceType, getStatus, getStatusElement, getStatusReason, getStatusReasonCodeableConcept, getStatusReasonReference, getSubject, getSubjectTarget, getSubstitution, getSupportingInformation, getSupportingInformationFirstRep, getSupportingInformationTarget, getType, getTypesForProperty, getWhenHandedOver, getWhenHandedOverElement, getWhenPrepared, getWhenPreparedElement, hasAuthorizingPrescription, hasCategory, hasContext, hasDaysSupply, hasDestination, hasDetectedIssue, hasDosageInstruction, hasEventHistory, hasIdentifier, hasLocation, hasMedication, hasMedicationCodeableConcept, hasMedicationReference, hasNote, hasPartOf, hasPerformer, hasQuantity, hasReceiver, hasStatus, hasStatusElement, hasStatusReason, hasStatusReasonCodeableConcept, hasStatusReasonReference, hasSubject, hasSubstitution, hasSupportingInformation, hasType, hasWhenHandedOver, hasWhenHandedOverElement, hasWhenPrepared, hasWhenPreparedElement, isEmpty, listChildren, makeProperty, removeChild, setAuthorizingPrescription, setCategory, setContext, setContextTarget, setDaysSupply, setDestination, setDestinationTarget, setDetectedIssue, setDosageInstruction, setEventHistory, setIdentifier, setLocation, setLocationTarget, setMedication, setNote, setPartOf, setPerformer, setProperty, setProperty, setQuantity, setReceiver, setStatus, setStatusElement, setStatusReason, setSubject, setSubjectTarget, setSubstitution, setSupportingInformation, setType, setWhenHandedOver, setWhenHandedOverElement, setWhenPrepared, setWhenPreparedElement, typedCopyMethods inherited from class org.hl7.fhir.r4.model.DomainResource
addContained, addExtension, addExtension, addExtension, addModifierExtension, addModifierExtension, checkNoModifiers, copyValues, getContained, getExtension, getExtensionByUrl, getExtensionsByUrl, getModifierExtension, getModifierExtensionsByUrl, getText, hasContained, hasExtension, hasExtension, hasModifierExtension, hasText, setContained, setExtension, setModifierExtension, setTextMethods inherited from class org.hl7.fhir.r4.model.Resource
copyValues, getId, getIdBase, getIdElement, getIdPart, getImplicitRules, getImplicitRulesElement, getLanguage, getLanguage, getLanguageElement, getMeta, hasId, hasIdElement, hasImplicitRules, hasImplicitRulesElement, hasLanguage, hasLanguageElement, hasMeta, setId, setIdBase, setIdElement, setImplicitRules, setImplicitRulesElement, setLanguage, setLanguageElement, setMetaMethods inherited from class org.hl7.fhir.r4.model.BaseResource
getStructureFhirVersionEnum, isResource, setIdMethods inherited from class org.hl7.fhir.r4.model.Base
castToAddress, castToAnnotation, castToAttachment, castToBase64Binary, castToBoolean, castToCanonical, castToCode, castToCodeableConcept, castToCoding, castToContactDetail, castToContactPoint, castToContributor, castToDataRequirement, castToDate, castToDateTime, castToDecimal, castToDosage, castToDuration, castToElementDefinition, castToExpression, castToExtension, castToHumanName, castToId, castToIdentifier, castToInstant, castToInteger, castToMarkdown, castToMarketingStatus, castToMeta, castToMoney, castToNarrative, castToOid, castToParameterDefinition, castToPeriod, castToPopulation, castToPositiveInt, castToProdCharacteristic, castToProductShelfLife, castToQuantity, castToRange, castToRatio, castToReference, castToRelatedArtifact, castToResource, castToSampledData, castToSignature, castToSimpleQuantity, castToString, castToSubstanceAmount, castToTime, castToTiming, castToTriggerDefinition, castToType, castToUnsignedInt, castToUri, castToUrl, castToUsageContext, castToXhtml, castToXhtmlString, children, clearUserData, compareDeep, compareDeep, compareDeep, compareDeep, compareValues, compareValues, copyValues, dateTimeValue, equals, getChildByName, getFormatCommentsPost, getFormatCommentsPre, getNamedProperty, getUserData, getUserInt, getUserString, getXhtml, hasFormatComment, hasPrimitiveValue, hasType, hasUserData, isBooleanPrimitive, isDateTime, isMetadataBased, isPrimitive, listChildrenByName, listChildrenByName, primitiveValue, setUserData, setUserDataINNMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.instance.model.api.IAnyResource
getId, getIdElement, getLanguageElement, getUserData, setId, setUserDataMethods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, hasFormatComment, isEmptyMethods inherited from interface org.hl7.fhir.instance.model.api.IBaseResource
getMeta, getStructureFhirVersionEnum, isDeleted, setId
-
Field Details
-
treatmentReason
protected @Nullable org.hl7.fhir.r4.model.StringType treatmentReasonThe treatment reason. -
prescription
Reference to the medication prescription. -
pharmaceuticalAdvice
Reference to the pharmaceutical advice. -
treatmentPlan
Reference to the medication treatment plan
-
-
Constructor Details
-
ChEmedEprMedicationDispense
public ChEmedEprMedicationDispense()Empty constructor for the parser. -
ChEmedEprMedicationDispense
Constructor that pre-populates fields.- Parameters:
entryUuid- The medication dispense id.
-
-
Method Details
-
resolveIdentifier
Resolves the medication dispense UUID or throws.- Specified by:
resolveIdentifierin interfaceChEmedEprEntry- Returns:
- the medication dispense UUID.
- Throws:
InvalidEmedContentException- if the id is missing.
-
resolveMedication
@ExpectsValidResource public ChEmedEprMedicationDis resolveMedication() throws InvalidEmedContentExceptionResolves the medication or throws.- Returns:
- the medication.
- Throws:
InvalidEmedContentException- if the medication is missing or if it isn't of the right type.
-
resolveQuantity
@ExpectsValidResource public ChEmedQuantityWithEmedUnits resolveQuantity() throws InvalidEmedContentExceptionResolves the amount of medication that has been dispensed. Includes unit of measure.- Returns:
- The amount of medication that has been dispensed.
- Throws:
InvalidEmedContentException- if the quantity is missing or invalid.
-
resolveWhenHandedOver
Resolves the date/time of when the product was distributed.- Returns:
- the date/time of when the product was distributed.
- Throws:
InvalidEmedContentException- if the date/time of when the product was distributed is missing.
-
resolveBaseDosage
Resolves the base entry of the dosage instruction.- Returns:
- the base entry of the dosage instruction
- Throws:
InvalidEmedContentException- if the base entry of the dosage instruction is missing.
-
resolveMtpReference
Resolves the reference to the treatment plan entry.- Returns:
- the reference to the treatment plan entry.
- Throws:
InvalidEmedContentException- if the reference is missing.
-
resolvePreReference
@ExpectsValidResource public @Nullable EmedReference resolvePreReference() throws InvalidEmedContentExceptionResolves the reference to the prescription entry (if any).- Returns:
- the reference to the prescription entry or
null. - Throws:
InvalidEmedContentException- if one of the IDs is missing.
-
resolveAdditionalDosage
Resolves additional entries of the dosage instruction. The list may be empty.- Returns:
- additional entries of the dosage instruction.
-
getEmedType
- Specified by:
getEmedTypein interfaceChEmedEprEntry
-
getTreatmentReason
public org.hl7.fhir.r4.model.StringType getTreatmentReason()Gets the treatment reason. If it doesn't exist, it is created.- Returns:
- the treatment reason.
-
setTreatmentReason
Sets the treatment reason.- Parameters:
treatmentReason- the treatment reason.- Returns:
- this.
-
getPrescriptionElement
Gets the prescription element. If it doesn't exist, it is created.- Returns:
- the prescription element.
-
setPrescriptionElement
Sets the prescription reference.- Parameters:
prescription- the prescription reference.- Returns:
- this.
-
getPharmaceuticalAdviceElement
Gets the pharmaceutical advice element. If it doesn't exist, it is created.- Returns:
- the pharmaceutical advice element.
-
setPharmaceuticalAdviceElement
public ChEmedEprMedicationDispense setPharmaceuticalAdviceElement(ChEmedExtPharmaceuticalAdvice pharmaceuticalAdvice) Sets the pharmaceutical advice reference.- Parameters:
pharmaceuticalAdvice- the pharmaceutical advice reference.- Returns:
- this.
-
getTreatmentPlanElement
Gets the treatment plan element. If it doesn't exist, it is created.- Returns:
- the treatment plan element.
-
setTreatmentPlanElement
Sets the treatment plan reference.- Parameters:
treatmentPlan- the treatment plan reference.- Returns:
- this.
-
setIdentifier
Sets the ID of a medication dispense, if it is already exists, it is replaced.- Parameters:
identifier- the ID of a medication dispense.- Returns:
- this.
-
setMedicationReference
public ChEmedEprMedicationDispense setMedicationReference(ChEmedEprMedicationDis chEmedEprMedication) Sets the medication reference.- Parameters:
chEmedEprMedication- the medication resource.- Returns:
- this.
-
setQuantity
Sets the number of packages.- Parameters:
quantity- the number of packages.- Returns:
- this.
-
setWhenHandedOver
Sets when product was given out.- Parameters:
whenHandedOver- when product was given out.- Returns:
- this.
-
setDosageBaseEntry
Sets the base entry of the dosage instruction. If it already exists, it will be replaced.- Parameters:
dosageBaseEntry- the base entry of the dosage instruction.- Returns:
- this.
-
addDosageAdditionalEntry
Adds additional entry of the dosage instruction.- Parameters:
dosageAdditionalEntry- additional entry of the dosage instruction.- Returns:
- this.
-
hasTreatmentReason
public boolean hasTreatmentReason()Returns whether the treatment reason.- Returns:
trueif the treatment reason exists,falseotherwise.
-
hasPrescription
public boolean hasPrescription()Returns whether the prescription reference.- Returns:
trueif the prescription reference exists,falseotherwise.
-
hasPharmaceuticalAdvice
public boolean hasPharmaceuticalAdvice()Returns whether the pharmaceutical advice reference.- Returns:
trueif the pharmaceutical advice reference exists,falseotherwise.
-
hasTreatmentPlan
public boolean hasTreatmentPlan()Returns whether the treatment plan reference.- Returns:
trueif the treatment plan reference exists,falseotherwise.
-
hasDosageBaseEntry
public boolean hasDosageBaseEntry()Returns whether the base entry of the dosage instruction.- Returns:
trueif the base entry of the dosage instruction exists,falseotherwise.
-
hasDosageAdditionalEntry
public boolean hasDosageAdditionalEntry()Returns whether additional entry of the dosage instruction.- Returns:
trueif additional entry of the dosage instruction exists,falseotherwise.
-
getDosageInstruction
- Overrides:
getDosageInstructionin classorg.hl7.fhir.r4.model.MedicationDispense- Returns:
MedicationDispense.dosageInstruction(Indicates how the medication is/was or should be taken by the patient.)
-
addDosageInstruction
- Overrides:
addDosageInstructionin classorg.hl7.fhir.r4.model.MedicationDispense
-
addDosageInstruction
public org.hl7.fhir.r4.model.MedicationDispense addDosageInstruction(org.hl7.fhir.r4.model.Dosage t) - Overrides:
addDosageInstructionin classorg.hl7.fhir.r4.model.MedicationDispense
-
getDosageInstructionFirstRep
- Overrides:
getDosageInstructionFirstRepin classorg.hl7.fhir.r4.model.MedicationDispense- Returns:
- The first repetition of repeating field
MedicationDispense.dosageInstruction, creating it if it does not already exist
-
resolveEffectiveDosageInstructions
Converts the main and additional dosages into a read-only model, containing the effective dosage instructions. -
resolveSubject
Resolves the subject as aChCorePatientEpr.- Returns:
- the subject.
-
resolvePerformer
Resolves the performer as aChEmedEprPractitionerRole.- Returns:
- the performer.
-
resolveMedicalAuthor
Checks the list of performers and returns the first performer with a final checker function and a valid medical author resource (ChEmedEprPractitionerRole) and sets the time to the value of the whenHandedOver field.- Specified by:
resolveMedicalAuthorin interfaceChEmedEprEntry- Returns:
- the medical Author with the relevant timestamp attached.
-
resolveMedicalAuthorshipTimestamp
- Specified by:
resolveMedicalAuthorshipTimestampin interfaceChEmedEprEntry- Returns:
- The time of medical authorship, i.e. whenHandedOver.
-
copyValues
public void copyValues(org.hl7.fhir.r4.model.MedicationDispense dst) - Overrides:
copyValuesin classorg.hl7.fhir.r4.model.MedicationDispense
-