<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="cmbd-pae">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="episodio_ambulatorio" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="tipo_de_actividad">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:pattern value="[1-8]"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="codigo_identificacion_centro" type="xs:string"/>
							<xs:element name="numero_historia" type="xs:string"/>
							<xs:element name="codigo_identificacion_paciente" type="xs:string" minOccurs="0"/>
							<xs:element name="fecha_nacimiento" type="xs:date"/>
							<xs:element name="sexo">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:pattern value="[1-3]"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="codigo_municipio" type="xs:string"/>
							<xs:element name="codigo_postal" type="xs:string"/>
							<xs:element name="zona_basica_salud" type="xs:string" minOccurs="0"/>
							<xs:element name="fecha_contacto" type="xs:date"/>
							<xs:element name="numero_autorizacion" type="xs:string" minOccurs="0"/>
							<xs:element name="tipo_financiacion_asistencia_sanitaria">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:pattern value="[1-9]"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="via_peticion_contacto">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:pattern value="[1-6]"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="codigo_centro_peticion" type="xs:string" minOccurs="0"/>
							<xs:element name="codigo_identificacion_servicio" type="xs:string"/>
							<xs:element name="codigo_identificacion_medico" type="xs:string"/>
							<xs:element name="destino_tras_contacto">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:pattern value="[1-8]"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element name="codigo_centro_traslado" type="xs:string" minOccurs="0"/>
							<xs:element name="codigo_diagnostico_principal" type="xs:string"/>
							<xs:element name="codigo_diagnostico_secundario" type="xs:string" minOccurs="0" maxOccurs="5"/>
							<xs:element name="codigo_procedimiento_diagnostico" type="xs:string" minOccurs="1" maxOccurs="5"/>
							<xs:element name="codigo_causa_externa_enfermedad" type="xs:string" minOccurs="0" maxOccurs="2"/>
							<xs:element name="codigo_morfologia_neoplasias" type="xs:string" minOccurs="0"/>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
