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

<StructureMap xmlns="http://hl7.org/fhir">
  <id value="vn-sm-bhyt-xml6-hiv-care"/>
  <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-xml6-hiv-care</b></p><a name="vn-sm-bhyt-xml6-hiv-care"> </a><a name="hcvn-sm-bhyt-xml6-hiv-care"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml6-hiv-care<span style="color: navy">&quot; = &quot;</span>BHYTXML6HIVCareLMStructureMap<span style="color: navy">&quot;

</span><span style="color: navy">// </span><span style="color: green">Generated StructureMap scaffold for Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML6HIVCareLM.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-bhytXml6HivCareLm.html" title="Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care Logical Model">http://fhir.hl7.org.vn/core/StructureDefinition/bhytXml6HivCareLm</a><span style="color: navy">&quot; </span><b>alias </b>BHYTXML6HIVCareLM <b>as </b><b>target</b> <span style="color: navy">// </span><span style="color: green">Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care Logical Model</span>

<span style="color: navy">// </span><span style="color: green">Rows are derived from HIV/AIDS/TB clinical resources and supporting documents. This table was previously mis-numbered in draft FSH and must not be confused with discharge documents. 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>MapBHYTXML6HIVCareLM<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>BHYTXML6HIVCareLM<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">sttSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.stt <i>&quot;stt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: STT - Số thứ tự dòng FHIR path: Derived export row order for HIV care rows</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maTheBhytSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maTheBhyt <i>&quot;maTheBhyt&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_THE_BHYT - Mã thẻ BHYT FHIR path: VNCoreCoverage.identifier[BHYT].value</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngaySinhSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngaySinh <i>&quot;ngaySinh&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAY_SINH - Ngày sinh FHIR path: VNCorePatient.birthDate</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">gioiTinhSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.gioiTinh <i>&quot;gioiTinh&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: GIOI_TINH - Giới tính FHIR path: VNCorePatient.gender</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">diaChiSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.diaChi <i>&quot;diaChi&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: DIA_CHI - Địa chỉ cư trú FHIR path: VNCorePatient.address.text</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maTinhCuTruSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maTinhCuTru <i>&quot;maTinhCuTru&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MATINH_CU_TRU - Mã tỉnh cư trú FHIR path: VNCorePatient.address.extension[province].valueCoding.code</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maHuyenCuTruSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maHuyenCuTru <i>&quot;maHuyenCuTru&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MAHUYEN_CU_TRU - Mã huyện cư trú legacy FHIR path: VNCorePatient.address.district</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maXaCuTruSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maXaCuTru <i>&quot;maXaCuTru&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MAXA_CU_TRU - Mã xã cư trú FHIR path: VNCorePatient.address.extension[ward].valueCoding.code</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">ngayKdHivSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.ngayKdHiv <i>&quot;ngayKdHiv&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: NGAYKD_HIV - Ngày khẳng định HIV FHIR path: VNCoreCondition.onsetDateTime | VNCoreObservation.effectiveDateTime Mapping note: The local OHP validator marks NGAYKD_HIV required, but its rule text notes the legal/source exception for exposure prophylaxis. Keep optional until the exception is confirmed in the normative source.</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">lyDoChuyenPhacDoSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.lyDoChuyenPhacDo <i>&quot;lyDoChuyenPhacDo&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: LY_DO_CHUYEN_PHAC_DO - Lý do chuyển phác đồ FHIR path: VNCoreMedicationRequest.reasonCode | VNCoreDocumentReference.category | future HIV workflow extension</span>
  sourceBundle.entry<b> as </b><span style="color: maroon">maCskcbSource</span><span style="color: navy"><b> -&gt; </b></span>targetRow.maCskcb <i>&quot;maCskcb&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Target field: MA_CSKCB - Mã cơ sở KCB FHIR path: VNCoreEncounter.serviceProvider.resolve().identifier[CSKCB].value | VNCoreClaim.provider.resolve().identifier[CSKCB].value</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url value="http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml6-hiv-care"/>
  <version value="0.5.0"/>
  <name value="BHYTXML6HIVCareLMStructureMap"/>
  <title value="Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care 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 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML6HIVCareLM.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/bhytXml6HivCareLm"/>
    <mode value="target"/>
    <alias value="BHYTXML6HIVCareLM"/>
    <documentation value="Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care Logical Model"/>
  </structure>
  <group>
    <name value="MapBHYTXML6HIVCareLM"/>
    <typeMode value="none"/>
    <documentation value="Rows are derived from HIV/AIDS/TB clinical resources and supporting documents. This table was previously mis-numbered in draft FSH and must not be confused with discharge documents. 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="BHYTXML6HIVCareLM"/>
      <mode value="target"/>
      <documentation value="Bảng 6 hồ sơ HIV/AIDS — XML6 HIV/AIDS Care 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="stt"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="sttSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="stt"/>
      </target>
      <documentation value="Target field: STT - Số thứ tự dòng FHIR path: Derived export row order for HIV care rows"/>
    </rule>
    <rule>
      <name value="maTheBhyt"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maTheBhytSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maTheBhyt"/>
      </target>
      <documentation value="Target field: MA_THE_BHYT - Mã thẻ BHYT FHIR path: VNCoreCoverage.identifier[BHYT].value"/>
    </rule>
    <rule>
      <name value="ngaySinh"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngaySinhSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngaySinh"/>
      </target>
      <documentation value="Target field: NGAY_SINH - Ngày sinh FHIR path: VNCorePatient.birthDate"/>
    </rule>
    <rule>
      <name value="gioiTinh"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="gioiTinhSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="gioiTinh"/>
      </target>
      <documentation value="Target field: GIOI_TINH - Giới tính FHIR path: VNCorePatient.gender"/>
    </rule>
    <rule>
      <name value="diaChi"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="diaChiSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="diaChi"/>
      </target>
      <documentation value="Target field: DIA_CHI - Địa chỉ cư trú FHIR path: VNCorePatient.address.text"/>
    </rule>
    <rule>
      <name value="maTinhCuTru"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maTinhCuTruSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maTinhCuTru"/>
      </target>
      <documentation value="Target field: MATINH_CU_TRU - Mã tỉnh cư trú FHIR path: VNCorePatient.address.extension[province].valueCoding.code"/>
    </rule>
    <rule>
      <name value="maHuyenCuTru"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maHuyenCuTruSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maHuyenCuTru"/>
      </target>
      <documentation value="Target field: MAHUYEN_CU_TRU - Mã huyện cư trú legacy FHIR path: VNCorePatient.address.district"/>
    </rule>
    <rule>
      <name value="maXaCuTru"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maXaCuTruSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maXaCuTru"/>
      </target>
      <documentation value="Target field: MAXA_CU_TRU - Mã xã cư trú FHIR path: VNCorePatient.address.extension[ward].valueCoding.code"/>
    </rule>
    <rule>
      <name value="ngayKdHiv"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="ngayKdHivSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="ngayKdHiv"/>
      </target>
      <documentation value="Target field: NGAYKD_HIV - Ngày khẳng định HIV FHIR path: VNCoreCondition.onsetDateTime | VNCoreObservation.effectiveDateTime Mapping note: The local OHP validator marks NGAYKD_HIV required, but its rule text notes the legal/source exception for exposure prophylaxis. Keep optional until the exception is confirmed in the normative source."/>
    </rule>
    <rule>
      <name value="lyDoChuyenPhacDo"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="lyDoChuyenPhacDoSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="lyDoChuyenPhacDo"/>
      </target>
      <documentation value="Target field: LY_DO_CHUYEN_PHAC_DO - Lý do chuyển phác đồ FHIR path: VNCoreMedicationRequest.reasonCode | VNCoreDocumentReference.category | future HIV workflow extension"/>
    </rule>
    <rule>
      <name value="maCskcb"/>
      <source>
        <context value="sourceBundle"/>
        <min value="0"/>
        <max value="*"/>
        <element value="entry"/>
        <variable value="maCskcbSource"/>
      </source>
      <target>
        <context value="targetRow"/>
        <contextType value="variable"/>
        <element value="maCskcb"/>
      </target>
      <documentation value="Target field: MA_CSKCB - Mã cơ sở KCB FHIR path: VNCoreEncounter.serviceProvider.resolve().identifier[CSKCB].value | VNCoreClaim.provider.resolve().identifier[CSKCB].value"/>
    </rule>
  </group>
</StructureMap>