# text.div
Generated Narrative: StructureMap vn-sm-bhyt-xml12-medical-assessment

map "http://fhir.hl7.org.vn/core/StructureMap/vn-sm-bhyt-xml12-medical-assessment" = "BHYTXML12MedicalAssessmentLMStructureMap"

// Generated StructureMap scaffold for Bảng 12 giám định y khoa — XML12 Medical Assessment Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML12MedicalAssessmentLM.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/bhytXml12MedicalAssessmentLm" alias BHYTXML12MedicalAssessmentLM as target // Bảng 12 giám định y khoa — XML12 Medical Assessment Logical Model

// Rows are derived from medical-assessment Composition/DocumentReference, Patient/Coverage identity data and structured assessment Observations. 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 MapBHYTXML12MedicalAssessmentLM(source sourceBundle : BHYTSubmissionBundle, target targetRow : BHYTXML12MedicalAssessmentLM) {
  sourceBundle.entry as nguoiChuTriSource -> targetRow.nguoiChuTri "nguoiChuTri"; // Target field: NGUOI_CHU_TRI - Người chủ trì FHIR path: VNCoreComposition.author.resolve().identifier.value | VNCorePractitioner.identifier.value
  sourceBundle.entry as chucVuSource -> targetRow.chucVu "chucVu"; // Target field: CHUC_VU - Chức vụ FHIR path: VNCorePractitionerRole.code | VNCorePractitioner.qualification.code
  sourceBundle.entry as ngayHopSource -> targetRow.ngayHop "ngayHop"; // Target field: NGAY_HOP - Ngày họp FHIR path: VNCoreComposition.event.period.start | VNCoreDocumentReference.context.period.start
  sourceBundle.entry as hoTenSource -> targetRow.hoTen "hoTen"; // Target field: HO_TEN - Họ tên người được giám định FHIR path: VNCorePatient.name
  sourceBundle.entry as ngaySinhSource -> targetRow.ngaySinh "ngaySinh"; // Target field: NGAY_SINH - Ngày sinh FHIR path: VNCorePatient.birthDate
  sourceBundle.entry as ngayCapCccdSource -> targetRow.ngayCapCccd "ngayCapCccd"; // Target field: NGAY_CAP_CCCD - Ngày cấp CCCD FHIR path: VNCorePatient.identifier[CCCD].period.start
  sourceBundle.entry as noiCapCccdSource -> targetRow.noiCapCccd "noiCapCccd"; // Target field: NOI_CAP_CCCD - Nơi cấp CCCD FHIR path: VNCorePatient.identifier[CCCD].assigner.display
  sourceBundle.entry as diaChiSource -> targetRow.diaChi "diaChi"; // Target field: DIA_CHI - Địa chỉ FHIR path: VNCorePatient.address.text
  sourceBundle.entry as maTinhCuTruSource -> targetRow.maTinhCuTru "maTinhCuTru"; // Target field: MATINH_CU_TRU - Mã tỉnh cư trú FHIR path: VNCorePatient.address.extension[province].valueCoding.code
  sourceBundle.entry as maHuyenCuTruSource -> targetRow.maHuyenCuTru "maHuyenCuTru"; // Target field: MAHUYEN_CU_TRU - Mã huyện cư trú legacy FHIR path: VNCorePatient.address.district
  sourceBundle.entry as maXaCuTruSource -> targetRow.maXaCuTru "maXaCuTru"; // Target field: MAXA_CU_TRU - Mã xã cư trú FHIR path: VNCorePatient.address.extension[ward].valueCoding.code
  sourceBundle.entry as maBhxhSource -> targetRow.maBhxh "maBhxh"; // Target field: MA_BHXH - Mã BHXH FHIR path: VNCorePatient.identifier[BHXH].value | VNCoreCoverage.subscriberId
  sourceBundle.entry as maTheBhytSource -> targetRow.maTheBhyt "maTheBhyt"; // Target field: MA_THE_BHYT - Mã thẻ BHYT FHIR path: VNCoreCoverage.identifier[BHYT].value
  sourceBundle.entry as ngheNghiepSource -> targetRow.ngheNghiep "ngheNghiep"; // Target field: NGHE_NGHIEP - Nghề nghiệp FHIR path: VNCorePatient.extension[occupation].valueCodeableConcept.coding.code
  sourceBundle.entry as dienThoaiSource -> targetRow.dienThoai "dienThoai"; // Target field: DIEN_THOAI - Điện thoại FHIR path: VNCorePatient.telecom.where(system='phone').value
  sourceBundle.entry as soBienBanSource -> targetRow.soBienBan "soBienBan"; // Target field: SO_BIEN_BAN - Số biên bản FHIR path: VNCoreDocumentReference.identifier.value | VNCoreComposition.identifier.value
  sourceBundle.entry as tyleTtctCuSource -> targetRow.tyleTtctCu "tyleTtctCu"; // Target field: TYLE_TTCT_CU - Tỷ lệ tổn thương cơ thể cũ FHIR path: VNCoreObservation.valueQuantity
  sourceBundle.entry as ngayChungTuSource -> targetRow.ngayChungTu "ngayChungTu"; // Target field: NGAY_CHUNG_TU - Ngày chứng từ FHIR path: VNCoreDocumentReference.date | VNCoreComposition.date
  sourceBundle.entry as soGiayGioiThieuSource -> targetRow.soGiayGioiThieu "soGiayGioiThieu"; // Target field: SO_GIAY_GIOI_THIEU - Số giấy giới thiệu FHIR path: VNCoreDocumentReference.relatesTo.target.identifier.value | VNCoreDocumentReference.identifier.value
  sourceBundle.entry as ngayDeNghiSource -> targetRow.ngayDeNghi "ngayDeNghi"; // Target field: NGAY_DE_NGHI - Ngày đề nghị FHIR path: VNCoreServiceRequest.authoredOn | VNCoreDocumentReference.context.period.start
  sourceBundle.entry as maDonviSource -> targetRow.maDonvi "maDonvi"; // Target field: MA_DONVI - Mã đơn vị FHIR path: VNCoreOrganization.identifier.value | VNCoreDocumentReference.custodian.resolve().identifier.value
  sourceBundle.entry as gioiThieuCuaSource -> targetRow.gioiThieuCua "gioiThieuCua"; // Target field: GIOI_THIEU_CUA - Giới thiệu của FHIR path: VNCoreDocumentReference.relatesTo.target.display | VNCoreServiceRequest.requester.display
  sourceBundle.entry as soVanBanCanCuSource -> targetRow.soVanBanCanCu "soVanBanCanCu"; // Target field: SO_VAN_BAN_CAN_CU - Số văn bản căn cứ FHIR path: VNCoreDocumentReference.identifier.value | VNCoreComposition.identifier.value
  sourceBundle.entry as tyleTtctMoiSource -> targetRow.tyleTtctMoi "tyleTtctMoi"; // Target field: TYLE_TTCT_MOI - Tỷ lệ tổn thương cơ thể mới FHIR path: VNCoreObservation.valueQuantity
  sourceBundle.entry as tongTyleTtctSource -> targetRow.tongTyleTtct "tongTyleTtct"; // Target field: TONG_TYLE_TTCT - Tổng tỷ lệ tổn thương cơ thể FHIR path: VNCoreObservation.valueQuantity
}

# title
Bảng 12 giám định y khoa — XML12 Medical Assessment 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 12 giám định y khoa — XML12 Medical Assessment Logical Model. Source semantics come from the logical model mapping annotations in `BHYTXML12MedicalAssessmentLM.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 12 giám định y khoa — XML12 Medical Assessment Logical Model

# group[].documentation
Rows are derived from medical-assessment Composition/DocumentReference, Patient/Coverage identity data and structured assessment Observations. 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 12 giám định y khoa — XML12 Medical Assessment Logical Model

# group[].rule[].documentation
Target field: CHUC_VU - Chức vụ FHIR path: VNCorePractitionerRole.code | VNCorePractitioner.qualification.code

# group[].rule[].documentation
Target field: HO_TEN - Họ tên người được giám định FHIR path: VNCorePatient.name

# group[].rule[].documentation
Target field: NGAY_SINH - Ngày sinh FHIR path: VNCorePatient.birthDate

# group[].rule[].documentation
Target field: NGAY_CAP_CCCD - Ngày cấp CCCD FHIR path: VNCorePatient.identifier[CCCD].period.start

# group[].rule[].documentation
Target field: NOI_CAP_CCCD - Nơi cấp CCCD FHIR path: VNCorePatient.identifier[CCCD].assigner.display

# group[].rule[].documentation
Target field: DIA_CHI - Địa chỉ FHIR path: VNCorePatient.address.text

# group[].rule[].documentation
Target field: MATINH_CU_TRU - Mã tỉnh cư trú FHIR path: VNCorePatient.address.extension[province].valueCoding.code

# group[].rule[].documentation
Target field: MAHUYEN_CU_TRU - Mã huyện cư trú legacy FHIR path: VNCorePatient.address.district

# group[].rule[].documentation
Target field: MAXA_CU_TRU - Mã xã cư trú FHIR path: VNCorePatient.address.extension[ward].valueCoding.code

# group[].rule[].documentation
Target field: MA_BHXH - Mã BHXH FHIR path: VNCorePatient.identifier[BHXH].value | VNCoreCoverage.subscriberId

# group[].rule[].documentation
Target field: MA_THE_BHYT - Mã thẻ BHYT FHIR path: VNCoreCoverage.identifier[BHYT].value

# group[].rule[].documentation
Target field: SO_BIEN_BAN - Số biên bản FHIR path: VNCoreDocumentReference.identifier.value | VNCoreComposition.identifier.value

# group[].rule[].documentation
Target field: TYLE_TTCT_CU - Tỷ lệ tổn thương cơ thể cũ FHIR path: VNCoreObservation.valueQuantity

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

# group[].rule[].documentation
Target field: NGAY_DE_NGHI - Ngày đề nghị FHIR path: VNCoreServiceRequest.authoredOn | VNCoreDocumentReference.context.period.start

# group[].rule[].documentation
Target field: SO_VAN_BAN_CAN_CU - Số văn bản căn cứ FHIR path: VNCoreDocumentReference.identifier.value | VNCoreComposition.identifier.value

# group[].rule[].documentation
Target field: TYLE_TTCT_MOI - Tỷ lệ tổn thương cơ thể mới FHIR path: VNCoreObservation.valueQuantity

# group[].rule[].documentation
Target field: TONG_TYLE_TTCT - Tổng tỷ lệ tổn thương cơ thể FHIR path: VNCoreObservation.valueQuantity