示例#1
0
        /// <summary>
        /// Deserialize JSON into a FHIR Organization#Contact
        /// </summary>
        public static void DeserializeJsonProperty(this Organization.ContactComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "purpose":
                current.Purpose = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Purpose).DeserializeJson(ref reader, options);
                break;

            case "name":
                current.Name = new Hl7.Fhir.Model.HumanName();
                ((Hl7.Fhir.Model.HumanName)current.Name).DeserializeJson(ref reader, options);
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"ContactComponent error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"ContactComponent error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "address":
                current.Address = new Hl7.Fhir.Model.Address();
                ((Hl7.Fhir.Model.Address)current.Address).DeserializeJson(ref reader, options);
                break;

            // Complex: contact, Export: ContactComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Deserialize JSON into a FHIR CareTeam
        /// </summary>
        public static void DeserializeJsonProperty(this CareTeam current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.CareTeam.CareTeamStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.CareTeam.CareTeamStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'category' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Category = new Hl7.Fhir.Model.CodeableConcept();
                    v_Category.DeserializeJson(ref reader, options);
                    current.Category.Add(v_Category);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'category' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Category.Count == 0)
                {
                    current.Category = null;
                }
                break;

            case "name":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.NameElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.NameElement = new FhirString(reader.GetString());
                }
                break;

            case "_name":
                if (current.NameElement == null)
                {
                    current.NameElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.NameElement).DeserializeJson(ref reader, options);
                break;

            case "subject":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "encounter":
                current.Encounter = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Encounter).DeserializeJson(ref reader, options);
                break;

            case "period":
                current.Period = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options);
                break;

            case "participant":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'participant' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Participant = new List <CareTeam.ParticipantComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CareTeam.ParticipantComponent v_Participant = new Hl7.Fhir.Model.CareTeam.ParticipantComponent();
                    v_Participant.DeserializeJson(ref reader, options);
                    current.Participant.Add(v_Participant);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'participant' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Participant.Count == 0)
                {
                    current.Participant = null;
                }
                break;

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'reasonCode' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.ReasonCode = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_ReasonCode = new Hl7.Fhir.Model.CodeableConcept();
                    v_ReasonCode.DeserializeJson(ref reader, options);
                    current.ReasonCode.Add(v_ReasonCode);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'reasonCode' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.ReasonCode.Count == 0)
                {
                    current.ReasonCode = null;
                }
                break;

            case "reasonReference":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'reasonReference' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.ReasonReference = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_ReasonReference = new Hl7.Fhir.Model.ResourceReference();
                    v_ReasonReference.DeserializeJson(ref reader, options);
                    current.ReasonReference.Add(v_ReasonReference);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'reasonReference' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.ReasonReference.Count == 0)
                {
                    current.ReasonReference = null;
                }
                break;

            case "managingOrganization":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'managingOrganization' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.ManagingOrganization = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_ManagingOrganization = new Hl7.Fhir.Model.ResourceReference();
                    v_ManagingOrganization.DeserializeJson(ref reader, options);
                    current.ManagingOrganization.Add(v_ManagingOrganization);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'managingOrganization' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.ManagingOrganization.Count == 0)
                {
                    current.ManagingOrganization = null;
                }
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CareTeam error reading 'note' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Annotation v_Note = new Hl7.Fhir.Model.Annotation();
                    v_Note.DeserializeJson(ref reader, options);
                    current.Note.Add(v_Note);

                    if (!reader.Read())
                    {
                        throw new JsonException($"CareTeam error reading 'note' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Note.Count == 0)
                {
                    current.Note = null;
                }
                break;

            // Complex: CareTeam, Export: CareTeam, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#3
0
        /// <summary>
        /// Deserialize JSON into a FHIR Organization
        /// </summary>
        public static void DeserializeJsonProperty(this Organization current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "active":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ActiveElement = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.ActiveElement = new FhirBoolean(reader.GetBoolean());
                }
                break;

            case "_active":
                if (current.ActiveElement == null)
                {
                    current.ActiveElement = new FhirBoolean();
                }
                ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options);
                break;

            case "type":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'type' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Type = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Type = new Hl7.Fhir.Model.CodeableConcept();
                    v_Type.DeserializeJson(ref reader, options);
                    current.Type.Add(v_Type);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'type' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Type.Count == 0)
                {
                    current.Type = null;
                }
                break;

            case "name":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.NameElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.NameElement = new FhirString(reader.GetString());
                }
                break;

            case "_name":
                if (current.NameElement == null)
                {
                    current.NameElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.NameElement).DeserializeJson(ref reader, options);
                break;

            case "alias":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.AliasElement = new List <FhirString>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        current.AliasElement.Add(new FhirString());
                        reader.Skip();
                    }
                    else
                    {
                        current.AliasElement.Add(new FhirString(reader.GetString()));
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.AliasElement.Count == 0)
                {
                    current.AliasElement = null;
                }
                break;

            case "_alias":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                int i_alias = 0;

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (i_alias >= current.AliasElement.Count)
                    {
                        current.AliasElement.Add(new FhirString());
                    }
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        reader.Skip();
                    }
                    else
                    {
                        ((Hl7.Fhir.Model.Element)current.AliasElement[i_alias++]).DeserializeJson(ref reader, options);
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "address":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'address' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Address = new List <Address>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Address v_Address = new Hl7.Fhir.Model.Address();
                    v_Address.DeserializeJson(ref reader, options);
                    current.Address.Add(v_Address);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'address' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Address.Count == 0)
                {
                    current.Address = null;
                }
                break;

            case "partOf":
                current.PartOf = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.PartOf).DeserializeJson(ref reader, options);
                break;

            case "contact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'contact' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Contact = new List <Organization.ContactComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Organization.ContactComponent v_Contact = new Hl7.Fhir.Model.Organization.ContactComponent();
                    v_Contact.DeserializeJson(ref reader, options);
                    current.Contact.Add(v_Contact);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'contact' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Contact.Count == 0)
                {
                    current.Contact = null;
                }
                break;

            case "endpoint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Organization error reading 'endpoint' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Endpoint = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Endpoint = new Hl7.Fhir.Model.ResourceReference();
                    v_Endpoint.DeserializeJson(ref reader, options);
                    current.Endpoint.Add(v_Endpoint);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Organization error reading 'endpoint' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Endpoint.Count == 0)
                {
                    current.Endpoint = null;
                }
                break;

            // Complex: Organization, Export: Organization, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#4
0
        /// <summary>
        /// Deserialize JSON into a FHIR OrganizationAffiliation
        /// </summary>
        public static void DeserializeJsonProperty(this OrganizationAffiliation current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "active":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ActiveElement = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.ActiveElement = new FhirBoolean(reader.GetBoolean());
                }
                break;

            case "_active":
                if (current.ActiveElement == null)
                {
                    current.ActiveElement = new FhirBoolean();
                }
                ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options);
                break;

            case "period":
                current.Period = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options);
                break;

            case "organization":
                current.Organization = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Organization).DeserializeJson(ref reader, options);
                break;

            case "participatingOrganization":
                current.ParticipatingOrganization = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.ParticipatingOrganization).DeserializeJson(ref reader, options);
                break;

            case "network":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'network' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Network = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Network = new Hl7.Fhir.Model.ResourceReference();
                    v_Network.DeserializeJson(ref reader, options);
                    current.Network.Add(v_Network);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'network' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Network.Count == 0)
                {
                    current.Network = null;
                }
                break;

            case "code":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'code' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Code = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Code = new Hl7.Fhir.Model.CodeableConcept();
                    v_Code.DeserializeJson(ref reader, options);
                    current.Code.Add(v_Code);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'code' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Code.Count == 0)
                {
                    current.Code = null;
                }
                break;

            case "specialty":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'specialty' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Specialty = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Specialty = new Hl7.Fhir.Model.CodeableConcept();
                    v_Specialty.DeserializeJson(ref reader, options);
                    current.Specialty.Add(v_Specialty);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'specialty' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Specialty.Count == 0)
                {
                    current.Specialty = null;
                }
                break;

            case "location":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'location' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Location = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Location = new Hl7.Fhir.Model.ResourceReference();
                    v_Location.DeserializeJson(ref reader, options);
                    current.Location.Add(v_Location);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'location' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Location.Count == 0)
                {
                    current.Location = null;
                }
                break;

            case "healthcareService":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'healthcareService' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.HealthcareService = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_HealthcareService = new Hl7.Fhir.Model.ResourceReference();
                    v_HealthcareService.DeserializeJson(ref reader, options);
                    current.HealthcareService.Add(v_HealthcareService);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'healthcareService' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.HealthcareService.Count == 0)
                {
                    current.HealthcareService = null;
                }
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "endpoint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"OrganizationAffiliation error reading 'endpoint' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Endpoint = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Endpoint = new Hl7.Fhir.Model.ResourceReference();
                    v_Endpoint.DeserializeJson(ref reader, options);
                    current.Endpoint.Add(v_Endpoint);

                    if (!reader.Read())
                    {
                        throw new JsonException($"OrganizationAffiliation error reading 'endpoint' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Endpoint.Count == 0)
                {
                    current.Endpoint = null;
                }
                break;

            // Complex: OrganizationAffiliation, Export: OrganizationAffiliation, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#5
0
        /// <summary>
        /// Deserialize JSON into a FHIR Location
        /// </summary>
        public static void DeserializeJsonProperty(this Location current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Location.LocationStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Location.LocationStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Location.LocationStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Location.LocationStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "operationalStatus":
                current.OperationalStatus = new Hl7.Fhir.Model.Coding();
                ((Hl7.Fhir.Model.Coding)current.OperationalStatus).DeserializeJson(ref reader, options);
                break;

            case "name":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.NameElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.NameElement = new FhirString(reader.GetString());
                }
                break;

            case "_name":
                if (current.NameElement == null)
                {
                    current.NameElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.NameElement).DeserializeJson(ref reader, options);
                break;

            case "alias":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.AliasElement = new List <FhirString>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        current.AliasElement.Add(new FhirString());
                        reader.Skip();
                    }
                    else
                    {
                        current.AliasElement.Add(new FhirString(reader.GetString()));
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.AliasElement.Count == 0)
                {
                    current.AliasElement = null;
                }
                break;

            case "_alias":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'alias' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                int i_alias = 0;

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (i_alias >= current.AliasElement.Count)
                    {
                        current.AliasElement.Add(new FhirString());
                    }
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        reader.Skip();
                    }
                    else
                    {
                        ((Hl7.Fhir.Model.Element)current.AliasElement[i_alias++]).DeserializeJson(ref reader, options);
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'alias' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }
                break;

            case "description":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DescriptionElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.DescriptionElement = new FhirString(reader.GetString());
                }
                break;

            case "_description":
                if (current.DescriptionElement == null)
                {
                    current.DescriptionElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.DescriptionElement).DeserializeJson(ref reader, options);
                break;

            case "mode":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ModeElement = new Code <Hl7.Fhir.Model.Location.LocationMode>();
                    reader.Skip();
                }
                else
                {
                    current.ModeElement = new Code <Hl7.Fhir.Model.Location.LocationMode>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Location.LocationMode>(reader.GetString()));
                }
                break;

            case "_mode":
                if (current.ModeElement == null)
                {
                    current.ModeElement = new Code <Hl7.Fhir.Model.Location.LocationMode>();
                }
                ((Hl7.Fhir.Model.Element)current.ModeElement).DeserializeJson(ref reader, options);
                break;

            case "type":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'type' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Type = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Type = new Hl7.Fhir.Model.CodeableConcept();
                    v_Type.DeserializeJson(ref reader, options);
                    current.Type.Add(v_Type);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'type' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Type.Count == 0)
                {
                    current.Type = null;
                }
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "address":
                current.Address = new Hl7.Fhir.Model.Address();
                ((Hl7.Fhir.Model.Address)current.Address).DeserializeJson(ref reader, options);
                break;

            case "physicalType":
                current.PhysicalType = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.PhysicalType).DeserializeJson(ref reader, options);
                break;

            case "position":
                current.Position = new Hl7.Fhir.Model.Location.PositionComponent();
                ((Hl7.Fhir.Model.Location.PositionComponent)current.Position).DeserializeJson(ref reader, options);
                break;

            case "managingOrganization":
                current.ManagingOrganization = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.ManagingOrganization).DeserializeJson(ref reader, options);
                break;

            case "partOf":
                current.PartOf = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.PartOf).DeserializeJson(ref reader, options);
                break;

            case "hoursOfOperation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'hoursOfOperation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.HoursOfOperation = new List <Location.HoursOfOperationComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Location.HoursOfOperationComponent v_HoursOfOperation = new Hl7.Fhir.Model.Location.HoursOfOperationComponent();
                    v_HoursOfOperation.DeserializeJson(ref reader, options);
                    current.HoursOfOperation.Add(v_HoursOfOperation);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'hoursOfOperation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.HoursOfOperation.Count == 0)
                {
                    current.HoursOfOperation = null;
                }
                break;

            case "availabilityExceptions":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.AvailabilityExceptionsElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.AvailabilityExceptionsElement = new FhirString(reader.GetString());
                }
                break;

            case "_availabilityExceptions":
                if (current.AvailabilityExceptionsElement == null)
                {
                    current.AvailabilityExceptionsElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.AvailabilityExceptionsElement).DeserializeJson(ref reader, options);
                break;

            case "endpoint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Location error reading 'endpoint' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Endpoint = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Endpoint = new Hl7.Fhir.Model.ResourceReference();
                    v_Endpoint.DeserializeJson(ref reader, options);
                    current.Endpoint.Add(v_Endpoint);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Location error reading 'endpoint' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Endpoint.Count == 0)
                {
                    current.Endpoint = null;
                }
                break;

            // Complex: Location, Export: Location, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#6
0
        /// <summary>
        /// Deserialize JSON into a FHIR Endpoint
        /// </summary>
        public static void DeserializeJsonProperty(this Endpoint current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Endpoint.EndpointStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Endpoint.EndpointStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Endpoint.EndpointStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Endpoint.EndpointStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "connectionType":
                current.ConnectionType = new Hl7.Fhir.Model.Coding();
                ((Hl7.Fhir.Model.Coding)current.ConnectionType).DeserializeJson(ref reader, options);
                break;

            case "name":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.NameElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.NameElement = new FhirString(reader.GetString());
                }
                break;

            case "_name":
                if (current.NameElement == null)
                {
                    current.NameElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.NameElement).DeserializeJson(ref reader, options);
                break;

            case "managingOrganization":
                current.ManagingOrganization = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.ManagingOrganization).DeserializeJson(ref reader, options);
                break;

            case "contact":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'contact' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Contact = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Contact = new Hl7.Fhir.Model.ContactPoint();
                    v_Contact.DeserializeJson(ref reader, options);
                    current.Contact.Add(v_Contact);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'contact' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Contact.Count == 0)
                {
                    current.Contact = null;
                }
                break;

            case "period":
                current.Period = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options);
                break;

            case "payloadType":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'payloadType' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.PayloadType = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_PayloadType = new Hl7.Fhir.Model.CodeableConcept();
                    v_PayloadType.DeserializeJson(ref reader, options);
                    current.PayloadType.Add(v_PayloadType);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'payloadType' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.PayloadType.Count == 0)
                {
                    current.PayloadType = null;
                }
                break;

            case "payloadMimeType":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'payloadMimeType' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.PayloadMimeTypeElement = new List <Code>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        current.PayloadMimeTypeElement.Add(new Code());
                        reader.Skip();
                    }
                    else
                    {
                        current.PayloadMimeTypeElement.Add(new Code(reader.GetString()));
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'payloadMimeType' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.PayloadMimeTypeElement.Count == 0)
                {
                    current.PayloadMimeTypeElement = null;
                }
                break;

            case "_payloadMimeType":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'payloadMimeType' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                int i_payloadMimeType = 0;

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (i_payloadMimeType >= current.PayloadMimeTypeElement.Count)
                    {
                        current.PayloadMimeTypeElement.Add(new Code());
                    }
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        reader.Skip();
                    }
                    else
                    {
                        ((Hl7.Fhir.Model.Element)current.PayloadMimeTypeElement[i_payloadMimeType++]).DeserializeJson(ref reader, options);
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'payloadMimeType' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }
                break;

            case "address":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.AddressElement = new FhirUrl();
                    reader.Skip();
                }
                else
                {
                    current.AddressElement = new FhirUrl(reader.GetString());
                }
                break;

            case "_address":
                if (current.AddressElement == null)
                {
                    current.AddressElement = new FhirUrl();
                }
                ((Hl7.Fhir.Model.Element)current.AddressElement).DeserializeJson(ref reader, options);
                break;

            case "header":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'header' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.HeaderElement = new List <FhirString>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        current.HeaderElement.Add(new FhirString());
                        reader.Skip();
                    }
                    else
                    {
                        current.HeaderElement.Add(new FhirString(reader.GetString()));
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'header' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.HeaderElement.Count == 0)
                {
                    current.HeaderElement = null;
                }
                break;

            case "_header":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Endpoint error reading 'header' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                int i_header = 0;

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    if (i_header >= current.HeaderElement.Count)
                    {
                        current.HeaderElement.Add(new FhirString());
                    }
                    if (reader.TokenType == JsonTokenType.Null)
                    {
                        reader.Skip();
                    }
                    else
                    {
                        ((Hl7.Fhir.Model.Element)current.HeaderElement[i_header++]).DeserializeJson(ref reader, options);
                    }

                    if (!reader.Read())
                    {
                        throw new JsonException($"Endpoint error reading 'header' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }
                break;

            // Complex: Endpoint, Export: Endpoint, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#7
0
        /// <summary>
        /// Deserialize JSON into a FHIR Practitioner
        /// </summary>
        public static void DeserializeJsonProperty(this Practitioner current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "active":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ActiveElement = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.ActiveElement = new FhirBoolean(reader.GetBoolean());
                }
                break;

            case "_active":
                if (current.ActiveElement == null)
                {
                    current.ActiveElement = new FhirBoolean();
                }
                ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options);
                break;

            case "name":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'name' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Name = new List <HumanName>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.HumanName v_Name = new Hl7.Fhir.Model.HumanName();
                    v_Name.DeserializeJson(ref reader, options);
                    current.Name.Add(v_Name);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'name' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Name.Count == 0)
                {
                    current.Name = null;
                }
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "address":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'address' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Address = new List <Address>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Address v_Address = new Hl7.Fhir.Model.Address();
                    v_Address.DeserializeJson(ref reader, options);
                    current.Address.Add(v_Address);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'address' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Address.Count == 0)
                {
                    current.Address = null;
                }
                break;

            case "gender":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>();
                    reader.Skip();
                }
                else
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AdministrativeGender>(reader.GetString()));
                }
                break;

            case "_gender":
                if (current.GenderElement == null)
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>();
                }
                ((Hl7.Fhir.Model.Element)current.GenderElement).DeserializeJson(ref reader, options);
                break;

            case "birthDate":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.BirthDateElement = new Date();
                    reader.Skip();
                }
                else
                {
                    current.BirthDateElement = new Date(reader.GetString());
                }
                break;

            case "_birthDate":
                if (current.BirthDateElement == null)
                {
                    current.BirthDateElement = new Date();
                }
                ((Hl7.Fhir.Model.Element)current.BirthDateElement).DeserializeJson(ref reader, options);
                break;

            case "photo":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'photo' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Photo = new List <Attachment>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Attachment v_Photo = new Hl7.Fhir.Model.Attachment();
                    v_Photo.DeserializeJson(ref reader, options);
                    current.Photo.Add(v_Photo);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'photo' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Photo.Count == 0)
                {
                    current.Photo = null;
                }
                break;

            case "qualification":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'qualification' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Qualification = new List <Practitioner.QualificationComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Practitioner.QualificationComponent v_Qualification = new Hl7.Fhir.Model.Practitioner.QualificationComponent();
                    v_Qualification.DeserializeJson(ref reader, options);
                    current.Qualification.Add(v_Qualification);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'qualification' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Qualification.Count == 0)
                {
                    current.Qualification = null;
                }
                break;

            case "communication":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Practitioner error reading 'communication' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Communication = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Communication = new Hl7.Fhir.Model.CodeableConcept();
                    v_Communication.DeserializeJson(ref reader, options);
                    current.Communication.Add(v_Communication);

                    if (!reader.Read())
                    {
                        throw new JsonException($"Practitioner error reading 'communication' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Communication.Count == 0)
                {
                    current.Communication = null;
                }
                break;

            // Complex: Practitioner, Export: Practitioner, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
示例#8
0
        /// <summary>
        /// Deserialize JSON into a FHIR Patient#Contact
        /// </summary>
        public static void DeserializeJsonProperty(this Patient.ContactComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "relationship":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"ContactComponent error reading 'relationship' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Relationship = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CodeableConcept v_Relationship = new Hl7.Fhir.Model.CodeableConcept();
                    v_Relationship.DeserializeJson(ref reader, options);
                    current.Relationship.Add(v_Relationship);

                    if (!reader.Read())
                    {
                        throw new JsonException($"ContactComponent error reading 'relationship' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Relationship.Count == 0)
                {
                    current.Relationship = null;
                }
                break;

            case "name":
                current.Name = new Hl7.Fhir.Model.HumanName();
                ((Hl7.Fhir.Model.HumanName)current.Name).DeserializeJson(ref reader, options);
                break;

            case "telecom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"ContactComponent error reading 'telecom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Telecom = new List <ContactPoint>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ContactPoint v_Telecom = new Hl7.Fhir.Model.ContactPoint();
                    v_Telecom.DeserializeJson(ref reader, options);
                    current.Telecom.Add(v_Telecom);

                    if (!reader.Read())
                    {
                        throw new JsonException($"ContactComponent error reading 'telecom' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Telecom.Count == 0)
                {
                    current.Telecom = null;
                }
                break;

            case "address":
                current.Address = new Hl7.Fhir.Model.Address();
                ((Hl7.Fhir.Model.Address)current.Address).DeserializeJson(ref reader, options);
                break;

            case "gender":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>();
                    reader.Skip();
                }
                else
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.AdministrativeGender>(reader.GetString()));
                }
                break;

            case "_gender":
                if (current.GenderElement == null)
                {
                    current.GenderElement = new Code <Hl7.Fhir.Model.AdministrativeGender>();
                }
                ((Hl7.Fhir.Model.Element)current.GenderElement).DeserializeJson(ref reader, options);
                break;

            case "organization":
                current.Organization = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Organization).DeserializeJson(ref reader, options);
                break;

            case "period":
                current.Period = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options);
                break;

            // Complex: contact, Export: ContactComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }