public async Task <IActionResult> GetReferrals() { var email = _userManager.GetUserId(HttpContext.User); var user = await _userManager.FindByEmailAsync(email); var referral_models = new List <ReferralModel>(); if (await _userManager.IsInRoleAsync(user, "client")) { var profile = _profileService.Get().FirstOrDefault(e => e.user_id == user.Id); var referrals = _referralService.Get().Where(e => e.profile_id == profile.id) .Include(e => e.clinician_) .Include(e => e.profile_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_type_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_activity_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_activity_sub_); foreach (var referral in referrals) { referral_models.Add(new ReferralModel(referral)); } return(Ok(referral_models)); } else if (await _userManager.IsInRoleAsync(user, "clinician")) { var clinician = _clinicianService.Get().FirstOrDefault(e => e.user_id == user.Id); var referrals = _referralService.Get().Where(e => e.clinician_id == clinician.id) .Include(e => e.clinician_) .Include(e => e.profile_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_type_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_activity_) .Include(e => e.profile_match_).ThenInclude(e => e.appointment_activity_sub_); foreach (var referral in referrals) { referral_models.Add(new ReferralModel(referral)); } return(Ok(referral_models)); } return(Ok(referral_models)); }
public IActionResult UpdateProfile(PersonModel personModel) { if (personModel != null) { if (personModel.role == "client") { var profile = _profileService.Get(personModel.id); if (profile != null) { profile.first_name = personModel.first_name; //continue _profileService.Update(profile); return(Ok(200)); } } else if (personModel.role == "clinician") { var clinician = _clinicianService.Get(personModel.id); if (clinician != null) { clinician.first_name = personModel.first_name; //continue _clinicianService.Update(clinician); return(Ok(200)); } } } return(Ok(400)); }
public async Task <IActionResult> CliniciansViewsByClient(int?pageNumber, string query = null) { int pageSize = 25; var profiles = _clinicianService.Get().Include(x => x.mp_profile_match); if (!string.IsNullOrEmpty(query)) { profiles.Where(e => e.last_name.Contains(query) || e.first_name.Contains(query) || e.phone.Contains(query) || e.preferred_name.Contains(query) || e.email.Contains(query)); } return(View(await PaginatedList <mp_clinician> .CreateAsync(profiles.OrderByDescending(e => e.last_name).AsNoTracking(), pageNumber ?? 1, pageSize))); }
public dynamic GetClinician(Guid guid) { var clinician = _clinicianService.Get(guid); if (clinician != null) { return(new { id = clinician.id, phone = clinician.phone, first_name = clinician.first_name, last_name = clinician.last_name }); } return("value"); }
//[AllowAnonymous] public IActionResult Index() { if (User.IsInRole("clinician")) { return(RedirectToAction("MyProfile", "Clinician")); } else if (User.IsInRole("client")) { return(RedirectToAction("MyProfile", "Profile")); } else if (User.IsInRole("admin") || User.IsInRole("super_admin")) { var sql = "select (select count(id) from mp_profile where profile_type=1) as \"clients\",(select count(id) from mp_clinician) as \"clinicians\",(select count(id) from mp_appointment) as \"appointments\" "; var cmd = new NpgsqlCommand(sql); ViewBag.dt = DataAccess.GetDataTable(cmd); sql = "SELECT * from public.get_appointment_monthly_summary()"; cmd = new NpgsqlCommand(sql); ViewBag.appointment_summary = DataAccess.GetDataTable(cmd); var provider_summary = _clinicianService.Get().GroupBy(e => e.area_of_interest).Select(e => new[] { e.Key.Value, e.Count() }).ToList(); ViewBag.provider_summary = provider_summary; sql = "SELECT * from public.get_appointment_trend()"; cmd = new NpgsqlCommand(sql); var appointment_trend = DataAccess.GetDataTable(cmd); ViewBag.appointment_trend = appointment_trend; return(View()); } else { return(NotFound()); } return(View()); }
public async Task <IActionResult> Get() { var email = _userManager.GetUserId(HttpContext.User); var user = await _userManager.FindByEmailAsync(email); var prescription_models = new List <PrescriptionModel>(); if (await _userManager.IsInRoleAsync(user, "client")) { var profile = _profileService.Get().FirstOrDefault(e => e.user_id == user.Id); var prescriptions = _prescriptionService.Get().Where(e => e.profile_id == profile.id).Include(e => e.clinician_).Include(e => e.profile_).Include(e => e.mp_prescription_drug); foreach (var prescription in prescriptions) { var pharmacy = prescription.pharmacy_id.HasValue ? _pharmacyService.GetById(prescription.pharmacy_id.Value) : new mp_pharmacy(); prescription_models.Add(new PrescriptionModel(prescription, pharmacy)); } } else if (await _userManager.IsInRoleAsync(user, "clinician")) { var clinician = _clinicianService.Get().FirstOrDefault(e => e.user_id == user.Id); var prescriptions = _prescriptionService.Get().Where(e => e.clinician_id == clinician.id).Include(e => e.profile_).Include(e => e.clinician_).Include(e => e.mp_prescription_drug); foreach (var prescription in prescriptions) { var pharmacy = prescription.pharmacy_id.HasValue ? _pharmacyService.GetById(prescription.pharmacy_id.Value) : new mp_pharmacy(); prescription_models.Add(new PrescriptionModel(prescription, pharmacy)); } } return(Ok(prescription_models)); }
public IActionResult Clinicians(int appointment_type, int appointment_category, int appointment_category_sub) { ViewBag.appointment_type = appointment_type; ViewBag.appointment_category = appointment_category; ViewBag.appointment_category_sub = appointment_category_sub; var profiles = _clinicianService.Get(); if (appointment_type == 1) { profiles = profiles.Where(e => e.area_of_interest == 165 || e.area_of_interest == 166); } else { profiles = profiles.Where(e => e.area_of_interest == 167); } return(View(profiles)); }
public IActionResult GetDoctor() { var clinician = _clinicianService.Get().FirstOrDefault(); return(Ok(new DoctorModel(clinician))); }