public static void SerializeImmunizationProfileRecommendationProtocolComponent(Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent 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 doseSequence
            if (value.DoseSequenceElement != null)
            {
                writer.WriteStartElement("doseSequence");
                IntegerSerializer.SerializeInteger(value.DoseSequenceElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #2
0
        public static void SerializePrescriptionDispenseComponent(Prescription.PrescriptionDispenseComponent 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 repeats
            if (value.Repeats != null)
            {
                writer.WriteStartElement("repeats");
                IntegerSerializer.SerializeInteger(value.Repeats, writer);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
Пример #3
0
        public static void SerializeProtocolStepActivityComponentComponent(Hl7.Fhir.Model.Protocol.ProtocolStepActivityComponentComponent 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 sequence
            if (value.Sequence != null)
            {
                writer.WriteStartElement("sequence");
                IntegerSerializer.SerializeInteger(value.Sequence, writer);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
Пример #4
0
        public static void SerializeStudy(Hl7.Fhir.Model.Study value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Study");
            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 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 sponsor
            if (value.Sponsor != null)
            {
                writer.WriteStartElement("sponsor");
                FhirStringSerializer.SerializeFhirString(value.Sponsor, writer);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element treatment
            if (value.Treatment != null && value.Treatment.Count > 0)
            {
                writer.WriteStartArrayElement("treatment");
                foreach (var item in value.Treatment)
                {
                    writer.WriteStartArrayMember("treatment");
                    StudySerializer.SerializeStudyTreatmentComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

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

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

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

            // Serialize element intervention
            if (value.Intervention != null)
            {
                writer.WriteStartElement("intervention");
                StudySerializer.SerializeStudyInterventionComponent(value.Intervention, writer);
                writer.WriteEndElement();
            }

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

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

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


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

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

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

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

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

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

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

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

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

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

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

            // Serialize element modality
            if (value.Modality_Element != null && !summary && value.Modality_Element.Count > 0)
            {
                writer.WriteStartArrayElement("modality");
                foreach (var item in value.Modality_Element)
                {
                    writer.WriteStartArrayMember("modality");
                    CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.ImagingModality>(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeConformanceMessagingComponent(Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent 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 endpoint
            if (value.EndpointElement != null)
            {
                writer.WriteStartElement("endpoint");
                FhirUriSerializer.SerializeFhirUri(value.EndpointElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
        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();
        }
Пример #8
0
        public static void SerializeQueryResponseComponent(Hl7.Fhir.Model.Query.QueryResponseComponent 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 identifier
            if (value.IdentifierElement != null)
            {
                writer.WriteStartElement("identifier");
                FhirUriSerializer.SerializeFhirUri(value.IdentifierElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #9
0
        public static void SerializeAttachment(Hl7.Fhir.Model.Attachment 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 contentType
            if (value.ContentTypeElement != null)
            {
                writer.WriteStartElement("contentType");
                CodeSerializer.SerializeCode(value.ContentTypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element data
            if (value.DataElement != null)
            {
                writer.WriteStartElement("data");
                Base64BinarySerializer.SerializeBase64Binary(value.DataElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #10
0
        public static void SerializeDocumentReference(Hl7.Fhir.Model.DocumentReference value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DocumentReference");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #11
0
        public static void SerializePrescriptionAdministrationRequestComponent(Prescription.PrescriptionAdministrationRequestComponent 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 description
            if (value.Description != null)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.Description, writer);
                writer.WriteEndElement();
            }

            // Serialize element totalPeriodicDose
            if (value.TotalPeriodicDose != null)
            {
                writer.WriteStartElement("totalPeriodicDose");
                RatioSerializer.SerializeRatio(value.TotalPeriodicDose, writer);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element dosageInstruction
            if (value.DosageInstruction != null && value.DosageInstruction.Count > 0)
            {
                writer.WriteStartArrayElement("dosageInstruction");
                foreach (var item in value.DosageInstruction)
                {
                    writer.WriteStartArrayMember("dosageInstruction");
                    PrescriptionSerializer.SerializePrescriptionAdministrationRequestDosageInstructionComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            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();
        }
Пример #13
0
        public static void SerializeTest(Hl7.Fhir.Model.Test value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Test");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeMedicationPrescriptionDispenseComponent(Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionDispenseComponent 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 medication
            if (value.Medication != null)
            {
                writer.WriteStartElement("medication");
                ResourceReferenceSerializer.SerializeResourceReference(value.Medication, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #15
0
        public static void SerializePicture(Hl7.Fhir.Model.Picture value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Picture");
            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 subject
            if (value.Subject != null)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeSampledData(Hl7.Fhir.Model.SampledData 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 origin
            if (value.Origin != null)
            {
                writer.WriteStartElement("origin");
                QuantitySerializer.SerializeQuantity(value.Origin, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element period
            if (value.PeriodElement != null)
            {
                writer.WriteStartElement("period");
                FhirDecimalSerializer.SerializeFhirDecimal(value.PeriodElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element factor
            if (value.FactorElement != null)
            {
                writer.WriteStartElement("factor");
                FhirDecimalSerializer.SerializeFhirDecimal(value.FactorElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element lowerLimit
            if (value.LowerLimitElement != null)
            {
                writer.WriteStartElement("lowerLimit");
                FhirDecimalSerializer.SerializeFhirDecimal(value.LowerLimitElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element upperLimit
            if (value.UpperLimitElement != null)
            {
                writer.WriteStartElement("upperLimit");
                FhirDecimalSerializer.SerializeFhirDecimal(value.UpperLimitElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeImmunizationProfileRecommendationComponent(Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationComponent 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 recommendationDate
            if (value.RecommendationDateElement != null)
            {
                writer.WriteStartElement("recommendationDate");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.RecommendationDateElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element forecastStatus
            if (value.ForecastStatusElement != null)
            {
                writer.WriteStartElement("forecastStatus");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImmunizationProfile.ImmunizationForecastStatus>(value.ForecastStatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element protocol
            if (value.Protocol != null)
            {
                writer.WriteStartElement("protocol");
                ImmunizationProfileSerializer.SerializeImmunizationProfileRecommendationProtocolComponent(value.Protocol, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #18
0
        public static void SerializeCoverage(Hl7.Fhir.Model.Coverage value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Coverage");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeScheduleRepeatComponent(Hl7.Fhir.Model.Schedule.ScheduleRepeatComponent 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 frequency
            if (value.FrequencyElement != null)
            {
                writer.WriteStartElement("frequency");
                IntegerSerializer.SerializeInteger(value.FrequencyElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element when
            if (value.WhenElement != null)
            {
                writer.WriteStartElement("when");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Schedule.EventTiming>(value.WhenElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element duration
            if (value.DurationElement != null)
            {
                writer.WriteStartElement("duration");
                FhirDecimalSerializer.SerializeFhirDecimal(value.DurationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element units
            if (value.UnitsElement != null)
            {
                writer.WriteStartElement("units");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Schedule.UnitsOfTime>(value.UnitsElement, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeImagingStudySeriesComponent(Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #21
0
        public static void SerializeArray(Hl7.Fhir.Model.Array 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 origin
            if (value.Origin != null)
            {
                writer.WriteStartElement("origin");
                QuantitySerializer.SerializeQuantity(value.Origin, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element factor
            if (value.Factor != null)
            {
                writer.WriteStartElement("factor");
                FhirDecimalSerializer.SerializeFhirDecimal(value.Factor, writer);
                writer.WriteEndElement();
            }

            // Serialize element lowerLimit
            if (value.LowerLimit != null)
            {
                writer.WriteStartElement("lowerLimit");
                FhirDecimalSerializer.SerializeFhirDecimal(value.LowerLimit, writer);
                writer.WriteEndElement();
            }

            // Serialize element upperLimit
            if (value.UpperLimit != null)
            {
                writer.WriteStartElement("upperLimit");
                FhirDecimalSerializer.SerializeFhirDecimal(value.UpperLimit, writer);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeImagingStudySeriesInstanceComponent(Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Пример #23
0
        public static void SerializeMedia(Hl7.Fhir.Model.Media value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Media");
            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 type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Media.MediaType>(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // 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 dateTime
            if (value.DateTimeElement != null)
            {
                writer.WriteStartElement("dateTime");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateTimeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

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

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


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