<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="jp-medicationquantity" />
  <url value="http://jpfhir.jp/fhir/core/StructureDefinition/JP_MedicationQuantity" />
  <version value="1.1.1" />
  <name value="JP_MedicationQuantity" />
  <title value="JP Core Medication Quantity DataType" />
  <status value="active" />
  <date value="2022-11-02" />
  <description value="このデータタイプはQuantity DataTypeに対して、JP Coreにおける薬剤量に関する定義を行なったものである" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <kind value="complex-type" />
  <abstract value="false" />
  <type value="Quantity" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Quantity" />
  <derivation value="constraint" />
  <snapshot>
    <element id="Quantity">
      <path value="Quantity" />
      <short value="薬剤に関する数量と単位を定めたデータイプ" />
      <definition value="薬剤に関する数量と単位を定めたデータイプ" />
      <comment value="薬剤に関する数量と単位を定めている。ValueおよびCodeを必須としている。単位についてはMERIT9医薬品単位略号の利用を推進している。(**SHOULD**)" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Quantity" />
        <min value="0" />
        <max value="*" />
      </base>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <constraint>
        <key value="qty-3" />
        <severity value="error" />
        <human value="If a code for the unit is present, the system SHALL also be present" />
        <expression value="code.empty() or system.exists()" />
        <xpath value="not(exists(f:code)) or exists(f:system)" />
        <source value="http://hl7.org/fhir/StructureDefinition/Quantity" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="SN (see also Range) or CQ" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PQ, IVL&lt;PQ&gt;, MO, CO, depending on the values" />
      </mapping>
    </element>
    <element id="Quantity.id">
      <path value="Quantity.id" />
      <representation value="xmlAttr" />
      <short value="Unique id for inter-element referencing" />
      <definition value="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Element.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type">
          <valueUrl value="string" />
        </extension>
        <code value="http://hl7.org/fhirpath/System.String" />
      </type>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
    </element>
    <element id="Quantity.extension">
      <path value="Quantity.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <description value="Extensions are always sliced by (at least) url" />
        <rules value="open" />
      </slicing>
      <short value="Additional content defined by implementations" />
      <definition value="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." />
      <comment value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone." />
      <alias value="extensions" />
      <alias value="user content" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="Element.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <constraint>
        <key value="ext-1" />
        <severity value="error" />
        <human value="Must have either extensions or value[x], not both" />
        <expression value="extension.exists() != value.exists()" />
        <xpath value="exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])" />
        <source value="http://hl7.org/fhir/StructureDefinition/Extension" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="N/A" />
      </mapping>
    </element>
    <element id="Quantity.value">
      <path value="Quantity.value" />
      <short value="（精度が暗示された）数値" />
      <definition value="計測された量。精度を含めた値が暗示される。" />
      <comment value="暗示された精度については常に尊重すべきである。貨幣計算では制度に関する独自のルールがある（会計についての標準的な教科書を参照すること）。" />
      <requirements value="Precision is handled implicitly in almost all cases of measurement." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Quantity.value" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="decimal" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="SN.2  / CQ - N/A" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value" />
      </mapping>
    </element>
    <element id="Quantity.comparator">
      <path value="Quantity.comparator" />
      <short value="&lt; | &lt;= | &gt;= | &gt; - 値の解釈法" />
      <definition value="実際の値が計測して示された値よりも大きいのか小さいのかなど、値がどのように解釈され、表現されるのかを示している。たとえば、もし、comparatorエレメントが&quot;&lt;&quot;であれば、実際の値は示された値よりも小さい(&lt;)。" />
      <comment value="FHIRの文字列は1MB以上の大きさとなってなはらない(SHALL NOT)。" />
      <requirements value="計測法に制限があって値が&lt;5ug/L や &gt;400mg/L として示されるような場合でも値を扱えるようなフレームワークが必要である。" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Quantity.comparator" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <meaningWhenMissing value="If there is no comparator, then there is no modification of the value" />
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <isModifier value="true" />
      <isModifierReason value="This is labeled as &quot;Is Modifier&quot; because the comparator modifies the interpretation of the value significantly. If there is no comparator, then there is no modification of the value" />
      <isSummary value="true" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="QuantityComparator" />
        </extension>
        <strength value="required" />
        <description value="How the Quantity should be understood and represented." />
        <valueSet value="http://hl7.org/fhir/ValueSet/quantity-comparator|4.0.1" />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="SN.1  / CQ.1" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="IVL properties" />
      </mapping>
    </element>
    <element id="Quantity.unit">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Quantity.unit" />
      <short value="単位表現" />
      <definition value="人間にも可読な単位表現" />
      <comment value="FHIRの文字列は1MB以上の大きさとなってなはらない(SHALL NOT)。" />
      <requirements value="コンテキストによってさまざまな単位の表現がある。固定された特定の表現が求められることがある。たとえば、mcgはmicrogramを表す。" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Quantity.unit" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="(see OBX.6 etc.) / CQ.2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PQ.unit" />
      </mapping>
    </element>
    <element id="Quantity.system">
      <path value="Quantity.system" />
      <short value="コード化された単位表現を規定するシステム" />
      <definition value="単位をコード化して表現するシステムについてのID。" />
      <comment value="以下参照。 http://en.wikipedia.org/wiki/Uniform_resource_identifier" />
      <requirements value="システムによって定義される単位のコードを把握しておく必要がある。" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Quantity.system" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="uri" />
      </type>
      <condition value="ele-1" />
      <condition value="qty-3" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <isSummary value="true" />
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="(see OBX.6 etc.) / CQ.2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="CO.codeSystem, PQ.translation.codeSystem" />
      </mapping>
    </element>
    <element id="Quantity.code">
      <path value="Quantity.code" />
      <short value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨" />
      <definition value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨(**SHOULD**)" />
      <comment value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨(**SHOULD**)されるが、ローカルコード等を利用することも可能とする" />
      <requirements value="Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Quantity.code" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <condition value="ele-1" />
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
      <isSummary value="true" />
      <binding>
        <strength value="preferred" />
        <valueSet value="http://jpfhir.jp/fhir/core/ValueSet/JP_MedicationUnitMERIT9_VS" />
      </binding>
      <mapping>
        <identity value="rim" />
        <map value="n/a" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="(see OBX.6 etc.) / CQ.2" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="PQ.code, MO.currency, PQ.translation.code" />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element id="Quantity">
      <path value="Quantity" />
      <short value="薬剤に関する数量と単位を定めたデータイプ" />
      <definition value="薬剤に関する数量と単位を定めたデータイプ" />
      <comment value="薬剤に関する数量と単位を定めている。ValueおよびCodeを必須としている。単位についてはMERIT9医薬品単位略号の利用を推進している。(**SHOULD**)" />
    </element>
    <element id="Quantity.value">
      <path value="Quantity.value" />
      <short value="（精度が暗示された）数値" />
      <definition value="計測された量。精度を含めた値が暗示される。" />
      <comment value="暗示された精度については常に尊重すべきである。貨幣計算では制度に関する独自のルールがある（会計についての標準的な教科書を参照すること）。" />
      <min value="1" />
    </element>
    <element id="Quantity.comparator">
      <path value="Quantity.comparator" />
      <short value="&lt; | &lt;= | &gt;= | &gt; - 値の解釈法" />
      <definition value="実際の値が計測して示された値よりも大きいのか小さいのかなど、値がどのように解釈され、表現されるのかを示している。たとえば、もし、comparatorエレメントが&quot;&lt;&quot;であれば、実際の値は示された値よりも小さい(&lt;)。" />
      <comment value="FHIRの文字列は1MB以上の大きさとなってなはらない(SHALL NOT)。" />
      <requirements value="計測法に制限があって値が&lt;5ug/L や &gt;400mg/L として示されるような場合でも値を扱えるようなフレームワークが必要である。" />
    </element>
    <element id="Quantity.unit">
      <path value="Quantity.unit" />
      <short value="単位表現" />
      <definition value="人間にも可読な単位表現" />
      <comment value="FHIRの文字列は1MB以上の大きさとなってなはらない(SHALL NOT)。" />
      <requirements value="コンテキストによってさまざまな単位の表現がある。固定された特定の表現が求められることがある。たとえば、mcgはmicrogramを表す。" />
    </element>
    <element id="Quantity.system">
      <path value="Quantity.system" />
      <short value="コード化された単位表現を規定するシステム" />
      <definition value="単位をコード化して表現するシステムについてのID。" />
      <comment value="以下参照。 http://en.wikipedia.org/wiki/Uniform_resource_identifier" />
      <requirements value="システムによって定義される単位のコードを把握しておく必要がある。" />
    </element>
    <element id="Quantity.code">
      <path value="Quantity.code" />
      <short value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨" />
      <definition value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨(**SHOULD**)" />
      <comment value="単位のコード化された形式、【JP Core仕様】MERIT9医薬品単位略号マスタコードを推奨(**SHOULD**)されるが、ローカルコード等を利用することも可能とする" />
      <min value="1" />
      <binding>
        <strength value="preferred" />
        <valueSet value="http://jpfhir.jp/fhir/core/ValueSet/JP_MedicationUnitMERIT9_VS" />
      </binding>
    </element>
  </differential>
</StructureDefinition>