示例#1
0
        public static void SerializeProvenanceAgentComponent(Hl7.Fhir.Model.Provenance.ProvenanceAgentComponent 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 role
            if (value.Role != null)
            {
                writer.WriteStartElement("role");
                CodingSerializer.SerializeCoding(value.Role, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeCodeableConcept(Hl7.Fhir.Model.CodeableConcept 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 coding
            if (value.Coding != null && value.Coding.Count > 0)
            {
                writer.WriteStartArrayElement("coding");
                foreach (var item in value.Coding)
                {
                    writer.WriteStartArrayMember("coding");
                    CodingSerializer.SerializeCoding(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeSecurityEventSourceComponent(Hl7.Fhir.Model.SecurityEvent.SecurityEventSourceComponent 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 site
            if (value.SiteElement != null)
            {
                writer.WriteStartElement("site");
                FhirStringSerializer.SerializeFhirString(value.SiteElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element type
            if (value.Type != null && value.Type.Count > 0)
            {
                writer.WriteStartArrayElement("type");
                foreach (var item in value.Type)
                {
                    writer.WriteStartArrayMember("type");
                    CodingSerializer.SerializeCoding(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();
        }
示例#5
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();
        }
示例#6
0
        public static void SerializeXdsFolder(XdsFolder value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsFolder");
            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 code
            if (value.Code != null && value.Code.Count > 0)
            {
                writer.WriteStartArrayElement("code");
                foreach (var item in value.Code)
                {
                    writer.WriteStartArrayMember("code");
                    CodingSerializer.SerializeCoding(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
示例#7
0
        public static void SerializeQuestionComponent(Hl7.Fhir.Model.Questionnaire.QuestionComponent 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 name
            if (value.Name != null)
            {
                writer.WriteStartElement("name");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Name, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
示例#8
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 SerializeConformanceMessagingEventComponent(Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent 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 code
            if (value.CodeElement != null)
            {
                writer.WriteStartElement("code");
                CodeSerializer.SerializeCode(value.CodeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element mode
            if (value.ModeElement != null)
            {
                writer.WriteStartElement("mode");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Conformance.ConformanceEventMode>(value.ModeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeImagingStudySeriesComponent(Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent 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 number
            if (value.NumberElement != null)
            {
                writer.WriteStartElement("number");
                IntegerSerializer.SerializeInteger(value.NumberElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element modality
            if (value.ModalityElement != null)
            {
                writer.WriteStartElement("modality");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.Modality>(value.ModalityElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element uid
            if (value.UidElement != null)
            {
                writer.WriteStartElement("uid");
                OidSerializer.SerializeOid(value.UidElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element availability
            if (value.AvailabilityElement != null)
            {
                writer.WriteStartElement("availability");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(value.AvailabilityElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
        }
示例#11
0
        public static void SerializeCoverage(Hl7.Fhir.Model.Coverage value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Coverage");
            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 issuer
            if (value.Issuer != null && !summary)
            {
                writer.WriteStartElement("issuer");
                ResourceReferenceSerializer.SerializeResourceReference(value.Issuer, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element type
            if (value.Type != null && !summary)
            {
                writer.WriteStartElement("type");
                CodingSerializer.SerializeCoding(value.Type, 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 group
            if (value.Group != null && !summary)
            {
                writer.WriteStartElement("group");
                IdentifierSerializer.SerializeIdentifier(value.Group, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element subscriber
            if (value.Subscriber != null && !summary)
            {
                writer.WriteStartElement("subscriber");
                CoverageSerializer.SerializeCoverageSubscriberComponent(value.Subscriber, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
示例#12
0
        public static void SerializeXdsEntry2(XdsEntry2 value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsEntry2");
            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 id
            if (value.Id != null)
            {
                writer.WriteStartElement("id");
                IdentifierSerializer.SerializeIdentifier(value.Id, writer);
                writer.WriteEndElement();
            }

            // Serialize element information
            if (value.Information != null)
            {
                writer.WriteStartElement("information");
                DocumentInformationSerializer.SerializeDocumentInformation(value.Information, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element availability
            if (value.Availability != null)
            {
                writer.WriteStartElement("availability");
                CodeSerializer.SerializeCode(value.Availability, 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 subject
            if (value.Subject != null)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer);
                writer.WriteEndElement();
            }

            // Serialize element content
            if (value.Content != null)
            {
                writer.WriteStartElement("content");
                AttachmentSerializer.SerializeAttachment(value.Content, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeSecurityEventParticipantComponent(Hl7.Fhir.Model.SecurityEvent.SecurityEventParticipantComponent 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 role
            if (value.Role != null && value.Role.Count > 0)
            {
                writer.WriteStartArrayElement("role");
                foreach (var item in value.Role)
                {
                    writer.WriteStartArrayMember("role");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

            // Serialize element requestor
            if (value.RequestorElement != null)
            {
                writer.WriteStartElement("requestor");
                FhirBooleanSerializer.SerializeFhirBoolean(value.RequestorElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element network
            if (value.Network != null)
            {
                writer.WriteStartElement("network");
                SecurityEventSerializer.SerializeSecurityEventParticipantNetworkComponent(value.Network, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeProfile(Hl7.Fhir.Model.Profile value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Profile");
            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)
            {
                writer.WriteStartElement("identifier");
                FhirStringSerializer.SerializeFhirString(value.IdentifierElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

            // Serialize element experimental
            if (value.ExperimentalElement != null)
            {
                writer.WriteStartElement("experimental");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ExperimentalElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeImagingStudy(Hl7.Fhir.Model.ImagingStudy value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("ImagingStudy");
            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 dateTime
            if (value.DateTimeElement != null && !summary)
            {
                writer.WriteStartElement("dateTime");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateTimeElement, 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 uid
            if (value.UidElement != null && !summary)
            {
                writer.WriteStartElement("uid");
                OidSerializer.SerializeOid(value.UidElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element accessionNo
            if (value.AccessionNo != null && !summary)
            {
                writer.WriteStartElement("accessionNo");
                IdentifierSerializer.SerializeIdentifier(value.AccessionNo, 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 modality
            if (value.Modality_Element != null && !summary && value.Modality_Element.Count > 0)
            {
                writer.WriteStartArrayElement("modality");
                foreach (var item in value.Modality_Element)
                {
                    writer.WriteStartArrayMember("modality");
                    CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.ImagingModality>(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

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

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

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

            // Serialize element interpreter
            if (value.Interpreter != null && !summary)
            {
                writer.WriteStartElement("interpreter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Interpreter, 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 series
            if (value.Series != null && !summary && value.Series.Count > 0)
            {
                writer.WriteStartArrayElement("series");
                foreach (var item in value.Series)
                {
                    writer.WriteStartArrayMember("series");
                    ImagingStudySerializer.SerializeImagingStudySeriesComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeOperationOutcomeIssueComponent(Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent 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 severity
            if (value.SeverityElement != null)
            {
                writer.WriteStartElement("severity");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.OperationOutcome.IssueSeverity>(value.SeverityElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
 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);
     }
 }