public CdaRecordTarget ExtractRecordTarget()
        {
            // *** Extract basic patient information from the document content ***

            CdaRecordTarget returnRecordTarget = null;

            if (this.Initialize())
            {
                // *** Check if we have something to work with ***
                if (this.PocdDocument != null)
                {
                    if (this.PocdDocument.recordTarget != null)
                    {
                        if (this.PocdDocument.recordTarget.Length > 0)
                        {
                            // *** Create the return value ***
                            returnRecordTarget = new CdaRecordTarget();

                            // *** Get the first record target ***
                            POCD_MT000040RecordTarget pocdRecordTarget = this.PocdDocument.recordTarget[0];

                            // *** Make sure we have a patient role section ***
                            if (pocdRecordTarget.patientRole != null)
                            {
                                // *** Get the SSN ***
                                returnRecordTarget.SSN = GetSSN(pocdRecordTarget.patientRole);

                                // *** Make sure we have a patient ***
                                if (pocdRecordTarget.patientRole.patient != null)
                                {
                                    // *** Create shortcut for patient ***
                                    POCD_MT000040Patient pat = pocdRecordTarget.patientRole.patient;

                                    // *** Get the date of birth ***
                                    returnRecordTarget.Patient.DateOfBirth = GetDOB(pat);

                                    // *** Get the name ***
                                    string[] name = GetName(pat.name);
                                    returnRecordTarget.Patient.Name.First = name[0];
                                    returnRecordTarget.Patient.Name.Last  = name[1];
                                }
                            }
                        }
                    }
                }
            }

            return(returnRecordTarget);
        }
        private DateTime GetDOB(POCD_MT000040Patient pat)
        {
            DateTime returnDOB = DateTime.MinValue;

            CultureInfo enUS = new CultureInfo("en-US");

            // *** DOB ***
            if (pat.birthTime != null)
            {
                if (!string.IsNullOrWhiteSpace(pat.birthTime.value))
                {
                    DateTime.TryParseExact(pat.birthTime.value, "yyyyMMdd", enUS, DateTimeStyles.None, out returnDOB);
                }
            }

            return(returnDOB);
        }
Beispiel #3
0
        internal POCD_MT000040Patient ToPocdPat()
        {
            POCD_MT000040Patient returnPat = new POCD_MT000040Patient();

            // *** Name ***
            returnPat.name = new PN[] { this.Name.ToPN() };

            // *** Gender ***
            returnPat.administrativeGenderCode = this.GenderEntry;

            // *** DOB ***
            returnPat.birthTime = new TS();
            if (this.DateOfBirth != DateTime.MinValue)
            {
                returnPat.birthTime.value = this.DateOfBirth.ToString("yyyyMMdd");
            }
            else
            {
                returnPat.birthTime.nullFlavor = "UNK";
            }

            // *** Marital Status ***
            if (this.MaritalStatus != Hl7MaritalStatus.Unknown)
            {
                returnPat.maritalStatusCode = this.MaritalStatusEntry;
            }

            // *** Ethnic Group ***
            if (this.EthnicGroup != Hl7EthnicGroup.Unknown)
            {
                returnPat.ethnicGroupCode = this.EthnicGroupEntry;
            }

            // *** Race ***
            if (this.Race != Hl7Race.Unknown)
            {
                returnPat.raceCode = this.RaceEntry;
            }

            return(returnPat);
        }