Class ChEmedEprObservation<T extends ChEmedEprMedicationStatement>

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.Observation
org.projecthusky.fhir.emed.ch.epr.resource.ChEmedEprObservation<T>
Type Parameters:
T - The type of ChEmedEprMedicationStatement to be returned by resolveMedicationStatementChanged(). This is needed for documents that might contain several subtypes of MedicationStatement, e.g. a PML doc. since the parser cannot discriminate between them and hence these resources might be parsed as a different ChEmedEprMedicationStatement than the PADV attached ChEmedEprMedicationStatementChanged.
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:
ChEmedEprObservationPadv, ChEmedEprObservationPml

public abstract class ChEmedEprObservation<T extends ChEmedEprMedicationStatement> extends org.hl7.fhir.r4.model.Observation implements ChEmedEprEntry
The HAPI custom structure for CH-EMED-EPR Observation.
Author:
Ronaldo Loureiro
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.hl7.fhir.r4.model.Observation

    org.hl7.fhir.r4.model.Observation.ObservationComponentComponent, org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent, org.hl7.fhir.r4.model.Observation.ObservationStatus, org.hl7.fhir.r4.model.Observation.ObservationStatusEnumFactory
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected @Nullable ChEmedExtDispense
    Reference to the medication dispense.
    protected @Nullable org.hl7.fhir.r4.model.Reference
    Reference to the changed medication request.
    protected @Nullable org.hl7.fhir.r4.model.Reference
    Reference to the changed medication statement.
    protected @Nullable ChEmedExtPrescription
    Reference to the medication prescription.
    protected @Nullable ChEmedExtTreatmentPlan
    Reference to the medication treatment plan.

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

    BASED_ON, basedOn, basedOnTarget, bodySite, category, CATEGORY, code, CODE, CODE_VALUE_CONCEPT, CODE_VALUE_DATE, CODE_VALUE_QUANTITY, CODE_VALUE_STRING, COMBO_CODE, COMBO_CODE_VALUE_CONCEPT, COMBO_CODE_VALUE_QUANTITY, COMBO_DATA_ABSENT_REASON, COMBO_VALUE_CONCEPT, COMBO_VALUE_QUANTITY, component, COMPONENT_CODE, COMPONENT_CODE_VALUE_CONCEPT, COMPONENT_CODE_VALUE_QUANTITY, COMPONENT_DATA_ABSENT_REASON, COMPONENT_VALUE_CONCEPT, COMPONENT_VALUE_QUANTITY, DATA_ABSENT_REASON, dataAbsentReason, DATE, DERIVED_FROM, derivedFrom, derivedFromTarget, device, DEVICE, deviceTarget, effective, encounter, ENCOUNTER, encounterTarget, focus, FOCUS, focusTarget, HAS_MEMBER, hasMember, hasMemberTarget, identifier, IDENTIFIER, INCLUDE_BASED_ON, INCLUDE_DERIVED_FROM, INCLUDE_DEVICE, INCLUDE_ENCOUNTER, INCLUDE_FOCUS, INCLUDE_HAS_MEMBER, INCLUDE_PART_OF, INCLUDE_PATIENT, INCLUDE_PERFORMER, INCLUDE_SPECIMEN, INCLUDE_SUBJECT, interpretation, issued, method, METHOD, note, PART_OF, partOf, partOfTarget, PATIENT, performer, PERFORMER, performerTarget, referenceRange, SP_BASED_ON, SP_CATEGORY, SP_CODE, SP_CODE_VALUE_CONCEPT, SP_CODE_VALUE_DATE, SP_CODE_VALUE_QUANTITY, SP_CODE_VALUE_STRING, SP_COMBO_CODE, SP_COMBO_CODE_VALUE_CONCEPT, SP_COMBO_CODE_VALUE_QUANTITY, SP_COMBO_DATA_ABSENT_REASON, SP_COMBO_VALUE_CONCEPT, SP_COMBO_VALUE_QUANTITY, SP_COMPONENT_CODE, SP_COMPONENT_CODE_VALUE_CONCEPT, SP_COMPONENT_CODE_VALUE_QUANTITY, SP_COMPONENT_DATA_ABSENT_REASON, SP_COMPONENT_VALUE_CONCEPT, SP_COMPONENT_VALUE_QUANTITY, SP_DATA_ABSENT_REASON, SP_DATE, SP_DERIVED_FROM, SP_DEVICE, SP_ENCOUNTER, SP_FOCUS, SP_HAS_MEMBER, SP_IDENTIFIER, SP_METHOD, SP_PART_OF, SP_PATIENT, SP_PERFORMER, SP_SPECIMEN, SP_STATUS, SP_SUBJECT, SP_VALUE_CONCEPT, SP_VALUE_DATE, SP_VALUE_QUANTITY, SP_VALUE_STRING, specimen, SPECIMEN, specimenTarget, status, STATUS, subject, SUBJECT, subjectTarget, value, VALUE_CONCEPT, VALUE_DATE, VALUE_QUANTITY, VALUE_STRING

    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.
    Constructor that pre-populates fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    copyValues(org.hl7.fhir.r4.model.Observation dst)
     
    Gets the medication dispense element.
     
    org.hl7.fhir.r4.model.Reference
    Gets the reference to the changed medication request.
    org.hl7.fhir.r4.model.Reference
    Gets the reference to the changed medication statement.
    protected abstract Class<T>
     
    Gets the prescription element.
    Gets the treatment plan element.
    boolean
    Returns whether the medication dispense reference.
    boolean
    Returns whether the changed medication request reference.
    boolean
    Returns whether the changed medication statement reference.
    boolean
    Returns whether the padv entry type.
    boolean
    Returns whether the prescription reference.
    boolean
    Returns whether the treatment plan reference.
    @Nullable EmedReference
    Resolves the reference to the dispense entry (if any).
    Resolves the observation UUID or throws.
    Resolves the date/time this version was made available.
     
     
    Resolves the changed medication request.
    @Nullable T
    Resolves the changed medication statement.
    @Nullable EmedReference
    Resolves the reference to the treatment plan entry (if any).
    Resolves the note.
    Resolves the PADV entry type.
    @Nullable EmedReference
    Resolves the reference to the prescription entry (if any).
    Resolves the reference to the entry.
    Resolves the subject as a ChCorePatientEpr.
    Sets the medication dispense reference.
    Sets the date/time this version was made available.
    Sets the changed medication request.
    Sets the changed medication statement.
    Sets the note.
    Sets the PADV entry type.
    Sets the prescription reference.
    Sets the treatment plan reference.

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

    addBasedOn, addBasedOn, addCategory, addCategory, addChild, addComponent, addComponent, addDerivedFrom, addDerivedFrom, addFocus, addFocus, addHasMember, addHasMember, addIdentifier, addIdentifier, addInterpretation, addInterpretation, addNote, addNote, addPartOf, addPartOf, addPerformer, addPerformer, addReferenceRange, addReferenceRange, copy, equalsDeep, equalsShallow, fhirType, getBasedOn, getBasedOnFirstRep, getBasedOnTarget, getBodySite, getCategory, getCategoryFirstRep, getCode, getComponent, getComponentFirstRep, getDataAbsentReason, getDerivedFrom, getDerivedFromFirstRep, getDerivedFromTarget, getDevice, getDeviceTarget, getEffective, getEffectiveDateTimeType, getEffectiveInstantType, getEffectivePeriod, getEffectiveTiming, getEncounter, getEncounterTarget, getFocus, getFocusFirstRep, getFocusTarget, getHasMember, getHasMemberFirstRep, getHasMemberTarget, getIdentifier, getIdentifierFirstRep, getInterpretation, getInterpretationFirstRep, getIssued, getIssuedElement, getMethod, getNamedProperty, getNote, getNoteFirstRep, getPartOf, getPartOfFirstRep, getPartOfTarget, getPerformer, getPerformerFirstRep, getPerformerTarget, getProperty, getReferenceRange, getReferenceRangeFirstRep, getResourceType, getSpecimen, getSpecimenTarget, getStatus, getStatusElement, getSubject, getSubjectTarget, getTypesForProperty, getValue, getValueBooleanType, getValueCodeableConcept, getValueDateTimeType, getValueIntegerType, getValuePeriod, getValueQuantity, getValueRange, getValueRatio, getValueSampledData, getValueStringType, getValueTimeType, hasBasedOn, hasBodySite, hasCategory, hasCode, hasComponent, hasDataAbsentReason, hasDerivedFrom, hasDevice, hasEffective, hasEffectiveDateTimeType, hasEffectiveInstantType, hasEffectivePeriod, hasEffectiveTiming, hasEncounter, hasFocus, hasHasMember, hasIdentifier, hasInterpretation, hasIssued, hasIssuedElement, hasMethod, hasNote, hasPartOf, hasPerformer, hasReferenceRange, hasSpecimen, hasStatus, hasStatusElement, hasSubject, hasValue, hasValueBooleanType, hasValueCodeableConcept, hasValueDateTimeType, hasValueIntegerType, hasValuePeriod, hasValueQuantity, hasValueRange, hasValueRatio, hasValueSampledData, hasValueStringType, hasValueTimeType, isEmpty, listChildren, makeProperty, removeChild, setBasedOn, setBodySite, setCategory, setCode, setComponent, setDataAbsentReason, setDerivedFrom, setDevice, setDeviceTarget, setEffective, setEncounter, setEncounterTarget, setFocus, setHasMember, setIdentifier, setInterpretation, setIssued, setIssuedElement, setMethod, setNote, setPartOf, setPerformer, setProperty, setProperty, setReferenceRange, setSpecimen, setSpecimenTarget, setStatus, setStatusElement, setSubject, setSubjectTarget, setValue, 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

    • treatmentPlan

      protected @Nullable ChEmedExtTreatmentPlan treatmentPlan
      Reference to the medication treatment plan.
    • prescription

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

      protected @Nullable ChEmedExtDispense dispense
      Reference to the medication dispense.
    • medicationStatementChanged

      protected @Nullable org.hl7.fhir.r4.model.Reference medicationStatementChanged
      Reference to the changed medication statement.
    • medicationRequestChanged

      protected @Nullable org.hl7.fhir.r4.model.Reference medicationRequestChanged
      Reference to the changed medication request.
  • Constructor Details

    • ChEmedEprObservation

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

      public ChEmedEprObservation(UUID entryUuid, EmedPadvEntryType padvType)
      Constructor that pre-populates fields.
      Parameters:
      entryUuid - The medication statement id.
      padvType - The pharmaceutical advice type.
  • Method Details

    • getEmedType

      public EmedEntryType getEmedType()
      Specified by:
      getEmedType in interface ChEmedEprEntry
    • resolveIdentifier

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

      @ExpectsValidResource public @Nullable T resolveMedicationStatementChanged() throws InvalidEmedContentException
      Resolves the changed medication statement.
      Returns:
      the changed medication statement or null.
      Throws:
      InvalidEmedContentException - if the changed medication statement isn't of the right type.
    • getMedicationStatementChangedType

      protected abstract Class<T> getMedicationStatementChangedType()
      Returns:
      The class (type) of medication statement resource that is to be returned by resolveMedicationStatementChanged().
    • resolveMedicationRequestChanged

      @ExpectsValidResource public @Nullable ChEmedEprMedicationRequestPre resolveMedicationRequestChanged() throws InvalidEmedContentException
      Resolves the changed medication request.
      Returns:
      the changed medication request or null.
      Throws:
      InvalidEmedContentException - if the changed medication request isn't of the right type.
    • resolvePadvEntryType

      Resolves the PADV entry type.
      Returns:
      the PADV entry type.
      Throws:
      InvalidEmedContentException - if the PADV entry type is missing or invalid.
    • resolveIssued

      Resolves the date/time this version was made available.
      Returns:
      the date/time this version was made available.
      Throws:
      InvalidEmedContentException - if the date/time this version was made available is missing.
    • resolveNote

      Resolves the note.
      Returns:
      the note.
      Throws:
      InvalidEmedContentException - if the note is missing.
    • resolveMtpReference

      @ExpectsValidResource public @Nullable EmedReference resolveMtpReference() throws InvalidEmedContentException
      Resolves the reference to the treatment plan entry (if any).
      Returns:
      the reference to the treatment plan entry or null.
      Throws:
      InvalidEmedContentException - if one of the IDs 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.
    • resolveDisReference

      @ExpectsValidResource public @Nullable EmedReference resolveDisReference() throws InvalidEmedContentException
      Resolves the reference to the dispense entry (if any).
      Returns:
      the reference to the dispense entry or null.
      Throws:
      InvalidEmedContentException - if one of the IDs is missing.
    • resolveReference

      Resolves the reference to the entry.
      Returns:
      the reference to the entry.
      Throws:
      InvalidEmedContentException - if there's not a single reference.
    • getTreatmentPlanElement

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

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

      public ChEmedExtDispense getDispenseElement()
      Gets the medication dispense element. If it doesn't exist, it is created.
      Returns:
      the medication dispense element.
    • getMedicationStatementChangedReference

      public org.hl7.fhir.r4.model.Reference getMedicationStatementChangedReference()
      Gets the reference to the changed medication statement. If it doesn't exist, it is created.
      Returns:
      the reference to the changed medication statement.
    • getMedicationRequestChangedReference

      public org.hl7.fhir.r4.model.Reference getMedicationRequestChangedReference()
      Gets the reference to the changed medication request. If it doesn't exist, it is created.
      Returns:
      the reference to the changed medication request.
    • setTreatmentPlanElement

      public ChEmedEprObservation<T> setTreatmentPlanElement(ChEmedExtTreatmentPlan treatmentPlan)
      Sets the treatment plan reference.
      Parameters:
      treatmentPlan - the treatment plan reference.
      Returns:
      this.
    • setPrescriptionElement

      public ChEmedEprObservation<T> setPrescriptionElement(ChEmedExtPrescription prescription)
      Sets the prescription reference.
      Parameters:
      prescription - the prescription reference.
      Returns:
      this.
    • setDispenseElement

      public ChEmedEprObservation<T> setDispenseElement(ChEmedExtDispense dispense)
      Sets the medication dispense reference.
      Parameters:
      dispense - the medication dispense reference.
      Returns:
      this.
    • setMedicationStatementChanged

      public ChEmedEprObservation<T> setMedicationStatementChanged(ChEmedEprMedicationStatementMtp medicationStatement)
      Sets the changed medication statement.
      Parameters:
      medicationStatement - the changed medication statement.
      Returns:
      this.
    • setMedicationRequestChanged

      public ChEmedEprObservation<T> setMedicationRequestChanged(ChEmedEprMedicationRequestPre medicationRequest)
      Sets the changed medication request.
      Parameters:
      medicationRequest - the changed medication request.
      Returns:
      this.
    • setPadvEntryType

      public ChEmedEprObservation<T> setPadvEntryType(EmedPadvEntryType padvEntryType)
      Sets the PADV entry type.
      Parameters:
      padvEntryType - the PADV entry type.
      Returns:
      this.
    • setIssued

      public ChEmedEprObservation<T> setIssued(Instant issued)
      Sets the date/time this version was made available.
      Parameters:
      issued - the date/time this version was made available.
      Returns:
      this.
    • setNote

      public ChEmedEprObservation<T> setNote(String note)
      Sets the note. If it already exists, it is replaced.
      Parameters:
      note - the note.
      Returns:
      this.
    • hasTreatmentPlan

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

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

      public boolean hasDispense()
      Returns whether the medication dispense reference.
      Returns:
      true if the medication dispense reference exists, false otherwise.
    • hasMedicationStatementChanged

      public boolean hasMedicationStatementChanged()
      Returns whether the changed medication statement reference.
      Returns:
      true if the changed medication statement reference exists, false otherwise.
    • hasMedicationRequestChanged

      public boolean hasMedicationRequestChanged()
      Returns whether the changed medication request reference.
      Returns:
      true if the changed medication request reference exists, false otherwise.
    • hasPadvEntryType

      public boolean hasPadvEntryType()
      Returns whether the padv entry type.
      Returns:
      true if the padv entry type exists, false otherwise.
    • resolveSubject

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

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

      @ExpectsValidResource public Author resolveMedicalAuthor()
      Specified by:
      resolveMedicalAuthor in interface ChEmedEprEntry
      Returns:
      The first performer of type ChEmedEprPractitionerRole, ChCorePatientEpr or ChEmedEprRelatedPerson as an Author with the time set to the medical authorship timestamp, i.e. when issued.
    • resolveMedicalAuthorshipTimestamp

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