Esempio n. 1
0
        /// <inheritdoc/>
        public void FromDelimitedString(string delimitedString, Separators separators)
        {
            Separators seps = separators ?? new Separators().UsingConfigurationValues();

            string[] segments = delimitedString == null
                ? Array.Empty <string>()
                : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);

            if (segments.Length > 0)
            {
                if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
                }
            }

            ProviderAdjustmentNumber = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null;
            PayerAdjustmentNumber    = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[2], false, seps) : null;
            AdjustmentSequenceNumber = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableUInt() : null;
            AdjustmentCategory       = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null;
            AdjustmentAmount         = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CompositePrice>(segments[5], false, seps) : null;
            AdjustmentQuantity       = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[6], false, seps) : null;
            AdjustmentReasonPa       = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null;
            AdjustmentDescription    = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null;
            OriginalValue            = segments.Length > 9 && segments[9].Length > 0 ? segments[9].ToNullableDecimal() : null;
            SubstituteValue          = segments.Length > 10 && segments[10].Length > 0 ? segments[10].ToNullableDecimal() : null;
            AdjustmentAction         = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[11], false, seps) : null;
            ProviderAdjustmentNumberCrossReference             = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[12], false, seps) : null;
            ProviderProductServiceLineItemNumberCrossReference = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[13], false, seps) : null;
            AdjustmentDate          = segments.Length > 14 && segments[14].Length > 0 ? segments[14].ToNullableDateTime() : null;
            ResponsibleOrganization = segments.Length > 15 && segments[15].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[15], false, seps) : null;
        }
        public void ToDelimitedString_WithAllProperties_ReturnsCorrectlySequencedFields()
        {
            IType hl7Type = new ExtendedCompositeNameAndIdNumberForOrganizations
            {
                OrganizationName         = "1",
                OrganizationNameTypeCode = new CodedWithExceptions
                {
                    Identifier = "2"
                },
                IdNumber             = 3,
                IdentifierCheckDigit = 4,
                CheckDigitScheme     = "5",
                AssigningAuthority   = new HierarchicDesignator
                {
                    NamespaceId = "6"
                },
                IdentifierTypeCode = "7",
                AssigningFacility  = new HierarchicDesignator
                {
                    NamespaceId = "8"
                },
                NameRepresentationCode = "9",
                OrganizationIdentifier = "10"
            };

            string expected = "1^2^3^4^5^6^7^8^9^10";
            string actual   = hl7Type.ToDelimitedString();

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public void FromDelimitedString(string delimitedString, Separators separators)
        {
            Separators seps = separators ?? new Separators().UsingConfigurationValues();

            string[] segments = delimitedString == null
                ? Array.Empty <string>()
                : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);

            if (segments.Length > 0)
            {
                if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
                }
            }

            RoleInstanceId              = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null;
            ActionCode                  = segments.Length > 2 && segments[2].Length > 0 ? segments[2] : null;
            RoleRol                     = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null;
            RolePerson                  = segments.Length > 4 && segments[4].Length > 0 ? segments[4].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null;
            RoleBeginDateTime           = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDateTime() : null;
            RoleEndDateTime             = segments.Length > 6 && segments[6].Length > 0 ? segments[6].ToNullableDateTime() : null;
            RoleDuration                = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null;
            RoleActionReason            = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[8], false, seps) : null;
            ProviderType                = segments.Length > 9 && segments[9].Length > 0 ? segments[9].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null;
            OrganizationUnitType        = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null;
            OfficeHomeAddressBirthplace = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedAddress>(x, false, seps)) : null;
            Phone           = segments.Length > 12 && segments[12].Length > 0 ? segments[12].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(x, false, seps)) : null;
            PersonsLocation = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[13], false, seps) : null;
            Organization    = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[14], false, seps) : null;
        }
        public void FromDelimitedString_WithAllProperties_ReturnsCorrectlyInitializedFields()
        {
            IType expected = new ExtendedCompositeNameAndIdNumberForOrganizations
            {
                OrganizationName         = "1",
                OrganizationNameTypeCode = new CodedWithExceptions
                {
                    IsSubcomponent = true,
                    Identifier     = "2"
                },
                IdNumber             = 3,
                IdentifierCheckDigit = 4,
                CheckDigitScheme     = "5",
                AssigningAuthority   = new HierarchicDesignator
                {
                    IsSubcomponent = true,
                    NamespaceId    = "6"
                },
                IdentifierTypeCode = "7",
                AssigningFacility  = new HierarchicDesignator
                {
                    IsSubcomponent = true,
                    NamespaceId    = "8"
                },
                NameRepresentationCode = "9",
                OrganizationIdentifier = "10"
            };

            IType actual = new ExtendedCompositeNameAndIdNumberForOrganizations();

            actual.FromDelimitedString("1^2^3^4^5^6^7^8^9^10");

            expected.Should().BeEquivalentTo(actual);
        }
Esempio n. 5
0
        /// <inheritdoc/>
        public void FromDelimitedString(string delimitedString, Separators separators)
        {
            Separators seps = separators ?? new Separators().UsingConfigurationValues();

            string[] segments = delimitedString == null
                ? Array.Empty <string>()
                : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None);

            if (segments.Length > 0)
            {
                if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0)
                {
                    throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString));
                }
            }

            SetIdIam         = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null;
            AllergenTypeCode = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null;
            AllergenCodeMnemonicDescription = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null;
            AllergySeverityCode             = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null;
            AllergyReactionCode             = segments.Length > 5 && segments[5].Length > 0 ? segments[5].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null;
            AllergyActionCode                    = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[6], false, seps) : null;
            AllergyUniqueIdentifier              = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[7], false, seps) : null;
            ActionReason                         = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null;
            SensitivityToCausativeAgentCode      = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[9], false, seps) : null;
            AllergenGroupCodeMnemonicDescription = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null;
            OnsetDate                       = segments.Length > 11 && segments[11].Length > 0 ? segments[11].ToNullableDateTime() : null;
            OnsetDateText                   = segments.Length > 12 && segments[12].Length > 0 ? segments[12] : null;
            ReportedDateTime                = segments.Length > 13 && segments[13].Length > 0 ? segments[13].ToNullableDateTime() : null;
            ReportedBy                      = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <ExtendedPersonName>(segments[14], false, seps) : null;
            RelationshipToPatientCode       = segments.Length > 15 && segments[15].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[15], false, seps) : null;
            AlertDeviceCode                 = segments.Length > 16 && segments[16].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[16], false, seps) : null;
            AllergyClinicalStatusCode       = segments.Length > 17 && segments[17].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[17], false, seps) : null;
            StatusedByPerson                = segments.Length > 18 && segments[18].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(segments[18], false, seps) : null;
            StatusedByOrganization          = segments.Length > 19 && segments[19].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[19], false, seps) : null;
            StatusedAtDateTime              = segments.Length > 20 && segments[20].Length > 0 ? segments[20].ToNullableDateTime() : null;
            InactivatedByPerson             = segments.Length > 21 && segments[21].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(segments[21], false, seps) : null;
            InactivatedDateTime             = segments.Length > 22 && segments[22].Length > 0 ? segments[22].ToNullableDateTime() : null;
            InitiallyRecordedByPerson       = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(segments[23], false, seps) : null;
            InitiallyRecordedDateTime       = segments.Length > 24 && segments[24].Length > 0 ? segments[24].ToNullableDateTime() : null;
            ModifiedByPerson                = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(segments[25], false, seps) : null;
            ModifiedDateTime                = segments.Length > 26 && segments[26].Length > 0 ? segments[26].ToNullableDateTime() : null;
            ClinicianIdentifiedCode         = segments.Length > 27 && segments[27].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[27], false, seps) : null;
            InitiallyRecordedByOrganization = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[28], false, seps) : null;
            ModifiedByOrganization          = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[29], false, seps) : null;
            InactivatedByOrganization       = segments.Length > 30 && segments[30].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[30], false, seps) : null;
        }