Example #1
0
        public static void SerializeChoice(Hl7.Fhir.Model.Choice 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 option
            if (value.Option != null && value.Option.Count > 0)
            {
                writer.WriteStartArrayElement("option");
                foreach (var item in value.Option)
                {
                    writer.WriteStartArrayMember("option");
                    ChoiceSerializer.SerializeChoiceOptionComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeValueSetDefineComponent(Hl7.Fhir.Model.ValueSet.ValueSetDefineComponent 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 system
            if (value.SystemElement != null)
            {
                writer.WriteStartElement("system");
                FhirUriSerializer.SerializeFhirUri(value.SystemElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeElementSlicingComponent(Hl7.Fhir.Model.Profile.ElementSlicingComponent 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 discriminator
            if (value.DiscriminatorElement != null)
            {
                writer.WriteStartElement("discriminator");
                IdSerializer.SerializeId(value.DiscriminatorElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeExtension(Hl7.Fhir.Model.Extension 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 url
            if (value.UrlElement != null)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.UrlElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeTypeRefComponent(Hl7.Fhir.Model.Profile.TypeRefComponent 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 profile
            if (value.ProfileElement != null)
            {
                writer.WriteStartElement("profile");
                FhirUriSerializer.SerializeFhirUri(value.ProfileElement, writer, summary);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeGroupCharacteristicComponent(Hl7.Fhir.Model.Group.GroupCharacteristicComponent 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 value
            if (value.Value != null)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("value", value.Value.GetType()));
                FhirSerializer.SerializeElement(value.Value, writer, summary);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
Example #7
0
        public static void SerializeImmunizationReactionComponent(Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent 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 date
            if (value.DateElement != null)
            {
                writer.WriteStartElement("date");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeGroup(Hl7.Fhir.Model.Group value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Group");
            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 type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Group.GroupType>(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializePatient(Hl7.Fhir.Model.Patient value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Patient");
            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 && 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 name
            if (value.Name != null && value.Name.Count > 0)
            {
                writer.WriteStartArrayElement("name");
                foreach (var item in value.Name)
                {
                    writer.WriteStartArrayMember("name");
                    HumanNameSerializer.SerializeHumanName(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // 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 gender
            if (value.Gender != null)
            {
                writer.WriteStartElement("gender");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Gender, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

            // Serialize element animal
            if (value.Animal != null)
            {
                writer.WriteStartElement("animal");
                PatientSerializer.SerializeAnimalComponent(value.Animal, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Example #10
0
        public static void SerializeStudyInterventionComponent(Hl7.Fhir.Model.Study.StudyInterventionComponent value, IFhirWriter writer)
        {
            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 _id
            if (value.LocalId != null)
            {
                writer.WriteStartElement("_id");
                IdSerializer.SerializeId(value.LocalId, writer);
                writer.WriteEndElement();
            }

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeMedication(Hl7.Fhir.Model.Medication value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Medication");
            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.NameElement != null)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

            // Serialize element kind
            if (value.KindElement != null)
            {
                writer.WriteStartElement("kind");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Medication.MedicationKind>(value.KindElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element product
            if (value.Product != null && !summary)
            {
                writer.WriteStartElement("product");
                MedicationSerializer.SerializeMedicationProductComponent(value.Product, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element package
            if (value.Package != null && !summary)
            {
                writer.WriteStartElement("package");
                MedicationSerializer.SerializeMedicationPackageComponent(value.Package, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeConformanceRestResourceComponent(Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent 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.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Example #13
0
        public static void SerializeList(Hl7.Fhir.Model.List value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("List");
            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 source
            if (value.Source != null && !summary)
            {
                writer.WriteStartElement("source");
                ResourceReferenceSerializer.SerializeResourceReference(value.Source, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeElementDefinitionComponent(Hl7.Fhir.Model.Profile.ElementDefinitionComponent 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 short
            if (value.ShortElement != null)
            {
                writer.WriteStartElement("short");
                FhirStringSerializer.SerializeFhirString(value.ShortElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

            // Serialize element max
            if (value.MaxElement != null)
            {
                writer.WriteStartElement("max");
                FhirStringSerializer.SerializeFhirString(value.MaxElement, 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");
                    ProfileSerializer.SerializeTypeRefComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeMedicationAdministration(Hl7.Fhir.Model.MedicationAdministration value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("MedicationAdministration");
            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 && !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 status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Example #16
0
        public static void SerializeAdverseReaction(Hl7.Fhir.Model.AdverseReaction value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("AdverseReaction");
            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 reactionDate
            if (value.ReactionDateElement != null && !summary)
            {
                writer.WriteStartElement("reactionDate");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.ReactionDateElement, 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 didNotOccurFlag
            if (value.DidNotOccurFlagElement != null && !summary)
            {
                writer.WriteStartElement("didNotOccurFlag");
                FhirBooleanSerializer.SerializeFhirBoolean(value.DidNotOccurFlagElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Example #17
0
        public static void SerializeImmunization(Hl7.Fhir.Model.Immunization value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Immunization");
            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 date
            if (value.DateElement != null && !summary)
            {
                writer.WriteStartElement("date");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element vaccineType
            if (value.VaccineType != null && !summary)
            {
                writer.WriteStartElement("vaccineType");
                CodeableConceptSerializer.SerializeCodeableConcept(value.VaccineType, 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 refusedIndicator
            if (value.RefusedIndicatorElement != null && !summary)
            {
                writer.WriteStartElement("refusedIndicator");
                FhirBooleanSerializer.SerializeFhirBoolean(value.RefusedIndicatorElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reported
            if (value.ReportedElement != null && !summary)
            {
                writer.WriteStartElement("reported");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ReportedElement, 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 requester
            if (value.Requester != null && !summary)
            {
                writer.WriteStartElement("requester");
                ResourceReferenceSerializer.SerializeResourceReference(value.Requester, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element manufacturer
            if (value.Manufacturer != null && !summary)
            {
                writer.WriteStartElement("manufacturer");
                ResourceReferenceSerializer.SerializeResourceReference(value.Manufacturer, 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 lotNumber
            if (value.LotNumberElement != null && !summary)
            {
                writer.WriteStartElement("lotNumber");
                FhirStringSerializer.SerializeFhirString(value.LotNumberElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element expirationDate
            if (value.ExpirationDateElement != null && !summary)
            {
                writer.WriteStartElement("expirationDate");
                DateSerializer.SerializeDate(value.ExpirationDateElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element doseQuantity
            if (value.DoseQuantity != null && !summary)
            {
                writer.WriteStartElement("doseQuantity");
                QuantitySerializer.SerializeQuantity(value.DoseQuantity, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element explanation
            if (value.Explanation != null && !summary)
            {
                writer.WriteStartElement("explanation");
                ImmunizationSerializer.SerializeImmunizationExplanationComponent(value.Explanation, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element vaccinationProtocol
            if (value.VaccinationProtocol != null && !summary)
            {
                writer.WriteStartElement("vaccinationProtocol");
                ImmunizationSerializer.SerializeImmunizationVaccinationProtocolComponent(value.VaccinationProtocol, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        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();
        }
        public static void SerializeCarePlanActivityComponent(Hl7.Fhir.Model.CarePlan.CarePlanActivityComponent 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 category
            if (value.CategoryElement != null)
            {
                writer.WriteStartElement("category");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.CarePlan.CarePlanActivityCategory>(value.CategoryElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

            // Serialize element dailyAmount
            if (value.DailyAmount != null)
            {
                writer.WriteStartElement("dailyAmount");
                QuantitySerializer.SerializeQuantity(value.DailyAmount, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element quantity
            if (value.Quantity != null)
            {
                writer.WriteStartElement("quantity");
                QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
        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();
        }
Example #21
0
        public static void SerializeOrganization(Hl7.Fhir.Model.Organization value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Organization");
            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 && !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 name
            if (value.NameElement != null && !summary)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, 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 telecom
            if (value.Telecom != null && !summary && 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 address
            if (value.Address != null && !summary && value.Address.Count > 0)
            {
                writer.WriteStartArrayElement("address");
                foreach (var item in value.Address)
                {
                    writer.WriteStartArrayMember("address");
                    AddressSerializer.SerializeAddress(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Example #22
0
        public static void SerializePrescriptionAdministrationRequestDosageInstructionComponent(Prescription.PrescriptionAdministrationRequestDosageInstructionComponent 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 precondition
            if (value.Precondition != null && value.Precondition.Count > 0)
            {
                writer.WriteStartArrayElement("precondition");
                foreach (var item in value.Precondition)
                {
                    writer.WriteStartArrayMember("precondition");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

            // Serialize element rate
            if (value.Rate != null)
            {
                writer.WriteStartElement("rate");
                QuantitySerializer.SerializeQuantity(value.Rate, writer);
                writer.WriteEndElement();
            }

            // Serialize element schedule
            if (value.Schedule != null && value.Schedule.Count > 0)
            {
                writer.WriteStartArrayElement("schedule");
                foreach (var item in value.Schedule)
                {
                    writer.WriteStartArrayMember("schedule");
                    ScheduleSerializer.SerializeSchedule(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeVisitHospitalizationComponent(Hl7.Fhir.Model.Visit.VisitHospitalizationComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

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

            // 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 preAdmissionIdentifier
            if (value.PreAdmissionIdentifier != null)
            {
                writer.WriteStartElement("preAdmissionIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.PreAdmissionIdentifier, writer);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element accomodation
            if (value.Accomodation != null && value.Accomodation.Count > 0)
            {
                writer.WriteStartArrayElement("accomodation");
                foreach (var item in value.Accomodation)
                {
                    writer.WriteStartArrayMember("accomodation");
                    VisitSerializer.SerializeVisitHospitalizationAccomodationComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeProfileStructureComponent(Hl7.Fhir.Model.Profile.ProfileStructureComponent 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.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeProfileBindingComponent(Hl7.Fhir.Model.Profile.ProfileBindingComponent 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.NameElement != null)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
        }
Example #26
0
        public static void SerializeListEntryComponent(Hl7.Fhir.Model.List.ListEntryComponent 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 flag
            if (value.Flag != null && value.Flag.Count > 0)
            {
                writer.WriteStartArrayElement("flag");
                foreach (var item in value.Flag)
                {
                    writer.WriteStartArrayMember("flag");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

            // Serialize element item
            if (value.Item != null)
            {
                writer.WriteStartElement("item");
                ResourceReferenceSerializer.SerializeResourceReference(value.Item, 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 SerializeValueSet(Hl7.Fhir.Model.ValueSet value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("ValueSet");
            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 copyright
            if (value.CopyrightElement != null && !summary)
            {
                writer.WriteStartElement("copyright");
                FhirStringSerializer.SerializeFhirString(value.CopyrightElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ValueSet.ValueSetStatus>(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 define
            if (value.Define != null && !summary)
            {
                writer.WriteStartElement("define");
                ValueSetSerializer.SerializeValueSetDefineComponent(value.Define, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element compose
            if (value.Compose != null && !summary)
            {
                writer.WriteStartElement("compose");
                ValueSetSerializer.SerializeValueSetComposeComponent(value.Compose, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element expansion
            if (value.Expansion != null && !summary)
            {
                writer.WriteStartElement("expansion");
                ValueSetSerializer.SerializeValueSetExpansionComponent(value.Expansion, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeValueSetDefineConceptComponent(Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent 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 abstract
            if (value.AbstractElement != null)
            {
                writer.WriteStartElement("abstract");
                FhirBooleanSerializer.SerializeFhirBoolean(value.AbstractElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformance(Hl7.Fhir.Model.Conformance value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Conformance");
            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 status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(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 software
            if (value.Software != null)
            {
                writer.WriteStartElement("software");
                ConformanceSerializer.SerializeConformanceSoftwareComponent(value.Software, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element implementation
            if (value.Implementation != null)
            {
                writer.WriteStartElement("implementation");
                ConformanceSerializer.SerializeConformanceImplementationComponent(value.Implementation, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }