{
  "resourceType": "StructureDefinition",
  "url": "https://example.org/fhir/StructureDefinition/SirirajPatientCoverage",
  "name": "SirirajPatientCoverage",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Coverage",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Coverage",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Coverage.extension",
        "path": "Coverage.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "Coverage.extension:active-type",
        "path": "Coverage.extension",
        "sliceName": "active-type",
        "short": "Extensions Element : activeType",
        "definition": "Extension Element : active-type ใช้สำหรับแสดงประเภทของข้อมูล (resource data type) ซึ่งมี 2 ประเภท คือ <br>\r\n1. person  =   คือสิทธิ์ที่เป็นสิทธิ์เริ่มต้นของผู้ใช้บริการ ( Default rights )  <br>\r\n2. visit      =   คือสิทธิ์ที่ที่มาใช้บริการในครั้งปัจจุบัน ( Current usage rights )  <br>\r\nและ active-type ยังเป็น search parameter สำหรับการค้นหาข้อมูล (search for information) ด้วย <br>\r\n\r\nหมายเหตุ   ในอนาคตอาจเพิ่มประเภทของข้อมูลสิทธิ์อีก 2 ประเภท คือ <br>\r\nhistory  =   คือการสรุปสิทธิ์ที่เคยมีการใช้งานทั้งหมดของผู้ม่ใช้บริการ ( Usage rights History )  <br>\r\nlast       =   คือสิทธิ์ที่มีการใช้งานครั้งสุดท้ายที่มีการปิด visit / admit ไปแล้วก่อนครั้งปัจจุบัน ( Usage last rights )",
        "min": 0,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://example.org/fhir/StructureDefinition/SirirajPatientCoverageTypeExtension"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Coverage.status",
        "path": "Coverage.status",
        "mustSupport": true
      },
      {
        "id": "Coverage.type",
        "path": "Coverage.type",
        "mustSupport": true
      },
      {
        "id": "Coverage.type.coding.system",
        "path": "Coverage.type.coding.system",
        "short": "Terminology Source Reference",
        "definition": "แหล่งอ้างอิงสำหรับข้อมูลกลุ่มสิทธิ์ (Reference source for permission group information)",
        "mustSupport": true
      },
      {
        "id": "Coverage.type.coding.code",
        "path": "Coverage.type.coding.code",
        "short": "รหัสของกลุ่มสิทธิ์",
        "mustSupport": true
      },
      {
        "id": "Coverage.type.coding.display",
        "path": "Coverage.type.coding.display",
        "short": "ชื่อของกลุ่มสิทธิ์",
        "mustSupport": true
      },
      {
        "id": "Coverage.type.text",
        "path": "Coverage.type.text",
        "short": "ข้อความที่ระบุประเภทข้อมูล",
        "definition": "ข้อความที่ระบุประเภทข้อมูล <br>\r\n     - กลุ่มสิทธิ์   หรือ <br>\r\n     - category",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary",
        "path": "Coverage.beneficiary",
        "short": "ผู้รับผลประโยชน์ตามสิทธิ์",
        "definition": "ผู้รับผลประโยชน์ตามสิทธิ์ หมายถึงผู้ป่วย หรือในบางกรณีอาจหมายถึงผู้รับสิทธิ์สืบทอด  เช่น <br>\r\n   - ผู้ป่วยที่เป็นทารกแรกคลอด  <br>\r\n   - ผู้ป่วยที่รับสืบทอดสิทธิ์จากบุตร หรือบิดา มารดาที่เป็นข้าราชการ",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary.reference",
        "path": "Coverage.beneficiary.reference",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary.type",
        "path": "Coverage.beneficiary.type",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary.identifier",
        "path": "Coverage.beneficiary.identifier",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary.identifier.system",
        "path": "Coverage.beneficiary.identifier.system",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary.identifier.value",
        "path": "Coverage.beneficiary.identifier.value",
        "mustSupport": true
      },
      {
        "id": "Coverage.period",
        "path": "Coverage.period",
        "mustSupport": true
      },
      {
        "id": "Coverage.period.start",
        "path": "Coverage.period.start",
        "mustSupport": true
      },
      {
        "id": "Coverage.period.end",
        "path": "Coverage.period.end",
        "mustSupport": true
      },
      {
        "id": "Coverage.payor",
        "path": "Coverage.payor",
        "mustSupport": true
      },
      {
        "id": "Coverage.class",
        "path": "Coverage.class",
        "mustSupport": true
      },
      {
        "id": "Coverage.class.extension",
        "path": "Coverage.class.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "Coverage.class.extension:rights-type",
        "path": "Coverage.class.extension",
        "sliceName": "rights-type",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://example.org/fhir/StructureDefinition/SirirajCoverageClassExtension"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Coverage.class.extension:rights-type.value[x].coding.code",
        "path": "Coverage.class.extension.value[x].coding.code",
        "mustSupport": true
      },
      {
        "id": "Coverage.class.extension:rights-type.value[x].coding.display",
        "path": "Coverage.class.extension.value[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Coverage.class.type.coding.system",
        "path": "Coverage.class.type.coding.system",
        "mustSupport": true
      },
      {
        "id": "Coverage.class.type.coding.code",
        "path": "Coverage.class.type.coding.code",
        "mustSupport": true
      },
      {
        "id": "Coverage.class.type.coding.display",
        "path": "Coverage.class.type.coding.display",
        "mustSupport": true
      }
    ]
  }
}