Exemple #1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

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

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

                foreach (CodeableConcept valCategory in Category)
                {
                    valCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

                foreach (CodeableConcept valBodySite in BodySite)
                {
                    valBodySite.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (!string.IsNullOrEmpty(OnsetDateTime))
            {
                writer.WriteString("onsetDateTime", (string)OnsetDateTime !);
            }

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

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

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

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

            if (!string.IsNullOrEmpty(OnsetString))
            {
                writer.WriteString("onsetString", (string)OnsetString !);
            }

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

            if (!string.IsNullOrEmpty(AbatementDateTime))
            {
                writer.WriteString("abatementDateTime", (string)AbatementDateTime !);
            }

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

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

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

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

            if (!string.IsNullOrEmpty(AbatementString))
            {
                writer.WriteString("abatementString", (string)AbatementString !);
            }

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

            if (!string.IsNullOrEmpty(RecordedDate))
            {
                writer.WriteString("recordedDate", (string)RecordedDate !);
            }

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

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

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

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

                foreach (ConditionStage valStage in Stage)
                {
                    valStage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ConditionEvidence valEvidence in Evidence)
                {
                    valEvidence.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            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();
            }
        }
Exemple #2
0
        /// <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 (Code != null)
            {
                writer.WritePropertyName("code");
                Code.SerializeJson(writer, options);
            }

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

            if (ContributedToDeath != null)
            {
                writer.WriteBoolean("contributedToDeath", (bool)ContributedToDeath !);
            }

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

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

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

            if (!string.IsNullOrEmpty(OnsetString))
            {
                writer.WriteString("onsetString", (string)OnsetString !);
            }

            if (_OnsetString != null)
            {
                writer.WritePropertyName("_onsetString");
                _OnsetString.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();
            }
        }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

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

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (!string.IsNullOrEmpty(Type))
            {
                writer.WriteString("type", (string)Type !);
            }

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

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

                foreach (string valCategory in Category)
                {
                    writer.WriteStringValue(valCategory);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Category in _Category)
                {
                    val_Category.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Criticality))
            {
                writer.WriteString("criticality", (string)Criticality !);
            }

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

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

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

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

            if (!string.IsNullOrEmpty(OnsetDateTime))
            {
                writer.WriteString("onsetDateTime", (string)OnsetDateTime !);
            }

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

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

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

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

            if (!string.IsNullOrEmpty(OnsetString))
            {
                writer.WriteString("onsetString", (string)OnsetString !);
            }

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

            if (!string.IsNullOrEmpty(RecordedDate))
            {
                writer.WriteString("recordedDate", (string)RecordedDate !);
            }

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

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

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

            if (!string.IsNullOrEmpty(LastOccurrence))
            {
                writer.WriteString("lastOccurrence", (string)LastOccurrence !);
            }

            if (_LastOccurrence != null)
            {
                writer.WritePropertyName("_lastOccurrence");
                _LastOccurrence.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 ((Reaction != null) && (Reaction.Count != 0))
            {
                writer.WritePropertyName("reaction");
                writer.WriteStartArray();

                foreach (AllergyIntoleranceReaction valReaction in Reaction)
                {
                    valReaction.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }