public static void SerializeValueSetExpansionComponent(Hl7.Fhir.Model.ValueSet.ValueSetExpansionComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element timestamp
            if (value.TimestampElement != null)
            {
                writer.WriteStartElement("timestamp");
                InstantSerializer.SerializeInstant(value.TimestampElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contains
            if (value.Contains != null && value.Contains.Count > 0)
            {
                writer.WriteStartArrayElement("contains");
                foreach (var item in value.Contains)
                {
                    writer.WriteStartArrayMember("contains");
                    ValueSetSerializer.SerializeValueSetExpansionContainsComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeDocumentInformation(DocumentInformation value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element id
            if (value.Id != null)
            {
                writer.WriteStartElement("id");
                IdentifierSerializer.SerializeIdentifier(value.Id, writer);
                writer.WriteEndElement();
            }

            // Serialize element versionId
            if (value.VersionId != null)
            {
                writer.WriteStartElement("versionId");
                IdentifierSerializer.SerializeIdentifier(value.VersionId, writer);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.Created != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.Created, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodingSerializer.SerializeCoding(value.Class, writer);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element confidentiality
            if (value.Confidentiality != null)
            {
                writer.WriteStartElement("confidentiality");
                CodingSerializer.SerializeCoding(value.Confidentiality, writer);
                writer.WriteEndElement();
            }

            // Serialize element subject
            if (value.Subject != null)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element attester
            if (value.Attester != null && value.Attester.Count > 0)
            {
                writer.WriteStartArrayElement("attester");
                foreach (var item in value.Attester)
                {
                    writer.WriteStartArrayMember("attester");
                    DocumentInformationSerializer.SerializeDocumentInformationAttesterComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element custodian
            if (value.Custodian != null)
            {
                writer.WriteStartElement("custodian");
                ResourceReferenceSerializer.SerializeResourceReference(value.Custodian, writer);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null)
            {
                writer.WriteStartElement("event");
                DocumentInformationSerializer.SerializeDocumentInformationEventComponent(value.Event, writer);
                writer.WriteEndElement();
            }

            // Serialize element encounter
            if (value.Encounter != null)
            {
                writer.WriteStartElement("encounter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer);
                writer.WriteEndElement();
            }

            // Serialize element facilityType
            if (value.FacilityType != null)
            {
                writer.WriteStartElement("facilityType");
                CodeableConceptSerializer.SerializeCodeableConcept(value.FacilityType, writer);
                writer.WriteEndElement();
            }

            // Serialize element practiceSetting
            if (value.PracticeSetting != null)
            {
                writer.WriteStartElement("practiceSetting");
                CodeableConceptSerializer.SerializeCodeableConcept(value.PracticeSetting, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeObservation(Hl7.Fhir.Model.Observation value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Observation");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.Name != null && !summary)
            {
                writer.WriteStartElement("name");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Name, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element value
            if (value.Value != null && !summary)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("value", value.Value.GetType()));
                FhirSerializer.SerializeElement(value.Value, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element interpretation
            if (value.Interpretation != null && !summary)
            {
                writer.WriteStartElement("interpretation");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Interpretation, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element comments
            if (value.CommentsElement != null && !summary)
            {
                writer.WriteStartElement("comments");
                FhirStringSerializer.SerializeFhirString(value.CommentsElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element applies
            if (value.Applies != null && !summary)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("applies", value.Applies.GetType()));
                FhirSerializer.SerializeElement(value.Applies, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element issued
            if (value.IssuedElement != null && !summary)
            {
                writer.WriteStartElement("issued");
                InstantSerializer.SerializeInstant(value.IssuedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reliability
            if (value.ReliabilityElement != null && !summary)
            {
                writer.WriteStartElement("reliability");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Observation.ObservationReliability>(value.ReliabilityElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element bodySite
            if (value.BodySite != null && !summary)
            {
                writer.WriteStartElement("bodySite");
                CodeableConceptSerializer.SerializeCodeableConcept(value.BodySite, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element method
            if (value.Method != null && !summary)
            {
                writer.WriteStartElement("method");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Method, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element identifier
            if (value.Identifier != null && !summary)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element performer
            if (value.Performer != null && !summary)
            {
                writer.WriteStartElement("performer");
                ResourceReferenceSerializer.SerializeResourceReference(value.Performer, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element referenceRange
            if (value.ReferenceRange != null && !summary && value.ReferenceRange.Count > 0)
            {
                writer.WriteStartArrayElement("referenceRange");
                foreach (var item in value.ReferenceRange)
                {
                    writer.WriteStartArrayMember("referenceRange");
                    ObservationSerializer.SerializeObservationReferenceRangeComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element component
            if (value.Component != null && !summary && value.Component.Count > 0)
            {
                writer.WriteStartArrayElement("component");
                foreach (var item in value.Component)
                {
                    writer.WriteStartArrayMember("component");
                    ObservationSerializer.SerializeObservationComponentComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #4
0
        public static void SerializeDocument(Hl7.Fhir.Model.Document value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Document");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element identifier
            if (value.Identifier != null)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element versionIdentifier
            if (value.VersionIdentifier != null)
            {
                writer.WriteStartElement("versionIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.VersionIdentifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.CreatedElement != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.CreatedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subtype
            if (value.Subtype != null)
            {
                writer.WriteStartElement("subtype");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Subtype, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.TitleElement != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.TitleElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Document.DocumentStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element confidentiality
            if (value.Confidentiality != null)
            {
                writer.WriteStartElement("confidentiality");
                CodingSerializer.SerializeCoding(value.Confidentiality, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subject
            if (value.Subject != null)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element attester
            if (value.Attester != null && value.Attester.Count > 0)
            {
                writer.WriteStartArrayElement("attester");
                foreach (var item in value.Attester)
                {
                    writer.WriteStartArrayMember("attester");
                    DocumentSerializer.SerializeDocumentAttesterComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element custodian
            if (value.Custodian != null)
            {
                writer.WriteStartElement("custodian");
                ResourceReferenceSerializer.SerializeResourceReference(value.Custodian, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null)
            {
                writer.WriteStartElement("event");
                DocumentSerializer.SerializeDocumentEventComponent(value.Event, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element encounter
            if (value.Encounter != null)
            {
                writer.WriteStartElement("encounter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element replaces
            if (value.ReplacesElement != null)
            {
                writer.WriteStartElement("replaces");
                IdSerializer.SerializeId(value.ReplacesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element provenance
            if (value.Provenance != null && !summary && value.Provenance.Count > 0)
            {
                writer.WriteStartArrayElement("provenance");
                foreach (var item in value.Provenance)
                {
                    writer.WriteStartArrayMember("provenance");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element stylesheet
            if (value.Stylesheet != null && !summary)
            {
                writer.WriteStartElement("stylesheet");
                AttachmentSerializer.SerializeAttachment(value.Stylesheet, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element representation
            if (value.Representation != null && !summary)
            {
                writer.WriteStartElement("representation");
                AttachmentSerializer.SerializeAttachment(value.Representation, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element section
            if (value.Section != null && !summary && value.Section.Count > 0)
            {
                writer.WriteStartArrayElement("section");
                foreach (var item in value.Section)
                {
                    writer.WriteStartArrayMember("section");
                    DocumentSerializer.SerializeSectionComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #5
0
        public static void SerializeDeviceLog(Hl7.Fhir.Model.DeviceLog value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DeviceLog");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element instant
            if (value.InstantElement != null && !summary)
            {
                writer.WriteStartElement("instant");
                InstantSerializer.SerializeInstant(value.InstantElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element capabilities
            if (value.Capabilities != null && !summary)
            {
                writer.WriteStartElement("capabilities");
                ResourceReferenceSerializer.SerializeResourceReference(value.Capabilities, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element item
            if (value.Item != null && !summary && value.Item.Count > 0)
            {
                writer.WriteStartArrayElement("item");
                foreach (var item in value.Item)
                {
                    writer.WriteStartArrayMember("item");
                    DeviceLogSerializer.SerializeDeviceLogItemComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeDeviceObservation(Hl7.Fhir.Model.DeviceObservation value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DeviceObservation");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element code
            if (value.Code != null && !summary)
            {
                writer.WriteStartElement("code");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Code, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element identifier
            if (value.Identifier != null && !summary && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element issued
            if (value.IssuedElement != null && !summary)
            {
                writer.WriteStartElement("issued");
                InstantSerializer.SerializeInstant(value.IssuedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element device
            if (value.Device != null && !summary)
            {
                writer.WriteStartElement("device");
                ResourceReferenceSerializer.SerializeResourceReference(value.Device, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element measurement
            if (value.Measurement != null && !summary && value.Measurement.Count > 0)
            {
                writer.WriteStartArrayElement("measurement");
                foreach (var item in value.Measurement)
                {
                    writer.WriteStartArrayMember("measurement");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #7
0
        public static void SerializeXdsEntry(XdsEntry value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsEntry");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element url
            if (value.Url != null)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.Url, writer);
                writer.WriteEndElement();
            }

            // Serialize element repositoryId
            if (value.RepositoryId != null)
            {
                writer.WriteStartElement("repositoryId");
                FhirUriSerializer.SerializeFhirUri(value.RepositoryId, writer);
                writer.WriteEndElement();
            }

            // Serialize element mimeType
            if (value.MimeType != null)
            {
                writer.WriteStartElement("mimeType");
                FhirStringSerializer.SerializeFhirString(value.MimeType, writer);
                writer.WriteEndElement();
            }

            // Serialize element format
            if (value.Format != null)
            {
                writer.WriteStartElement("format");
                CodingSerializer.SerializeCoding(value.Format, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodingSerializer.SerializeCoding(value.Class, writer);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null)
            {
                writer.WriteStartElement("type");
                CodingSerializer.SerializeCoding(value.Type, writer);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element documentId
            if (value.DocumentId != null)
            {
                writer.WriteStartElement("documentId");
                FhirUriSerializer.SerializeFhirUri(value.DocumentId, writer);
                writer.WriteEndElement();
            }

            // Serialize element availability
            if (value.Availability != null)
            {
                writer.WriteStartElement("availability");
                CodeSerializer.SerializeCode <XdsEntry.XdsEntryAvailability>(value.Availability, writer);
                writer.WriteEndElement();
            }

            // Serialize element confidentialityCode
            if (value.ConfidentialityCode != null)
            {
                writer.WriteStartElement("confidentialityCode");
                CodingSerializer.SerializeCoding(value.ConfidentialityCode, writer);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.Created != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.Created, writer);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null && value.Event.Count > 0)
            {
                writer.WriteStartArrayElement("event");
                foreach (var item in value.Event)
                {
                    writer.WriteStartArrayMember("event");
                    CodingSerializer.SerializeCoding(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element hash
            if (value.Hash != null)
            {
                writer.WriteStartElement("hash");
                FhirStringSerializer.SerializeFhirString(value.Hash, writer);
                writer.WriteEndElement();
            }

            // Serialize element size
            if (value.Size != null)
            {
                writer.WriteStartElement("size");
                FhirStringSerializer.SerializeFhirString(value.Size, writer);
                writer.WriteEndElement();
            }

            // Serialize element lang
            if (value.Lang != null)
            {
                writer.WriteStartElement("lang");
                FhirStringSerializer.SerializeFhirString(value.Lang, writer);
                writer.WriteEndElement();
            }

            // Serialize element folder
            if (value.Folder != null && value.Folder.Count > 0)
            {
                writer.WriteStartArrayElement("folder");
                foreach (var item in value.Folder)
                {
                    writer.WriteStartArrayMember("folder");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element patientId
            if (value.PatientId != null)
            {
                writer.WriteStartElement("patientId");
                IdentifierSerializer.SerializeIdentifier(value.PatientId, writer);
                writer.WriteEndElement();
            }

            // Serialize element sourcePatientId
            if (value.SourcePatientId != null)
            {
                writer.WriteStartElement("sourcePatientId");
                IdentifierSerializer.SerializeIdentifier(value.SourcePatientId, writer);
                writer.WriteEndElement();
            }

            // Serialize element patientInfo
            if (value.PatientInfo != null)
            {
                writer.WriteStartElement("patientInfo");
                ResourceReferenceSerializer.SerializeResourceReference(value.PatientInfo, writer);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    XdsEntrySerializer.SerializeXdsEntryAuthorComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element authenticator
            if (value.Authenticator != null)
            {
                writer.WriteStartElement("authenticator");
                XdsEntrySerializer.SerializeXdsEntryAuthenticatorComponent(value.Authenticator, writer);
                writer.WriteEndElement();
            }

            // Serialize element facilityType
            if (value.FacilityType != null)
            {
                writer.WriteStartElement("facilityType");
                CodingSerializer.SerializeCoding(value.FacilityType, writer);
                writer.WriteEndElement();
            }

            // Serialize element practiceSetting
            if (value.PracticeSetting != null)
            {
                writer.WriteStartElement("practiceSetting");
                CodingSerializer.SerializeCoding(value.PracticeSetting, writer);
                writer.WriteEndElement();
            }

            // Serialize element homeCommunity
            if (value.HomeCommunity != null)
            {
                writer.WriteStartElement("homeCommunity");
                FhirUriSerializer.SerializeFhirUri(value.HomeCommunity, writer);
                writer.WriteEndElement();
            }

            // Serialize element service
            if (value.Service != null)
            {
                writer.WriteStartElement("service");
                XdsEntrySerializer.SerializeXdsEntryServiceComponent(value.Service, writer);
                writer.WriteEndElement();
            }

            // Serialize element comments
            if (value.Comments != null)
            {
                writer.WriteStartElement("comments");
                FhirStringSerializer.SerializeFhirString(value.Comments, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeMessage(Hl7.Fhir.Model.Message value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Message");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element identifier
            if (value.IdentifierElement != null && !summary)
            {
                writer.WriteStartElement("identifier");
                IdSerializer.SerializeId(value.IdentifierElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element timestamp
            if (value.TimestampElement != null && !summary)
            {
                writer.WriteStartElement("timestamp");
                InstantSerializer.SerializeInstant(value.TimestampElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.EventElement != null && !summary)
            {
                writer.WriteStartElement("event");
                CodeSerializer.SerializeCode(value.EventElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element response
            if (value.Response != null && !summary)
            {
                writer.WriteStartElement("response");
                MessageSerializer.SerializeMessageResponseComponent(value.Response, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element source
            if (value.Source != null && !summary)
            {
                writer.WriteStartElement("source");
                MessageSerializer.SerializeMessageSourceComponent(value.Source, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element destination
            if (value.Destination != null && !summary)
            {
                writer.WriteStartElement("destination");
                MessageSerializer.SerializeMessageDestinationComponent(value.Destination, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element enterer
            if (value.Enterer != null && !summary)
            {
                writer.WriteStartElement("enterer");
                ResourceReferenceSerializer.SerializeResourceReference(value.Enterer, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && !summary)
            {
                writer.WriteStartElement("author");
                ResourceReferenceSerializer.SerializeResourceReference(value.Author, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element receiver
            if (value.Receiver != null && !summary)
            {
                writer.WriteStartElement("receiver");
                ResourceReferenceSerializer.SerializeResourceReference(value.Receiver, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element responsible
            if (value.Responsible != null && !summary)
            {
                writer.WriteStartElement("responsible");
                ResourceReferenceSerializer.SerializeResourceReference(value.Responsible, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element effective
            if (value.Effective != null && !summary)
            {
                writer.WriteStartElement("effective");
                PeriodSerializer.SerializePeriod(value.Effective, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reason
            if (value.Reason != null && !summary)
            {
                writer.WriteStartElement("reason");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Reason, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element data
            if (value.Data != null && !summary && value.Data.Count > 0)
            {
                writer.WriteStartArrayElement("data");
                foreach (var item in value.Data)
                {
                    writer.WriteStartArrayMember("data");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #9
0
        public static void SerializeDocumentReference(Hl7.Fhir.Model.DocumentReference value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DocumentReference");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element masterIdentifier
            if (value.MasterIdentifier != null && !summary)
            {
                writer.WriteStartElement("masterIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.MasterIdentifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element identifier
            if (value.Identifier != null && !summary && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null && !summary)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subtype
            if (value.Subtype != null && !summary)
            {
                writer.WriteStartElement("subtype");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Subtype, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && !summary && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element custodian
            if (value.Custodian != null && !summary)
            {
                writer.WriteStartElement("custodian");
                ResourceReferenceSerializer.SerializeResourceReference(value.Custodian, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element authenticator
            if (value.Authenticator != null && !summary)
            {
                writer.WriteStartElement("authenticator");
                ResourceReferenceSerializer.SerializeResourceReference(value.Authenticator, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.CreatedElement != null && !summary)
            {
                writer.WriteStartElement("created");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.CreatedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element indexed
            if (value.IndexedElement != null && !summary)
            {
                writer.WriteStartElement("indexed");
                InstantSerializer.SerializeInstant(value.IndexedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element docStatus
            if (value.DocStatus != null && !summary)
            {
                writer.WriteStartElement("docStatus");
                CodeableConceptSerializer.SerializeCodeableConcept(value.DocStatus, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element supercedes
            if (value.Supercedes != null && !summary)
            {
                writer.WriteStartElement("supercedes");
                ResourceReferenceSerializer.SerializeResourceReference(value.Supercedes, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element description
            if (value.DescriptionElement != null && !summary)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element confidentiality
            if (value.Confidentiality != null && !summary)
            {
                writer.WriteStartElement("confidentiality");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Confidentiality, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element primaryLanguage
            if (value.PrimaryLanguageElement != null && !summary)
            {
                writer.WriteStartElement("primaryLanguage");
                CodeSerializer.SerializeCode(value.PrimaryLanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element mimeType
            if (value.MimeTypeElement != null && !summary)
            {
                writer.WriteStartElement("mimeType");
                CodeSerializer.SerializeCode(value.MimeTypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element format
            if (value.Format != null && !summary)
            {
                writer.WriteStartElement("format");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Format, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element size
            if (value.SizeElement != null && !summary)
            {
                writer.WriteStartElement("size");
                IntegerSerializer.SerializeInteger(value.SizeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element hash
            if (value.HashElement != null && !summary)
            {
                writer.WriteStartElement("hash");
                FhirStringSerializer.SerializeFhirString(value.HashElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element location
            if (value.LocationElement != null && !summary)
            {
                writer.WriteStartElement("location");
                FhirUriSerializer.SerializeFhirUri(value.LocationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element service
            if (value.Service != null && !summary)
            {
                writer.WriteStartElement("service");
                DocumentReferenceSerializer.SerializeDocumentReferenceServiceComponent(value.Service, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element context
            if (value.Context != null && !summary)
            {
                writer.WriteStartElement("context");
                DocumentReferenceSerializer.SerializeDocumentReferenceContextComponent(value.Context, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #10
0
        public static void SerializeTest(Hl7.Fhir.Model.Test value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Test");
            writer.WriteStartComplexContent();

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element _id
            if (value.LocalId != null)
            {
                writer.WriteStartElement("_id");
                IdSerializer.SerializeId(value.LocalId, writer);
                writer.WriteEndElement();
            }

            // Serialize element stringErr
            if (value.StringErr != null && value.StringErr.Count > 0)
            {
                writer.WriteStartArrayElement("stringErr");
                foreach (var item in value.StringErr)
                {
                    writer.WriteStartArrayMember("stringErr");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element stringCorr
            if (value.StringCorr != null && value.StringCorr.Count > 0)
            {
                writer.WriteStartArrayElement("stringCorr");
                foreach (var item in value.StringCorr)
                {
                    writer.WriteStartArrayMember("stringCorr");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element booleanErr
            if (value.BooleanErr != null && value.BooleanErr.Count > 0)
            {
                writer.WriteStartArrayElement("booleanErr");
                foreach (var item in value.BooleanErr)
                {
                    writer.WriteStartArrayMember("booleanErr");
                    FhirBooleanSerializer.SerializeFhirBoolean(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element booleanCorr
            if (value.BooleanCorr != null && value.BooleanCorr.Count > 0)
            {
                writer.WriteStartArrayElement("booleanCorr");
                foreach (var item in value.BooleanCorr)
                {
                    writer.WriteStartArrayMember("booleanCorr");
                    FhirBooleanSerializer.SerializeFhirBoolean(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element integerErr
            if (value.IntegerErr != null && value.IntegerErr.Count > 0)
            {
                writer.WriteStartArrayElement("integerErr");
                foreach (var item in value.IntegerErr)
                {
                    writer.WriteStartArrayMember("integerErr");
                    IntegerSerializer.SerializeInteger(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element integerCorr
            if (value.IntegerCorr != null && value.IntegerCorr.Count > 0)
            {
                writer.WriteStartArrayElement("integerCorr");
                foreach (var item in value.IntegerCorr)
                {
                    writer.WriteStartArrayMember("integerCorr");
                    IntegerSerializer.SerializeInteger(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element decimalErr
            if (value.DecimalErr != null && value.DecimalErr.Count > 0)
            {
                writer.WriteStartArrayElement("decimalErr");
                foreach (var item in value.DecimalErr)
                {
                    writer.WriteStartArrayMember("decimalErr");
                    FhirDecimalSerializer.SerializeFhirDecimal(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element decimalCorr
            if (value.DecimalCorr != null && value.DecimalCorr.Count > 0)
            {
                writer.WriteStartArrayElement("decimalCorr");
                foreach (var item in value.DecimalCorr)
                {
                    writer.WriteStartArrayMember("decimalCorr");
                    FhirDecimalSerializer.SerializeFhirDecimal(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element b64Err
            if (value.B64Err != null && value.B64Err.Count > 0)
            {
                writer.WriteStartArrayElement("b64Err");
                foreach (var item in value.B64Err)
                {
                    writer.WriteStartArrayMember("b64Err");
                    Base64BinarySerializer.SerializeBase64Binary(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element b64Corr
            if (value.B64Corr != null && value.B64Corr.Count > 0)
            {
                writer.WriteStartArrayElement("b64Corr");
                foreach (var item in value.B64Corr)
                {
                    writer.WriteStartArrayMember("b64Corr");
                    Base64BinarySerializer.SerializeBase64Binary(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element instantErr
            if (value.InstantErr != null && value.InstantErr.Count > 0)
            {
                writer.WriteStartArrayElement("instantErr");
                foreach (var item in value.InstantErr)
                {
                    writer.WriteStartArrayMember("instantErr");
                    InstantSerializer.SerializeInstant(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element instantCorr
            if (value.InstantCorr != null && value.InstantCorr.Count > 0)
            {
                writer.WriteStartArrayElement("instantCorr");
                foreach (var item in value.InstantCorr)
                {
                    writer.WriteStartArrayMember("instantCorr");
                    InstantSerializer.SerializeInstant(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element uriErr
            if (value.UriErr != null && value.UriErr.Count > 0)
            {
                writer.WriteStartArrayElement("uriErr");
                foreach (var item in value.UriErr)
                {
                    writer.WriteStartArrayMember("uriErr");
                    FhirUriSerializer.SerializeFhirUri(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element uriCorr
            if (value.UriCorr != null && value.UriCorr.Count > 0)
            {
                writer.WriteStartArrayElement("uriCorr");
                foreach (var item in value.UriCorr)
                {
                    writer.WriteStartArrayMember("uriCorr");
                    FhirUriSerializer.SerializeFhirUri(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element idrefSingle
            if (value.IdrefSingle != null)
            {
                writer.WriteStartElement("idrefSingle");
                IdRefSerializer.SerializeIdRef(value.IdrefSingle, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
예제 #11
0
        public static void SerializeProvenance(Hl7.Fhir.Model.Provenance value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Provenance");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element target
            if (value.Target != null && !summary && value.Target.Count > 0)
            {
                writer.WriteStartArrayElement("target");
                foreach (var item in value.Target)
                {
                    writer.WriteStartArrayMember("target");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element period
            if (value.Period != null && !summary)
            {
                writer.WriteStartElement("period");
                PeriodSerializer.SerializePeriod(value.Period, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element recorded
            if (value.RecordedElement != null && !summary)
            {
                writer.WriteStartElement("recorded");
                InstantSerializer.SerializeInstant(value.RecordedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reason
            if (value.Reason != null && !summary)
            {
                writer.WriteStartElement("reason");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Reason, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element location
            if (value.Location != null && !summary)
            {
                writer.WriteStartElement("location");
                ResourceReferenceSerializer.SerializeResourceReference(value.Location, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element policy
            if (value.PolicyElement != null && !summary && value.PolicyElement.Count > 0)
            {
                writer.WriteStartArrayElement("policy");
                foreach (var item in value.PolicyElement)
                {
                    writer.WriteStartArrayMember("policy");
                    FhirUriSerializer.SerializeFhirUri(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element agent
            if (value.Agent != null && !summary && value.Agent.Count > 0)
            {
                writer.WriteStartArrayElement("agent");
                foreach (var item in value.Agent)
                {
                    writer.WriteStartArrayMember("agent");
                    ProvenanceSerializer.SerializeProvenanceAgentComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element entity
            if (value.Entity != null && !summary && value.Entity.Count > 0)
            {
                writer.WriteStartArrayElement("entity");
                foreach (var item in value.Entity)
                {
                    writer.WriteStartArrayMember("entity");
                    ProvenanceSerializer.SerializeProvenanceEntityComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element signature
            if (value.SignatureElement != null && !summary)
            {
                writer.WriteStartElement("signature");
                FhirStringSerializer.SerializeFhirString(value.SignatureElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeSecurityEventEventComponent(Hl7.Fhir.Model.SecurityEvent.SecurityEventEventComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element type
            if (value.Type != null)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element subtype
            if (value.Subtype != null && value.Subtype.Count > 0)
            {
                writer.WriteStartArrayElement("subtype");
                foreach (var item in value.Subtype)
                {
                    writer.WriteStartArrayMember("subtype");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element action
            if (value.ActionElement != null)
            {
                writer.WriteStartElement("action");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventAction>(value.ActionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element dateTime
            if (value.DateTimeElement != null)
            {
                writer.WriteStartElement("dateTime");
                InstantSerializer.SerializeInstant(value.DateTimeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element outcome
            if (value.OutcomeElement != null)
            {
                writer.WriteStartElement("outcome");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventOutcome>(value.OutcomeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element outcomeDesc
            if (value.OutcomeDescElement != null)
            {
                writer.WriteStartElement("outcomeDesc");
                FhirStringSerializer.SerializeFhirString(value.OutcomeDescElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
예제 #13
0
 internal static void SerializeElement(Element value, IFhirWriter writer, bool summary)
 {
     if (value.GetType() == typeof(Hl7.Fhir.Model.Address))
     {
         AddressSerializer.SerializeAddress((Hl7.Fhir.Model.Address)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Attachment))
     {
         AttachmentSerializer.SerializeAttachment((Hl7.Fhir.Model.Attachment)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Choice))
     {
         ChoiceSerializer.SerializeChoice((Hl7.Fhir.Model.Choice)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.CodeableConcept))
     {
         CodeableConceptSerializer.SerializeCodeableConcept((Hl7.Fhir.Model.CodeableConcept)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Coding))
     {
         CodingSerializer.SerializeCoding((Hl7.Fhir.Model.Coding)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Contact))
     {
         ContactSerializer.SerializeContact((Hl7.Fhir.Model.Contact)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Extension))
     {
         ExtensionSerializer.SerializeExtension((Hl7.Fhir.Model.Extension)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.HumanName))
     {
         HumanNameSerializer.SerializeHumanName((Hl7.Fhir.Model.HumanName)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Identifier))
     {
         IdentifierSerializer.SerializeIdentifier((Hl7.Fhir.Model.Identifier)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Narrative))
     {
         NarrativeSerializer.SerializeNarrative((Hl7.Fhir.Model.Narrative)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Period))
     {
         PeriodSerializer.SerializePeriod((Hl7.Fhir.Model.Period)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Quantity))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Quantity)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Range))
     {
         RangeSerializer.SerializeRange((Hl7.Fhir.Model.Range)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Ratio))
     {
         RatioSerializer.SerializeRatio((Hl7.Fhir.Model.Ratio)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.ResourceReference))
     {
         ResourceReferenceSerializer.SerializeResourceReference((Hl7.Fhir.Model.ResourceReference)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.SampledData))
     {
         SampledDataSerializer.SerializeSampledData((Hl7.Fhir.Model.SampledData)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Schedule))
     {
         ScheduleSerializer.SerializeSchedule((Hl7.Fhir.Model.Schedule)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Base64Binary))
     {
         Base64BinarySerializer.SerializeBase64Binary((Hl7.Fhir.Model.Base64Binary)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirBoolean))
     {
         FhirBooleanSerializer.SerializeFhirBoolean((Hl7.Fhir.Model.FhirBoolean)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Code))
     {
         CodeSerializer.SerializeCode((Hl7.Fhir.Model.Code)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Date))
     {
         DateSerializer.SerializeDate((Hl7.Fhir.Model.Date)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDateTime))
     {
         FhirDateTimeSerializer.SerializeFhirDateTime((Hl7.Fhir.Model.FhirDateTime)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDecimal))
     {
         FhirDecimalSerializer.SerializeFhirDecimal((Hl7.Fhir.Model.FhirDecimal)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Id))
     {
         IdSerializer.SerializeId((Hl7.Fhir.Model.Id)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.IdRef))
     {
         IdRefSerializer.SerializeIdRef((Hl7.Fhir.Model.IdRef)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Instant))
     {
         InstantSerializer.SerializeInstant((Hl7.Fhir.Model.Instant)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Integer))
     {
         IntegerSerializer.SerializeInteger((Hl7.Fhir.Model.Integer)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Oid))
     {
         OidSerializer.SerializeOid((Hl7.Fhir.Model.Oid)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirString))
     {
         FhirStringSerializer.SerializeFhirString((Hl7.Fhir.Model.FhirString)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirUri))
     {
         FhirUriSerializer.SerializeFhirUri((Hl7.Fhir.Model.FhirUri)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Uuid))
     {
         UuidSerializer.SerializeUuid((Hl7.Fhir.Model.Uuid)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.XHtml))
     {
         XHtmlSerializer.SerializeXHtml((Hl7.Fhir.Model.XHtml)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Age))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Age)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Count))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Count)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Distance))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Distance)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Duration))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Duration)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Money))
     {
         QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Money)value, writer, summary);
     }
     else
     {
         throw new Exception("Encountered unknown type " + value.GetType().Name);
     }
 }