示例#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 (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

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

                foreach (string valPurpose in Purpose)
                {
                    writer.WriteStringValue(valPurpose);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Purpose in _Purpose)
                {
                    val_Purpose.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

            if (!string.IsNullOrEmpty(ServicedDate))
            {
                writer.WriteString("servicedDate", (string)ServicedDate !);
            }

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

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

            if (!string.IsNullOrEmpty(Created))
            {
                writer.WriteString("created", (string)Created !);
            }

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

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

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

            if (!string.IsNullOrEmpty(Outcome))
            {
                writer.WriteString("outcome", (string)Outcome !);
            }

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

            if (!string.IsNullOrEmpty(Disposition))
            {
                writer.WriteString("disposition", (string)Disposition !);
            }

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

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

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

                foreach (CoverageEligibilityResponseInsurance valInsurance in Insurance)
                {
                    valInsurance.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(PreAuthRef))
            {
                writer.WriteString("preAuthRef", (string)PreAuthRef !);
            }

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

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

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

                foreach (CoverageEligibilityResponseError valError in Error)
                {
                    valError.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 !);
            }


            ((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 (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

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

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

                foreach (string valPurpose in Purpose)
                {
                    writer.WriteStringValue(valPurpose);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Purpose in _Purpose)
                {
                    val_Purpose.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

            if (!string.IsNullOrEmpty(ServicedDate))
            {
                writer.WriteString("servicedDate", (string)ServicedDate !);
            }

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

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

            if (!string.IsNullOrEmpty(Created))
            {
                writer.WriteString("created", (string)Created !);
            }

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

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

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

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

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

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

                foreach (CoverageEligibilityRequestSupportingInfo valSupportingInfo in SupportingInfo)
                {
                    valSupportingInfo.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CoverageEligibilityRequestInsurance valInsurance in Insurance)
                {
                    valInsurance.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CoverageEligibilityRequestItem valItem in Item)
                {
                    valItem.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 (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

            if (!string.IsNullOrEmpty(Created))
            {
                writer.WriteString("created", (string)Created !);
            }

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

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

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

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

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

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