Exemple #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();
        }
        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();
        }
        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();
        }
Exemple #4
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();
        }
        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();
        }
Exemple #6
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 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();
        }
        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();
        }
        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 SerializeMedicationDispenseDispenseDosageComponent(Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent 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 additionalInstructions
            if (value.AdditionalInstructions != null)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("additionalInstructions", value.AdditionalInstructions.GetType()));
                FhirSerializer.SerializeElement(value.AdditionalInstructions, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemple #11
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();
        }
Exemple #12
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 SerializeCarePlanActivityComponent(Hl7.Fhir.Model.CarePlan.CarePlanActivityComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void 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 SerializePatient(Hl7.Fhir.Model.Patient value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Patient");
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Exemple #16
0
        public static void SerializeStudyInterventionComponent(Hl7.Fhir.Model.Study.StudyInterventionComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
Exemple #17
0
        public static void SerializePrescriptionAdministrationRequestDosageInstructionComponent(Prescription.PrescriptionAdministrationRequestDosageInstructionComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

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

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

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

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

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

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

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

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

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


            writer.WriteEndComplexContent();
        }
        public static void 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 SerializeMedicationPrescription(Hl7.Fhir.Model.MedicationPrescription value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("MedicationPrescription");
            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 dateWritten
            if (value.DateWrittenElement != null && !summary)
            {
                writer.WriteStartElement("dateWritten");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateWrittenElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionStatus>(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 prescriber
            if (value.Prescriber != null && !summary)
            {
                writer.WriteStartElement("prescriber");
                ResourceReferenceSerializer.SerializeResourceReference(value.Prescriber, 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 reasonForPrescribing
            if (value.ReasonForPrescribing != null && !summary)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("reasonForPrescribing", value.ReasonForPrescribing.GetType()));
                FhirSerializer.SerializeElement(value.ReasonForPrescribing, 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 dosageInstruction
            if (value.DosageInstruction != null && !summary && value.DosageInstruction.Count > 0)
            {
                writer.WriteStartArrayElement("dosageInstruction");
                foreach (var item in value.DosageInstruction)
                {
                    writer.WriteStartArrayMember("dosageInstruction");
                    MedicationPrescriptionSerializer.SerializeMedicationPrescriptionDosageInstructionComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element dispense
            if (value.Dispense != null && !summary)
            {
                writer.WriteStartElement("dispense");
                MedicationPrescriptionSerializer.SerializeMedicationPrescriptionDispenseComponent(value.Dispense, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element substitution
            if (value.Substitution != null && !summary)
            {
                writer.WriteStartElement("substitution");
                MedicationPrescriptionSerializer.SerializeMedicationPrescriptionSubstitutionComponent(value.Substitution, writer, summary);
                writer.WriteEndElement();
            }


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