Exemplo n.º 1
0
        public static void SerializeFamilyHistoryRelationConditionComponent(Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemplo n.º 2
0
 internal static string SerializeElementAsXml(Element elem, string name = null, bool summary = false)
 {
     return(xmlWriterToString(xw =>
     {
         xw.WriteStartElement(name == null ? "element" : name, Support.Util.FHIRNS);
         FhirSerializer.SerializeElement(elem, new XmlFhirWriter(xw), summary);
         xw.WriteEndElement();
     }));
 }
        public static void SerializeFood(Food value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Food");
            writer.WriteStartComplexContent();

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 4
0
        public static void SerializeInterestOfCare(Hl7.Fhir.Model.InterestOfCare value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("InterestOfCare");
            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();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        private static JObject getContentsAsJObject(Resource resource, bool summary)
        {
            StringWriter w = new StringWriter();

            //TODO: This would be much more efficient if we could serialize
            //the resource to a JObject directly
            FhirSerializer.SerializeResource(resource, new JsonTextWriter(w), summary);

            JsonTextReader reader = Util.JsonReaderFromString(w.ToString());

            reader.DateParseHandling = DateParseHandling.None;
            return(JObject.Load(reader));
        }
        public static void SerializeExtension(Hl7.Fhir.Model.Extension value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeGroupCharacteristicComponent(Hl7.Fhir.Model.Group.GroupCharacteristicComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemplo n.º 8
0
        public static void SerializeProtocolStepPreconditionConditionComponent(Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionConditionComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemplo n.º 9
0
        public static void SerializePrescriptionMedicineInactiveIngredientComponent(Prescription.PrescriptionMedicineInactiveIngredientComponent 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 identification
            if (value.Identification != null)
            {
                writer.WriteStartElement("identification");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Identification, writer);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeObservationReferenceRangeComponent(Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent 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 meaning
            if (value.Meaning != null)
            {
                writer.WriteStartElement("meaning");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Meaning, writer, summary);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
Exemplo n.º 11
0
        public static void SerializeFamilyHistory(Hl7.Fhir.Model.FamilyHistory value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("FamilyHistory");
            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 note
            if (value.NoteElement != null && !summary)
            {
                writer.WriteStartElement("note");
                FhirStringSerializer.SerializeFhirString(value.NoteElement, writer, summary);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 12
0
        public static void SerializeQuery(Hl7.Fhir.Model.Query value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Query");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

            // Serialize element parameter
            if (value.Parameter != null && !summary && 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 response
            if (value.Response != null && !summary)
            {
                writer.WriteStartElement("response");
                QuerySerializer.SerializeQueryResponseComponent(value.Response, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 13
0
        public static void SerializeQuestionComponent(Hl7.Fhir.Model.Questionnaire.QuestionComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeProfileBindingComponent(Hl7.Fhir.Model.Profile.ProfileBindingComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void SerializeElementDefinitionComponent(Hl7.Fhir.Model.Profile.ElementDefinitionComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 17
0
        public static void SerializeProvider(Provider value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Provider");
            writer.WriteStartComplexContent();

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

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

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

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

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

            // Serialize element 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 details
            if (value.Details != null)
            {
                writer.WriteStartElement("details");
                DemographicsSerializer.SerializeDemographics(value.Details, writer);
                writer.WriteEndElement();
            }

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 18
0
        public static void SerializeSpecimen(Hl7.Fhir.Model.Specimen value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Specimen");
            writer.WriteStartComplexContent();

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

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

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

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

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

            // Serialize element identifier
            if (value.Identifier != null && !summary)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, 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 source
            if (value.Source != null && !summary && value.Source.Count > 0)
            {
                writer.WriteStartArrayElement("source");
                foreach (var item in value.Source)
                {
                    writer.WriteStartArrayMember("source");
                    SpecimenSerializer.SerializeSpecimenSourceComponent(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 accessionIdentifier
            if (value.AccessionIdentifier != null && !summary && value.AccessionIdentifier.Count > 0)
            {
                writer.WriteStartArrayElement("accessionIdentifier");
                foreach (var item in value.AccessionIdentifier)
                {
                    writer.WriteStartArrayMember("accessionIdentifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element collection
            if (value.Collection != null && !summary)
            {
                writer.WriteStartElement("collection");
                SpecimenSerializer.SerializeSpecimenCollectionComponent(value.Collection, writer, summary);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 19
0
        public static void SerializeXdsFolder(XdsFolder value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsFolder");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 20
0
        public static void SerializeOrganization(Hl7.Fhir.Model.Organization value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Organization");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 21
0
        public static void SerializeQuestionnaire(Hl7.Fhir.Model.Questionnaire value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Questionnaire");
            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 status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 22
0
        public static void SerializeVisit(Hl7.Fhir.Model.Visit value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Visit");
            writer.WriteStartComplexContent();

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

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

            // Serialize element 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 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 status
            if (value.Status != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Visit.EncounterState>(value.Status, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Visit.EncounterClass>(value.Class, writer);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

            // Serialize element hospitalization
            if (value.Hospitalization != null)
            {
                writer.WriteStartElement("hospitalization");
                VisitSerializer.SerializeVisitHospitalizationComponent(value.Hospitalization, writer);
                writer.WriteEndElement();
            }

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeActivityDefinition(Hl7.Fhir.Model.ActivityDefinition 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 category
            if (value.Category != null)
            {
                writer.WriteStartElement("category");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ActivityDefinition.ActivityDefinitionCategory>(value.Category, writer);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemplo n.º 24
0
        public static void SerializeDocument(Hl7.Fhir.Model.Document value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Document");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 26
0
        public static void SerializeCondition(Hl7.Fhir.Model.Condition value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Condition");
            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 && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

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

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

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

            // Serialize element stage
            if (value.Stage != null && !summary)
            {
                writer.WriteStartElement("stage");
                ConditionSerializer.SerializeConditionStageComponent(value.Stage, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 28
0
        public static void SerializeDiagnosticOrder(Hl7.Fhir.Model.DiagnosticOrder value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DiagnosticOrder");
            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 && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element orderer
            if (value.Orderer != null && !summary)
            {
                writer.WriteStartElement("orderer");
                ResourceReferenceSerializer.SerializeResourceReference(value.Orderer, 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 encounter
            if (value.Encounter != null && !summary)
            {
                writer.WriteStartElement("encounter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemplo n.º 29
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();
        }
Exemplo n.º 30
0
        public static void SerializeAdverseReaction(Hl7.Fhir.Model.AdverseReaction value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("AdverseReaction");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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


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