Ejemplo n.º 1
0
        /// <summary>
        /// Deserialize JSON into a FHIR Condition#Stage
        /// </summary>
        public static void DeserializeJsonProperty(this Condition.StageComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "summary":
                current.Summary = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Summary).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

            // Complex: stage, Export: StageComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deserialize JSON into a FHIR ClinicalImpression#Investigation
        /// </summary>
        public static void DeserializeJsonProperty(this ClinicalImpression.InvestigationComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "code":
                current.Code = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

            // Complex: investigation, Export: InvestigationComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deserialize JSON into a FHIR DeviceUseStatement
        /// </summary>
        public static void DeserializeJsonProperty(this DeviceUseStatement current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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 "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceUseStatement error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).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 "derivedFrom":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceUseStatement error reading 'derivedFrom' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

            case "timingDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Timing = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Timing = new FhirDateTime(reader.GetString());
                }
                break;

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

            case "recordedOn":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.RecordedOnElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.RecordedOnElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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($"DeviceUseStatement 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($"DeviceUseStatement 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 "bodySite":
                current.BodySite = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.BodySite).DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceUseStatement 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($"DeviceUseStatement 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: DeviceUseStatement, Export: DeviceUseStatement, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Deserialize JSON into a FHIR DetectedIssue#Evidence
        /// </summary>
        public static void DeserializeJsonProperty(this DetectedIssue.EvidenceComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "code":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"EvidenceComponent 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($"EvidenceComponent 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 "detail":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"EvidenceComponent error reading 'detail' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

            // Complex: evidence, Export: EvidenceComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize JSON into a FHIR BiologicallyDerivedProduct
        /// </summary>
        public static void DeserializeJsonProperty(this BiologicallyDerivedProduct current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"BiologicallyDerivedProduct 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($"BiologicallyDerivedProduct 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 "productCategory":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ProductCategoryElement = new Code <Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory>();
                    reader.Skip();
                }
                else
                {
                    current.ProductCategoryElement = new Code <Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory>(reader.GetString()));
                }
                break;

            case "_productCategory":
                if (current.ProductCategoryElement == null)
                {
                    current.ProductCategoryElement = new Code <Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCategory>();
                }
                ((Hl7.Fhir.Model.Element)current.ProductCategoryElement).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

            case "quantity":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.QuantityElement = new Integer();
                    reader.Skip();
                }
                else
                {
                    current.QuantityElement = new Integer(reader.GetInt32());
                }
                break;

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

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

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

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

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

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

            case "collection":
                current.Collection = new Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent();
                ((Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)current.Collection).DeserializeJson(ref reader, options);
                break;

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

                current.Processing = new List <BiologicallyDerivedProduct.ProcessingComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.BiologicallyDerivedProduct.ProcessingComponent v_Processing = new Hl7.Fhir.Model.BiologicallyDerivedProduct.ProcessingComponent();
                    v_Processing.DeserializeJson(ref reader, options);
                    current.Processing.Add(v_Processing);

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

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

            case "manipulation":
                current.Manipulation = new Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent();
                ((Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)current.Manipulation).DeserializeJson(ref reader, options);
                break;

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

                current.Storage = new List <BiologicallyDerivedProduct.StorageComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.BiologicallyDerivedProduct.StorageComponent v_Storage = new Hl7.Fhir.Model.BiologicallyDerivedProduct.StorageComponent();
                    v_Storage.DeserializeJson(ref reader, options);
                    current.Storage.Add(v_Storage);

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

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

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

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

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

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

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

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

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

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

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

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

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

            case "medicationReference":
                current.Medication = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Medication).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 "context":
                current.Context = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

                current.Performer = new List <MedicationDispense.PerformerComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.MedicationDispense.PerformerComponent v_Performer = new Hl7.Fhir.Model.MedicationDispense.PerformerComponent();
                    v_Performer.DeserializeJson(ref reader, options);
                    current.Performer.Add(v_Performer);

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

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

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

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

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

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

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

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

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

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

            case "daysSupply":
                current.DaysSupply = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.DaysSupply).DeserializeJson(ref reader, options);
                break;

            case "whenPrepared":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WhenPreparedElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.WhenPreparedElement = new FhirDateTime(reader.GetString());
                }
                break;

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

            case "whenHandedOver":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WhenHandedOverElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.WhenHandedOverElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense 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($"MedicationDispense 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;

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

                current.DosageInstruction = new List <Dosage>();

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

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

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

            case "substitution":
                current.Substitution = new Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent();
                ((Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)current.Substitution).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

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

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

            // Complex: MedicationDispense, Export: MedicationDispense, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Deserialize JSON into a FHIR GuidanceResponse
        /// </summary>
        public static void DeserializeJsonProperty(this GuidanceResponse current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "requestIdentifier":
                current.RequestIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.RequestIdentifier).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse 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($"GuidanceResponse 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 "moduleUri":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Module = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.Module = new FhirUri(reader.GetString());
                }
                break;

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

            case "moduleCanonical":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Module = new Canonical();
                    reader.Skip();
                }
                else
                {
                    current.Module = new Canonical(reader.GetString());
                }
                break;

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

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

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

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).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 "occurrenceDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.OccurrenceDateTimeElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.OccurrenceDateTimeElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse 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($"GuidanceResponse 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($"GuidanceResponse 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($"GuidanceResponse 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 "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"GuidanceResponse 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($"GuidanceResponse 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;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            case "view":
                current.View = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.View).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 "createdDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Created = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Created = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "issued":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.IssuedElement = new Instant();
                    reader.Skip();
                }
                else
                {
                    current.IssuedElement = new Instant(DateTimeOffset.Parse(reader.GetString()));
                }
                break;

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Media 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($"Media 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 "bodySite":
                current.BodySite = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.BodySite).DeserializeJson(ref reader, options);
                break;

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

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

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

            case "height":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.HeightElement = new PositiveInt();
                    reader.Skip();
                }
                else
                {
                    current.HeightElement = new PositiveInt(reader.GetInt32());
                }
                break;

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

            case "width":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WidthElement = new PositiveInt();
                    reader.Skip();
                }
                else
                {
                    current.WidthElement = new PositiveInt(reader.GetInt32());
                }
                break;

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

            case "frames":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.FramesElement = new PositiveInt();
                    reader.Skip();
                }
                else
                {
                    current.FramesElement = new PositiveInt(reader.GetInt32());
                }
                break;

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

            case "duration":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DurationElement = new FhirDecimal();
                    reader.Skip();
                }
                else
                {
                    current.DurationElement = new FhirDecimal(reader.GetDecimal());
                }
                break;

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

            case "content":
                current.Content = new Hl7.Fhir.Model.Attachment();
                ((Hl7.Fhir.Model.Attachment)current.Content).DeserializeJson(ref reader, options);
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Media 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($"Media 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: Media, Export: Media, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Deserialize JSON into a FHIR MeasureReport
        /// </summary>
        public static void DeserializeJsonProperty(this MeasureReport current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MeasureReport 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($"MeasureReport 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.MeasureReport.MeasureReportStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.MeasureReport.MeasureReportStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.MeasureReport.MeasureReportStatus>(reader.GetString()));
                }
                break;

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

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

            case "_type":
                if (current.TypeElement == null)
                {
                    current.TypeElement = new Code <Hl7.Fhir.Model.MeasureReport.MeasureReportType>();
                }
                ((Hl7.Fhir.Model.Element)current.TypeElement).DeserializeJson(ref reader, options);
                break;

            case "measure":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.MeasureElement = new Canonical();
                    reader.Skip();
                }
                else
                {
                    current.MeasureElement = new Canonical(reader.GetString());
                }
                break;

            case "_measure":
                if (current.MeasureElement == null)
                {
                    current.MeasureElement = new Canonical();
                }
                ((Hl7.Fhir.Model.Element)current.MeasureElement).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 "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new FhirDateTime(reader.GetString());
                }
                break;

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

            case "reporter":
                current.Reporter = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Reporter).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 "improvementNotation":
                current.ImprovementNotation = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.ImprovementNotation).DeserializeJson(ref reader, options);
                break;

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

                current.Group = new List <MeasureReport.GroupComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.MeasureReport.GroupComponent v_Group = new Hl7.Fhir.Model.MeasureReport.GroupComponent();
                    v_Group.DeserializeJson(ref reader, options);
                    current.Group.Add(v_Group);

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

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

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

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

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

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

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

            // Complex: MeasureReport, Export: MeasureReport, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Deserialize JSON into a FHIR RiskAssessment
        /// </summary>
        public static void DeserializeJsonProperty(this RiskAssessment current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"RiskAssessment 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($"RiskAssessment 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 "basedOn":
                current.BasedOn = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.BasedOn).DeserializeJson(ref reader, options);
                break;

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

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

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

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

            case "code":
                current.Code = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Code).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 "occurrenceDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Occurrence = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Occurrence = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"RiskAssessment 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($"RiskAssessment 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($"RiskAssessment 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($"RiskAssessment 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 "basis":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"RiskAssessment error reading 'basis' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

                current.Prediction = new List <RiskAssessment.PredictionComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.RiskAssessment.PredictionComponent v_Prediction = new Hl7.Fhir.Model.RiskAssessment.PredictionComponent();
                    v_Prediction.DeserializeJson(ref reader, options);
                    current.Prediction.Add(v_Prediction);

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

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

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

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

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"RiskAssessment 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($"RiskAssessment 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: RiskAssessment, Export: RiskAssessment, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Deserialize JSON into a FHIR CommunicationRequest
        /// </summary>
        public static void DeserializeJsonProperty(this CommunicationRequest current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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 "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CommunicationRequest error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

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

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

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

            case "groupIdentifier":
                current.GroupIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.GroupIdentifier).DeserializeJson(ref reader, options);
                break;

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

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

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

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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 "priority":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>();
                    reader.Skip();
                }
                else
                {
                    current.PriorityElement = new Code <Hl7.Fhir.Model.RequestPriority>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.RequestPriority>(reader.GetString()));
                }
                break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                current.Payload = new List <CommunicationRequest.PayloadComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.CommunicationRequest.PayloadComponent v_Payload = new Hl7.Fhir.Model.CommunicationRequest.PayloadComponent();
                    v_Payload.DeserializeJson(ref reader, options);
                    current.Payload.Add(v_Payload);

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

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

            case "occurrenceDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Occurrence = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Occurrence = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "authoredOn":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.AuthoredOnElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.AuthoredOnElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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($"CommunicationRequest 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 "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"CommunicationRequest 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($"CommunicationRequest 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: CommunicationRequest, Export: CommunicationRequest, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Deserialize JSON into a FHIR ImmunizationRecommendation#Recommendation
        /// </summary>
        public static void DeserializeJsonProperty(this ImmunizationRecommendation.RecommendationComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "vaccineCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"RecommendationComponent error reading 'vaccineCode' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                current.DateCriterion = new List <ImmunizationRecommendation.DateCriterionComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ImmunizationRecommendation.DateCriterionComponent v_DateCriterion = new Hl7.Fhir.Model.ImmunizationRecommendation.DateCriterionComponent();
                    v_DateCriterion.DeserializeJson(ref reader, options);
                    current.DateCriterion.Add(v_DateCriterion);

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

                if (current.DateCriterion.Count == 0)
                {
                    current.DateCriterion = null;
                }
                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 "series":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.SeriesElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.SeriesElement = new FhirString(reader.GetString());
                }
                break;

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

            case "doseNumberPositiveInt":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DoseNumber = new PositiveInt();
                    reader.Skip();
                }
                else
                {
                    current.DoseNumber = new PositiveInt(reader.GetInt32());
                }
                break;

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

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

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

            case "seriesDosesPositiveInt":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.SeriesDoses = new PositiveInt();
                    reader.Skip();
                }
                else
                {
                    current.SeriesDoses = new PositiveInt(reader.GetInt32());
                }
                break;

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: recommendation, Export: RecommendationComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Deserialize JSON into a FHIR ClinicalImpression
        /// </summary>
        public static void DeserializeJsonProperty(this ClinicalImpression current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"ClinicalImpression 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($"ClinicalImpression 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.ClinicalImpression.ClinicalImpressionStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus>(reader.GetString()));
                }
                break;

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

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

            case "code":
                current.Code = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options);
                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 "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 "effectiveDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Effective = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Effective = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

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

                current.Investigation = new List <ClinicalImpression.InvestigationComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ClinicalImpression.InvestigationComponent v_Investigation = new Hl7.Fhir.Model.ClinicalImpression.InvestigationComponent();
                    v_Investigation.DeserializeJson(ref reader, options);
                    current.Investigation.Add(v_Investigation);

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

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

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

                current.ProtocolElement = new List <FhirUri>();

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

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

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

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

                int i_protocol = 0;

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

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

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

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

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

                current.Finding = new List <ClinicalImpression.FindingComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ClinicalImpression.FindingComponent v_Finding = new Hl7.Fhir.Model.ClinicalImpression.FindingComponent();
                    v_Finding.DeserializeJson(ref reader, options);
                    current.Finding.Add(v_Finding);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"ClinicalImpression 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($"ClinicalImpression 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: ClinicalImpression, Export: ClinicalImpression, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Deserialize JSON into a FHIR DiagnosticReport
        /// </summary>
        public static void DeserializeJsonProperty(this DiagnosticReport current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DiagnosticReport 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($"DiagnosticReport 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 "basedOn":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DiagnosticReport error reading 'basedOn' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DiagnosticReport 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($"DiagnosticReport 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 "code":
                current.Code = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Code).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 "effectiveDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Effective = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Effective = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "issued":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.IssuedElement = new Instant();
                    reader.Skip();
                }
                else
                {
                    current.IssuedElement = new Instant(DateTimeOffset.Parse(reader.GetString()));
                }
                break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                current.Media = new List <DiagnosticReport.MediaComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DiagnosticReport.MediaComponent v_Media = new Hl7.Fhir.Model.DiagnosticReport.MediaComponent();
                    v_Media.DeserializeJson(ref reader, options);
                    current.Media.Add(v_Media);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: DiagnosticReport, Export: DiagnosticReport, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 15
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;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Deserialize JSON into a FHIR Composition#Section
        /// </summary>
        public static void DeserializeJsonProperty(this Composition.SectionComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "title":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.TitleElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.TitleElement = new FhirString(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

            case "text":
                current.Text = new Hl7.Fhir.Model.Narrative();
                ((Hl7.Fhir.Model.Narrative)current.Text).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

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

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

                current.Section = new List <Composition.SectionComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Composition.SectionComponent v_Section = new Hl7.Fhir.Model.Composition.SectionComponent();
                    v_Section.DeserializeJson(ref reader, options);
                    current.Section.Add(v_Section);

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

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

            // Complex: section, Export: SectionComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Deserialize JSON into a FHIR Composition
        /// </summary>
        public static void DeserializeJsonProperty(this Composition current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                current.Identifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.Identifier).DeserializeJson(ref reader, options);
                break;

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

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

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

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Composition 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($"Composition 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 "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 "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

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

            case "_confidentiality":
                if (current.ConfidentialityElement == null)
                {
                    current.ConfidentialityElement = new Code <Hl7.Fhir.Model.Composition.v3_ConfidentialityClassification>();
                }
                ((Hl7.Fhir.Model.Element)current.ConfidentialityElement).DeserializeJson(ref reader, options);
                break;

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

                current.Attester = new List <Composition.AttesterComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Composition.AttesterComponent v_Attester = new Hl7.Fhir.Model.Composition.AttesterComponent();
                    v_Attester.DeserializeJson(ref reader, options);
                    current.Attester.Add(v_Attester);

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

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

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

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

                current.RelatesTo = new List <Composition.RelatesToComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Composition.RelatesToComponent v_RelatesTo = new Hl7.Fhir.Model.Composition.RelatesToComponent();
                    v_RelatesTo.DeserializeJson(ref reader, options);
                    current.RelatesTo.Add(v_RelatesTo);

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

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

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

                current.Event = new List <Composition.EventComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Composition.EventComponent v_Event = new Hl7.Fhir.Model.Composition.EventComponent();
                    v_Event.DeserializeJson(ref reader, options);
                    current.Event.Add(v_Event);

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

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

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

                current.Section = new List <Composition.SectionComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Composition.SectionComponent v_Section = new Hl7.Fhir.Model.Composition.SectionComponent();
                    v_Section.DeserializeJson(ref reader, options);
                    current.Section.Add(v_Section);

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

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

            // Complex: Composition, Export: Composition, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Deserialize JSON into a FHIR DocumentManifest
        /// </summary>
        public static void DeserializeJsonProperty(this DocumentManifest current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "masterIdentifier":
                current.MasterIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.MasterIdentifier).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentManifest 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($"DocumentManifest 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.DocumentReferenceStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DocumentReferenceStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.DocumentReferenceStatus>(reader.GetString()));
                }
                break;

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

            case "type":
                current.Type = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Type).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 "created":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.CreatedElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.CreatedElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

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

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

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

            case "source":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.SourceElement = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.SourceElement = new FhirUri(reader.GetString());
                }
                break;

            case "_source":
                if (current.SourceElement == null)
                {
                    current.SourceElement = new FhirUri();
                }
                ((Hl7.Fhir.Model.Element)current.SourceElement).DeserializeJson(ref reader, options);
                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 "content":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentManifest error reading 'content' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

                current.Related = new List <DocumentManifest.RelatedComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DocumentManifest.RelatedComponent v_Related = new Hl7.Fhir.Model.DocumentManifest.RelatedComponent();
                    v_Related.DeserializeJson(ref reader, options);
                    current.Related.Add(v_Related);

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

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

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

                current.InstantiatesCanonicalElement = new List <Canonical>();

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

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

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

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

                int i_instantiatesCanonical = 0;

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

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

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

                current.InstantiatesUriElement = new List <FhirUri>();

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

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

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

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

                int i_instantiatesUri = 0;

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

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

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

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

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

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

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

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

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

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

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

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

            case "groupIdentifier":
                current.GroupIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.GroupIdentifier).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

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

                current.Parameter = new List <DeviceRequest.ParameterComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DeviceRequest.ParameterComponent v_Parameter = new Hl7.Fhir.Model.DeviceRequest.ParameterComponent();
                    v_Parameter.DeserializeJson(ref reader, options);
                    current.Parameter.Add(v_Parameter);

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

                if (current.Parameter.Count == 0)
                {
                    current.Parameter = null;
                }
                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 "occurrenceDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Occurrence = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Occurrence = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "occurrenceTiming":
                current.Occurrence = new Hl7.Fhir.Model.Timing();
                ((Hl7.Fhir.Model.Timing)current.Occurrence).DeserializeJson(ref reader, options);
                break;

            case "authoredOn":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.AuthoredOnElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.AuthoredOnElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceRequest 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($"DeviceRequest 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($"DeviceRequest 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($"DeviceRequest 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 "insurance":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceRequest error reading 'insurance' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

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

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

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

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DeviceRequest 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($"DeviceRequest 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;

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

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

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

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

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

            // Complex: DeviceRequest, Export: DeviceRequest, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Deserialize JSON into a FHIR Account
        /// </summary>
        public static void DeserializeJsonProperty(this Account current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Account 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($"Account 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.Account.AccountStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Account.AccountStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Account.AccountStatus>(reader.GetString()));
                }
                break;

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

            case "type":
                current.Type = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Type).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 "subject":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Account error reading 'subject' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

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

                current.Coverage = new List <Account.CoverageComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Account.CoverageComponent v_Coverage = new Hl7.Fhir.Model.Account.CoverageComponent();
                    v_Coverage.DeserializeJson(ref reader, options);
                    current.Coverage.Add(v_Coverage);

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

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

            case "owner":
                current.Owner = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Owner).DeserializeJson(ref reader, options);
                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 "guarantor":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Account error reading 'guarantor' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Guarantor = new List <Account.GuarantorComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Account.GuarantorComponent v_Guarantor = new Hl7.Fhir.Model.Account.GuarantorComponent();
                    v_Guarantor.DeserializeJson(ref reader, options);
                    current.Guarantor.Add(v_Guarantor);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            case "medicationReference":
                current.Medication = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Medication).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 "context":
                current.Context = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options);
                break;

            case "effectiveDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Effective = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Effective = new FhirDateTime(reader.GetString());
                }
                break;

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

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

            case "dateAsserted":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateAssertedElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.DateAssertedElement = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

            case "reasonCode":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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($"MedicationStatement 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 "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationStatement 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($"MedicationStatement 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;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: MedicinalProductUndesirableEffect, Export: MedicinalProductUndesirableEffect, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Deserialize JSON into a FHIR MessageHeader
        /// </summary>
        public static void DeserializeJsonProperty(this MessageHeader current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "eventCoding":
                current.Event = new Hl7.Fhir.Model.Coding();
                ((Hl7.Fhir.Model.Coding)current.Event).DeserializeJson(ref reader, options);
                break;

            case "eventUri":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Event = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.Event = new FhirUri(reader.GetString());
                }
                break;

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

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

                current.Destination = new List <MessageHeader.MessageDestinationComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.MessageHeader.MessageDestinationComponent v_Destination = new Hl7.Fhir.Model.MessageHeader.MessageDestinationComponent();
                    v_Destination.DeserializeJson(ref reader, options);
                    current.Destination.Add(v_Destination);

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

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

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

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

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

            case "source":
                current.Source = new Hl7.Fhir.Model.MessageHeader.MessageSourceComponent();
                ((Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)current.Source).DeserializeJson(ref reader, options);
                break;

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

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

            case "response":
                current.Response = new Hl7.Fhir.Model.MessageHeader.ResponseComponent();
                ((Hl7.Fhir.Model.MessageHeader.ResponseComponent)current.Response).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

            case "definition":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DefinitionElement = new Canonical();
                    reader.Skip();
                }
                else
                {
                    current.DefinitionElement = new Canonical(reader.GetString());
                }
                break;

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

            // Complex: MessageHeader, Export: MessageHeader, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Deserialize JSON into a FHIR EpisodeOfCare
        /// </summary>
        public static void DeserializeJsonProperty(this EpisodeOfCare current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"EpisodeOfCare 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($"EpisodeOfCare 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.EpisodeOfCare.EpisodeOfCareStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus>(reader.GetString()));
                }
                break;

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

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

                current.StatusHistory = new List <EpisodeOfCare.StatusHistoryComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.EpisodeOfCare.StatusHistoryComponent v_StatusHistory = new Hl7.Fhir.Model.EpisodeOfCare.StatusHistoryComponent();
                    v_StatusHistory.DeserializeJson(ref reader, options);
                    current.StatusHistory.Add(v_StatusHistory);

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

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

            case "type":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"EpisodeOfCare 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($"EpisodeOfCare 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 "diagnosis":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"EpisodeOfCare error reading 'diagnosis' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Diagnosis = new List <EpisodeOfCare.DiagnosisComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.EpisodeOfCare.DiagnosisComponent v_Diagnosis = new Hl7.Fhir.Model.EpisodeOfCare.DiagnosisComponent();
                    v_Diagnosis.DeserializeJson(ref reader, options);
                    current.Diagnosis.Add(v_Diagnosis);

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

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

            case "patient":
                current.Patient = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Patient).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 "period":
                current.Period = new Hl7.Fhir.Model.Period();
                ((Hl7.Fhir.Model.Period)current.Period).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: EpisodeOfCare, Export: EpisodeOfCare, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Deserialize JSON into a FHIR MedicationDispense#Substitution
        /// </summary>
        public static void DeserializeJsonProperty(this MedicationDispense.SubstitutionComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "wasSubstituted":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WasSubstitutedElement = new FhirBoolean();
                    reader.Skip();
                }
                else
                {
                    current.WasSubstitutedElement = new FhirBoolean(reader.GetBoolean());
                }
                break;

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: substitution, Export: SubstitutionComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Deserialize JSON into a FHIR DocumentReference
        /// </summary>
        public static void DeserializeJsonProperty(this DocumentReference current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "masterIdentifier":
                current.MasterIdentifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.MasterIdentifier).DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference 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($"DocumentReference 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.DocumentReferenceStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.DocumentReferenceStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.DocumentReferenceStatus>(reader.GetString()));
                }
                break;

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

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

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

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

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference 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($"DocumentReference 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 "subject":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "date":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.DateElement = new Instant();
                    reader.Skip();
                }
                else
                {
                    current.DateElement = new Instant(DateTimeOffset.Parse(reader.GetString()));
                }
                break;

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

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

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

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

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

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

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

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

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

                current.RelatesTo = new List <DocumentReference.RelatesToComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DocumentReference.RelatesToComponent v_RelatesTo = new Hl7.Fhir.Model.DocumentReference.RelatesToComponent();
                    v_RelatesTo.DeserializeJson(ref reader, options);
                    current.RelatesTo.Add(v_RelatesTo);

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

                if (current.RelatesTo.Count == 0)
                {
                    current.RelatesTo = null;
                }
                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 "securityLabel":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DocumentReference error reading 'securityLabel' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

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

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

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

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

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

                current.Content = new List <DocumentReference.ContentComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DocumentReference.ContentComponent v_Content = new Hl7.Fhir.Model.DocumentReference.ContentComponent();
                    v_Content.DeserializeJson(ref reader, options);
                    current.Content.Add(v_Content);

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

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

            case "context":
                current.Context = new Hl7.Fhir.Model.DocumentReference.ContextComponent();
                ((Hl7.Fhir.Model.DocumentReference.ContextComponent)current.Context).DeserializeJson(ref reader, options);
                break;

            // Complex: DocumentReference, Export: DocumentReference, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Deserialize JSON into a FHIR DetectedIssue
        /// </summary>
        public static void DeserializeJsonProperty(this DetectedIssue current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"DetectedIssue 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($"DetectedIssue 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.ObservationStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.ObservationStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.ObservationStatus>(reader.GetString()));
                }
                break;

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

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

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

            case "_severity":
                if (current.SeverityElement == null)
                {
                    current.SeverityElement = new Code <Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity>();
                }
                ((Hl7.Fhir.Model.Element)current.SeverityElement).DeserializeJson(ref reader, options);
                break;

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

            case "identifiedDateTime":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Identified = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.Identified = new FhirDateTime(reader.GetString());
                }
                break;

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

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

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

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

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

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

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

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

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

                current.Evidence = new List <DetectedIssue.EvidenceComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DetectedIssue.EvidenceComponent v_Evidence = new Hl7.Fhir.Model.DetectedIssue.EvidenceComponent();
                    v_Evidence.DeserializeJson(ref reader, options);
                    current.Evidence.Add(v_Evidence);

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

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

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

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

            case "reference":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.ReferenceElement = new FhirUri();
                    reader.Skip();
                }
                else
                {
                    current.ReferenceElement = new FhirUri(reader.GetString());
                }
                break;

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

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

                current.Mitigation = new List <DetectedIssue.MitigationComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.DetectedIssue.MitigationComponent v_Mitigation = new Hl7.Fhir.Model.DetectedIssue.MitigationComponent();
                    v_Mitigation.DeserializeJson(ref reader, options);
                    current.Mitigation.Add(v_Mitigation);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            // Complex: context, Export: ContextComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
        /// <summary>
        /// Deserialize JSON into a FHIR MedicinalProductManufactured
        /// </summary>
        public static void DeserializeJsonProperty(this MedicinalProductManufactured current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "manufacturedDoseForm":
                current.ManufacturedDoseForm = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.ManufacturedDoseForm).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

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

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

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

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

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

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

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

            case "physicalCharacteristics":
                current.PhysicalCharacteristics = new Hl7.Fhir.Model.ProdCharacteristic();
                ((Hl7.Fhir.Model.ProdCharacteristic)current.PhysicalCharacteristics).DeserializeJson(ref reader, options);
                break;

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

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

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

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

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

            // Complex: MedicinalProductManufactured, Export: MedicinalProductManufactured, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Deserialize JSON into a FHIR Goal
        /// </summary>
        public static void DeserializeJsonProperty(this Goal current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Goal 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($"Goal 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 "lifecycleStatus":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>();
                    reader.Skip();
                }
                else
                {
                    current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>(reader.GetString()));
                }
                break;

            case "_lifecycleStatus":
                if (current.LifecycleStatusElement == null)
                {
                    current.LifecycleStatusElement = new Code <Hl7.Fhir.Model.Goal.GoalLifecycleStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.LifecycleStatusElement).DeserializeJson(ref reader, options);
                break;

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

            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Goal 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($"Goal 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 "priority":
                current.Priority = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Priority).DeserializeJson(ref reader, options);
                break;

            case "description":
                current.Description = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Description).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 "startDate":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.Start = new Date();
                    reader.Skip();
                }
                else
                {
                    current.Start = new Date(reader.GetString());
                }
                break;

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

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

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

                current.Target = new List <Goal.TargetComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Goal.TargetComponent v_Target = new Hl7.Fhir.Model.Goal.TargetComponent();
                    v_Target.DeserializeJson(ref reader, options);
                    current.Target.Add(v_Target);

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

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

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

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

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

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

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

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

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

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

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

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

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"Goal 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($"Goal 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;

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

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

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

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

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

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

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

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

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

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

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