コード例 #1
0
ファイル: MessageHeader.cs プロジェクト: trifork/fhir-codegen
        /// <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 (EventCoding != null)
            {
                writer.WritePropertyName("eventCoding");
                EventCoding.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(EventUri))
            {
                writer.WriteString("eventUri", (string)EventUri !);
            }

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

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

                foreach (MessageHeaderDestination valDestination in Destination)
                {
                    valDestination.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

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

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

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

                foreach (Reference valFocus in Focus)
                {
                    valFocus.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Definition))
            {
                writer.WriteString("definition", (string)Definition !);
            }

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
コード例 #2
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 (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();
            }
        }
コード例 #3
0
ファイル: ChargeItem.cs プロジェクト: trifork/fhir-codegen
        /// <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 ((DefinitionUri != null) && (DefinitionUri.Count != 0))
            {
                writer.WritePropertyName("definitionUri");
                writer.WriteStartArray();

                foreach (string valDefinitionUri in DefinitionUri)
                {
                    writer.WriteStringValue(valDefinitionUri);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_DefinitionUri in _DefinitionUri)
                {
                    val_DefinitionUri.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valDefinitionCanonical in DefinitionCanonical)
                {
                    writer.WriteStringValue(valDefinitionCanonical);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_DefinitionCanonical in _DefinitionCanonical)
                {
                    val_DefinitionCanonical.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 ((PartOf != null) && (PartOf.Count != 0))
            {
                writer.WritePropertyName("partOf");
                writer.WriteStartArray();

                foreach (Reference valPartOf in PartOf)
                {
                    valPartOf.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

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

                foreach (ChargeItemPerformer valPerformer in Performer)
                {
                    valPerformer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.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 (FactorOverride != null)
            {
                writer.WriteNumber("factorOverride", (decimal)FactorOverride !);
            }

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

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

            if (!string.IsNullOrEmpty(OverrideReason))
            {
                writer.WriteString("overrideReason", (string)OverrideReason !);
            }

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

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

            if (!string.IsNullOrEmpty(EnteredDate))
            {
                writer.WriteString("enteredDate", (string)EnteredDate !);
            }

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

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

                foreach (CodeableConcept valReason in Reason)
                {
                    valReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valService in Service)
                {
                    valService.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

                foreach (Reference valAccount in Account)
                {
                    valAccount.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 ((SupportingInformation != null) && (SupportingInformation.Count != 0))
            {
                writer.WritePropertyName("supportingInformation");
                writer.WriteStartArray();

                foreach (Reference valSupportingInformation in SupportingInformation)
                {
                    valSupportingInformation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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