public List <PatientDTO> ListPatientsByFilter(PatientFilter filter) { StoreContext db = new StoreContext(); List <Patient> patients = db.Patient .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); if (!string.IsNullOrEmpty(filter.FirstName) && filter.FirstName != "string") { patients = db.Patient.Where(u => u.User.FirstName == filter.FirstName) .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); } if (!string.IsNullOrEmpty(filter.LastName) && filter.LastName != "string") { patients = db.Patient.Where(u => u.User.LastName == filter.LastName) .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); } if (!string.IsNullOrEmpty(filter.Gender) && filter.Gender != "string") { patients = db.Patient.Where(u => u.Gender == filter.Gender) .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); } if (string.IsNullOrEmpty(filter.BloodGroupId) && filter.BloodGroupId != "string" && Helper.DecryptInt(filter.BloodGroupId) != 0) { patients = db.Patient.Where(u => u.BloodType.BloodTypeId == Helper.DecryptInt(filter.BloodGroupId)) .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); } if (string.IsNullOrEmpty(filter.StatusId) && filter.StatusId != "string" && Helper.DecryptInt(filter.StatusId) != 0) { patients = db.Patient.Where(u => u.StatusId == Helper.DecryptInt(filter.StatusId)) .Include(u => u.User) .Include(b => b.BloodType) .Include(s => s.Status) .ToList(); } patients = patients .Take(filter.PageSize) .ToList(); List <PatientDTO> response = mapper.Map <List <PatientDTO> >(patients); return(response); }
public ActionResult <List <PatientModel> > Get([FromQuery] PatientFilter filter) { return(_context.Patients.Where(x => (String.IsNullOrEmpty(filter.Country) || x.NewCountry.ToUpper().Contains(filter.Country.ToUpper())) ) .ToList()); }
public string GetPatientsFromApi() { PatientFilter patientFilter = new PatientFilter() { }; PatientFieldsToReturn patientFieldsToReturn = new PatientFieldsToReturn(); GetPatientsResp response = null; GetPatientsReq request = new GetPatientsReq() { RequestHeader = _requestHeader, Filter = patientFilter, Fields = patientFieldsToReturn }; response = _kareoServices.GetPatients(request); if (response.ErrorResponse.IsError) { return(response.ErrorResponse.ErrorMessage); } if (response.Patients == null || response.Patients.Length == 0) { return("No results. Check Customer Key is valid in .config file."); } List <PatientData> responseData = response.Patients.ToList(); return(ExportPatients(responseData)); }
private List <Patient> GetPatientList(PatientFilter filter) { List <Patient> patientList = null; try { if (filter.patientId.HasValue) { patientList = GetPatientById(filter.patientId.Value); } else if (!string.IsNullOrEmpty(filter.search)) { patientList = SearchPatients(filter.includeDeleted, filter.search); } else { patientList = GetAllPatients(filter.includeDeleted); } } catch (Exception e) { Console.WriteLine(e); } return(patientList); }
public Task <IPaginatedList <PatientDto> > GetAll(PatientFilter filter) { Expression <Func <TPatient, bool> > expression = null; if (!string.IsNullOrEmpty(filter.Code)) { expression = c => c.Code.Contains(filter.Code); } else if (!string.IsNullOrEmpty(filter.Name)) { expression = c => (c.FirstName + " " + c.LastName).Contains(filter.Name); } else if (!string.IsNullOrEmpty(filter.Phone)) { expression = c => c.Phone.Contains(filter.Phone); } else if (!string.IsNullOrEmpty(filter.IdentifyCardNo)) { expression = c => c.IdentifyCardNo.Contains(filter.IdentifyCardNo); } else { expression = c => c.IsActived; } return(GetAll(expression, filter.PageIndex, filter.PageSize)); }
public IActionResult ListAllPatients([FromBody] PatientFilter info) { List <PatientDTO> response = repository.ListPatientsByFilter(info); if (response != null) { return(new ObjectResult(response)); } else { return(new NotFoundObjectResult("There isn't any patient inserted yet.")); } }
public Task <IPaginatedList <PatientDto> > Get(string code, string value, int pageIndex = Constant.PAGE_INDEX_DEFAULT, int pageSize = Constant.PAGE_SIZE_DEFAULT) { var filter = new PatientFilter { PageIndex = pageIndex, PageSize = pageSize, Code = string.Equals("Code", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, Name = string.Equals("Name", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, Phone = string.Equals("Phone", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, IdentifyCardNo = string.Equals("IdentifyCardNo", code, StringComparison.OrdinalIgnoreCase) ? value : string.Empty, }; return(_patientBusiness.GetAll(filter)); }
public List <Patient> GetPatients(PatientFilter filter) { List <Patient> patients = null; try { patients = GetPatientList(filter); } catch (Exception e) { Console.WriteLine(e); } return(patients); }
public PatientSearch(System.Collections.Specialized.NameValueCollection form) { PatientFilter = form["PatientFilter"]; FirstName = form["FirstName"]; LastName = form["LastName"]; DateTime tmp; if (DateTime.TryParse(form["BirthDate"], out tmp)) { BirthDate = tmp; } Gender = form["Gender"]; Race = form["Race"]; Providers = form["Providers"]; MedicalScheme = form["MedicalScheme"]; if (!string.IsNullOrWhiteSpace(PatientFilter)) { PatientFilter = PatientFilter.ToLower(); } if (!string.IsNullOrWhiteSpace(FirstName)) { FirstName = FirstName.ToLower(); } if (!string.IsNullOrWhiteSpace(LastName)) { LastName = LastName.ToLower(); } if (!string.IsNullOrWhiteSpace(Gender)) { Gender = Gender.ToLower(); } if (!string.IsNullOrWhiteSpace(Race)) { Race = Race.ToLower(); } if (!string.IsNullOrWhiteSpace(Providers)) { Providers = Providers.ToLower(); } if (!string.IsNullOrWhiteSpace(MedicalScheme)) { MedicalScheme = MedicalScheme.ToLower(); } }
public ActionResult <List <Patient> > Get([FromQuery] PatientFilter filter) { List <Patient> patients = null; ActionResult retval = BadRequest(patients); try { patients = _patientService.GetPatients(filter); if (patients != null) { retval = new OkObjectResult(patients); } } catch (Exception e) { Console.Write(e); } return(retval); }
public Patient Find(PatientFilter filter) { return(Set.FirstOrDefault(d => d.Id == filter.Id)); }
public ActionResult SearchPatient() { var model = new PatientFilter(); return(PartialView(model)); }
public IEnumerable <PatientTableView> FindPatiets(DataTablesRequest dataTablesRequest, PatientFilter patient, out int totalRecordsNumber) { IQueryable <Patient> query = db.Patients.AsQueryable <Patient>(); if (!String.IsNullOrEmpty(patient.FirstName)) { query = query.Where(x => x.FirstName.Contains(patient.FirstName)); } if (!String.IsNullOrEmpty(patient.LastName)) { query = query.Where(x => x.LastName.Contains(patient.LastName)); } if (patient.Pesel.HasValue) { query = query.Where(x => x.Pesel == patient.Pesel); } totalRecordsNumber = query.Count(); query = query.OrderBy(x => x.Id).Skip(dataTablesRequest.iDisplayStart).Take(dataTablesRequest.iDisplayLength); var patientDBList = query.ToList <Patient>(); var patientTableList = new List <PatientTableView>(); foreach (var pat in patientDBList) { PatientTableView p = new PatientTableView() { City = pat.City.CityName, FirstName = pat.FirstName, Id = pat.Id, LastName = pat.LastName, Pesel = pat.Pesel.ToString() }; patientTableList.Add(p); } return(patientTableList); }
public List <Patient> FilterPatients(List <Patient> patients, string filterVal, PatientFilter filter) { return(_patientService.FilterPatients(patients, filterVal, filter)); }
public List <Patient> FilterPatients(List <Patient> patients, string filterVal, PatientFilter filter) { List <Patient> filteredPatients = new List <Patient>(); foreach (Patient patient in patients) { if (filter.FitsFilter(patient, filterVal)) { filteredPatients.Add(patient); } } return(filteredPatients); }
/// <summary> /// Retrieves a list of patients. The endpoint implements pagination by using links. Additionally, it is possible to filter by parameters such as lastName, firstName, createdAfter, updatedAfter or to sort ascending or descending. /// </summary> /// <exception cref="CNXT.Connector.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="first">Fetch only the first certain number of patients of the set. The default and maximum value is set to 25 patients per request.</param> /// <param name="after">Fetch only patients in the set after (below) this cursor (exclusive). (optional)</param> /// <param name="filter">Filter patients by parameters e.g. lastName for filtering patients by their last name. (Supported values: firstName, lastName, search, dateOfBirth, createdAfter, updatedAfter) (optional)</param> /// <param name="sort">List of parameters to sort patients by parameters. (Supported values: lastName, firstName, latestSessionUpdate, createdAt, updatedAt). To sort descending add a '-' as prefix e.g (-lastName, -firstName, -latestSessionUpdate, -createdAt, -updatedAt). (optional)</param> /// <param name="include">List of related resources for including relationships or properties directly into patient such as Session, latestSessionId, or latestSessionUpdate (Supported values: session, latestSessionId, latestSessionUpdate) (optional)</param> /// <returns>ApiResponse of PatientsResponse</returns> public ApiResponse <PatientsResponse> GetPatientsWithHttpInfo(int first, string after = default(string), PatientFilter filter = default(PatientFilter), List <string> sort = default(List <string>), List <string> include = default(List <string>)) { // verify the required parameter 'first' is set if (first == null) { throw new ApiException(400, "Missing required parameter 'first' when calling PatientsApi->GetPatients"); } var localVarPath = "/patients"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (first != null) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "first", first)); // query parameter } if (after != null) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "after", after)); // query parameter } // TODO: Bugfix for supporting deepObjects as query parameters //if (filter != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "filter", filter)); // query parameter if (filter != null) { foreach (PropertyInfo propertyInfo in filter.GetType().GetProperties().Where(property => property.GetValue(filter, null) != null)) { if (propertyInfo.PropertyType == typeof(DateTime) || propertyInfo.PropertyType == typeof(DateTime?)) { DateTime?dateTimeValue = propertyInfo.GetValue(filter, null) as DateTime?; if (dateTimeValue.HasValue) { localVarQueryParams.Add(new KeyValuePair <string, string>(string.Format("filter[{0}]", char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1)), dateTimeValue.Value.ToString("s"))); } } else { localVarQueryParams.Add(new KeyValuePair <string, string>(string.Format("filter[{0}]", char.ToLower(propertyInfo.Name[0]) + propertyInfo.Name.Substring(1)), propertyInfo.GetValue(filter, null).ToString())); } } } if (sort != null) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "sort", sort)); // query parameter } if (include != null) { localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "include", include)); // query parameter } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath, Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("GetPatients", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <PatientsResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (PatientsResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(PatientsResponse)))); }
/// <summary> /// Retrieves a list of patients. The endpoint implements pagination by using links. Additionally, it is possible to filter by parameters such as lastName, firstName, createdAfter, updatedAfter or to sort ascending or descending. /// </summary> /// <exception cref="CNXT.Connector.Client.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="first">Fetch only the first certain number of patients of the set. The default and maximum value is set to 25 patients per request.</param> /// <param name="after">Fetch only patients in the set after (below) this cursor (exclusive). (optional)</param> /// <param name="filter">Filter patients by parameters e.g. lastName for filtering patients by their last name. (Supported values: firstName, lastName, search, dateOfBirth, createdAfter, updatedAfter) (optional)</param> /// <param name="sort">List of parameters to sort patients by parameters. (Supported values: lastName, firstName, latestSessionUpdate, createdAt, updatedAt). To sort descending add a '-' as prefix e.g (-lastName, -firstName, -latestSessionUpdate, -createdAt, -updatedAt). (optional)</param> /// <param name="include">List of related resources for including relationships or properties directly into patient such as Session, latestSessionId, or latestSessionUpdate (Supported values: session, latestSessionId, latestSessionUpdate) (optional)</param> /// <returns>PatientsResponse</returns> public PatientsResponse GetPatients(int first, string after = default(string), PatientFilter filter = default(PatientFilter), List <string> sort = default(List <string>), List <string> include = default(List <string>)) { ApiResponse <PatientsResponse> localVarResponse = GetPatientsWithHttpInfo(first, after, filter, sort, include); return(localVarResponse.Data); }
public ActionResult GetPatientListByFilter(DataTablesRequest dataTablesRequest, PatientFilter patient) { Service serv = new Service(); int totalRecordsNumber; var model = serv.FindPatiets(dataTablesRequest, patient, out totalRecordsNumber); return(new DataTablesResult(dataTablesRequest.sEcho, totalRecordsNumber, totalRecordsNumber, model)); }
public IActionResult PatientFiltering(PatientFilter patientFIlter) { return(RedirectToAction("Patient", "Home", new { id = patientFIlter.Id, filtering = patientFIlter.Filtering, dataTime = patientFIlter.DatePick })); }