{
  "resourceType": "StructureDefinition",
  "id": "HealthLinkOrganization",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
      "valueString": "Base.Entities"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
      "valueCode": "business"
    }
  ],
  "url": "https://healthlink.go.th/fhir/StructureDefinition/HealthLinkOrganization",
  "version": "0.5.2",
  "name": "HealthLinkOrganization",
  "title": "Health Link Organization Profile",
  "status": "active",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "servd",
      "uri": "http://www.omg.org/spec/ServD/1.0/",
      "name": "ServD"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Organization",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Organization",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Organization.id",
        "path": "Organization.id",
        "min": 1,
        "constraint": [
          {
            "key": "health-link-3",
            "severity": "error",
            "human": "Organization id must be 'hXXXXXXXXX' or 'sXXXXX' ('h' + 9-digit mdp9id in case using hcode, or 's' + 5-digit number otherwise)",
            "expression": "matches(\"^(h[0-9]{9})|(s[0-9]{5})$\")",
            "source": "https://healthlink.go.th/fhir/StructureDefinition/HealthLinkOrganization"
          }
        ]
      },
      {
        "id": "Organization.identifier",
        "path": "Organization.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Organization.identifier:mdp",
        "path": "Organization.identifier",
        "sliceName": "mdp",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Organization.identifier:mdp.use",
        "path": "Organization.identifier.use",
        "patternCode": "official"
      },
      {
        "id": "Organization.identifier:mdp.system",
        "path": "Organization.identifier.system",
        "min": 1,
        "patternUri": "http://203.157.10.8/hcode_2020/query_set.php"
      },
      {
        "id": "Organization.identifier:mdp.value",
        "path": "Organization.identifier.value",
        "min": 1,
        "constraint": [
          {
            "key": "health-link-4",
            "severity": "error",
            "human": "Resource identifer.value must be a 9 digit number (hcode)",
            "expression": "matches(\"^[0-9]{9}$\")",
            "source": "https://healthlink.go.th/fhir/StructureDefinition/HealthLinkOrganization"
          }
        ]
      }
    ]
  }
}