<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:hl7finland" xmlns="urn:hl7finland" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hl7="urn:hl7-org:v3" elementFormDefault="qualified">
	<xs:import namespace="urn:hl7-org:v3" schemaLocation="../coreschemas/infrastructureRoot.xsd"/>
	<xs:complexType name="tableOfContents">
		<xs:sequence>
			<xs:element name="contentsCode" type="hl7:CV" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="serviceChainLink">
		<xs:sequence>
			<xs:element name="serviceChainLinkId" type="hl7:II"/>
			<xs:element name="serviceChainLinkName" type="hl7:ST" minOccurs="0"/>
			<xs:element name="serviceChainLinkCode" type="hl7:CV" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="episodeLink">
		<xs:sequence>
			<xs:element name="episodeLinkId" type="hl7:II"/>
			<xs:element name="episodeLinkName" type="hl7:ST" minOccurs="0"/>
			<xs:element name="episodeLinkCode" type="hl7:CV" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="product">
		<xs:sequence>
			<xs:any/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="signatureCollection">
		<xs:sequence>
			<xs:element name="signature" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="signatureDescription" type="hl7:CV"/>
						<xs:any/>
					</xs:sequence>
					<xs:attribute name="ID" type="xs:ID"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="secondaryCustodian">
		<xs:sequence>
			<xs:element name="secondaryCustodianId" type="hl7:II"/>
			<xs:element name="secondaryCustodianRegisterId" type="hl7:CV" minOccurs="0"/>
			<!-- <xs:element name="linkToDecisionDocument" type="hl7:II" minOccurs="0"/> -->
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="KantaMetadata">
		<xs:sequence>
			<xs:element name="FieldName" type="hl7:II"/>
			<xs:element name="FieldNameCoded" type="hl7:CV" minOccurs="0"/>
			<xs:element name="FieldValue" type="hl7:ST"/>
			<xs:element name="FieldValueAsHL7Datatyped" type="hl7:ANY" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="localHeader">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="description" type="hl7:ST" minOccurs="0"/>
				<xs:element name="tableOfContents" type="tableOfContents" minOccurs="0"/>
				<xs:element name="registratedTime" type="hl7:TS" minOccurs="0"/>
				<xs:element name="declaredTime" type="hl7:TS" minOccurs="0"/>
				<xs:element name="typeCode" type="hl7:CV" minOccurs="0"/>
				<xs:element name="fileFormat" type="hl7:CV" minOccurs="0"/>
				<xs:element name="softwareSupport" minOccurs="0">
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute name="moderator" type="xs:string"/>
								<xs:attribute name="product" type="xs:string"/>
								<xs:attribute name="version" type="xs:string"/>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
				<xs:element name="documentType" type="hl7:CV" minOccurs="0"/>
				<xs:element name="currentLocation" type="hl7:ST" minOccurs="0"/>
				<xs:element name="retentionPeriod" type="hl7:TS" minOccurs="0"/>
				<xs:element name="functionCode" type="hl7:CV" minOccurs="0"/>
				<xs:element name="recordStatus" type="hl7:CV" minOccurs="0"/>
				<xs:element name="serviceChainLink" type="serviceChainLink" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="episodeLink" type="episodeLink" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="patientRegistrySpecifier" type="hl7:II" minOccurs="0"/>
				<xs:element name="patientRegistrySpecifierName" type="hl7:ST" minOccurs="0"/>
				<xs:element name="custodianTypecode" type="hl7:CV" minOccurs="0"/>
				<xs:element name="encompassingEncounterCode" type="hl7:CV" minOccurs="0"/>
				<xs:element name="activeCustodian" type="hl7:II" minOccurs="0"/>
				<xs:element name="activeCustodianName" type="hl7:ST" minOccurs="0"/>
				<xs:element name="encompassingEncounterMasterCode" type="hl7:CV" minOccurs="0"/>
				<xs:element name="secondaryEncompassingEncounterId" type="hl7:II" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="outsourcingServiceCustomer" type="hl7:II" minOccurs="0"/>
				<xs:element name="outsourcingServiceCustomerName" type="hl7:ST" minOccurs="0"/>
				<xs:element name="retentionPeriodClass" type="hl7:CV" minOccurs="0"/>
				<xs:element name="extendedRetentionPeriod" type="hl7:TS" minOccurs="0"/>
				<xs:element name="sensitiveDocument" type="hl7:CV" minOccurs="0"/>
				<xs:element name="eprServiceProvider" type="hl7:II" minOccurs="0"/>
				<xs:element name="eprServiceProviderName" type="hl7:ST" minOccurs="0"/>
				<xs:element name="releaseDateForPatientViewing" type="hl7:TS" minOccurs="0"/>
				<xs:element name="KantaMetadata" type="KantaMetadata" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="validConsentId" type="hl7:II" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="diagnosisCode" type="hl7:CV" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="imagingStudyCode" type="hl7:CV" minOccurs="0" maxOccurs="unbounded"/>
				<xs:element name="procedureCode" type="hl7:CV" minOccurs="0" maxOccurs="unbounded"/>

				<!-- pois vai ei? -->
				<!--				<xs:element name="secondaryCustodian" type="secondaryCustodian" minOccurs="0" maxOccurs="unbounded"/> -->
				<!-- <xs:element name="description" type="hl7:ST" minOccurs="0"/> -->
				<!-- <xs:element name="product" type="product" minOccurs="0" maxOccurs="unbounded"/> -->
				<!--  <xs:element name="signatureCollection" type="signatureCollection" minOccurs="0"/> -->
				<!--  <xs:element name="taskWorkflowPhase" type="hl7:ST" minOccurs="0"/>
				<xs:element name="retentionPeriodBasis" type="hl7:ST" minOccurs="0"/>
				<xs:element name="retentionPeriodCalculationBasis" type="hl7:ST" minOccurs="0"/>
				<xs:element name="taskGuidingInformation" type="hl7:ST" minOccurs="0"/>
				<xs:element name="taskAdditionalInformation" type="hl7:ST" minOccurs="0"/> -->
				<!-- <xs:element name="activeArchiveFormer" type="hl7:II" minOccurs="0"/> -->
				<!-- <xs:element name="activePatientRegistry" type="hl7:II" minOccurs="0"/>
				<xs:element name="activePatientRegistrySpecifier" type="hl7:II" minOccurs="0"/> -->
				<!-- <xs:element name="personInformationDescriptor" type="hl7:ST" minOccurs="0"/>
				<xs:element name="basisForNondisclosure" type="hl7:ST" minOccurs="0"/>
				<xs:element name="userGroup" type="hl7:ST" minOccurs="0"/> -->
				<!-- tämä elementti on poistettu käytöstä 
					<xs:element name="hasPart" type="hl7:II" minOccurs="0" maxOccurs="0"/> -->
				<!-- tämä elementti ei ole käytössä, tiedot ilmoitetaan body tasolla
				<xs:element name="auditTrail" type="hl7:" minOccurs="" maxOccurs=""/>-->
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
