<?xml version="1.0" encoding="UTF-8"?>

<StructureMap xmlns="http://hl7.org/fhir">
  <id value="vn-sm-bhyt-xml8-treatment-summary"/>
  <language value="vi"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap vn-sm-bhyt-xml8-treatment-summary</b></p><a name="vn-sm-bhyt-xml8-treatment-summary"> </a><a name="hcvn-sm-bhyt-xml8-treatment-summary"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml8-treatment-summary<span style="color: navy">&quot; = &quot;</span>BHYTXML8TreatmentSummaryLMStructureMap<span style="color: navy">&quot;

</span><span style="color: navy">// </span><span style="color: green">Generated StructureMap scaffold for Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML8TreatmentSummaryLM.fsh` and remain aligned with the Python BHYT round-trip export adapter.</span>

<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-vn-core-bhyt-submission-bundle.html" title="Bundle hồ sơ thanh toán BHYT — VN Core BHYT Submission Bundle">http://fhir.hl7.org.vn/core/StructureDefinition/vn-core-bhyt-submission-bundle</a><span style="color: navy">&quot; </span><b>alias </b>BHYTSubmissionBundle <b>as </b><b>source</b> <span style="color: navy">// </span><span style="color: green">FHIR-native source bundle profile used by the repository round-trip adapter.</span>
<b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-bhytXml8TreatmentSummaryLm.html" title="Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model">http://fhir.hl7.org.vn/core/StructureDefinition/bhytXml8TreatmentSummaryLm</a><span style="color: navy">&quot; </span><b>alias </b>BHYTXML8TreatmentSummaryLM <b>as </b><b>target</b> <span style="color: navy">// </span><span style="color: green">Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model</span>

<span style="color: navy">// </span><span style="color: green">Rows are derived from treatment summary Composition/DocumentReference and the linked Encounter, Condition, Patient and guardian data. Generated from logical-model `^mapping` annotations. Fields still missing a field-level `^mapping.map` entry remain outside this StructureMap and are tracked in `wiki/mappings/bhyt-output-data/machine/structuremap-coverage.json`.</span>
<b>group </b>MapBHYTXML8TreatmentSummaryLM<span style="color: navy">(</span><b>source</b> <span style="color: maroon">sourceBundle</span><span style="color: navy"> : </span>BHYTSubmissionBundle, <b>target</b> <span style="color: maroon">targetRow</span><span style="color: navy"> : </span>BHYTXML8TreatmentSummaryLM<span style="color: navy">)</span><span style="color: navy"> {
</span>  sourceBundle.entry<b> as </b><span style="color: maroon">maLkSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maLk <i>&quot;maLk&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_LK - Mã liên kết hồ sơ FHIR path: VNCoreClaim.identifier[MALK].value</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maLoaiKcbSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maLoaiKcb <i>&quot;maLoaiKcb&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_LOAI_KCB - Mã loại KCB FHIR path: VNCoreEncounter.type</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">hoTenChaSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.hoTenCha <i>&quot;hoTenCha&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: HO_TEN_CHA - Họ tên cha FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='FTH').name.text | VNCorePatient.contact.where(relationship.coding.code='FTH').name.text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">hoTenMeSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.hoTenMe <i>&quot;hoTenMe&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: HO_TEN_ME - Họ tên mẹ FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='MTH').name.text | VNCorePatient.contact.where(relationship.coding.code='MTH').name.text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">nguoiGiamHoSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.nguoiGiamHo <i>&quot;nguoiGiamHo&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGUOI_GIAM_HO - Người giám hộ FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='GUARD').name.text | VNCorePatient.contact.name.text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">donViSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.donVi <i>&quot;donVi&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: DON_VI - Đơn vị FHIR path: VNCoreOrganization.name | VNCoreDocumentReference.custodian.resolve().name</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngayVaoSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngayVao <i>&quot;ngayVao&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_VAO - Ngày vào FHIR path: VNCoreEncounter.period.start</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngayRaSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngayRa <i>&quot;ngayRa&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_RA - Ngày ra FHIR path: VNCoreEncounter.period.end</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">chanDoanVaoSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.chanDoanVao <i>&quot;chanDoanVao&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: CHAN_DOAN_VAO - Chẩn đoán vào FHIR path: VNCoreEncounter.reasonCode | VNCoreComposition.section[chiefComplaint|history].text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">chanDoanRvSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.chanDoanRv <i>&quot;chanDoanRv&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: CHAN_DOAN_RV - Chẩn đoán ra viện FHIR path: VNCoreCondition.code | VNCoreComposition.section[diagnosis].entry.resolve().code | section.text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngaySinhConSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngaySinhCon <i>&quot;ngaySinhCon&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_SINHCON - Ngày sinh con FHIR path: VNCorePatient.birthDate | VNCoreComposition.section[delivery].entry.resolve().birthDate</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngayConChetSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngayConChet <i>&quot;ngayConChet&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_CONCHET - Ngày con chết FHIR path: VNCoreObservation.effectiveDateTime | VNCoreCondition.onsetDateTime</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">soConChetSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.soConChet <i>&quot;soConChet&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: SO_CONCHET - Số con chết FHIR path: VNCoreObservation.valueQuantity</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ketQuaDtriSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ketQuaDtri <i>&quot;ketQuaDtri&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: KET_QUA_DTRI - Kết quả điều trị FHIR path: VNCoreEncounter.hospitalization.dischargeDisposition | VNCoreEncounter.extension[treatmentOutcome].valueCodeableConcept</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maTtdvSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maTtdv <i>&quot;maTtdv&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_TTDV - Mã thủ trưởng đơn vị/người ký FHIR path: VNCoreComposition.attester.party.resolve().identifier.value | VNCoreDocumentReference.authenticator.resolve().identifier.value</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngayCtSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngayCt <i>&quot;ngayCt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_CT - Ngày cấp chứng từ FHIR path: VNCoreDocumentReference.date | VNCoreComposition.date</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maTheTamSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maTheTam <i>&quot;maTheTam&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_THE_TAM - Mã thẻ tạm FHIR path: VNCoreCoverage.identifier.value Mapping note: Temporary card identifiers are kept as Coverage.identifier until a dedicated temporary-card slice is profiled.</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url value="http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml8-treatment-summary"/>
  <version value="0.5.0"/>
  <name value="BHYTXML8TreatmentSummaryLMStructureMap"/>
  <title value="Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model — StructureMap"/>
  <status value="draft"/>
  <experimental value="false"/>
  <date value="2026-04-28"/>
  <publisher value="Omi HealthTech / VN Core FHIR Community Initiative"/>
  <contact>
    <name value="Omi HealthTech / VN Core FHIR Community Initiative"/>
    <telecom>
      <system value="url"/>
      <value value="https://hl7.org.vn"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="info@hl7.org.vn"/>
    </telecom>
  </contact>
  <contact>
    <name value="Omi HealthTech (OmiGroup)"/>
    <telecom>
      <system value="url"/>
      <value value="https://omihealthtech.vn"/>
    </telecom>
    <telecom>
      <system value="url"/>
      <value value="https://omigroup.vn"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="healthtech@omigroup.vn"/>
    </telecom>
  </contact>
  <description value="Generated StructureMap scaffold for Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML8TreatmentSummaryLM.fsh` and remain aligned with the Python BHYT round-trip export adapter."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="VN"/>
      <display value="Viet Nam"/>
    </coding>
  </jurisdiction>
  <purpose value="Publish canonical, reviewable FHIR-to-BHYT XML mapping artifacts for XML1-XML12 without duplicating field-level mapping semantics across FSH, wiki, and export code."/>
  <structure>
    <url value="http://fhir.hl7.org.vn/core/StructureDefinition/vn-core-bhyt-submission-bundle"/>
    <mode value="source"/>
    <alias value="BHYTSubmissionBundle"/>
    <documentation value="FHIR-native source bundle profile used by the repository round-trip adapter."/>
  </structure>
  <structure>
    <url value="http://fhir.hl7.org.vn/core/StructureDefinition/bhytXml8TreatmentSummaryLm"/>
    <mode value="target"/>
    <alias value="BHYTXML8TreatmentSummaryLM"/>
    <documentation value="Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model"/>
  </structure>
  <group>
    <name value="MapBHYTXML8TreatmentSummaryLM"/>
    <typeMode value="none"/>
    <documentation value="Rows are derived from treatment summary Composition/DocumentReference and the linked Encounter, Condition, Patient and guardian data. Generated from logical-model `^mapping` annotations. Fields still missing a field-level `^mapping.map` entry remain outside this StructureMap and are tracked in `wiki/mappings/bhyt-output-data/machine/structuremap-coverage.json`."/>
    <input>
      <name value="sourceBundle"/>
      <type value="BHYTSubmissionBundle"/>
      <mode value="source"/>
      <documentation value="VN Core BHYT submission bundle."/>
    </input>
    <input>
      <name value="targetRow"/>
      <type value="BHYTXML8TreatmentSummaryLM"/>
      <mode value="target"/>
      <documentation value="Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model"/>
    </input>
    <rule>
      <name value="maLk"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maLkSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maLk"/>
      </target>
      <documentation value="Target field: MA_LK - Mã liên kết hồ sơ FHIR path: VNCoreClaim.identifier[MALK].value"/>
    </rule>
    <rule>
      <name value="maLoaiKcb"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maLoaiKcbSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maLoaiKcb"/>
      </target>
      <documentation value="Target field: MA_LOAI_KCB - Mã loại KCB FHIR path: VNCoreEncounter.type"/>
    </rule>
    <rule>
      <name value="hoTenCha"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="hoTenChaSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="hoTenCha"/>
      </target>
      <documentation value="Target field: HO_TEN_CHA - Họ tên cha FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='FTH').name.text | VNCorePatient.contact.where(relationship.coding.code='FTH').name.text"/>
    </rule>
    <rule>
      <name value="hoTenMe"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="hoTenMeSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="hoTenMe"/>
      </target>
      <documentation value="Target field: HO_TEN_ME - Họ tên mẹ FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='MTH').name.text | VNCorePatient.contact.where(relationship.coding.code='MTH').name.text"/>
    </rule>
    <rule>
      <name value="nguoiGiamHo"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="nguoiGiamHoSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="nguoiGiamHo"/>
      </target>
      <documentation value="Target field: NGUOI_GIAM_HO - Người giám hộ FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='GUARD').name.text | VNCorePatient.contact.name.text"/>
    </rule>
    <rule>
      <name value="donVi"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="donViSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="donVi"/>
      </target>
      <documentation value="Target field: DON_VI - Đơn vị FHIR path: VNCoreOrganization.name | VNCoreDocumentReference.custodian.resolve().name"/>
    </rule>
    <rule>
      <name value="ngayVao"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngayVaoSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngayVao"/>
      </target>
      <documentation value="Target field: NGAY_VAO - Ngày vào FHIR path: VNCoreEncounter.period.start"/>
    </rule>
    <rule>
      <name value="ngayRa"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngayRaSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngayRa"/>
      </target>
      <documentation value="Target field: NGAY_RA - Ngày ra FHIR path: VNCoreEncounter.period.end"/>
    </rule>
    <rule>
      <name value="chanDoanVao"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="chanDoanVaoSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="chanDoanVao"/>
      </target>
      <documentation value="Target field: CHAN_DOAN_VAO - Chẩn đoán vào FHIR path: VNCoreEncounter.reasonCode | VNCoreComposition.section[chiefComplaint|history].text"/>
    </rule>
    <rule>
      <name value="chanDoanRv"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="chanDoanRvSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="chanDoanRv"/>
      </target>
      <documentation value="Target field: CHAN_DOAN_RV - Chẩn đoán ra viện FHIR path: VNCoreCondition.code | VNCoreComposition.section[diagnosis].entry.resolve().code | section.text"/>
    </rule>
    <rule>
      <name value="ngaySinhCon"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngaySinhConSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngaySinhCon"/>
      </target>
      <documentation value="Target field: NGAY_SINHCON - Ngày sinh con FHIR path: VNCorePatient.birthDate | VNCoreComposition.section[delivery].entry.resolve().birthDate"/>
    </rule>
    <rule>
      <name value="ngayConChet"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngayConChetSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngayConChet"/>
      </target>
      <documentation value="Target field: NGAY_CONCHET - Ngày con chết FHIR path: VNCoreObservation.effectiveDateTime | VNCoreCondition.onsetDateTime"/>
    </rule>
    <rule>
      <name value="soConChet"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="soConChetSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="soConChet"/>
      </target>
      <documentation value="Target field: SO_CONCHET - Số con chết FHIR path: VNCoreObservation.valueQuantity"/>
    </rule>
    <rule>
      <name value="ketQuaDtri"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ketQuaDtriSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ketQuaDtri"/>
      </target>
      <documentation value="Target field: KET_QUA_DTRI - Kết quả điều trị FHIR path: VNCoreEncounter.hospitalization.dischargeDisposition | VNCoreEncounter.extension[treatmentOutcome].valueCodeableConcept"/>
    </rule>
    <rule>
      <name value="maTtdv"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maTtdvSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maTtdv"/>
      </target>
      <documentation value="Target field: MA_TTDV - Mã thủ trưởng đơn vị/người ký FHIR path: VNCoreComposition.attester.party.resolve().identifier.value | VNCoreDocumentReference.authenticator.resolve().identifier.value"/>
    </rule>
    <rule>
      <name value="ngayCt"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngayCtSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngayCt"/>
      </target>
      <documentation value="Target field: NGAY_CT - Ngày cấp chứng từ FHIR path: VNCoreDocumentReference.date | VNCoreComposition.date"/>
    </rule>
    <rule>
      <name value="maTheTam"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maTheTamSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maTheTam"/>
      </target>
      <documentation value="Target field: MA_THE_TAM - Mã thẻ tạm FHIR path: VNCoreCoverage.identifier.value Mapping note: Temporary card identifiers are kept as Coverage.identifier until a dedicated temporary-card slice is profiled."/>
    </rule>
  </group>
</StructureMap>