Beispiel #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 ((ServiceCategory != null) && (ServiceCategory.Count != 0))
            {
                writer.WritePropertyName("serviceCategory");
                writer.WriteStartArray();

                foreach (CodeableConcept valServiceCategory in ServiceCategory)
                {
                    valServiceCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valServiceType in ServiceType)
                {
                    valServiceType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valSpecialty in Specialty)
                {
                    valSpecialty.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

            if (!string.IsNullOrEmpty(Start))
            {
                writer.WriteString("start", (string)Start !);
            }

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

            if (!string.IsNullOrEmpty(End))
            {
                writer.WriteString("end", (string)End !);
            }

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

            if (Overbooked != null)
            {
                writer.WriteBoolean("overbooked", (bool)Overbooked !);
            }

            if (!string.IsNullOrEmpty(Comment))
            {
                writer.WriteString("comment", (string)Comment !);
            }

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Beispiel #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 (CancelationReason != null)
            {
                writer.WritePropertyName("cancelationReason");
                CancelationReason.SerializeJson(writer, options);
            }

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

                foreach (CodeableConcept valServiceCategory in ServiceCategory)
                {
                    valServiceCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valServiceType in ServiceType)
                {
                    valServiceType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valSpecialty in Specialty)
                {
                    valSpecialty.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Priority != null)
            {
                writer.WriteNumber("priority", (uint)Priority !);
            }

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

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

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

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

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Start))
            {
                writer.WriteString("start", (string)Start !);
            }

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

            if (!string.IsNullOrEmpty(End))
            {
                writer.WriteString("end", (string)End !);
            }

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

            if (MinutesDuration != null)
            {
                writer.WriteNumber("minutesDuration", (uint)MinutesDuration !);
            }

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

                foreach (Reference valSlot in Slot)
                {
                    valSlot.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (!string.IsNullOrEmpty(Comment))
            {
                writer.WriteString("comment", (string)Comment !);
            }

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

            if (!string.IsNullOrEmpty(PatientInstruction))
            {
                writer.WriteString("patientInstruction", (string)PatientInstruction !);
            }

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

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

                foreach (Reference valBasedOn in BasedOn)
                {
                    valBasedOn.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (AppointmentParticipant valParticipant in Participant)
                {
                    valParticipant.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Period valRequestedPeriod in RequestedPeriod)
                {
                    valRequestedPeriod.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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