{
    "resourceType": "StructureDefinition",
    "id": "MyEncounter",
    "extension":  [
        {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
            "valueString": "Base.Management"
        },
        {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
            "valueCode": "patient"
        }
    ],
    "url": "http://example.org/StructureDefinition/MyEncounter",
    "name": "MyEncounter",
    "status": "active",
    "fhirVersion": "4.0.1",
    "mapping":  [
        {
            "identity": "workflow",
            "uri": "http://hl7.org/fhir/workflow",
            "name": "Workflow Pattern"
        },
        {
            "identity": "rim",
            "uri": "http://hl7.org/v3",
            "name": "RIM Mapping"
        },
        {
            "identity": "w5",
            "uri": "http://hl7.org/fhir/fivews",
            "name": "FiveWs Pattern Mapping"
        },
        {
            "identity": "v2",
            "uri": "http://hl7.org/v2",
            "name": "HL7 v2 Mapping"
        }
    ],
    "kind": "resource",
    "abstract": false,
    "type": "Encounter",
    "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Encounter",
    "derivation": "constraint",
    "differential": {
        "element":  [
            {
                "id": "Encounter.extension",
                "path": "Encounter.extension",
                "slicing": {
                    "discriminator":  [
                        {
                            "type": "value",
                            "path": "url"
                        }
                    ],
                    "ordered": false,
                    "rules": "open"
                },
                "min": 1
            },
            {
                "id": "Encounter.extension:InsurancePlan",
                "path": "Encounter.extension",
                "sliceName": "InsurancePlan",
                "min": 1,
                "max": "1",
                "type":  [
                    {
                        "code": "Extension",
                        "profile":  [
                            "http://hl7.org/fhir/StructureDefinition/workflow-supportingInfo"
                        ]
                    }
                ],
                "mustSupport": true
            },
            {
                "id": "Encounter.identifier",
                "path": "Encounter.identifier",
                "slicing": {
                    "discriminator":  [
                        {
                            "type": "value",
                            "path": "system"
                        }
                    ],
                    "rules": "open",
                    "description": "Slice"
                },
                "min": 1
            },
            {
                "id": "Encounter.identifier:NSOLIC",
                "path": "Encounter.identifier",
                "sliceName": "NSOLIC",
                "min": 1,
                "max": "1"
            },
            {
                "id": "Encounter.identifier:NSOLIC.type.coding.code",
                "path": "Encounter.identifier.type.coding.code",
                "patternCode": "VN"
            },
            {
                "id": "Encounter.identifier:NSOLIC.type.coding.display",
                "path": "Encounter.identifier.type.coding.display",
                "patternString": "Visit Number"
            },
            {
                "id": "Encounter.identifier:NSOLIC.system",
                "path": "Encounter.identifier.system",
                "min": 1,
                "patternUri": "http://example.org/StructureDefinition/MyPatient"
            },
            {
                "id": "Encounter.identifier:NSOLIC.value",
                "path": "Encounter.identifier.value",
                "min": 1
            },
            {
                "id": "Encounter.status",
                "path": "Encounter.status",
                "binding": {
                    "strength": "required",
                    "valueSet": "https://example.org/StructureDefinition/ICD"
                }
            },
            {
                "id": "Encounter.class",
                "path": "Encounter.class",
                "binding": {
                    "strength": "required",
                    "valueSet": "https://example.org/StructureDefinition/Atos"
                }
            },
            {
                "id": "Encounter.serviceType",
                "path": "Encounter.serviceType",
                "binding": {
                    "strength": "required",
                    "valueSet": "http://hl7.org/fhir/request-priority"
                }
            },
            {
                "id": "Encounter.subject",
                "path": "Encounter.subject",
                "min": 1
            },
            {
                "id": "Encounter.appointment",
                "path": "Encounter.appointment",
                "min": 1,
                "max": "1"
            },
            {
                "id": "Encounter.reasonCode",
                "path": "Encounter.reasonCode",
                "binding": {
                    "strength": "required",
                    "valueSet": "http://hl7.org/fhir/request-status"
                }
            },
            {
                "id": "Encounter.serviceProvider",
                "path": "Encounter.serviceProvider",
                "min": 1
            }
        ]
    }
}
{
    "resourceType": "StructureDefinition",
    "id": "InsurancePlan",
    "url": "http://example.org/StructureDefinition/InsurancePlan",
    "name": "InsurancePlan_extension",
    "title": "InsurancePlan_extension",
    "status": "active",
    "fhirVersion": "4.0.1",
    "mapping":  [
        {
            "identity": "rim",
            "uri": "http://hl7.org/v3",
            "name": "RIM Mapping"
        }
    ],
    "kind": "complex-type",
    "abstract": false,
    "context":  [
        {
            "type": "element",
            "expression": "Element"
        }
    ],
    "type": "Extension",
    "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
    "derivation": "constraint",
    "differential": {
        "element":  [
            {
                "id": "Extension",
                "path": "Extension",
                "short": "InsurancePlan_extension"
            },
            {
                "id": "Extension.extension",
                "path": "Extension.extension",
                "max": "0"
            },
            {
                "id": "Extension.url",
                "path": "Extension.url",
                "fixedUri": "http://example.org/StructureDefinition/InsurancePlan"
            },
            {
                "id": "Extension.value[x]",
                "path": "Extension.value[x]",
                "type":  [
                    {
                        "code": "Reference",
                        "targetProfile":  [
                            "http://example.org/StructureDefinition/InsurancePlan"
                        ]
                    }
                ],
                "binding": {
                    "strength": "required",
                    "valueSet": "http://hl7.org/fhir/StructureDefinition/workflow-supportingInfo"
                }
            }
        ]
    }
}
{
    "resourceType": "ValueSet",
    "status": "draft",
    "name": "ActEncounterCode",
    "id": "ActEncounterCode",
    "title": "ActEncounterCode",
    "version": "1.0",
    "url": "https://example.org/StructureDefinition/Atos"
}
{
    "resourceType": "ValueSet",
    "status": "draft",
    "name": "EncounterReasonCode",
    "id": "EncounterReasonCode",
    "title": "EncounterReasonCode",
    "version": "1.0",
    "url": "http://hl7.org/fhir/request-status"
}
{
    "resourceType": "ValueSet",
    "status": "draft",
    "name": "EncounterStatus",
    "id": "EncounterStatus",
    "title": "EncounterStatus",
    "version": "1.0",
    "url": "https://example.org/StructureDefinition/ICD"
}
{
    "resourceType": "ValueSet",
    "status": "draft",
    "name": "ServiceType",
    "id": "ServiceType",
    "title": "ServiceType",
    "version": "1.0",
    "url": "http://hl7.org/fhir/request-priority"
}