{
  "resourceType": "StructureDefinition",
  "url": "http://ehrrunner.com/fhir/StructureDefinition/Appointment",
  "version": "1.0",
  "name": "Appointment",
  "title": "Agendamento de Consulta ou Procedimento",
  "status": "draft",
  "date": "2024-01-24T18:16:52.4222349+00:00",
  "description": "Agendamento de consulta ou procedimento",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Appointment",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Appointment",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Appointment.meta",
        "path": "Appointment.meta"
      },
      {
        "id": "Appointment.meta.tag",
        "path": "Appointment.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Appointment.meta.tag:estabelecimentoExecutante",
        "path": "Appointment.meta.tag",
        "sliceName": "estabelecimentoExecutante",
        "max": "1"
      },
      {
        "id": "Appointment.meta.tag:estabelecimentoExecutante.system",
        "path": "Appointment.meta.tag.system",
        "min": 1,
        "fixedUri": "http://ehrrunner.com/fhir/StructureDefinition/EstabelecimentoExecutante"
      },
      {
        "id": "Appointment.meta.tag:estabelecimentoExecutante.code",
        "path": "Appointment.meta.tag.code",
        "short": "CNES do estabelecimento executante",
        "definition": "CNES do estabelecimento executante",
        "min": 1
      },
      {
        "id": "Appointment.contained",
        "path": "Appointment.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Appointment.contained:organization",
        "path": "Appointment.contained",
        "sliceName": "organization",
        "max": "1",
        "type": [
          {
            "code": "Resource",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ]
      },
      {
        "id": "Appointment.contained:organization.identifier",
        "path": "Appointment.contained.identifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.contained:organization.active",
        "path": "Appointment.contained.active",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.type",
        "path": "Appointment.contained.type",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.alias",
        "path": "Appointment.contained.alias",
        "max": "1"
      },
      {
        "id": "Appointment.contained:organization.telecom",
        "path": "Appointment.contained.telecom",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.address",
        "path": "Appointment.contained.address",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.partOf",
        "path": "Appointment.contained.partOf",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.contact",
        "path": "Appointment.contained.contact",
        "max": "0"
      },
      {
        "id": "Appointment.contained:organization.endpoint",
        "path": "Appointment.contained.endpoint",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService",
        "path": "Appointment.contained",
        "sliceName": "healthcareService",
        "short": "Serviço de saúde",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Resource",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/HealthcareService"
            ]
          }
        ]
      },
      {
        "id": "Appointment.contained:healthcareService.id",
        "path": "Appointment.contained.id",
        "min": 1,
        "fixedString": "service1"
      },
      {
        "id": "Appointment.contained:healthcareService.providedBy",
        "path": "Appointment.contained.providedBy"
      },
      {
        "id": "Appointment.contained:healthcareService.providedBy.reference",
        "path": "Appointment.contained.providedBy.reference",
        "min": 1
      },
      {
        "id": "Appointment.contained:healthcareService.category",
        "path": "Appointment.contained.category",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.type",
        "path": "Appointment.contained.type",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.specialty",
        "path": "Appointment.contained.specialty",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.location",
        "path": "Appointment.contained.location",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.contained:healthcareService.location.reference",
        "path": "Appointment.contained.location.reference",
        "fixedString": "location1"
      },
      {
        "id": "Appointment.contained:healthcareService.location.type",
        "path": "Appointment.contained.location.type",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.location.identifier",
        "path": "Appointment.contained.location.identifier",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.comment",
        "path": "Appointment.contained.comment",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.extraDetails",
        "path": "Appointment.contained.extraDetails",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.photo",
        "path": "Appointment.contained.photo",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.telecom",
        "path": "Appointment.contained.telecom",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.coverageArea",
        "path": "Appointment.contained.coverageArea",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.serviceProvisionCode",
        "path": "Appointment.contained.serviceProvisionCode",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.eligibility",
        "path": "Appointment.contained.eligibility",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.program",
        "path": "Appointment.contained.program",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.characteristic",
        "path": "Appointment.contained.characteristic",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.communication",
        "path": "Appointment.contained.communication",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.referralMethod",
        "path": "Appointment.contained.referralMethod",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.appointmentRequired",
        "path": "Appointment.contained.appointmentRequired",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.availableTime",
        "path": "Appointment.contained.availableTime",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.notAvailable",
        "path": "Appointment.contained.notAvailable",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.availabilityExceptions",
        "path": "Appointment.contained.availabilityExceptions",
        "max": "0"
      },
      {
        "id": "Appointment.contained:healthcareService.endpoint",
        "path": "Appointment.contained.endpoint",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location",
        "path": "Appointment.contained",
        "sliceName": "location",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Resource",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Location"
            ]
          }
        ]
      },
      {
        "id": "Appointment.contained:location.identifier",
        "path": "Appointment.contained.identifier",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.status",
        "path": "Appointment.contained.status",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.operationalStatus",
        "path": "Appointment.contained.operationalStatus",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.alias",
        "path": "Appointment.contained.alias",
        "max": "1"
      },
      {
        "id": "Appointment.contained:location.mode",
        "path": "Appointment.contained.mode",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.type",
        "path": "Appointment.contained.type",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.telecom",
        "path": "Appointment.contained.telecom"
      },
      {
        "id": "Appointment.contained:location.telecom.system",
        "path": "Appointment.contained.telecom.system",
        "min": 1,
        "fixedCode": "phone"
      },
      {
        "id": "Appointment.contained:location.telecom.value",
        "path": "Appointment.contained.telecom.value",
        "min": 1
      },
      {
        "id": "Appointment.contained:location.address",
        "path": "Appointment.contained.address",
        "min": 1
      },
      {
        "id": "Appointment.contained:location.physicalType",
        "path": "Appointment.contained.physicalType",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.managingOrganization",
        "path": "Appointment.contained.managingOrganization",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.partOf",
        "path": "Appointment.contained.partOf",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.availabilityExceptions",
        "path": "Appointment.contained.availabilityExceptions",
        "max": "0"
      },
      {
        "id": "Appointment.contained:location.endpoint",
        "path": "Appointment.contained.endpoint",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner",
        "path": "Appointment.contained",
        "sliceName": "practitioner",
        "max": "1",
        "type": [
          {
            "code": "Resource",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Practitioner"
            ]
          }
        ]
      },
      {
        "id": "Appointment.contained:practitioner.active",
        "path": "Appointment.contained.active",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.name",
        "path": "Appointment.contained.name",
        "max": "1"
      },
      {
        "id": "Appointment.contained:practitioner.telecom",
        "path": "Appointment.contained.telecom",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.address",
        "path": "Appointment.contained.address",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.gender",
        "path": "Appointment.contained.gender",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.birthDate",
        "path": "Appointment.contained.birthDate",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.photo",
        "path": "Appointment.contained.photo",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.qualification",
        "path": "Appointment.contained.qualification",
        "max": "0"
      },
      {
        "id": "Appointment.contained:practitioner.communication",
        "path": "Appointment.contained.communication",
        "max": "0"
      },
      {
        "id": "Appointment.identifier",
        "path": "Appointment.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "max": "1"
      },
      {
        "id": "Appointment.identifier:localIdentifier",
        "path": "Appointment.identifier",
        "sliceName": "localIdentifier",
        "short": "Identificador do registro no sistema de origem",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.identifier:localIdentifier.use",
        "path": "Appointment.identifier.use",
        "max": "0"
      },
      {
        "id": "Appointment.identifier:localIdentifier.type",
        "path": "Appointment.identifier.type",
        "max": "0"
      },
      {
        "id": "Appointment.identifier:localIdentifier.system",
        "path": "Appointment.identifier.system",
        "short": "Identificador único do sistema de origem",
        "definition": "URL ou OID da instância/sistema de origem - fornecido pela plataforma.",
        "min": 1
      },
      {
        "id": "Appointment.identifier:localIdentifier.value",
        "path": "Appointment.identifier.value",
        "short": "Identificador do registro no sistema de origem",
        "definition": "Identificador do registro no sistema de origem",
        "min": 1
      },
      {
        "id": "Appointment.identifier:localIdentifier.period",
        "path": "Appointment.identifier.period",
        "max": "0"
      },
      {
        "id": "Appointment.identifier:localIdentifier.assigner",
        "path": "Appointment.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Appointment.serviceCategory",
        "path": "Appointment.serviceCategory",
        "max": "1",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://www.saude.gov.br/fhir/r4/CodeSystem/BRModalidadeAssistencial"
        }
      },
      {
        "id": "Appointment.serviceType",
        "path": "Appointment.serviceType",
        "short": "Procedimento(s) agendado(s)",
        "binding": {
          "strength": "preferred",
          "description": "http://www.saude.gov.br/fhir/r4/ValueSet/BRProcedimentosNacionais-1.0"
        }
      },
      {
        "id": "Appointment.specialty",
        "path": "Appointment.specialty",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Appointment.specialty:specialty",
        "path": "Appointment.specialty",
        "sliceName": "specialty",
        "max": "1",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://ehrrunner.com/fhir/ValueSet/Especialidade"
        }
      },
      {
        "id": "Appointment.specialty:specialtyDetail",
        "path": "Appointment.specialty",
        "sliceName": "specialtyDetail",
        "max": "1",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://ehrrunner.com/fhir/ValueSet/AreaAtuacao"
        }
      },
      {
        "id": "Appointment.specialty:cbo",
        "path": "Appointment.specialty",
        "sliceName": "cbo",
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://www.saude.gov.br/fhir/r4/ValueSet/BROcupacao-1.0"
        }
      },
      {
        "id": "Appointment.reasonCode",
        "path": "Appointment.reasonCode",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://www.saude.gov.br/fhir/r4/ValueSet/BRProblemaDiagnostico"
        }
      },
      {
        "id": "Appointment.reasonReference",
        "path": "Appointment.reasonReference",
        "max": "0"
      },
      {
        "id": "Appointment.priority",
        "path": "Appointment.priority",
        "max": "0"
      },
      {
        "id": "Appointment.supportingInformation",
        "path": "Appointment.supportingInformation",
        "max": "0"
      },
      {
        "id": "Appointment.start",
        "path": "Appointment.start",
        "min": 1
      },
      {
        "id": "Appointment.basedOn",
        "path": "Appointment.basedOn",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
              "https://ehrrunner.com/fhir/StructureDefinition/Referral",
              "https://ehrrunner.com/fhir/StructureDefinition/ServiceRequest"
            ]
          }
        ]
      },
      {
        "id": "Appointment.basedOn.type",
        "path": "Appointment.basedOn.type",
        "max": "0"
      },
      {
        "id": "Appointment.basedOn.identifier",
        "path": "Appointment.basedOn.identifier",
        "max": "0"
      },
      {
        "id": "Appointment.basedOn.display",
        "path": "Appointment.basedOn.display",
        "max": "0"
      },
      {
        "id": "Appointment.participant",
        "path": "Appointment.participant",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Appointment.participant:patient",
        "path": "Appointment.participant",
        "sliceName": "patient",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.participant:patient.type",
        "path": "Appointment.participant.type",
        "min": 1,
        "max": "1",
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
              "code": "SBJ"
            }
          ]
        }
      },
      {
        "id": "Appointment.participant:patient.type.coding",
        "path": "Appointment.participant.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.participant:patient.actor",
        "path": "Appointment.participant.actor",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://ehrrunner.com/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Appointment.participant:patient.actor.reference",
        "path": "Appointment.participant.actor.reference",
        "min": 1
      },
      {
        "id": "Appointment.participant:patient.actor.type",
        "path": "Appointment.participant.actor.type",
        "max": "0"
      },
      {
        "id": "Appointment.participant:patient.actor.identifier",
        "path": "Appointment.participant.actor.identifier",
        "max": "0"
      },
      {
        "id": "Appointment.participant:patient.actor.display",
        "path": "Appointment.participant.actor.display",
        "max": "0"
      },
      {
        "id": "Appointment.participant:patient.required",
        "path": "Appointment.participant.required",
        "max": "0"
      },
      {
        "id": "Appointment.participant:patient.period",
        "path": "Appointment.participant.period",
        "max": "0"
      },
      {
        "id": "Appointment.participant:healthcareService",
        "path": "Appointment.participant",
        "sliceName": "healthcareService",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Appointment.participant:healthcareService.type",
        "path": "Appointment.participant.type",
        "min": 1,
        "max": "1",
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
              "code": "PPRF"
            }
          ]
        }
      },
      {
        "id": "Appointment.participant:healthcareService.actor",
        "path": "Appointment.participant.actor",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/HealthcareService"
            ]
          }
        ],
        "fixedReference": {
          "reference": "#service1"
        }
      },
      {
        "id": "Appointment.participant:healthcareService.required",
        "path": "Appointment.participant.required",
        "max": "0"
      },
      {
        "id": "Appointment.participant:healthcareService.period",
        "path": "Appointment.participant.period",
        "max": "0"
      },
      {
        "id": "Appointment.participant:practitioner",
        "path": "Appointment.participant",
        "sliceName": "practitioner",
        "max": "1"
      },
      {
        "id": "Appointment.participant:practitioner.type",
        "path": "Appointment.participant.type",
        "min": 1,
        "max": "1",
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
              "code": "PPRF"
            }
          ]
        }
      },
      {
        "id": "Appointment.participant:practitioner.actor",
        "path": "Appointment.participant.actor",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Practitioner"
            ]
          }
        ],
        "fixedReference": {
          "reference": "#practitioner1"
        }
      },
      {
        "id": "Appointment.requestedPeriod",
        "path": "Appointment.requestedPeriod",
        "max": "0"
      }
    ]
  }
}