Beispiel #1
0
        public JsonResult SearchDoctor(SearchDoctorModel model)
        {
            SeeDoctorRepository objSeeDoctorRepo = new SeeDoctorRepository();

            //IEnumerable<SeeDoctorDTO> docList= objDoctorRepo.SeeDoctor(model.Doctor.firstName, model.Gender, model.Language, model.Speciallity, model.AppDate.DayOfWeek.ToString(), model.Timing.seacrhTime);
            try
            {
                if (model.gender == "ALL")
                {
                    model.gender = null;
                }
                if (model.name == "")
                {
                    model.name = null;
                }
                if (model.language == "ALL")
                {
                    model.language = null;
                }
                if (model.speciality == "ALL")
                {
                    model.speciality = null;
                }
                if (model.appTime.ToString() == "")
                {
                    model.appTime = null;
                }
                List <DoctorDataset> doctorList = objSeeDoctorRepo.SeeDoctor(model);
                return(Json(new { Success = true, DoctorModel = doctorList }));
            }
            catch (Exception ex)
            {
                return(Json(new { Message = ex.Message }));
            }
        }
 public SearchDoctorResult SeeDoctorWithShift(SearchDoctorModel searchModel)
 {
     try
     {
         var strContent = JsonConvert.SerializeObject(searchModel);
         var response   = ApiConsumerHelper.PostData("api/searchDoctorwithFav/?searchModel", strContent);
         var result     = JsonConvert.DeserializeObject <SearchDoctorResult>(response);
         return(result);
     }
     catch (HttpResponseException ex)
     {
         throw ex;
     }
 }
 public List <DoctorDataset> SeeDoctor(SearchDoctorModel searchModel)
 {
     try
     {
         var strContent = JsonConvert.SerializeObject(searchModel);
         var response   = ApiConsumerHelper.PostData("api/searchDoctor/?searchModel", strContent);
         var result     = JsonConvert.DeserializeObject <List <DoctorDataset> >(response);
         return(result);
     }
     catch (HttpResponseException ex)
     {
         throw ex;
     }
 }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        public IActionResult GetSearchClinicians(SearchDoctorModel search)
        {
            var provider_category = _providerCategoryService.GetClinicianCategory();
            var clinicians        = _clinicianService.GetClinicians();

            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))
            {
                clinicians = clinicians.Where(e => e.last_name.ToLower().Contains(search.name.ToLower()) || e.first_name.ToLower().Contains(search.name.ToLower()));
            }

            var doctors = new List <DoctorModel>();

            foreach (var clinician in clinicians)
            {
                doctors.Add(new DoctorModel(clinician));
            }

            return(Ok(doctors));
        }
Beispiel #6
0
        public IQueryable <mp_clinician> Get(SearchDoctorModel model)
        {
            IQueryable <mp_clinician> clinicians = _context.mp_clinician.Include(e => e.mp_clinician_category).Include(e => e.mp_clinician_specialty).Include(e => e.mp_clinician_other_activities).AsQueryable();

            return(clinicians.Where(e => e.mp_clinician_category.Any(e => e.id == model.appointmentCategory) && e.mp_clinician_other_activities.Any(e => e.id == model.appointmentActivity)));
        }
        public HttpResponseMessage searchDoctorwithFav(SearchDoctorModel searchModel)
        {
            string   timingsFrom    = null;
            string   timingsTo      = null;
            TimeSpan?appFromtimings = null;
            TimeSpan?appTotimings   = null;

            if (searchModel.language == "")
            {
                searchModel.language = null;
            }
            if (searchModel.speciality == "")
            {
                searchModel.speciality = null;
            }
            if (searchModel.name == "")
            {
                searchModel.name = null;
            }
            if (searchModel.appDate == "")
            {
                searchModel.appDate = null;
            }
            if (searchModel.appTime == "")
            {
                searchModel.appTime = null;
            }
            if (searchModel.gender == "")
            {
                searchModel.gender = null;
            }



            try
            {
                if (searchModel.appTime != null)
                {
                    List <string> timeframe = searchModel.appTime.Split(':').ToList <string>();
                    var           j         = 0;
                    foreach (var item in timeframe)
                    {
                        if (j == 0)
                        {
                            //timingsFrom = item;
                            if (item.Length == 1)
                            {
                                timingsFrom = "0" + item;
                            }
                            else
                            {
                                timingsFrom = item;
                            }
                            j++;
                            continue;
                        }
                        if (j == 1)
                        {
                            if (item.Length == 1)
                            {
                                timingsTo = "0" + item;
                            }
                            else
                            {
                                timingsTo = item;
                            }
                        }
                    }
                    DateTime dateTimeFrom = DateTime.ParseExact(timingsFrom + ":00",
                                                                "HH:mm", CultureInfo.InvariantCulture);
                    DateTime dateTimeTo = DateTime.ParseExact(timingsTo + ":00",
                                                              "HH:mm", CultureInfo.InvariantCulture);

                    appFromtimings = dateTimeFrom.TimeOfDay;
                    appTotimings   = dateTimeTo.TimeOfDay;
                }
                if (searchModel.appDate == null)
                {
                    var result = (from l in db.SearchDoctorWithShift(searchModel.language, searchModel.speciality, searchModel.name, null,
                                                                     appFromtimings, appTotimings, searchModel.gender)
                                  select new SearchDoctorWithShift_Model {
                        doctorID = l.doctorID, title = l.title,
                        firstName = l.firstName,
                        lastName = l.lastName,
                        city = l.city,
                        ProfilePhotoBase64 = l.ProfilePhotoBase64,
                        state = l.state,
                        languageName = l.languageName,
                        specialityName = l.specialityName,
                        reviewStar = l.reviewStar
                    }
                                  ).ToList();
                    var favdoc = (from l in db.FavouriteDoctors
                                  where l.patientID == searchModel.patientID && l.active == true
                                  select new FavouriteDoctorModel {
                        docID = l.doctorID, patID = l.patientID
                    }).ToList();
                    SearchDoctorResult searchResult = new SearchDoctorResult();
                    searchResult.doctor    = result;
                    searchResult.favdoctor = favdoc;

                    response = Request.CreateResponse(HttpStatusCode.OK, searchResult);
                }

                if (searchModel.appDate != null)
                {
                    try
                    {
                        string      dateString = searchModel.appDate.Trim();
                        string      format     = "dd/MM/yyyy";
                        CultureInfo provider   = CultureInfo.InvariantCulture;

                        DateTime day    = DateTime.ParseExact(dateString, format, provider);
                        var      result = (from l in db.SearchDoctorWithShift(searchModel.language, searchModel.speciality, searchModel.name, day.DayOfWeek.ToString(),
                                                                              appFromtimings, appTotimings, searchModel.gender)
                                           select new SearchDoctorWithShift_Model
                        {
                            doctorID = l.doctorID,
                            title = l.title,
                            firstName = l.firstName,
                            lastName = l.lastName,
                            city = l.city,
                            ProfilePhotoBase64 = "",
                            state = l.state,
                            languageName = l.languageName,
                            specialityName = l.specialityName,
                            reviewStar = l.reviewStar
                        }
                                           ).ToList();
                        var favdoc = (from l in db.FavouriteDoctors
                                      where l.patientID == searchModel.patientID && l.active == true
                                      select new FavouriteDoctorModel {
                            docID = l.doctorID, patID = l.patientID
                        }).ToList();
                        SearchDoctorResult searchResult = new SearchDoctorResult();
                        searchResult.doctor    = result;
                        searchResult.favdoctor = favdoc;

                        response = Request.CreateResponse(HttpStatusCode.OK, searchResult);
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("{0} is not in the correct format.", searchModel.appDate.Trim());
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                return(ThrowError(ex, "searchDoctorwithFav in SeacrhDoctorController."));
            }
        }