public static void SerializeCoverageSubscriberComponent(Hl7.Fhir.Model.Coverage.CoverageSubscriberComponent value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element name if (value.Name != null) { writer.WriteStartElement("name"); HumanNameSerializer.SerializeHumanName(value.Name, writer, summary); writer.WriteEndElement(); } // Serialize element address if (value.Address != null) { writer.WriteStartElement("address"); AddressSerializer.SerializeAddress(value.Address, writer, summary); writer.WriteEndElement(); } // Serialize element birthdate if (value.BirthdateElement != null) { writer.WriteStartElement("birthdate"); DateSerializer.SerializeDate(value.BirthdateElement, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
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(); }
public static void SerializeOrganizationContactComponent(Hl7.Fhir.Model.Organization.OrganizationContactComponent 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 purpose if (value.Purpose != null) { writer.WriteStartElement("purpose"); CodeableConceptSerializer.SerializeCodeableConcept(value.Purpose, writer, summary); writer.WriteEndElement(); } // Serialize element name if (value.Name != null) { writer.WriteStartElement("name"); HumanNameSerializer.SerializeHumanName(value.Name, 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 address if (value.Address != null) { writer.WriteStartElement("address"); AddressSerializer.SerializeAddress(value.Address, writer, summary); writer.WriteEndElement(); } // Serialize element gender if (value.Gender != null) { writer.WriteStartElement("gender"); CodeableConceptSerializer.SerializeCodeableConcept(value.Gender, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
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(); }
public static void SerializeRelatedPerson(Hl7.Fhir.Model.RelatedPerson value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("RelatedPerson"); 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 patient if (value.Patient != null) { writer.WriteStartElement("patient"); ResourceReferenceSerializer.SerializeResourceReference(value.Patient, writer, summary); writer.WriteEndElement(); } // Serialize element relationship if (value.Relationship != null) { writer.WriteStartElement("relationship"); CodeableConceptSerializer.SerializeCodeableConcept(value.Relationship, writer, summary); writer.WriteEndElement(); } // Serialize element name if (value.Name != null) { writer.WriteStartElement("name"); HumanNameSerializer.SerializeHumanName(value.Name, 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 gender if (value.Gender != null) { writer.WriteStartElement("gender"); CodeableConceptSerializer.SerializeCodeableConcept(value.Gender, writer, summary); writer.WriteEndElement(); } // Serialize element address if (value.Address != null) { writer.WriteStartElement("address"); AddressSerializer.SerializeAddress(value.Address, 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(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void SerializePractitioner(Hl7.Fhir.Model.Practitioner value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Practitioner"); 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) { writer.WriteStartElement("name"); HumanNameSerializer.SerializeHumanName(value.Name, 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 address if (value.Address != null) { writer.WriteStartElement("address"); AddressSerializer.SerializeAddress(value.Address, writer, summary); writer.WriteEndElement(); } // 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 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 organization if (value.Organization != null) { writer.WriteStartElement("organization"); ResourceReferenceSerializer.SerializeResourceReference(value.Organization, writer, summary); writer.WriteEndElement(); } // 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 specialty if (value.Specialty != null && value.Specialty.Count > 0) { writer.WriteStartArrayElement("specialty"); foreach (var item in value.Specialty) { writer.WriteStartArrayMember("specialty"); CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element period if (value.Period != null) { writer.WriteStartElement("period"); PeriodSerializer.SerializePeriod(value.Period, writer, summary); writer.WriteEndElement(); } // Serialize element qualification if (value.Qualification != null && !summary && value.Qualification.Count > 0) { writer.WriteStartArrayElement("qualification"); foreach (var item in value.Qualification) { writer.WriteStartArrayMember("qualification"); PractitionerSerializer.SerializePractitionerQualificationComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // 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(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
internal static void SerializeElement(Element value, IFhirWriter writer, bool summary) { if (value.GetType() == typeof(Hl7.Fhir.Model.Address)) { AddressSerializer.SerializeAddress((Hl7.Fhir.Model.Address)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Attachment)) { AttachmentSerializer.SerializeAttachment((Hl7.Fhir.Model.Attachment)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Choice)) { ChoiceSerializer.SerializeChoice((Hl7.Fhir.Model.Choice)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.CodeableConcept)) { CodeableConceptSerializer.SerializeCodeableConcept((Hl7.Fhir.Model.CodeableConcept)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Coding)) { CodingSerializer.SerializeCoding((Hl7.Fhir.Model.Coding)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Contact)) { ContactSerializer.SerializeContact((Hl7.Fhir.Model.Contact)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Extension)) { ExtensionSerializer.SerializeExtension((Hl7.Fhir.Model.Extension)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.HumanName)) { HumanNameSerializer.SerializeHumanName((Hl7.Fhir.Model.HumanName)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Identifier)) { IdentifierSerializer.SerializeIdentifier((Hl7.Fhir.Model.Identifier)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Narrative)) { NarrativeSerializer.SerializeNarrative((Hl7.Fhir.Model.Narrative)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Period)) { PeriodSerializer.SerializePeriod((Hl7.Fhir.Model.Period)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Quantity)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Quantity)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Range)) { RangeSerializer.SerializeRange((Hl7.Fhir.Model.Range)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Ratio)) { RatioSerializer.SerializeRatio((Hl7.Fhir.Model.Ratio)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.ResourceReference)) { ResourceReferenceSerializer.SerializeResourceReference((Hl7.Fhir.Model.ResourceReference)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.SampledData)) { SampledDataSerializer.SerializeSampledData((Hl7.Fhir.Model.SampledData)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Schedule)) { ScheduleSerializer.SerializeSchedule((Hl7.Fhir.Model.Schedule)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Base64Binary)) { Base64BinarySerializer.SerializeBase64Binary((Hl7.Fhir.Model.Base64Binary)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirBoolean)) { FhirBooleanSerializer.SerializeFhirBoolean((Hl7.Fhir.Model.FhirBoolean)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Code)) { CodeSerializer.SerializeCode((Hl7.Fhir.Model.Code)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Date)) { DateSerializer.SerializeDate((Hl7.Fhir.Model.Date)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDateTime)) { FhirDateTimeSerializer.SerializeFhirDateTime((Hl7.Fhir.Model.FhirDateTime)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDecimal)) { FhirDecimalSerializer.SerializeFhirDecimal((Hl7.Fhir.Model.FhirDecimal)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Id)) { IdSerializer.SerializeId((Hl7.Fhir.Model.Id)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.IdRef)) { IdRefSerializer.SerializeIdRef((Hl7.Fhir.Model.IdRef)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Instant)) { InstantSerializer.SerializeInstant((Hl7.Fhir.Model.Instant)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Integer)) { IntegerSerializer.SerializeInteger((Hl7.Fhir.Model.Integer)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Oid)) { OidSerializer.SerializeOid((Hl7.Fhir.Model.Oid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirString)) { FhirStringSerializer.SerializeFhirString((Hl7.Fhir.Model.FhirString)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirUri)) { FhirUriSerializer.SerializeFhirUri((Hl7.Fhir.Model.FhirUri)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Uuid)) { UuidSerializer.SerializeUuid((Hl7.Fhir.Model.Uuid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.XHtml)) { XHtmlSerializer.SerializeXHtml((Hl7.Fhir.Model.XHtml)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Age)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Age)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Count)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Count)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Distance)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Distance)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Duration)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Duration)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Money)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Money)value, writer, summary); } else { throw new Exception("Encountered unknown type " + value.GetType().Name); } }
public static void SerializeDemographics(Hl7.Fhir.Model.Demographics 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 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); 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); 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); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element gender if (value.Gender != null) { writer.WriteStartElement("gender"); CodeableConceptSerializer.SerializeCodeableConcept(value.Gender, writer); writer.WriteEndElement(); } // Serialize element birthDate if (value.BirthDate != null) { writer.WriteStartElement("birthDate"); FhirDateTimeSerializer.SerializeFhirDateTime(value.BirthDate, writer); writer.WriteEndElement(); } // Serialize element deceased if (value.Deceased != null) { writer.WriteStartElement("deceased"); FhirBooleanSerializer.SerializeFhirBoolean(value.Deceased, writer); 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); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element photo if (value.Photo != null && value.Photo.Count > 0) { writer.WriteStartArrayElement("photo"); foreach (var item in value.Photo) { writer.WriteStartArrayMember("photo"); AttachmentSerializer.SerializeAttachment(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element maritalStatus if (value.MaritalStatus != null) { writer.WriteStartElement("maritalStatus"); CodeableConceptSerializer.SerializeCodeableConcept(value.MaritalStatus, writer); writer.WriteEndElement(); } // Serialize element language if (value.Language != null && value.Language.Count > 0) { writer.WriteStartArrayElement("language"); foreach (var item in value.Language) { writer.WriteStartArrayMember("language"); DemographicsSerializer.SerializeDemographicsLanguageComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }