<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASAppointment" />
  <name value="UNICASAppointment" />
  <title value="Appointment Cita Agenda ÚNICAS" />
  <status value="draft" />
  <description value="Este perfil define las restricciones del recurso Appointment para representar el registro de una cita programada en el contexto del caso de uso de ÚNICAS." />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Appointment" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Appointment" />
  <derivation value="constraint" />
  <differential>
    <element id="Appointment.identifier">
      <path value="Appointment.identifier" />
      <short value="Identificador único" />
      <definition value="External Ids for this item. This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." />
      <min value="1" />
    </element>
    <element id="Appointment.identifier.system">
      <path value="Appointment.identifier.system" />
      <short value="Sistema para identificar el origen" />
      <definition value="Formato: urn:regcess:[CódigoREGCESS] Debe incluir el código REGCESS después de urn:regcess:" />
      <min value="1" />
      <constraint>
        <key value="regcess-system" />
        <severity value="warning" />
        <human value="system debe comenzar por urn:regcess: seguido del identificador del sistema." />
        <expression value="matches('^urn:regcess:[A-Za-z0-9]+$')" />
      </constraint>
    </element>
    <element id="Appointment.identifier.value">
      <path value="Appointment.identifier.value" />
      <short value="Identificador interno del sistema para la cita programada" />
      <definition value="Debe indicar el ID interno del sistema de origen utilizado para la cita programada." />
      <min value="1" />
    </element>
    <element id="Appointment.serviceCategory">
      <path value="Appointment.serviceCategory" />
      <short value="Categorización de la cita" />
      <binding>
        <strength value="required" />
        <description value="Value set de Tipos de servicios asistenciales para ÚNICAS" />
        <valueSet value="https://unicas-fhir.sanidad.gob.es/ValueSet/TiposServicios" />
      </binding>
    </element>
    <element id="Appointment.serviceCategory.coding.system">
      <path value="Appointment.serviceCategory.coding.system" />
      <short value="OID del catálogo de clasificación de Servicios" />
      <definition value="Posible OID de catálogo utilizado para indicar la clasificación de servicio y su descripción correspondiente:&#xD;&#xA;&#xD;&#xA;- Catálogo de clasificación de Servicios: urn:oid:2.16.724.4.21.5.9" />
    </element>
    <element id="Appointment.serviceCategory.coding.code">
      <path value="Appointment.serviceCategory.coding.code" />
      <short value="Código del servicio asistencial para ÚNICAS" />
    </element>
    <element id="Appointment.serviceCategory.coding.display">
      <path value="Appointment.serviceCategory.coding.display" />
      <short value="Descripción del servicio asistencial para ÚNICAS" />
      <definition value="Representation defined by the system. A representation of the meaning of the code in the system, following the rules of the system." />
    </element>
    <element id="Appointment.serviceType">
      <path value="Appointment.serviceType" />
      <short value="Canal de cita" />
      <binding>
        <strength value="extensible" />
        <description value="Value set de Canales de cita" />
        <valueSet value="https://unicas-fhir.sanidad.gob.es/ValueSet/CanalesCita" />
      </binding>
    </element>
    <element id="Appointment.serviceType.concept">
      <path value="Appointment.serviceType.concept" />
      <short value="Canal de cita" />
    </element>
    <element id="Appointment.serviceType.concept.coding.system">
      <path value="Appointment.serviceType.concept.coding.system" />
      <short value="URL del SNOMED CT. Extensión para España del SNS" />
      <definition value="Posible URL de terminología utilizada para indicar el canal de cita y su descripción correspondiente:&#xD;&#xA;&#xD;&#xA;- SNOMED CT. Extensión para España del SNS: http://snomed.info/sct/900000001000122104" />
    </element>
    <element id="Appointment.serviceType.concept.coding.code">
      <path value="Appointment.serviceType.concept.coding.code" />
      <short value="Código del canal de cita" />
    </element>
    <element id="Appointment.serviceType.concept.coding.display">
      <path value="Appointment.serviceType.concept.coding.display" />
      <short value="Descripción del canal de cita" />
      <definition value="Representation defined by the system. A representation of the meaning of the code in the system, following the rules of the system." />
    </element>
    <element id="Appointment.reason">
      <path value="Appointment.reason" />
      <short value="Motivo de cita" />
      <definition value="Reason this appointment is scheduled. The reason that this appointment is being scheduled. This is more clinical than administrative. This can be coded, or as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure." />
      <min value="1" />
      <binding>
        <strength value="extensible" />
        <description value="Value set de Motivos de la cita" />
        <valueSet value="https://unicas-fhir.sanidad.gob.es/ValueSet/MotivosCita" />
      </binding>
    </element>
    <element id="Appointment.reason.concept">
      <path value="Appointment.reason.concept" />
      <short value="Motivo de cita" />
      <definition value="Reference to a concept (by class). A reference to a concept - e.g. the information is identified by its general class to the degree of precision found in the terminology." />
    </element>
    <element id="Appointment.reason.concept.coding.system">
      <path value="Appointment.reason.concept.coding.system" />
      <short value="URL del SNOMED CT. Extensión para España del SNS | OID del CIE-10-ES. Diagnósticos | OID del ORPHA" />
      <definition value="Posibles URLs y/o OIDs de terminologías utilizadas para indicar el motivo de la cita y su descripción correspondiente:&#xD;&#xA;&#xA;- SNOMED CT. Extensión para España del SNS con filtro eje hallazgo: http://snomed.info/sct/900000001000122104&#xA;- CIE-10-ES. Diagnósticos: urn:oid:2.16.724.4.21.5.29&#xA;- ORPHA: urn:oid:2.16.724.4.21.5.22" />
      <min value="1" />
    </element>
    <element id="Appointment.reason.concept.coding.code">
      <path value="Appointment.reason.concept.coding.code" />
      <short value="Código del motivo de la cita" />
      <min value="1" />
    </element>
    <element id="Appointment.reason.concept.coding.display">
      <path value="Appointment.reason.concept.coding.display" />
      <short value="Descripción del motivo de la cita" />
      <definition value="Representation defined by the system. A representation of the meaning of the code in the system, following the rules of the system." />
      <min value="1" />
    </element>
    <element id="Appointment.start">
      <path value="Appointment.start" />
      <short value="Fecha y hora de inicio de la cita programada" />
      <definition value="When appointment is to take place. Date/Time that the appointment is to take place." />
      <min value="1" />
    </element>
    <element id="Appointment.end">
      <path value="Appointment.end" />
      <short value="Fecha y hora de fin de la cita programada" />
      <definition value="When appointment is to conclude. Date/Time that the appointment is to conclude." />
    </element>
    <element id="Appointment.minutesDuration">
      <path value="Appointment.minutesDuration" />
      <short value="Duración de la cita programada" />
      <definition value="Can be less than start/end (e.g. estimate). Number of minutes that the appointment is to take. This can be less than the duration between the start and end times.  For example, where the actual time of appointment is only an estimate or if a 30 minute appointment is being requested, but any time would work.  Also, if there is, for example, a planned 15 minute break in the middle of a long appointment, the duration may be 15 minutes less than the difference between the start and end." />
    </element>
    <element id="Appointment.created">
      <path value="Appointment.created" />
      <short value="Fecha y hora de creación de la cita" />
    </element>
    <element id="Appointment.cancellationDate">
      <path value="Appointment.cancellationDate" />
      <short value="Fecha y hora de cancelación de la cita" />
      <definition value="When the appointment was cancelled. The date/time describing when the appointment was cancelled." />
    </element>
    <element id="Appointment.note">
      <path value="Appointment.note" />
      <short value="Comentario" />
    </element>
    <element id="Appointment.note.text">
      <path value="Appointment.note.text" />
      <short value="Comentario" />
      <definition value="The annotation  - text content (as markdown). The text of the annotation in markdown format." />
    </element>
    <element id="Appointment.subject">
      <path value="Appointment.subject" />
      <short value="Referencia al paciente" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASPatient" />
      </type>
    </element>
    <element id="Appointment.subject.reference">
      <path value="Appointment.subject.reference" />
      <short value="Referencia recurso FHIR. Identificador de la referencia del recurso FHIR asociado cuando exista/creamos un recurso en el mismo servidor FHIR" />
      <definition value="Formato: [base]/Patient?identifier=[OID registro de número de CIP-SNS]|[Número CIP-SNS]" />
    </element>
    <element id="Appointment.subject.type">
      <path value="Appointment.subject.type" />
      <short value="Tipo de recurso FHIR" />
      <definition value="Type the reference refers to (e.g. &quot;Patient&quot;) - must be a resource in resources. The expected type of the target of the reference. If both Reference.type and Reference.reference are populated and Reference.reference is a FHIR URL, both SHALL be consistent.&#xA;&#xA;The type is the Canonical URL of Resource Definition that is the type this reference refers to. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition/ e.g. &quot;Patient&quot; is a reference to http://hl7.org/fhir/StructureDefinition/Patient. Absolute URLs are only allowed for logical models (and can only be used in references in logical models, not resources)." />
      <min value="1" />
    </element>
    <element id="Appointment.subject.identifier">
      <path value="Appointment.subject.identifier" />
      <short value="Identificador de paciente CIP-SNS. Cuando no tengamos recurso Patient, se debera informar el identificador de paciente mediante CIP-SNS" />
      <definition value="Logical reference, when literal reference is not known. An identifier for the target resource. This is used when there is no way to reference the other resource directly, either because the entity it represents is not available through a FHIR server, or because there is no way for the author of the resource to convert a known identifier to an actual location. There is no requirement that a Reference.identifier point to something that is actually exposed as a FHIR instance, but it SHALL point to a business concept that would be expected to be exposed as a FHIR instance, and that instance would need to be of a FHIR resource type allowed by the reference." />
      <min value="1" />
    </element>
    <element id="Appointment.subject.identifier.type">
      <path value="Appointment.subject.identifier.type" />
      <short value="Tipos de documentos de identificación para persona ÚNICAS" />
      <definition value="Description of identifier. A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." />
      <binding>
        <strength value="extensible" />
        <description value="Value set de Tipos de documentos de identificación para persona ÚNICAS" />
        <valueSet value="https://unicas-fhir.sanidad.gob.es/ValueSet/TiposDocumentosIdentificacionPersona" />
      </binding>
    </element>
    <element id="Appointment.subject.identifier.type.coding.system">
      <path value="Appointment.subject.identifier.type.coding.system" />
      <short value="URL del SNOMED CT. Extensión para España del SNS" />
      <definition value="Posible URL de terminología utilizada para indicar el tipo de documentos de identificación y su descripción correspondiente:&#xD;&#xA;&#xD;&#xA;- SNOMED CT. Extensión para España del SNS: http://snomed.info/sct/900000001000122104" />
    </element>
    <element id="Appointment.subject.identifier.type.coding.code">
      <path value="Appointment.subject.identifier.type.coding.code" />
      <short value="Código del identificador" />
    </element>
    <element id="Appointment.subject.identifier.type.coding.display">
      <path value="Appointment.subject.identifier.type.coding.display" />
      <short value="Decripción del identificador" />
      <definition value="Representation defined by the system. A representation of the meaning of the code in the system, following the rules of the system." />
    </element>
    <element id="Appointment.subject.identifier.system">
      <path value="Appointment.subject.identifier.system" />
      <short value="OID registro de número de CIP-SNS" />
      <definition value="The namespace for the identifier value. Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique." />
    </element>
    <element id="Appointment.subject.identifier.value">
      <path value="Appointment.subject.identifier.value" />
      <short value="Número CIP-SNS" />
      <definition value="The value that is unique. The portion of the identifier typically relevant to the user and which is unique within the context of the system." />
    </element>
    <element id="Appointment.subject.display">
      <path value="Appointment.subject.display" />
      <short value="Nombre completo del paciente" />
      <definition value="Text alternative for the resource. Plain text narrative that identifies the resource in addition to the resource reference." />
    </element>
    <element id="Appointment.participant">
      <path value="Appointment.participant" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="resource" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante">
      <path value="Appointment.participant" />
      <sliceName value="ProfesionalSanitarioParticipante" />
      <short value="Profesional sanitario participante" />
      <definition value="Participants involved in appointment. List of participants involved in the appointment." />
      <min value="1" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor">
      <path value="Appointment.participant.actor" />
      <short value="Referencia al profesional sanitario" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASPractitionerRole" />
        <targetProfile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASPractitioner" />
      </type>
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.reference">
      <path value="Appointment.participant.actor.reference" />
      <short value="Referencia recurso FHIR. Identificador de la referencia del recurso FHIR asociado cuando exista/creamos un recurso en el mismo servidor FHIR" />
      <definition value="Formato: [base]/Practitioner?identifier=[OID registro de DNI]|[Número DNI]" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.type">
      <path value="Appointment.participant.actor.type" />
      <short value="Tipo de recurso FHIR" />
      <definition value="Type the reference refers to (e.g. &quot;Patient&quot;) - must be a resource in resources. The expected type of the target of the reference. If both Reference.type and Reference.reference are populated and Reference.reference is a FHIR URL, both SHALL be consistent.&#xA;&#xA;The type is the Canonical URL of Resource Definition that is the type this reference refers to. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition/ e.g. &quot;Patient&quot; is a reference to http://hl7.org/fhir/StructureDefinition/Patient. Absolute URLs are only allowed for logical models (and can only be used in references in logical models, not resources)." />
      <min value="1" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier">
      <path value="Appointment.participant.actor.identifier" />
      <short value="Identificadores del profesional sanitario. Cuando no tengamos recurso Practitioner, se debera informar el identificador del profesional sanitario mediante DNI como dato mínimo. Adicionalmente, se puede informar el número colegiado del profesional sanitario como dato recomendado" />
      <definition value="Logical reference, when literal reference is not known. An identifier for the target resource. This is used when there is no way to reference the other resource directly, either because the entity it represents is not available through a FHIR server, or because there is no way for the author of the resource to convert a known identifier to an actual location. There is no requirement that a Reference.identifier point to something that is actually exposed as a FHIR instance, but it SHALL point to a business concept that would be expected to be exposed as a FHIR instance, and that instance would need to be of a FHIR resource type allowed by the reference." />
      <min value="1" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.extension:numeroColegiadoProfesionalSanitario">
      <path value="Appointment.participant.actor.identifier.extension" />
      <sliceName value="numeroColegiadoProfesionalSanitario" />
      <type>
        <code value="Extension" />
        <profile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/NumeroColegiadoProfesionalSanitario" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.type">
      <path value="Appointment.participant.actor.identifier.type" />
      <short value="Tipos de documentos de identificación para persona ÚNICAS" />
      <definition value="Description of identifier. A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." />
      <binding>
        <strength value="extensible" />
        <description value="Value set de Tipos de documentos de identificación para persona ÚNICAS" />
        <valueSet value="https://unicas-fhir.sanidad.gob.es/ValueSet/TiposDocumentosIdentificacionPersona" />
      </binding>
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.type.coding.system">
      <path value="Appointment.participant.actor.identifier.type.coding.system" />
      <short value="URL del refset Tipos de documento para identificación personal de SNOMED CT. Extensión para España del SNS" />
      <definition value="Posible URL de terminología utilizada para indicar el tipo de documentos de identificación y su descripción correspondiente:&#xD;&#xA;&#xD;&#xA;- Refset Tipos de documento para identificación personal del SNOMED CT. Extensión para España del SNS: http://snomed.info/sct/900000001000122104?fhir_vs-refset/900000251000122107" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.type.coding.code">
      <path value="Appointment.participant.actor.identifier.type.coding.code" />
      <short value="Código del identificador" />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.type.coding.display">
      <path value="Appointment.participant.actor.identifier.type.coding.display" />
      <short value="Decripción del identificador" />
      <definition value="Representation defined by the system. A representation of the meaning of the code in the system, following the rules of the system." />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.system">
      <path value="Appointment.participant.actor.identifier.system" />
      <short value="OID registro de DNI" />
      <definition value="The namespace for the identifier value. Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique." />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.identifier.value">
      <path value="Appointment.participant.actor.identifier.value" />
      <short value="Número del DNI" />
      <definition value="The value that is unique. The portion of the identifier typically relevant to the user and which is unique within the context of the system." />
    </element>
    <element id="Appointment.participant:ProfesionalSanitarioParticipante.actor.display">
      <path value="Appointment.participant.actor.display" />
      <short value="Nombre completo del profesional sanitario" />
      <definition value="Text alternative for the resource. Plain text narrative that identifies the resource in addition to the resource reference." />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante">
      <path value="Appointment.participant" />
      <sliceName value="ServicioAsistencialParticipante" />
      <short value="Servicio asistencial (Localización) participante" />
      <definition value="Participants involved in appointment. List of participants involved in the appointment." />
      <min value="1" />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor">
      <path value="Appointment.participant.actor" />
      <short value="Referencia a la localización y servicio asistencial" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://unicas-fhir.sanidad.gob.es/StructureDefinition/UNICASLocation" />
      </type>
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor.reference">
      <path value="Appointment.participant.actor.reference" />
      <short value="Referencia recurso FHIR" />
      <definition value="Formato: [base]/Location?identifier=urn:regcess:[CódigoREGCESS]|[Id interno del sistema para la localización]" />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor.type">
      <path value="Appointment.participant.actor.type" />
      <short value="Tipo de recurso FHIR" />
      <definition value="Type the reference refers to (e.g. &quot;Patient&quot;) - must be a resource in resources. The expected type of the target of the reference. If both Reference.type and Reference.reference are populated and Reference.reference is a FHIR URL, both SHALL be consistent.&#xA;&#xA;The type is the Canonical URL of Resource Definition that is the type this reference refers to. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition/ e.g. &quot;Patient&quot; is a reference to http://hl7.org/fhir/StructureDefinition/Patient. Absolute URLs are only allowed for logical models (and can only be used in references in logical models, not resources)." />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor.identifier">
      <path value="Appointment.participant.actor.identifier" />
      <short value="Identificador del recurso FHIR" />
      <definition value="Logical reference, when literal reference is not known. An identifier for the target resource. This is used when there is no way to reference the other resource directly, either because the entity it represents is not available through a FHIR server, or because there is no way for the author of the resource to convert a known identifier to an actual location. There is no requirement that a Reference.identifier point to something that is actually exposed as a FHIR instance, but it SHALL point to a business concept that would be expected to be exposed as a FHIR instance, and that instance would need to be of a FHIR resource type allowed by the reference." />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor.identifier.system">
      <path value="Appointment.participant.actor.identifier.system" />
      <short value="Sistema para identificar el origen" />
      <definition value="Formato: urn:regcess:[CódigoREGCESS] Debe incluir el código REGCESS después de urn:regcess:" />
    </element>
    <element id="Appointment.participant:ServicioAsistencialParticipante.actor.identifier.value">
      <path value="Appointment.participant.actor.identifier.value" />
      <short value="Identificador interno del sistema para la localización" />
      <definition value="Debe indicar el ID interno del sistema de origen utilizado para la localización." />
    </element>
  </differential>
</StructureDefinition>