# text.div
Generated Narrative: StructureMap vn-sm-bhyt-xml8-treatment-summary

map "http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml8-treatment-summary" = "BHYTXML8TreatmentSummaryLMStructureMap"

// 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.

uses "http://fhir.hl7.org.vn/core/StructureDefinition/vn-core-bhyt-submission-bundle" alias BHYTSubmissionBundle as source // FHIR-native source bundle profile used by the repository round-trip adapter.
uses "http://fhir.hl7.org.vn/core/StructureDefinition/bhytXml8TreatmentSummaryLm" alias BHYTXML8TreatmentSummaryLM as target // Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model

// 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`.
group MapBHYTXML8TreatmentSummaryLM(source sourceBundle : BHYTSubmissionBundle, target targetRow : BHYTXML8TreatmentSummaryLM) {
  sourceBundle.entry as maLkSource -> targetRow.maLk "maLk"; // Target field: MA_LK - Mã liên kết hồ sơ FHIR path: VNCoreClaim.identifier[MALK].value
  sourceBundle.entry as maLoaiKcbSource -> targetRow.maLoaiKcb "maLoaiKcb"; // Target field: MA_LOAI_KCB - Mã loại KCB FHIR path: VNCoreEncounter.type
  sourceBundle.entry as hoTenChaSource -> targetRow.hoTenCha "hoTenCha"; // 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
  sourceBundle.entry as hoTenMeSource -> targetRow.hoTenMe "hoTenMe"; // 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
  sourceBundle.entry as nguoiGiamHoSource -> targetRow.nguoiGiamHo "nguoiGiamHo"; // Target field: NGUOI_GIAM_HO - Người giám hộ FHIR path: VNCoreRelatedPerson.where(relationship.coding.code='GUARD').name.text | VNCorePatient.contact.name.text
  sourceBundle.entry as donViSource -> targetRow.donVi "donVi"; // Target field: DON_VI - Đơn vị FHIR path: VNCoreOrganization.name | VNCoreDocumentReference.custodian.resolve().name
  sourceBundle.entry as ngayVaoSource -> targetRow.ngayVao "ngayVao"; // Target field: NGAY_VAO - Ngày vào FHIR path: VNCoreEncounter.period.start
  sourceBundle.entry as ngayRaSource -> targetRow.ngayRa "ngayRa"; // Target field: NGAY_RA - Ngày ra FHIR path: VNCoreEncounter.period.end
  sourceBundle.entry as chanDoanVaoSource -> targetRow.chanDoanVao "chanDoanVao"; // Target field: CHAN_DOAN_VAO - Chẩn đoán vào FHIR path: VNCoreEncounter.reasonCode | VNCoreComposition.section[chiefComplaint|history].text
  sourceBundle.entry as chanDoanRvSource -> targetRow.chanDoanRv "chanDoanRv"; // Target field: CHAN_DOAN_RV - Chẩn đoán ra viện FHIR path: VNCoreCondition.code | VNCoreComposition.section[diagnosis].entry.resolve().code | section.text
  sourceBundle.entry as ngaySinhConSource -> targetRow.ngaySinhCon "ngaySinhCon"; // Target field: NGAY_SINHCON - Ngày sinh con FHIR path: VNCorePatient.birthDate | VNCoreComposition.section[delivery].entry.resolve().birthDate
  sourceBundle.entry as ngayConChetSource -> targetRow.ngayConChet "ngayConChet"; // Target field: NGAY_CONCHET - Ngày con chết FHIR path: VNCoreObservation.effectiveDateTime | VNCoreCondition.onsetDateTime
  sourceBundle.entry as soConChetSource -> targetRow.soConChet "soConChet"; // Target field: SO_CONCHET - Số con chết FHIR path: VNCoreObservation.valueQuantity
  sourceBundle.entry as ketQuaDtriSource -> targetRow.ketQuaDtri "ketQuaDtri"; // Target field: KET_QUA_DTRI - Kết quả điều trị FHIR path: VNCoreEncounter.hospitalization.dischargeDisposition | VNCoreEncounter.extension[treatmentOutcome].valueCodeableConcept
  sourceBundle.entry as maTtdvSource -> targetRow.maTtdv "maTtdv"; // 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
  sourceBundle.entry as ngayCtSource -> targetRow.ngayCt "ngayCt"; // Target field: NGAY_CT - Ngày cấp chứng từ FHIR path: VNCoreDocumentReference.date | VNCoreComposition.date
  sourceBundle.entry as maTheTamSource -> targetRow.maTheTam "maTheTam"; // 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.
}

# title
Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model — StructureMap

# publisher
Omi HealthTech / VN Core FHIR Community Initiative

# contact[].name
Omi HealthTech / VN Core FHIR Community Initiative

# description
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.

# purpose
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[].documentation
FHIR-native source bundle profile used by the repository round-trip adapter.

# structure[].documentation
Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model

# group[].documentation
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`.

# group[].input[].documentation
Bảng 8 tóm tắt hồ sơ bệnh án — XML8 Treatment Summary Logical Model

# group[].rule[].documentation
Target field: MA_LK - Mã liên kết hồ sơ FHIR path: VNCoreClaim.identifier[MALK].value

# group[].rule[].documentation
Target field: MA_LOAI_KCB - Mã loại KCB FHIR path: VNCoreEncounter.type

# group[].rule[].documentation
Target field: DON_VI - Đơn vị FHIR path: VNCoreOrganization.name | VNCoreDocumentReference.custodian.resolve().name

# group[].rule[].documentation
Target field: NGAY_VAO - Ngày vào FHIR path: VNCoreEncounter.period.start

# group[].rule[].documentation
Target field: NGAY_RA - Ngày ra FHIR path: VNCoreEncounter.period.end

# group[].rule[].documentation
Target field: CHAN_DOAN_RV - Chẩn đoán ra viện FHIR path: VNCoreCondition.code | VNCoreComposition.section[diagnosis].entry.resolve().code | section.text

# group[].rule[].documentation
Target field: NGAY_CONCHET - Ngày con chết FHIR path: VNCoreObservation.effectiveDateTime | VNCoreCondition.onsetDateTime

# group[].rule[].documentation
Target field: SO_CONCHET - Số con chết FHIR path: VNCoreObservation.valueQuantity

# group[].rule[].documentation
Target field: NGAY_CT - Ngày cấp chứng từ FHIR path: VNCoreDocumentReference.date | VNCoreComposition.date

# group[].rule[].documentation
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.