示例#1
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as AllergyIntoleranceEventComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Substance != null)
                    {
                        dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopy();
                    }
                    if (CertaintyElement != null)
                    {
                        dest.CertaintyElement = (Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCertainty>)CertaintyElement.DeepCopy();
                    }
                    if (Manifestation != null)
                    {
                        dest.Manifestation = new List <Hl7.Fhir.Model.CodeableConcept>(Manifestation.DeepCopy());
                    }
                    if (DescriptionElement != null)
                    {
                        dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                    }
                    if (OnsetElement != null)
                    {
                        dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopy();
                    }
                    if (Duration != null)
                    {
                        dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopy();
                    }
                    if (SeverityElement != null)
                    {
                        dest.SeverityElement = (Code <Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>)SeverityElement.DeepCopy();
                    }
                    if (ExposureRoute != null)
                    {
                        dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopy();
                    }
                    if (CommentElement != null)
                    {
                        dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (Substance != null)
            {
                writer.WritePropertyName("substance");
                Substance.SerializeJson(writer, options);
            }

            if ((Manifestation != null) && (Manifestation.Count != 0))
            {
                writer.WritePropertyName("manifestation");
                writer.WriteStartArray();

                foreach (CodeableConcept valManifestation in Manifestation)
                {
                    valManifestation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

            if (_Description != null)
            {
                writer.WritePropertyName("_description");
                _Description.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Onset))
            {
                writer.WriteString("onset", (string)Onset !);
            }

            if (_Onset != null)
            {
                writer.WritePropertyName("_onset");
                _Onset.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Severity))
            {
                writer.WriteString("severity", (string)Severity !);
            }

            if (_Severity != null)
            {
                writer.WritePropertyName("_severity");
                _Severity.SerializeJson(writer, options);
            }

            if (ExposureRoute != null)
            {
                writer.WritePropertyName("exposureRoute");
                ExposureRoute.SerializeJson(writer, options);
            }

            if ((Note != null) && (Note.Count != 0))
            {
                writer.WritePropertyName("note");
                writer.WriteStartArray();

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
      public override IDeepCopyable CopyTo(IDeepCopyable other)
      {
        var dest = other as ReactionComponent;

        if (dest == null)
        {
          throw new ArgumentException("Can only copy to an object of the same type", "other");
        }

        base.CopyTo(dest);
        if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopy();
        if(Manifestation != null) dest.Manifestation = new List<Hl7.Fhir.Model.CodeableConcept>(Manifestation.DeepCopy());
        if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
        if(OnsetElement != null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopy();
        if(SeverityElement != null) dest.SeverityElement = (Code<Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity>)SeverityElement.DeepCopy();
        if(ExposureRoute != null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopy();
        if(Note != null) dest.Note = new List<Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
        return dest;
      }