public PatientSearchResult ProgressiveSearch(string lastName, string firstName, int page, int itemsPerPage) { // *** Tries several searches to get results *** // TODO: Add ssn, city, state, zip to search and matching... PatientSearchResult result = new PatientSearchResult(); List <string> searchValueList = new List <string>(); string[] searchVals = new string[] { string.Format("{0},{1}", lastName, firstName), string.Format("{0},{1}", lastName, firstName.Substring(0, 1)), string.Format("{0}", lastName) }; bool keepLooking = true; int idx = 0; while ((keepLooking) && (idx < searchVals.Length)) { result = Search(searchVals[idx], page, itemsPerPage); if (result.Success) { if (result.Patients != null) { if (result.Patients.Count > 0) { keepLooking = false; } } } idx += 1; } return(result); }
public PatientSearchResult Search(string searchParam, int page, int itemsPerPage) { // *** Gets female patients matching search criteria *** PatientSearchResult result = new PatientSearchResult(); //DsioFemalePatientSearchCommand patSearchCommand; //if (Regex.IsMatch(searchParam, @"^[a-zA-Z]\d{4}$")) //{ // // *** Use Find command *** // DsioFemalePatientFindCommand tempCommand = new DsioFemalePatientFindCommand(broker); // tempCommand.AddCommandArguments(searchParam.ToUpper()); // patSearchCommand = tempCommand; //} //else //{ // // *** Use Search command *** // patSearchCommand = new DsioFemalePatientSearchCommand(broker); // // *** Set arguments/parameters *** // if (string.IsNullOrWhiteSpace(searchParam)) // patSearchCommand.AddCommandArguments("", page, itemsPerPage); // else // patSearchCommand.AddCommandArguments(searchParam.ToUpper(), page, itemsPerPage); //} // *** Execute command *** //RpcResponse response = patSearchCommand.Execute(); DsioPatientListCommand patSearchCommand = new DsioPatientListCommand(broker); patSearchCommand.AddCommandArguments(searchParam, page, itemsPerPage); RpcResponse response = patSearchCommand.Execute(); // *** Set return values *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** If we have patients, then add them to return *** if (response.Status == RpcResponseStatus.Success) { if (patSearchCommand.MatchingPatients != null) { if (patSearchCommand.MatchingPatients.Count > 0) { foreach (DsioSearchPatient commandPatient in patSearchCommand.MatchingPatients) { SearchPatient uiPatient = GetSearchPatient(commandPatient); if (uiPatient != null) { result.Patients.Add(uiPatient); } } } } result.TotalResults = patSearchCommand.TotalResults; } return(result); }