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

    Fields
    Modifier and Type
    Field
    Description
    protected @Nullable ChEmedExtPharmaceuticalAdvice
    Reference to the pharmaceutical advice.
    protected @Nullable ChEmedExtPrescription
    Reference to the medication prescription.
    protected @Nullable ChEmedExtTreatmentPlan
    Reference to the medication treatment plan
    protected @Nullable org.hl7.fhir.r4.model.StringType
    The 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, WHENPREPARED

    Fields inherited from class org.hl7.fhir.r4.model.DomainResource

    contained, extension, modifierExtension, text

    Fields inherited from class org.hl7.fhir.r4.model.Resource

    id, implicitRules, language, meta

    Fields inherited from interface org.hl7.fhir.instance.model.api.IAnyResource

    RES_ID, SP_RES_ID

    Fields inherited from interface org.hl7.fhir.instance.model.api.IBaseResource

    INCLUDE_ALL, WILDCARD_ALL_SET
  • Constructor Summary

    Constructors
    Constructor
    Description
    Empty constructor for the parser.
    ChEmedEprMedicationDispense(UUID entryUuid, Instant whenHandedOver)
    Constructor that pre-populates fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    Adds additional entry of the dosage instruction.
     
    org.hl7.fhir.r4.model.MedicationDispense
    addDosageInstruction(org.hl7.fhir.r4.model.Dosage t)
     
    void
    copyValues(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.StringType
    Gets the treatment reason.
    boolean
    Returns whether additional entry of the dosage instruction.
    boolean
    Returns whether the base entry of the dosage instruction.
    boolean
    Returns whether the pharmaceutical advice reference.
    boolean
    Returns whether the prescription reference.
    boolean
    Returns whether the treatment plan reference.
    boolean
    Returns 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 (i.e.
     
    Resolves the medication or throws.
    Resolves the reference to the treatment plan entry.
    @Nullable EmedReference
    Resolves the reference to the prescription entry (if any).
    Resolves the amount of medication that has been dispensed.
    Resolves the subject as a ChCorePatientEpr.
    Resolves the date/time of when the product was distributed.
    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.
    Sets the medication reference.
    Sets the pharmaceutical advice reference.
    Sets the prescription reference.
    setQuantity(int quantity)
    Sets the number of packages.
    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, typedCopy

    Methods 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, setText

    Methods 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, setMeta

    Methods inherited from class org.hl7.fhir.r4.model.BaseResource

    getStructureFhirVersionEnum, isResource, setId

    Methods 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, setUserDataINN

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.hl7.fhir.instance.model.api.IAnyResource

    getId, getIdElement, getLanguageElement, getUserData, setId, setUserData

    Methods inherited from interface org.hl7.fhir.instance.model.api.IBase

    fhirType, getFormatCommentsPost, getFormatCommentsPre, hasFormatComment, isEmpty

    Methods 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 treatmentReason
      The treatment reason.
    • prescription

      protected @Nullable ChEmedExtPrescription prescription
      Reference to the medication prescription.
    • pharmaceuticalAdvice

      protected @Nullable ChEmedExtPharmaceuticalAdvice pharmaceuticalAdvice
      Reference to the pharmaceutical advice.
    • treatmentPlan

      protected @Nullable ChEmedExtTreatmentPlan treatmentPlan
      Reference to the medication treatment plan
  • Constructor Details

    • ChEmedEprMedicationDispense

      public ChEmedEprMedicationDispense()
      Empty constructor for the parser.
    • ChEmedEprMedicationDispense

      public ChEmedEprMedicationDispense(UUID entryUuid, Instant whenHandedOver)
      Constructor that pre-populates fields.
      Parameters:
      entryUuid - The medication dispense id.
  • Method Details

    • resolveIdentifier

      @ExpectsValidResource public UUID resolveIdentifier() throws InvalidEmedContentException
      Resolves the medication dispense UUID or throws.
      Specified by:
      resolveIdentifier in interface ChEmedEprEntry
      Returns:
      the medication dispense UUID.
      Throws:
      InvalidEmedContentException - if the id is missing.
    • resolveMedication

      Resolves the medication or throws.
      Returns:
      the medication.
      Throws:
      InvalidEmedContentException - if the medication is missing or if it isn't of the right type.
    • resolveQuantity

      Resolves 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

      @ExpectsValidResource public Instant resolveWhenHandedOver() throws InvalidEmedContentException
      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 InvalidEmedContentException
      Resolves 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

      public List<ChEmedEprDosage> resolveAdditionalDosage()
      Resolves additional entries of the dosage instruction. The list may be empty.
      Returns:
      additional entries of the dosage instruction.
    • getEmedType

      public EmedEntryType getEmedType()
      Specified by:
      getEmedType in interface ChEmedEprEntry
    • 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

      public ChEmedEprMedicationDispense setTreatmentReason(String treatmentReason)
      Sets the treatment reason.
      Parameters:
      treatmentReason - the treatment reason.
      Returns:
      this.
    • getPrescriptionElement

      public ChEmedExtPrescription getPrescriptionElement()
      Gets the prescription element. If it doesn't exist, it is created.
      Returns:
      the prescription element.
    • setPrescriptionElement

      public ChEmedEprMedicationDispense setPrescriptionElement(ChEmedExtPrescription prescription)
      Sets the prescription reference.
      Parameters:
      prescription - the prescription reference.
      Returns:
      this.
    • getPharmaceuticalAdviceElement

      public ChEmedExtPharmaceuticalAdvice 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

      public ChEmedExtTreatmentPlan getTreatmentPlanElement()
      Gets the treatment plan element. If it doesn't exist, it is created.
      Returns:
      the treatment plan element.
    • setTreatmentPlanElement

      public ChEmedEprMedicationDispense setTreatmentPlanElement(ChEmedExtTreatmentPlan treatmentPlan)
      Sets the treatment plan reference.
      Parameters:
      treatmentPlan - the treatment plan reference.
      Returns:
      this.
    • setIdentifier

      public ChEmedEprMedicationDispense setIdentifier(UUID identifier)
      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

      public ChEmedEprMedicationDispense setQuantity(int quantity)
      Sets the number of packages.
      Parameters:
      quantity - the number of packages.
      Returns:
      this.
    • setWhenHandedOver

      public ChEmedEprMedicationDispense setWhenHandedOver(Instant whenHandedOver)
      Sets when product was given out.
      Parameters:
      whenHandedOver - when product was given out.
      Returns:
      this.
    • setDosageBaseEntry

      public ChEmedEprMedicationDispense setDosageBaseEntry(ChEmedEprDosage dosageBaseEntry)
      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

      public ChEmedEprMedicationDispense addDosageAdditionalEntry(ChEmedEprDosage dosageAdditionalEntry)
      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:
      true if the treatment reason exists, false otherwise.
    • hasPrescription

      public boolean hasPrescription()
      Returns whether the prescription reference.
      Returns:
      true if the prescription reference exists, false otherwise.
    • hasPharmaceuticalAdvice

      public boolean hasPharmaceuticalAdvice()
      Returns whether the pharmaceutical advice reference.
      Returns:
      true if the pharmaceutical advice reference exists, false otherwise.
    • hasTreatmentPlan

      public boolean hasTreatmentPlan()
      Returns whether the treatment plan reference.
      Returns:
      true if the treatment plan reference exists, false otherwise.
    • hasDosageBaseEntry

      public boolean hasDosageBaseEntry()
      Returns whether the base entry of the dosage instruction.
      Returns:
      true if the base entry of the dosage instruction exists, false otherwise.
    • hasDosageAdditionalEntry

      public boolean hasDosageAdditionalEntry()
      Returns whether additional entry of the dosage instruction.
      Returns:
      true if additional entry of the dosage instruction exists, false otherwise.
    • getDosageInstruction

      public List<org.hl7.fhir.r4.model.Dosage> getDosageInstruction()
      Overrides:
      getDosageInstruction in class org.hl7.fhir.r4.model.MedicationDispense
      Returns:
      MedicationDispense.dosageInstruction (Indicates how the medication is/was or should be taken by the patient.)
    • addDosageInstruction

      public ChEmedEprDosage addDosageInstruction()
      Overrides:
      addDosageInstruction in class org.hl7.fhir.r4.model.MedicationDispense
    • addDosageInstruction

      public org.hl7.fhir.r4.model.MedicationDispense addDosageInstruction(org.hl7.fhir.r4.model.Dosage t)
      Overrides:
      addDosageInstruction in class org.hl7.fhir.r4.model.MedicationDispense
    • getDosageInstructionFirstRep

      public ChEmedEprDosage getDosageInstructionFirstRep()
      Overrides:
      getDosageInstructionFirstRep in class org.hl7.fhir.r4.model.MedicationDispense
      Returns:
      The first repetition of repeating field MedicationDispense.dosageInstruction, creating it if it does not already exist
    • resolveEffectiveDosageInstructions

      @ExpectsValidResource public EffectiveDosageInstructions resolveEffectiveDosageInstructions()
      Converts the main and additional dosages into a read-only model, containing the effective dosage instructions.
    • resolveSubject

      @ExpectsValidResource public ChCorePatientEpr resolveSubject()
      Resolves the subject as a ChCorePatientEpr.
      Returns:
      the subject.
    • copyValues

      public void copyValues(org.hl7.fhir.r4.model.MedicationDispense dst)
      Overrides:
      copyValues in class org.hl7.fhir.r4.model.MedicationDispense
    • resolveMedicalAuthor

      @ExpectsValidResource public Author resolveMedicalAuthor()
      Checks the list of performers and returns the first performer with a final checker function and a valid medical author resource (i.e. ChEmedEprPractitionerRole or ChCorePatientEpr or ChEmedEprRelatedPerson) and sets the time to the value of the whenHandedOver field.
      Specified by:
      resolveMedicalAuthor in interface ChEmedEprEntry
      Returns:
      the medical Author with the relevant timestamp attached.
    • resolveMedicalAuthorshipTimestamp

      @ExpectsValidResource public Instant resolveMedicalAuthorshipTimestamp()
      Specified by:
      resolveMedicalAuthorshipTimestamp in interface ChEmedEprEntry
      Returns:
      The time of medical authorship, i.e. whenHandedOver.