public IActionResult GetClinicianServiceCosts(Guid clinician_id) { var costs = _serviceCostService.Get().Where(e => e.clinician_id == clinician_id); var costing_models = new List <CostingModel>(); var provider_categories = _providerCategoryService.GetClinicianCategory().Where(e => e.clinician_id == clinician_id).Include(e => e.appointment_category_subNavigation); foreach (var provider_category in provider_categories) { var appointment_sub_services = Options.GetAppointmentSubServices().Where(e => e.activity_sub_id == provider_category.appointment_category_sub).Select(e => e.appointment_service_id); var appointment_services = Options.GetAppointmentServices().Where(e => appointment_sub_services.Contains(e.id)); foreach (var appointment_service in appointment_services) { decimal amount = 0; var service_cost = costs.FirstOrDefault(e => e.appointment_activity_sub_id == provider_category.appointment_category_sub && e.appointment_service_id == appointment_service.id); if (service_cost != null) { amount = service_cost.cost; } costing_models.Add(new CostingModel { service_id = appointment_service.id, service_name = appointment_service.name, sub_id = provider_category.appointment_category_sub, sub_name = provider_category.appointment_category_subNavigation.name, cost = amount }); } } return(Ok(costing_models)); }
public IActionResult Settings() { var user_id = _userManager.GetUserId(HttpContext.User); var profile = _clinicianService.Get().FirstOrDefault(e => e.user_id == user_id); var costing_models = new List <CostingModel>(); var provider_categories = _providerCategoryService.GetClinicianCategory().Where(e => e.clinician_id == profile.id).Include(e => e.appointment_category_subNavigation); foreach (var provider_category in provider_categories) { var appointment_sub_services = Options.GetAppointmentSubServices().Where(e => e.activity_sub_id == provider_category.appointment_category_sub).Select(e => e.appointment_service_id); var appointment_services = Options.GetAppointmentServices().Where(e => appointment_sub_services.Contains(e.id)); foreach (var appointment_service in appointment_services) { costing_models.Add(new CostingModel { service_id = appointment_service.id, service_name = appointment_service.name, sub_id = provider_category.appointment_category_sub, sub_name = provider_category.appointment_category_subNavigation.name }); } } ViewBag.costing_models = costing_models; //var appointment_services = Options.GetAppointmentServices().Where(e => appointment_sub_services.Contains(e.id)); ViewBag.service_costs = _serviceCostService.Get().Where(e => e.clinician_id == profile.id); ViewBag.schedules = _clinicianAvailabilityService.Get(profile.id); return(View(profile)); }
public IActionResult GetClinicians(SearchDoctorModel search) { var provider_category = _providerCategoryService.GetClinicianCategory(); var areas = Options.Getlookups("area_of_interest"); var clinicians = _clinicianService.GetClinicians(); List <DoctorModel> doctorModels = new List <DoctorModel>(); if (search.appointmentType.HasValue) { provider_category = provider_category.Where(e => e.appointment_type == search.appointmentType.Value); } if (search.appointmentCategory.HasValue) { provider_category = provider_category.Where(e => e.appointment_category == search.appointmentCategory.Value); } if (search.appointmentActivity.HasValue) { provider_category = provider_category.Where(e => e.appointment_category_sub == search.appointmentActivity.Value); } if (provider_category.Any()) { var ids = provider_category.Select(e => e.clinician_id).ToList(); clinicians = clinicians.Where(e => ids.Contains(e.id)); } //check if name is one of the search models if (!string.IsNullOrEmpty(search.name)) { var category = areas.FirstOrDefault(x => x.value.ToLower() == search.name.ToLower()); clinicians = clinicians.Where(e => e.last_name.ToLower().Contains(search.name.ToLower()) || e.first_name.ToLower().Contains(search.name.ToLower()) || (e.area_of_interest == (category == null ? -1 : category.id))); } if (clinicians.Count() > 0) { foreach (var clinician in clinicians) { doctorModels.Add(new DoctorModel(clinician)); } } return(Ok(doctorModels)); }