public static void SerializePrescriptionDispenseComponent(Prescription.PrescriptionDispenseComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element's localId attribute if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents)) { writer.WriteRefIdContents(value.InternalId.Contents); } // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element repeats if (value.Repeats != null) { writer.WriteStartElement("repeats"); IntegerSerializer.SerializeInteger(value.Repeats, writer); writer.WriteEndElement(); } // Serialize element quantity if (value.Quantity != null) { writer.WriteStartElement("quantity"); QuantitySerializer.SerializeQuantity(value.Quantity, writer); writer.WriteEndElement(); } // Serialize element dispenser if (value.Dispenser != null) { writer.WriteStartElement("dispenser"); ResourceReferenceSerializer.SerializeResourceReference(value.Dispenser, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeRange(Hl7.Fhir.Model.Range 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 low if (value.Low != null) { writer.WriteStartElement("low"); QuantitySerializer.SerializeQuantity(value.Low, writer, summary); writer.WriteEndElement(); } // Serialize element high if (value.High != null) { writer.WriteStartElement("high"); QuantitySerializer.SerializeQuantity(value.High, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeRatio(Hl7.Fhir.Model.Ratio 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 numerator if (value.Numerator != null) { writer.WriteStartElement("numerator"); QuantitySerializer.SerializeQuantity(value.Numerator, writer, summary); writer.WriteEndElement(); } // Serialize element denominator if (value.Denominator != null) { writer.WriteStartElement("denominator"); QuantitySerializer.SerializeQuantity(value.Denominator, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeMedicationPackageContentComponent(Hl7.Fhir.Model.Medication.MedicationPackageContentComponent 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 item if (value.Item != null) { writer.WriteStartElement("item"); ResourceReferenceSerializer.SerializeResourceReference(value.Item, writer, summary); writer.WriteEndElement(); } // Serialize element amount if (value.Amount != null) { writer.WriteStartElement("amount"); QuantitySerializer.SerializeQuantity(value.Amount, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeStudy(Hl7.Fhir.Model.Study value, IFhirWriter writer) { writer.WriteStartRootObject("Study"); writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.Language != null) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.Language, writer); writer.WriteEndElement(); } // Serialize element text if (value.Text != null) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element identifier if (value.Identifier != null && value.Identifier.Count > 0) { writer.WriteStartArrayElement("identifier"); foreach (var item in value.Identifier) { writer.WriteStartArrayMember("identifier"); IdentifierSerializer.SerializeIdentifier(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element sponsor if (value.Sponsor != null) { writer.WriteStartElement("sponsor"); FhirStringSerializer.SerializeFhirString(value.Sponsor, writer); writer.WriteEndElement(); } // Serialize element title if (value.Title != null) { writer.WriteStartElement("title"); FhirStringSerializer.SerializeFhirString(value.Title, writer); writer.WriteEndElement(); } // Serialize element description if (value.Description != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.Description, writer); writer.WriteEndElement(); } // Serialize element type if (value.Type != null) { writer.WriteStartElement("type"); CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer); writer.WriteEndElement(); } // Serialize element condition if (value.Condition != null && value.Condition.Count > 0) { writer.WriteStartArrayElement("condition"); foreach (var item in value.Condition) { writer.WriteStartArrayMember("condition"); CodeableConceptSerializer.SerializeCodeableConcept(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element treatment if (value.Treatment != null && value.Treatment.Count > 0) { writer.WriteStartArrayElement("treatment"); foreach (var item in value.Treatment) { writer.WriteStartArrayMember("treatment"); StudySerializer.SerializeStudyTreatmentComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element controlType if (value.ControlType != null && value.ControlType.Count > 0) { writer.WriteStartArrayElement("controlType"); foreach (var item in value.ControlType) { writer.WriteStartArrayMember("controlType"); CodeableConceptSerializer.SerializeCodeableConcept(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element objective if (value.Objective != null && value.Objective.Count > 0) { writer.WriteStartArrayElement("objective"); foreach (var item in value.Objective) { writer.WriteStartArrayMember("objective"); FhirStringSerializer.SerializeFhirString(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element outcomeMeasure if (value.OutcomeMeasure != null && value.OutcomeMeasure.Count > 0) { writer.WriteStartArrayElement("outcomeMeasure"); foreach (var item in value.OutcomeMeasure) { writer.WriteStartArrayMember("outcomeMeasure"); FhirStringSerializer.SerializeFhirString(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element eligibility if (value.Eligibility != null && value.Eligibility.Count > 0) { writer.WriteStartArrayElement("eligibility"); foreach (var item in value.Eligibility) { writer.WriteStartArrayMember("eligibility"); ResourceReferenceSerializer.SerializeResourceReference(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element period if (value.Period != null) { writer.WriteStartElement("period"); PeriodSerializer.SerializePeriod(value.Period, writer); writer.WriteEndElement(); } // Serialize element duration if (value.Duration != null) { writer.WriteStartElement("duration"); QuantitySerializer.SerializeQuantity(value.Duration, writer); writer.WriteEndElement(); } // Serialize element plannedEnrollment if (value.PlannedEnrollment != null) { writer.WriteStartElement("plannedEnrollment"); IntegerSerializer.SerializeInteger(value.PlannedEnrollment, writer); writer.WriteEndElement(); } // Serialize element intervention if (value.Intervention != null) { writer.WriteStartElement("intervention"); StudySerializer.SerializeStudyInterventionComponent(value.Intervention, writer); writer.WriteEndElement(); } // Serialize element protocol if (value.Protocol != null && value.Protocol.Count > 0) { writer.WriteStartArrayElement("protocol"); foreach (var item in value.Protocol) { writer.WriteStartArrayMember("protocol"); ResourceReferenceSerializer.SerializeResourceReference(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element dataStructure if (value.DataStructure != null) { writer.WriteStartElement("dataStructure"); ResourceReferenceSerializer.SerializeResourceReference(value.DataStructure, writer); writer.WriteEndElement(); } // Serialize element data if (value.Data != null && value.Data.Count > 0) { writer.WriteStartArrayElement("data"); foreach (var item in value.Data) { writer.WriteStartArrayMember("data"); ResourceReferenceSerializer.SerializeResourceReference(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void SerializeSubstance(Hl7.Fhir.Model.Substance value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Substance"); 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 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 description if (value.DescriptionElement != null && !summary) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary); writer.WriteEndElement(); } // Serialize element status if (value.Status != null && !summary) { writer.WriteStartElement("status"); CodeableConceptSerializer.SerializeCodeableConcept(value.Status, writer, summary); writer.WriteEndElement(); } // Serialize element effectiveTime if (value.EffectiveTime != null && !summary) { writer.WriteStartElement("effectiveTime"); PeriodSerializer.SerializePeriod(value.EffectiveTime, writer, summary); writer.WriteEndElement(); } // Serialize element quantity if (value.Quantity != null && !summary) { writer.WriteStartElement("quantity"); QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary); writer.WriteEndElement(); } // Serialize element ingredient if (value.Ingredient != null && !summary && value.Ingredient.Count > 0) { writer.WriteStartArrayElement("ingredient"); foreach (var item in value.Ingredient) { writer.WriteStartArrayMember("ingredient"); ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element quantityMode if (value.QuantityMode != null && !summary) { writer.WriteStartElement("quantityMode"); CodeableConceptSerializer.SerializeCodeableConcept(value.QuantityMode, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void SerializePicture(Hl7.Fhir.Model.Picture value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Picture"); writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.LanguageElement != null && !summary) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.LanguageElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.Text != null && !summary) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer, summary); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && !summary && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element subject if (value.Subject != null) { writer.WriteStartElement("subject"); ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary); writer.WriteEndElement(); } // Serialize element dateTime if (value.DateTimeElement != null) { writer.WriteStartElement("dateTime"); FhirDateTimeSerializer.SerializeFhirDateTime(value.DateTimeElement, writer, summary); writer.WriteEndElement(); } // Serialize element operator if (value.Operator != null) { writer.WriteStartElement("operator"); ResourceReferenceSerializer.SerializeResourceReference(value.Operator, writer, summary); writer.WriteEndElement(); } // Serialize element identifier if (value.Identifier != null) { writer.WriteStartElement("identifier"); IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary); writer.WriteEndElement(); } // Serialize element accessionNo if (value.AccessionNo != null) { writer.WriteStartElement("accessionNo"); IdentifierSerializer.SerializeIdentifier(value.AccessionNo, writer, summary); writer.WriteEndElement(); } // Serialize element studyId if (value.StudyId != null) { writer.WriteStartElement("studyId"); IdentifierSerializer.SerializeIdentifier(value.StudyId, writer, summary); writer.WriteEndElement(); } // Serialize element seriesId if (value.SeriesId != null) { writer.WriteStartElement("seriesId"); IdentifierSerializer.SerializeIdentifier(value.SeriesId, writer, summary); writer.WriteEndElement(); } // Serialize element method if (value.Method != null) { writer.WriteStartElement("method"); CodeableConceptSerializer.SerializeCodeableConcept(value.Method, writer, summary); writer.WriteEndElement(); } // Serialize element requester if (value.Requester != null) { writer.WriteStartElement("requester"); ResourceReferenceSerializer.SerializeResourceReference(value.Requester, writer, summary); writer.WriteEndElement(); } // Serialize element modality if (value.ModalityElement != null) { writer.WriteStartElement("modality"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.Picture.PictureType>(value.ModalityElement, writer, summary); writer.WriteEndElement(); } // Serialize element deviceName if (value.DeviceNameElement != null) { writer.WriteStartElement("deviceName"); FhirStringSerializer.SerializeFhirString(value.DeviceNameElement, writer, summary); writer.WriteEndElement(); } // Serialize element height if (value.HeightElement != null) { writer.WriteStartElement("height"); IntegerSerializer.SerializeInteger(value.HeightElement, writer, summary); writer.WriteEndElement(); } // Serialize element width if (value.WidthElement != null) { writer.WriteStartElement("width"); IntegerSerializer.SerializeInteger(value.WidthElement, writer, summary); writer.WriteEndElement(); } // Serialize element bits if (value.BitsElement != null) { writer.WriteStartElement("bits"); IntegerSerializer.SerializeInteger(value.BitsElement, writer, summary); writer.WriteEndElement(); } // Serialize element frames if (value.FramesElement != null) { writer.WriteStartElement("frames"); IntegerSerializer.SerializeInteger(value.FramesElement, writer, summary); writer.WriteEndElement(); } // Serialize element frameDelay if (value.FrameDelay != null) { writer.WriteStartElement("frameDelay"); QuantitySerializer.SerializeQuantity(value.FrameDelay, writer, summary); writer.WriteEndElement(); } // Serialize element view if (value.View != null) { writer.WriteStartElement("view"); CodeableConceptSerializer.SerializeCodeableConcept(value.View, writer, summary); writer.WriteEndElement(); } // Serialize element content if (value.Content != null && !summary) { writer.WriteStartElement("content"); AttachmentSerializer.SerializeAttachment(value.Content, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void SerializeSampledData(Hl7.Fhir.Model.SampledData value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element origin if (value.Origin != null) { writer.WriteStartElement("origin"); QuantitySerializer.SerializeQuantity(value.Origin, writer, summary); writer.WriteEndElement(); } // Serialize element period if (value.PeriodElement != null) { writer.WriteStartElement("period"); FhirDecimalSerializer.SerializeFhirDecimal(value.PeriodElement, writer, summary); writer.WriteEndElement(); } // Serialize element factor if (value.FactorElement != null) { writer.WriteStartElement("factor"); FhirDecimalSerializer.SerializeFhirDecimal(value.FactorElement, writer, summary); writer.WriteEndElement(); } // Serialize element lowerLimit if (value.LowerLimitElement != null) { writer.WriteStartElement("lowerLimit"); FhirDecimalSerializer.SerializeFhirDecimal(value.LowerLimitElement, writer, summary); writer.WriteEndElement(); } // Serialize element upperLimit if (value.UpperLimitElement != null) { writer.WriteStartElement("upperLimit"); FhirDecimalSerializer.SerializeFhirDecimal(value.UpperLimitElement, writer, summary); writer.WriteEndElement(); } // Serialize element dimensions if (value.DimensionsElement != null) { writer.WriteStartElement("dimensions"); IntegerSerializer.SerializeInteger(value.DimensionsElement, writer, summary); writer.WriteEndElement(); } // Serialize element data if (value.DataElement != null) { writer.WriteStartElement("data"); FhirStringSerializer.SerializeFhirString(value.DataElement, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeMedicationAdministrationDosageComponent(Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent 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 timing if (value.Timing != null) { writer.WriteStartElement("timing"); ScheduleSerializer.SerializeSchedule(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(); }
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 SerializeProtocolStepActivityComponent(Hl7.Fhir.Model.Protocol.ProtocolStepActivityComponent 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 alternative if (value.Alternative != null && value.Alternative.Count > 0) { writer.WriteStartArrayElement("alternative"); foreach (var item in value.Alternative) { writer.WriteStartArrayMember("alternative"); IdRefSerializer.SerializeIdRef(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element component if (value.Component != null && value.Component.Count > 0) { writer.WriteStartArrayElement("component"); foreach (var item in value.Component) { writer.WriteStartArrayMember("component"); ProtocolSerializer.SerializeProtocolStepActivityComponentComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element following if (value.Following != null && value.Following.Count > 0) { writer.WriteStartArrayElement("following"); foreach (var item in value.Following) { writer.WriteStartArrayMember("following"); IdRefSerializer.SerializeIdRef(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element wait if (value.Wait != null) { writer.WriteStartElement("wait"); QuantitySerializer.SerializeQuantity(value.Wait, writer); writer.WriteEndElement(); } // Serialize element detail if (value.Detail != null) { writer.WriteStartElement("detail"); ActivityDefinitionSerializer.SerializeActivityDefinition(value.Detail, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeSpecimenCollectionComponent(Hl7.Fhir.Model.Specimen.SpecimenCollectionComponent 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 collector if (value.Collector != null) { writer.WriteStartElement("collector"); ResourceReferenceSerializer.SerializeResourceReference(value.Collector, writer, summary); writer.WriteEndElement(); } // Serialize element comment if (value.CommentElement != null && value.CommentElement.Count > 0) { writer.WriteStartArrayElement("comment"); foreach (var item in value.CommentElement) { writer.WriteStartArrayMember("comment"); FhirStringSerializer.SerializeFhirString(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element collectedTime if (value.CollectedTimeElement != null) { writer.WriteStartElement("collectedTime"); FhirDateTimeSerializer.SerializeFhirDateTime(value.CollectedTimeElement, writer, summary); writer.WriteEndElement(); } // Serialize element quantity if (value.Quantity != null) { writer.WriteStartElement("quantity"); QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary); writer.WriteEndElement(); } // Serialize element method if (value.Method != null) { writer.WriteStartElement("method"); CodeableConceptSerializer.SerializeCodeableConcept(value.Method, writer, summary); writer.WriteEndElement(); } // Serialize element sourceSite if (value.SourceSite != null) { writer.WriteStartElement("sourceSite"); CodeableConceptSerializer.SerializeCodeableConcept(value.SourceSite, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeMedicationDispenseDispenseComponent(Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element identifier if (value.Identifier != null) { writer.WriteStartElement("identifier"); IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary); writer.WriteEndElement(); } // Serialize element status if (value.StatusElement != null) { writer.WriteStartElement("status"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>(value.StatusElement, writer, summary); writer.WriteEndElement(); } // Serialize element type if (value.Type != null) { writer.WriteStartElement("type"); CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary); writer.WriteEndElement(); } // Serialize element quantity if (value.Quantity != null) { writer.WriteStartElement("quantity"); QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary); writer.WriteEndElement(); } // Serialize element medication if (value.Medication != null) { writer.WriteStartElement("medication"); ResourceReferenceSerializer.SerializeResourceReference(value.Medication, writer, summary); writer.WriteEndElement(); } // Serialize element whenPrepared if (value.WhenPrepared != null) { writer.WriteStartElement("whenPrepared"); PeriodSerializer.SerializePeriod(value.WhenPrepared, writer, summary); writer.WriteEndElement(); } // Serialize element whenHandedOver if (value.WhenHandedOver != null) { writer.WriteStartElement("whenHandedOver"); PeriodSerializer.SerializePeriod(value.WhenHandedOver, writer, summary); writer.WriteEndElement(); } // Serialize element destination if (value.Destination != null) { writer.WriteStartElement("destination"); ResourceReferenceSerializer.SerializeResourceReference(value.Destination, writer, summary); writer.WriteEndElement(); } // Serialize element receiver if (value.Receiver != null && value.Receiver.Count > 0) { writer.WriteStartArrayElement("receiver"); foreach (var item in value.Receiver) { writer.WriteStartArrayMember("receiver"); ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element dosage if (value.Dosage != null && value.Dosage.Count > 0) { writer.WriteStartArrayElement("dosage"); foreach (var item in value.Dosage) { writer.WriteStartArrayMember("dosage"); MedicationDispenseSerializer.SerializeMedicationDispenseDispenseDosageComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }
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(); }
public static void SerializeImmunization(Hl7.Fhir.Model.Immunization value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Immunization"); writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.LanguageElement != null && !summary) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.LanguageElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.Text != null && !summary) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer, summary); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && !summary && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element date if (value.DateElement != null && !summary) { writer.WriteStartElement("date"); FhirDateTimeSerializer.SerializeFhirDateTime(value.DateElement, writer, summary); writer.WriteEndElement(); } // Serialize element vaccineType if (value.VaccineType != null && !summary) { writer.WriteStartElement("vaccineType"); CodeableConceptSerializer.SerializeCodeableConcept(value.VaccineType, writer, summary); writer.WriteEndElement(); } // Serialize element subject if (value.Subject != null && !summary) { writer.WriteStartElement("subject"); ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary); writer.WriteEndElement(); } // Serialize element refusedIndicator if (value.RefusedIndicatorElement != null && !summary) { writer.WriteStartElement("refusedIndicator"); FhirBooleanSerializer.SerializeFhirBoolean(value.RefusedIndicatorElement, writer, summary); writer.WriteEndElement(); } // Serialize element reported if (value.ReportedElement != null && !summary) { writer.WriteStartElement("reported"); FhirBooleanSerializer.SerializeFhirBoolean(value.ReportedElement, writer, summary); writer.WriteEndElement(); } // Serialize element performer if (value.Performer != null && !summary) { writer.WriteStartElement("performer"); ResourceReferenceSerializer.SerializeResourceReference(value.Performer, writer, summary); writer.WriteEndElement(); } // Serialize element requester if (value.Requester != null && !summary) { writer.WriteStartElement("requester"); ResourceReferenceSerializer.SerializeResourceReference(value.Requester, writer, summary); writer.WriteEndElement(); } // Serialize element manufacturer if (value.Manufacturer != null && !summary) { writer.WriteStartElement("manufacturer"); ResourceReferenceSerializer.SerializeResourceReference(value.Manufacturer, writer, summary); writer.WriteEndElement(); } // Serialize element location if (value.Location != null && !summary) { writer.WriteStartElement("location"); ResourceReferenceSerializer.SerializeResourceReference(value.Location, writer, summary); writer.WriteEndElement(); } // Serialize element lotNumber if (value.LotNumberElement != null && !summary) { writer.WriteStartElement("lotNumber"); FhirStringSerializer.SerializeFhirString(value.LotNumberElement, writer, summary); writer.WriteEndElement(); } // Serialize element expirationDate if (value.ExpirationDateElement != null && !summary) { writer.WriteStartElement("expirationDate"); DateSerializer.SerializeDate(value.ExpirationDateElement, writer, summary); writer.WriteEndElement(); } // Serialize element site if (value.Site != null && !summary) { writer.WriteStartElement("site"); CodeableConceptSerializer.SerializeCodeableConcept(value.Site, writer, summary); writer.WriteEndElement(); } // Serialize element route if (value.Route != null && !summary) { writer.WriteStartElement("route"); CodeableConceptSerializer.SerializeCodeableConcept(value.Route, writer, summary); writer.WriteEndElement(); } // Serialize element doseQuantity if (value.DoseQuantity != null && !summary) { writer.WriteStartElement("doseQuantity"); QuantitySerializer.SerializeQuantity(value.DoseQuantity, writer, summary); writer.WriteEndElement(); } // Serialize element explanation if (value.Explanation != null && !summary) { writer.WriteStartElement("explanation"); ImmunizationSerializer.SerializeImmunizationExplanationComponent(value.Explanation, writer, summary); writer.WriteEndElement(); } // Serialize element reaction if (value.Reaction != null && !summary && value.Reaction.Count > 0) { writer.WriteStartArrayElement("reaction"); foreach (var item in value.Reaction) { writer.WriteStartArrayMember("reaction"); ImmunizationSerializer.SerializeImmunizationReactionComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element vaccinationProtocol if (value.VaccinationProtocol != null && !summary) { writer.WriteStartElement("vaccinationProtocol"); ImmunizationSerializer.SerializeImmunizationVaccinationProtocolComponent(value.VaccinationProtocol, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void 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 SerializeMedicationPrescriptionDispenseComponent(Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionDispenseComponent value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element medication if (value.Medication != null) { writer.WriteStartElement("medication"); ResourceReferenceSerializer.SerializeResourceReference(value.Medication, writer, summary); writer.WriteEndElement(); } // Serialize element validityPeriod if (value.ValidityPeriod != null) { writer.WriteStartElement("validityPeriod"); PeriodSerializer.SerializePeriod(value.ValidityPeriod, writer, summary); writer.WriteEndElement(); } // Serialize element numberOfRepeatsAllowed if (value.NumberOfRepeatsAllowedElement != null) { writer.WriteStartElement("numberOfRepeatsAllowed"); IntegerSerializer.SerializeInteger(value.NumberOfRepeatsAllowedElement, writer, summary); writer.WriteEndElement(); } // Serialize element quantity if (value.Quantity != null) { writer.WriteStartElement("quantity"); QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary); writer.WriteEndElement(); } // Serialize element expectedSupplyDuration if (value.ExpectedSupplyDuration != null) { writer.WriteStartElement("expectedSupplyDuration"); QuantitySerializer.SerializeQuantity(value.ExpectedSupplyDuration, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeProtocolStepComponent(Hl7.Fhir.Model.Protocol.ProtocolStepComponent 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 name if (value.Name != null) { writer.WriteStartElement("name"); FhirStringSerializer.SerializeFhirString(value.Name, writer); writer.WriteEndElement(); } // Serialize element description if (value.Description != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.Description, writer); writer.WriteEndElement(); } // Serialize element duration if (value.Duration != null) { writer.WriteStartElement("duration"); QuantitySerializer.SerializeQuantity(value.Duration, writer); writer.WriteEndElement(); } // Serialize element precondition if (value.Precondition != null) { writer.WriteStartElement("precondition"); ProtocolSerializer.SerializeProtocolStepPreconditionComponent(value.Precondition, writer); writer.WriteEndElement(); } // Serialize element exit if (value.Exit != null) { writer.WriteStartElement("exit"); ProtocolSerializer.SerializeProtocolStepPreconditionComponent(value.Exit, writer); writer.WriteEndElement(); } // Serialize element firstActivity if (value.FirstActivity != null) { writer.WriteStartElement("firstActivity"); IdRefSerializer.SerializeIdRef(value.FirstActivity, writer); writer.WriteEndElement(); } // Serialize element activity if (value.Activity != null && value.Activity.Count > 0) { writer.WriteStartArrayElement("activity"); foreach (var item in value.Activity) { writer.WriteStartArrayMember("activity"); ProtocolSerializer.SerializeProtocolStepActivityComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element next if (value.Next != null && value.Next.Count > 0) { writer.WriteStartArrayElement("next"); foreach (var item in value.Next) { writer.WriteStartArrayMember("next"); ProtocolSerializer.SerializeProtocolStepNextComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }
public static void SerializePrescriptionAdministrationRequestComponent(Prescription.PrescriptionAdministrationRequestComponent value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element's localId attribute if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents)) { writer.WriteRefIdContents(value.InternalId.Contents); } // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element description if (value.Description != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.Description, writer); writer.WriteEndElement(); } // Serialize element totalPeriodicDose if (value.TotalPeriodicDose != null) { writer.WriteStartElement("totalPeriodicDose"); RatioSerializer.SerializeRatio(value.TotalPeriodicDose, writer); writer.WriteEndElement(); } // Serialize element start if (value.Start != null) { writer.WriteStartElement("start"); FhirDateTimeSerializer.SerializeFhirDateTime(value.Start, writer); writer.WriteEndElement(); } // Serialize element end if (value.End != null) { writer.WriteStartElement("end"); FhirDateTimeSerializer.SerializeFhirDateTime(value.End, writer); writer.WriteEndElement(); } // Serialize element duration if (value.Duration != null) { writer.WriteStartElement("duration"); QuantitySerializer.SerializeQuantity(value.Duration, writer); writer.WriteEndElement(); } // Serialize element numberOfAdministrations if (value.NumberOfAdministrations != null) { writer.WriteStartElement("numberOfAdministrations"); IntegerSerializer.SerializeInteger(value.NumberOfAdministrations, writer); writer.WriteEndElement(); } // Serialize element dosageInstruction if (value.DosageInstruction != null && value.DosageInstruction.Count > 0) { writer.WriteStartArrayElement("dosageInstruction"); foreach (var item in value.DosageInstruction) { writer.WriteStartArrayMember("dosageInstruction"); PrescriptionSerializer.SerializePrescriptionAdministrationRequestDosageInstructionComponent(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }
public static void SerializeSpecimenContainerComponent(Hl7.Fhir.Model.Specimen.SpecimenContainerComponent value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element identifier if (value.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 description if (value.DescriptionElement != null) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary); writer.WriteEndElement(); } // Serialize element type if (value.Type != null) { writer.WriteStartElement("type"); CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary); writer.WriteEndElement(); } // Serialize element capacity if (value.Capacity != null) { writer.WriteStartElement("capacity"); QuantitySerializer.SerializeQuantity(value.Capacity, writer, summary); writer.WriteEndElement(); } // Serialize element specimenQuantity if (value.SpecimenQuantity != null) { writer.WriteStartElement("specimenQuantity"); QuantitySerializer.SerializeQuantity(value.SpecimenQuantity, writer, summary); writer.WriteEndElement(); } // Serialize element additive if (value.Additive != null) { writer.WriteStartElement("additive"); ResourceReferenceSerializer.SerializeResourceReference(value.Additive, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
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 SerializeArray(Hl7.Fhir.Model.Array value, IFhirWriter writer) { writer.WriteStartComplexContent(); // Serialize element extension if (value.Extension != null && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element _id if (value.LocalId != null) { writer.WriteStartElement("_id"); IdSerializer.SerializeId(value.LocalId, writer); writer.WriteEndElement(); } // Serialize element origin if (value.Origin != null) { writer.WriteStartElement("origin"); QuantitySerializer.SerializeQuantity(value.Origin, writer); writer.WriteEndElement(); } // Serialize element period if (value.Period != null) { writer.WriteStartElement("period"); FhirDecimalSerializer.SerializeFhirDecimal(value.Period, writer); writer.WriteEndElement(); } // Serialize element factor if (value.Factor != null) { writer.WriteStartElement("factor"); FhirDecimalSerializer.SerializeFhirDecimal(value.Factor, writer); writer.WriteEndElement(); } // Serialize element lowerLimit if (value.LowerLimit != null) { writer.WriteStartElement("lowerLimit"); FhirDecimalSerializer.SerializeFhirDecimal(value.LowerLimit, writer); writer.WriteEndElement(); } // Serialize element upperLimit if (value.UpperLimit != null) { writer.WriteStartElement("upperLimit"); FhirDecimalSerializer.SerializeFhirDecimal(value.UpperLimit, writer); writer.WriteEndElement(); } // Serialize element dimensions if (value.Dimensions != null) { writer.WriteStartElement("dimensions"); IntegerSerializer.SerializeInteger(value.Dimensions, writer); writer.WriteEndElement(); } // Serialize element data if (value.Data != null) { writer.WriteStartElement("data"); FhirStringSerializer.SerializeFhirString(value.Data, writer); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }
public static void SerializeOrderResponse(Hl7.Fhir.Model.OrderResponse value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("OrderResponse"); 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 request if (value.Request != null && !summary) { writer.WriteStartElement("request"); ResourceReferenceSerializer.SerializeResourceReference(value.Request, writer, summary); writer.WriteEndElement(); } // Serialize element date if (value.DateElement != null && !summary) { writer.WriteStartElement("date"); FhirDateTimeSerializer.SerializeFhirDateTime(value.DateElement, writer, summary); writer.WriteEndElement(); } // Serialize element who if (value.Who != null && !summary) { writer.WriteStartElement("who"); ResourceReferenceSerializer.SerializeResourceReference(value.Who, writer, summary); writer.WriteEndElement(); } // Serialize element authority if (value.Authority != null && !summary) { writer.WriteStartElement("authority"); ResourceReferenceSerializer.SerializeResourceReference(value.Authority, writer, summary); writer.WriteEndElement(); } // Serialize element cost if (value.Cost != null && !summary) { writer.WriteStartElement("cost"); QuantitySerializer.SerializeQuantity(value.Cost, writer, summary); writer.WriteEndElement(); } // Serialize element code if (value.CodeElement != null && !summary) { writer.WriteStartElement("code"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.OrderResponse.OrderOutcomeCode>(value.CodeElement, writer, summary); writer.WriteEndElement(); } // Serialize element description if (value.DescriptionElement != null && !summary) { writer.WriteStartElement("description"); FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary); writer.WriteEndElement(); } // Serialize element fulfillment if (value.Fulfillment != null && !summary && value.Fulfillment.Count > 0) { writer.WriteStartArrayElement("fulfillment"); foreach (var item in value.Fulfillment) { writer.WriteStartArrayMember("fulfillment"); ResourceReferenceSerializer.SerializeResourceReference(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(); }
internal static void SerializeElement(Element value, IFhirWriter writer, bool summary) { if (value.GetType() == typeof(Hl7.Fhir.Model.Address)) { AddressSerializer.SerializeAddress((Hl7.Fhir.Model.Address)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Attachment)) { AttachmentSerializer.SerializeAttachment((Hl7.Fhir.Model.Attachment)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Choice)) { ChoiceSerializer.SerializeChoice((Hl7.Fhir.Model.Choice)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.CodeableConcept)) { CodeableConceptSerializer.SerializeCodeableConcept((Hl7.Fhir.Model.CodeableConcept)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Coding)) { CodingSerializer.SerializeCoding((Hl7.Fhir.Model.Coding)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Contact)) { ContactSerializer.SerializeContact((Hl7.Fhir.Model.Contact)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Extension)) { ExtensionSerializer.SerializeExtension((Hl7.Fhir.Model.Extension)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.HumanName)) { HumanNameSerializer.SerializeHumanName((Hl7.Fhir.Model.HumanName)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Identifier)) { IdentifierSerializer.SerializeIdentifier((Hl7.Fhir.Model.Identifier)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Narrative)) { NarrativeSerializer.SerializeNarrative((Hl7.Fhir.Model.Narrative)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Period)) { PeriodSerializer.SerializePeriod((Hl7.Fhir.Model.Period)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Quantity)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Quantity)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Range)) { RangeSerializer.SerializeRange((Hl7.Fhir.Model.Range)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Ratio)) { RatioSerializer.SerializeRatio((Hl7.Fhir.Model.Ratio)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.ResourceReference)) { ResourceReferenceSerializer.SerializeResourceReference((Hl7.Fhir.Model.ResourceReference)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.SampledData)) { SampledDataSerializer.SerializeSampledData((Hl7.Fhir.Model.SampledData)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Schedule)) { ScheduleSerializer.SerializeSchedule((Hl7.Fhir.Model.Schedule)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Base64Binary)) { Base64BinarySerializer.SerializeBase64Binary((Hl7.Fhir.Model.Base64Binary)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirBoolean)) { FhirBooleanSerializer.SerializeFhirBoolean((Hl7.Fhir.Model.FhirBoolean)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Code)) { CodeSerializer.SerializeCode((Hl7.Fhir.Model.Code)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Date)) { DateSerializer.SerializeDate((Hl7.Fhir.Model.Date)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDateTime)) { FhirDateTimeSerializer.SerializeFhirDateTime((Hl7.Fhir.Model.FhirDateTime)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirDecimal)) { FhirDecimalSerializer.SerializeFhirDecimal((Hl7.Fhir.Model.FhirDecimal)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Id)) { IdSerializer.SerializeId((Hl7.Fhir.Model.Id)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.IdRef)) { IdRefSerializer.SerializeIdRef((Hl7.Fhir.Model.IdRef)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Instant)) { InstantSerializer.SerializeInstant((Hl7.Fhir.Model.Instant)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Integer)) { IntegerSerializer.SerializeInteger((Hl7.Fhir.Model.Integer)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Oid)) { OidSerializer.SerializeOid((Hl7.Fhir.Model.Oid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirString)) { FhirStringSerializer.SerializeFhirString((Hl7.Fhir.Model.FhirString)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.FhirUri)) { FhirUriSerializer.SerializeFhirUri((Hl7.Fhir.Model.FhirUri)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Uuid)) { UuidSerializer.SerializeUuid((Hl7.Fhir.Model.Uuid)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.XHtml)) { XHtmlSerializer.SerializeXHtml((Hl7.Fhir.Model.XHtml)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Age)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Age)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Count)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Count)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Distance)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Distance)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Duration)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Duration)value, writer, summary); } else if (value.GetType() == typeof(Hl7.Fhir.Model.Money)) { QuantitySerializer.SerializeQuantity((Hl7.Fhir.Model.Money)value, writer, summary); } else { throw new Exception("Encountered unknown type " + value.GetType().Name); } }