public static string GetSexString(this vocSex sex) { switch (sex) { case vocSex.M: return("Male"); case vocSex.F: return("Female"); case vocSex.I: return("Unknown"); case vocSex.U: return("Unspecified"); default: return(string.Empty); } }
public string[] TracePatientByDemographics(string surname, vocSex sex, DateTime dateOfBirth, string forename = null, string postcode = null) { if ((surname ?? string.Empty).Replace(" ", string.Empty).Length < 2) { throw new FaultException <ApiFault>(new ApiFault("Two or more characters of the surname must be specified.")); } if (dateOfBirth == default(DateTime)) { throw new FaultException <ApiFault>(new ApiFault("Date of birth must be specified.")); } return(DataStore .OpenHRPatients .Where(t => t.Person.surname.StartsWith(surname.Trim()) && t.Person.sex == sex && t.Person.birthDate.Date == dateOfBirth.Date && (string.IsNullOrEmpty(forename) || t.Person.forenames.StartsWith(forename.Replace(" ", string.Empty))) && (string.IsNullOrEmpty(postcode) || t.Person.address.GetHomeAddress().postCode.ToUpper().Replace(" ", string.Empty).StartsWith(postcode.ToUpper().Replace(" ", string.Empty)))) .Select(t => t.OpenHRExcludingHealthDomainXml) .ToArray()); }