Example #1
0
        public static Client GetClientFromPatientRole(this POCD_MT000040PatientRole patientRole)
        {
            var client = new Client
            {
                ClientIdentifier = patientRole?.id?.FirstOrDefault()?.extension,
                FirstName        = patientRole?.patient?.name?.FirstOrDefault()?.Items?.FirstOrDefault(n => n is engiven)?.Text?.FirstOrDefault(),
                LastName         = patientRole?.patient?.name?.FirstOrDefault()?.Items?.FirstOrDefault(n => n is enfamily)?.Text?.FirstOrDefault(),
                DateOfBirth      = patientRole?.patient?.birthTime.GetDate(),
                Gender           = patientRole?.patient?.administrativeGenderCode.GetCode(),
                Address          = patientRole?.addr?.FirstOrDefault()?.GetAddress(),
                Phone            = patientRole?.telecom?.FirstOrDefault()?.GetPhone(),
                Language         = patientRole?.patient?.languageCommunication?.FirstOrDefault()?.languageCode.GetCode(),
                Ethnicity        = patientRole?.patient?.ethnicGroupCode.GetCode(),
                Race             = patientRole?.patient?.raceCode.GetCode()
            };

            return(client);
        }
        private string GetSSN(POCD_MT000040PatientRole patRole)
        {
            string returnVal = "";

            // *** SSN ***
            if (patRole.id != null)
            {
                foreach (II tempII in patRole.id)
                {
                    if (tempII.root == "2.16.840.1.113883.4.1")
                    {
                        if (!string.IsNullOrWhiteSpace(tempII.extension))
                        {
                            returnVal = tempII.extension;
                        }
                    }
                }
            }

            return(returnVal);
        }