Esempio n. 1
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 50, Configuration.FieldSeparator),
                       Id,
                       ExternalAccessionIdentifier?.ToDelimitedString(),
                       AccessionIdentifier?.ToDelimitedString(),
                       ContainerIdentifier?.ToDelimitedString(),
                       PrimaryParentContainerIdentifier?.ToDelimitedString(),
                       EquipmentContainerIdentifier?.ToDelimitedString(),
                       SpecimenSource,
                       RegistrationDateTime.HasValue ? RegistrationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ContainerStatus?.ToDelimitedString(),
                       CarrierType?.ToDelimitedString(),
                       CarrierIdentifier?.ToDelimitedString(),
                       PositionInCarrier?.ToDelimitedString(),
                       TrayTypeSac?.ToDelimitedString(),
                       TrayIdentifier?.ToDelimitedString(),
                       PositionInTray?.ToDelimitedString(),
                       Location != null ? string.Join(Configuration.FieldRepeatSeparator, Location.Select(x => x.ToDelimitedString())) : null,
                       ContainerHeight.HasValue ? ContainerHeight.Value.ToString(Consts.NumericFormat, culture) : null,
                       ContainerDiameter.HasValue ? ContainerDiameter.Value.ToString(Consts.NumericFormat, culture) : null,
                       BarrierDelta.HasValue ? BarrierDelta.Value.ToString(Consts.NumericFormat, culture) : null,
                       BottomDelta.HasValue ? BottomDelta.Value.ToString(Consts.NumericFormat, culture) : null,
                       ContainerHeightDiameterDeltaUnits?.ToDelimitedString(),
                       ContainerVolume.HasValue ? ContainerVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       AvailableSpecimenVolume.HasValue ? AvailableSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       InitialSpecimenVolume.HasValue ? InitialSpecimenVolume.Value.ToString(Consts.NumericFormat, culture) : null,
                       VolumeUnits?.ToDelimitedString(),
                       SeparatorType?.ToDelimitedString(),
                       CapType?.ToDelimitedString(),
                       Additive != null ? string.Join(Configuration.FieldRepeatSeparator, Additive.Select(x => x.ToDelimitedString())) : null,
                       SpecimenComponent?.ToDelimitedString(),
                       DilutionFactor?.ToDelimitedString(),
                       Treatment?.ToDelimitedString(),
                       Temperature?.ToDelimitedString(),
                       HemolysisIndex.HasValue ? HemolysisIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       HemolysisIndexUnits?.ToDelimitedString(),
                       LipemiaIndex.HasValue ? LipemiaIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       LipemiaIndexUnits?.ToDelimitedString(),
                       IcterusIndex.HasValue ? IcterusIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       IcterusIndexUnits?.ToDelimitedString(),
                       FibrinIndex.HasValue ? FibrinIndex.Value.ToString(Consts.NumericFormat, culture) : null,
                       FibrinIndexUnits?.ToDelimitedString(),
                       SystemInducedContaminants != null ? string.Join(Configuration.FieldRepeatSeparator, SystemInducedContaminants.Select(x => x.ToDelimitedString())) : null,
                       DrugInterference != null ? string.Join(Configuration.FieldRepeatSeparator, DrugInterference.Select(x => x.ToDelimitedString())) : null,
                       ArtificialBlood?.ToDelimitedString(),
                       SpecialHandlingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialHandlingCode.Select(x => x.ToDelimitedString())) : null,
                       OtherEnvironmentalFactors != null ? string.Join(Configuration.FieldRepeatSeparator, OtherEnvironmentalFactors.Select(x => x.ToDelimitedString())) : null,
                       ContainerLength?.ToDelimitedString(),
                       ContainerWidth?.ToDelimitedString(),
                       ContainerForm?.ToDelimitedString(),
                       ContainerMaterial?.ToDelimitedString(),
                       ContainerCommonName?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Esempio n. 2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Specimen;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Specimen.SpecimenStatus>)StatusElement.DeepCopy();
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (Parent != null)
                {
                    dest.Parent = new List <Hl7.Fhir.Model.ResourceReference>(Parent.DeepCopy());
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (AccessionIdentifier != null)
                {
                    dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopy();
                }
                if (ReceivedTimeElement != null)
                {
                    dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopy();
                }
                if (Collection != null)
                {
                    dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopy();
                }
                if (Treatment != null)
                {
                    dest.Treatment = new List <Hl7.Fhir.Model.Specimen.TreatmentComponent>(Treatment.DeepCopy());
                }
                if (Container != null)
                {
                    dest.Container = new List <Hl7.Fhir.Model.Specimen.ContainerComponent>(Container.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Esempio n. 3
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                result.AddRange(Identifier.Validate());
            }
            if (Type != null)
            {
                result.AddRange(Type.Validate());
            }
            if (Source != null)
            {
                Source.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Subject != null)
            {
                result.AddRange(Subject.Validate());
            }
            if (AccessionIdentifier != null)
            {
                AccessionIdentifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (ReceivedTimeElement != null)
            {
                result.AddRange(ReceivedTimeElement.Validate());
            }
            if (Collection != null)
            {
                result.AddRange(Collection.Validate());
            }
            if (Treatment != null)
            {
                Treatment.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Container != null)
            {
                Container.ForEach(elem => result.AddRange(elem.Validate()));
            }

            return(result);
        }
Esempio n. 4
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 10, Configuration.FieldSeparator),
                       Id,
                       AccessionIdentifier?.ToDelimitedString(),
                       RequestedProcedureId?.ToDelimitedString(),
                       StudyInstanceUid?.ToDelimitedString(),
                       ScheduledProcedureStepId?.ToDelimitedString(),
                       Modality?.ToDelimitedString(),
                       ProtocolCode != null ? string.Join(Configuration.FieldRepeatSeparator, ProtocolCode.Select(x => x.ToDelimitedString())) : null,
                       ScheduledStationName?.ToDelimitedString(),
                       ScheduledProcedureStepLocation != null ? string.Join(Configuration.FieldRepeatSeparator, ScheduledProcedureStepLocation.Select(x => x.ToDelimitedString())) : null,
                       ScheduledStationAeTitle
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Esempio n. 5
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

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

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

            if (!string.IsNullOrEmpty(ReceivedTime))
            {
                writer.WriteString("receivedTime", (string)ReceivedTime !);
            }

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

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

                foreach (Reference valParent in Parent)
                {
                    valParent.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valRequest in Request)
                {
                    valRequest.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (SpecimenProcessing valProcessing in Processing)
                {
                    valProcessing.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (SpecimenContainer valContainer in Container)
                {
                    valContainer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valCondition in Condition)
                {
                    valCondition.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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