public DataSourceResult <PatientViewModel> Search(SearchPatientViewModel searchPatientViewModel, int pageIndex, int pageSize)
        {
            ModelPager modelPager = new ModelPager()
            {
                PageIndex   = pageIndex,
                PageSize    = pageSize,
                IncludeAll  = false,
                SortOrder   = SortOrder.ASCENDING,
                OrderColumn = "FirstName"
            };
            PatientDtoResult response = _PhekoServiceClient.Search(_PatientViewModelMapper.MapSearchPatientViewModelToPatientDto(searchPatientViewModel), modelPager);

            //if (response.)
            //{
            //    ModelException modelException = new ModelException();

            //    response.FieldErrors.ToList<FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError() { FieldName = item.FieldName, Message = item.ErrorMessage }));

            //    throw modelException;
            //}

            return(new DataSourceResult <PatientViewModel>()
            {
                Total = response.Total,
                Data = response.Models.Select(item => _PatientViewModelMapper.MapToPatientViewModel(item)).ToList <PatientViewModel>()
            });
        }
        /// <summary>
        /// Search patient by id
        /// </summary>
        /// <param name="model">Search view model</param>
        /// <returns>View</returns>
        public ActionResult SearchPatientById(SearchPatientViewModel model)
        {
            if (!model.PatientId.HasValue)
            {
                TempData["errorMessage"] = "No record found.";
                return(RedirectToAction("Search"));
            }

            var viewModel = _patientRepository.GetPatient(model.PatientId.Value);

            if (viewModel != null)
            {
                var relationships = _relationshipRepository.GetRelationships();
                if (relationships != null)
                {
                    viewModel.PropertyPatientNOKDetail = new ViewModel.NOKDetails.NOKDetailsViewModel
                    {
                        RelationshipList = new SelectList(relationships.Select(x => new SelectListItem {
                            Text = x.Description, Value = x.RelationshipId.ToString()
                        }), "Value", "Text")
                    };
                }

                return(View("Edit", viewModel));
            }
            else
            {
                TempData["errorMessage"] = "No record found.";
                return(RedirectToAction("Search"));
            }
        }
Exemple #3
0
 public IEnumerable <Patient> SearchPatient(SearchPatientViewModel model)
 {
     return(GetList(p => (model.Name != null && p.FirstName?.ToUpper()?.Trim() == model.Name?.ToUpper()?.Trim()) ||
                    (model.Name != null && p.LastName?.ToUpper()?.Trim() == model.Name?.ToUpper()?.Trim()) ||
                    (model.MRN != null && p.MRN?.ToUpper()?.Trim() == model.MRN?.ToUpper()?.Trim()) ||
                    (model.Contact != null && p.PhoneNumber?.ToUpper()?.Trim() == model.Contact?.ToUpper()?.Trim())));
 }
Exemple #4
0
 public ActionResult LoadPatients(SearchPatientViewModel model)
 {
     try
     {
         DataSourceResult response = _IPatientHandler.Search(model);
         return(Json(new { ok = true, total = response.Total, data = response.Data }, JsonRequestBehavior.AllowGet));
     }
     catch (ModelException ex)
     {
         return(Json(new { errors = ex.ModelErrors }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #5
0
 public ActionResult SearchPatient(SearchPatientViewModel model)
 {
     try
     {
         DataSourceResult response = _IPatientHandler.Search(model);
         //return Json(new { ok = true, total = response.Total, data = response.Data });
         return(PartialView("_SearchPatientGrid", response.Data));
     }
     catch (ModelException ex)
     {
         return(Json(new { errors = ex.ModelErrors }));
     }
 }
 public ActionResult SearchPatient(SearchPatientViewModel model, int pageIndex, int pageSize)
 {
     try
     {
         DataSourceResult <PatientViewModel> response = _IPatientHandler.Search(model, pageIndex, pageSize);
         //return Json(new { ok = true, total = response.Total, data = response.Data });
         return(Json(new { data = response }));
     }
     catch (ModelException ex)
     {
         return(Json(new { errors = ex.ModelErrors }));
     }
 }
        public ActionResult LoadPatients(SearchPatientViewModel searchPatientViewModel, int pageIndex, int pageSize)
        {
            try
            {
                Response.CacheControl = "no-cache";

                DataSourceResult <PatientViewModel> response = _IPatientHandler.Search(searchPatientViewModel, pageIndex, pageSize);

                return(Json(new { data = response }, JsonRequestBehavior.AllowGet));
            }
            catch (ModelException ex)
            {
                return(Json(new { errors = ex.ModelErrors }, JsonRequestBehavior.AllowGet));
            }
        }
        public PatientDto MapSearchPatientViewModelToPatientDto(SearchPatientViewModel searchPatientViewModel)
        {
            if (searchPatientViewModel == null)
            {
                return(null);
            }

            PatientDto patientDto = new PatientDto();

            patientDto.PatientId = searchPatientViewModel.PatientId;
            patientDto.FirstName = searchPatientViewModel.FirstName;
            patientDto.LastName  = searchPatientViewModel.LastName;
            patientDto.BirthDate = Converter.StringToDate(searchPatientViewModel.BirthDate);
            patientDto.IDNumber  = searchPatientViewModel.IdNumber;

            return(patientDto);
        }
Exemple #9
0
        public ActionResult Search(SearchPatientViewModel model)
        {
            if (ModelState.IsValid)
            {
                var patients = patientService.SearchPatient(model.Keyword).ToList();

                if (patients != null && patients.Count > 0)
                {
                    return(Json(
                               new { result = true, records = patients },
                               JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(
                       new { result = false, message = "Provide keyword to search for" },
                       JsonRequestBehavior.AllowGet));
        }
Exemple #10
0
        // GET: LabRequest
        public ActionResult GenerateLabRequest(SearchPatientViewModel model)
        {
            LabRequestViewModel labRequest = new LabRequestViewModel();

            if (TempData.ContainsKey("PatientDetails"))
            {
                model.patient      = (Patient)TempData["PatientDetails"];
                labRequest.Patient = model.patient;
                labRequest.Sample  = "Blood";
            }
            else
            {
                TempData["_Error"] = "Some Error Occurred";
                return(RedirectToAction("Error", "Error"));
            }

            return(View(labRequest));
        }
Exemple #11
0
        public ActionResult SearchPatient(SearchPatientViewModel searchPatientViewModel)
        {
            //search for all patients
            var blockChainApiService   = new Logic.Services.BlockChainService();
            var foundPatients          = blockChainApiService.GetAllPatients();
            var foundPatientsViewModel = new FoundPatientsViewModel();

            foundPatientsViewModel.FoundPatients = foundPatients;

            if (foundPatients.Count() < 1)
            {
                return(RedirectToAction("NoPatientsFound", "Home"));
            }
            else
            {
                return(RedirectToAction("FoundPatients", "Home", new { foundPatientsViewModel = foundPatientsViewModel }));
            }
        }
Exemple #12
0
        public DataSourceResult Search(SearchPatientViewModel searchPatientViewModel)
        {
            PatientDtoResult response = _PhekoServiceClient.Search(_PatientViewModelMapper.MapSearchPatientViewModelToPatientDto(searchPatientViewModel));

            //if (response.)
            //{
            //    ModelException modelException = new ModelException();

            //    response.FieldErrors.ToList<FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError() { FieldName = item.FieldName, Message = item.ErrorMessage }));

            //    throw modelException;
            //}

            return(new DataSourceResult()
            {
                Total = response.Models.Count(),
                Data = response.Models.Select(item => _PatientViewModelMapper.MapToPatientViewModel(item)).ToList <PatientViewModel>()
            });
        }
Exemple #13
0
        public void SearchPatient()
        {
            SearchPatientViewModel criteria = View.GetSearchCriteria();

            PatientsViewModel patients;

            try
            {
                using (var proxy = _patientService.CreateChannel())
                {
                    patients = proxy.SearchPatients(criteria);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            View.ShowSearchResult(patients);
        }
        public ActionResult PatientDetails(SearchPatientViewModel modeldata)
        {
            var patientId = string.Empty;

            patientId = modeldata.searchPatientId;

            var patientResult = _serviceFactory.GetPatientDetails(patientId);

            TempData["PatientDetails"] = patientResult.patient;

            if (patientResult.patient != null)
            {
                TempData["PatientName"] = patientResult.patient.Name[0];
            }
            else
            {
                TempData["_Error"] = "No Patient Found";
                return(RedirectToAction("Error", "Error"));
            }

            return(View(patientResult));
        }
 public SearchPatientPage()
 {
     InitializeComponent();
     BindingContext = new SearchPatientViewModel();
 }
 public IEnumerable <Patient> SearchPatient(SearchPatientViewModel model)
 {
     return(_repo.SearchPatient(model));
 }
        /// <summary>
        /// Search action
        /// </summary>
        /// <returns>Search view</returns>
        public ActionResult Search()
        {
            var viewModel = new SearchPatientViewModel();

            return(View(viewModel));
        }
Exemple #18
0
        public PartialViewResult _SearchPatient()
        {
            var searchPatientViewModel = new SearchPatientViewModel();

            return(PartialView(searchPatientViewModel));
        }
Exemple #19
0
 public PatientsViewModel SearchPatients(SearchPatientViewModel criteria)
 {
     throw new NotImplementedException();
 }