/// <summary> /// Add a specified address /// </summary> public void AddFull(PatientAddressClassifier addressType, string country, string stateProvince, string countyParish, string cityVillage, string streetAddress, string additionalLocator, string zipPostCode) { this.Add(new PatientAddress() { Classifier = addressType, Country = country, StateOrProvince = stateProvince, County = countyParish, City = cityVillage, StreetAddressLine = streetAddress, ZipOrPostalCode = zipPostCode }); }
/// <summary> /// Find an address /// </summary> public PatientAddress Find(PatientAddressClassifier classifier) { return(this.Find(o => o.Classifier == classifier)); }
/// <summary> /// Update a child record to match the PID segment /// </summary> private void CopyChildRecordFields(Patient patient, PID pid) { Trace.TraceInformation("Parsing patient structure"); // Gender switch (pid.AdministrativeSex.Value) { case "M": patient.Gender = GenderType.Male; break; case "F": patient.Gender = GenderType.Female; break; case "UN": patient.Gender = GenderType.Undifferentiated; break; } // Date of birth if (!String.IsNullOrEmpty(pid.DateTimeOfBirth.Time.Value)) { patient.DateOfBirth = pid.DateTimeOfBirth.Time.GetAsDate(); } // Is part of a multiple birth? if (!String.IsNullOrEmpty(pid.MultipleBirthIndicator.Value)) { patient.MultipleBirthIndicator = pid.MultipleBirthIndicator.Value == "Y"; } // Phone if (!String.IsNullOrEmpty(pid.GetPhoneNumberHome(0).TelephoneNumber.Value)) { patient.Telephone = pid.GetPhoneNumberHome(0).TelephoneNumber.Value; } // Mother's name? if (pid.MotherSMaidenNameRepetitionsUsed > 0) { patient.MotherName = new PatientName() { Surname = pid.GetMotherSMaidenName()[0].FamilyName.Surname.Value, GivenName = pid.GetMotherSMaidenName()[0].GivenName.Value }; } // Name if (pid.PatientNameRepetitionsUsed > 0) { for (int i = 0; i < pid.PatientNameRepetitionsUsed; i++) { PatientNameUse use = PatientNameUse.None; if (!String.IsNullOrEmpty(pid.GetPatientName(i).NameTypeCode.Value)) { use = this.m_nameUseCodes.FirstOrDefault(o => o.Value == pid.GetPatientName(i).NameTypeCode.Value).Key; } PatientNameRepresentation representation = PatientNameRepresentation.Alphabetic; if (!String.IsNullOrEmpty(pid.GetPatientName(i).NameRepresentationCode.Value)) { representation = this.m_nameRepresentationCodes.FirstOrDefault(o => o.Value == pid.GetPatientName(i).NameRepresentationCode.Value).Key; } patient.Names.Add(new PatientName() { Surname = pid.GetPatientName(i).FamilyName.Surname.Value, MaidenSurname = pid.GetPatientName(i).FamilyName.OwnSurname.Value, GivenName = pid.GetPatientName(i).GivenName.Value, SecondNamesOrInitials = pid.GetPatientName(i).SecondAndFurtherGivenNamesOrInitialsThereof.Value, Use = use, Representation = representation }); } } // Identification numbers foreach (var id in pid.GetPatientIdentifierList()) { patient.Identifiers.Add(new PatientIdentifier() { Domain = id.AssigningAuthority.NamespaceID.Value, Value = id.IDNumber.Value }); } // Address information // TODO: How does this map to GIIS? if (pid.PatientAddressRepetitionsUsed > 0) { for (int i = 0; i < pid.PatientAddressRepetitionsUsed; i++) { PatientAddressClassifier classifier = PatientAddressClassifier.None; if (!String.IsNullOrEmpty(pid.GetPatientAddress(i).AddressType.Value)) { classifier = this.m_addressCodes.FirstOrDefault(o => o.Value == pid.GetPatientAddress(i).AddressType.Value).Key; } patient.Addresses.Add(new PatientAddress() { CensusTract = pid.GetPatientAddress(i).CensusTract.Value, City = pid.GetPatientAddress(i).City.Value, Country = pid.GetPatientAddress(i).Country.Value, County = pid.GetPatientAddress(i).CountyParishCode.Value, OtherLocator = pid.GetPatientAddress(i).OtherDesignation.Value, StateOrProvince = pid.GetPatientAddress(i).StateOrProvince.Value, StreetAddressLine = pid.GetPatientAddress(i).StreetAddress.StreetOrMailingAddress.Value, ZipOrPostalCode = pid.GetPatientAddress(i).ZipOrPostalCode.Value, Classifier = classifier }); } } // Death? if (!String.IsNullOrEmpty(pid.PatientDeathDateAndTime.Time.Value)) { patient.DeceasedDate = pid.PatientDeathDateAndTime.Time.GetAsDate(); } Trace.TraceInformation("Successfully parsed patient structure"); }