コード例 #1
0
        //public ActionResult GetPatientSearchList(string txtVisitDateInc, string ddlDrInc, string ddlKbn, string ddlVisit, string txtPatientNameInc, string txtPatientIdInc, string sort, string flag, string sortFlag)
        public ActionResult GetPatientSearchList(string txtVisitDateInc, string ddlDrInc, string ddlKbn, string txtVisit, string txtPatientNameInc, string txtPatientIdInc, string sort, string flag, string sortFlag)
        {
            if (!Request.IsAjaxRequest())
            {
                return(PartialView("_PatientSearchResult"));
            }
            PatientSearchViewModel patientSearchViewModel = new PatientSearchViewModel();
            PatientSearchService   service = new PatientSearchService();
            inputModel             model   = new inputModel();

            //訪問日が日付型で無ければ、無視する。(空白として扱う)
            if (!DateTime.TryParse(txtVisitDateInc, out DateTime _))
            {
                txtVisitDateInc = "";
            }

            if (flag == "1")
            {
                model.txtVisitDateInc = txtVisitDateInc;
                model.ddlDrInc        = ddlDrInc;
                model.ddlKbn          = ddlKbn;
                //model.ddlVisit = txtVisit;
                model.txtVisit          = txtVisit;
                model.txtPatientNameInc = txtPatientNameInc;
                model.txtPatientIdInc   = txtPatientIdInc;
                model.sortStr           = sort;
                model.sortFlag          = sortFlag;
            }
            else
            {
                if (mySession.search_visit_date != "" || mySession.search_dr != "" || mySession.search_kbn != "" ||
                    mySession.search_visit != "" || mySession.search_patient_name != "" || mySession.search_patient_id != "" || mySession.patient_search_sort != "")
                {
                    model.txtVisitDateInc = mySession.search_visit_date.ToString();
                    model.ddlDrInc        = mySession.search_dr.ToString();
                    model.ddlKbn          = mySession.search_kbn.ToString();
                    //model.ddlVisit = mySession.search_visit.ToString();
                    model.txtVisit          = mySession.search_visit.ToString();
                    model.txtPatientNameInc = mySession.search_patient_name.ToString();
                    model.txtPatientIdInc   = mySession.search_patient_id.ToString();
                    model.sortStr           = flag == "0" ? mySession.patient_search_sort.ToString() : sort;
                    model.sortFlag          = flag == "0" ? mySession.patient_search_sort_flag.ToString() : sortFlag;
                }
                else if (flag == "0")
                {
                    return(PartialView("_PatientSearchResult", patientSearchViewModel));
                }
                else if (flag == "2")
                {
                    model.sortStr = sort;
                }
            }

            List <PatientSearchResultModel> resultList = service.GetPatientSearchList(model);

            //セッションに検索条件を保存する
            service.RegistSession(model);
            patientSearchViewModel.ResultList = resultList;
            return(PartialView("_PatientSearchResult", patientSearchViewModel));
        }
コード例 #2
0
        public void Should_return_zero_search_results()
        {
            PatientDto expectedDto = new PatientDto()
            {
                Id     = Guid.NewGuid(),
                Name   = "Jeff Carley",
                Status = "Active",
                Street = "123 Main St",
                City   = "Madison",
                State  = "WI",
                Zip    = "53571"
            };

            var query = new EnumerableQuery <PatientDto>(new List <PatientDto>()
            {
                expectedDto
            });

            IReportingRepository <PatientDto> repository = MockRepository.GenerateMock <IReportingRepository <PatientDto> >();

            repository.Stub(repo => repo.GetAll()).Return(query);

            PatientSearchViewModel viewModel = new PatientSearchViewModel(repository);

            // searchs are exact only
            viewModel.SearchText = "Jeff";
            viewModel.Search.Execute(null);

            viewModel.PatientResults.ShouldBeEmpty();
        }
コード例 #3
0
        public void PatientSearchViewModelValidator_GivenClinicalSystemIdHasNotBeenProvided_ValidationShouldFail()
        {
            var model = new PatientSearchViewModel();

            var result = ValidationResult(model);

            result.IsValid.Should().BeFalse();
        }
コード例 #4
0
        public IActionResult SearchCriteria()
        {
            var searchVm = new PatientSearchViewModel();

            searchVm.Index        = (string)Request.Query["index"];
            ViewBag.CriteriaItems = DropdownSearchHelper.CriteriaMatchesDropdownList(Request.Query["fieldType"]);
            return(PartialView(searchVm));
        }
コード例 #5
0
        public ActionResult GetPatientByName(string _searchText, int _skip)
        {
            var _patientDetails = _iPatientService.getPatientsByName(_searchText, _skip, GlobalConst.Records.LandingTake);
            PatientSearchViewModel objPatientList = new PatientSearchViewModel();

            objPatientList.PatientDetails = Mapper.Map <IEnumerable <Patient> >(_patientDetails.PatientDetails);
            objPatientList.TotalCount     = _patientDetails.TotalCount;
            return(Json(objPatientList, GlobalConst.ContentTypes.TextHtml));
        }
コード例 #6
0
        public void DisplayEmptySearchResultsMessage_GivenNullOrganisations_ShouldReturnFalse()
        {
            var model = new PatientSearchViewModel()
            {
                Items = null
            };

            model.DisplayEmptySearchResultsMessage().Should().BeFalse();
        }
コード例 #7
0
        public void DisplayEmptySearchResultsMessagee_GivenZeroOrganisations_ShouldReturnTrue()
        {
            var model = new PatientSearchViewModel()
            {
                Items = new List <PatientViewModel>()
            };

            model.DisplayEmptySearchResultsMessage().Should().BeTrue();
        }
コード例 #8
0
        public void PatientSearchViewModelValidator_GivenClinicalSystemIdHasNotBeProvided_ErrorShouldContainClinicalSystemIdDescription()
        {
            var model = new PatientSearchViewModel();

            var result = ValidationResult(model);

            result.Errors.Should()
            .Contain(x => x.PropertyName == "ClinicalSystemId" && x.ErrorMessage == string.Format("{0} is mandatory", Clinicalsystemid));
        }
コード例 #9
0
        public void CanCreate_GivenZeroOrganisations_ShouldReturnTrue()
        {
            var model = new PatientSearchViewModel()
            {
                Items = new List <PatientViewModel>().AsEnumerable()
            };

            model.CanCreate().Should().BeTrue();
        }
コード例 #10
0
 public PatientSearch()
 {
     InitializeComponent();
     if (psvm == null)
     {
         psvm = new PatientSearchViewModel();
     }
     DataContext = psvm;
 }
コード例 #11
0
        public void HasOrganisations_GivenZeroOrganisations_ShouldReturnFalse()
        {
            var model = new PatientSearchViewModel()
            {
                Items = new List <PatientViewModel>().AsEnumerable()
            };

            model.HasResult().Should().BeFalse();
        }
コード例 #12
0
        public void IndexPOST_GivenPatientSearchViewModelIsValid_BuilderModelShouldBeReturned()
        {
            var model = new PatientSearchViewModel();

            A.CallTo(() => _patientBuilder.BuildPatientSearchViewModel(A <Patients> ._)).Returns(model);

            var result = _personController.Index(model) as ViewResult;

            result.Model.ShouldBeEquivalentTo(model);
        }
コード例 #13
0
        public void IndexPOST_GivenPatientSearchViewModelIsNotValid_ModelShouldBeReturned()
        {
            var model = new PatientSearchViewModel();

            _personController.ModelState.AddModelError("error", "error");

            var result = _personController.Index(model) as ViewResult;

            result.Model.ShouldBeEquivalentTo(model);
        }
コード例 #14
0
        public IActionResult SearchPartial()
        {
            ViewBag.Index = (string)Request.Query["index"];
            CriteriaClassesDropdownList();
            CriteriaMatchesDropdownList();
            PatientFieldsDropdownList();
            var searchVm = new PatientSearchViewModel();

            searchVm.Index = (string)Request.Query["index"];
            return(PartialView(searchVm));
        }
コード例 #15
0
        public void IndexPOST_GivenPatientSearchViewModelIsValid_PatientQueryShouldBeCalled()
        {
            var viewModel = new PatientSearchViewModel()
            {
                ClinicalSystemId = "1"
            };

            _personController.Index(viewModel);

            A.CallTo(() => _queryDispatcher.Dispatch <PatientByClinicalIdQuery, Patients>(A <PatientByClinicalIdQuery> .That.Matches(x => x.ClinicalId == "1"))).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #16
0
        public IActionResult Search(PatientSearchViewModel model, string q = "")
        {
            model.Query = q;

            if (!string.IsNullOrEmpty(q))
            {
                model.Search = new PatientService(HttpContext).SearchPatients(q);
            }

            return(View(model));
        }
コード例 #17
0
        public ActionResult Index(string s)
        {
            getNoOfReferralAccordingToProcessLevels();

            var _patientDetails = _iPatientService.getPatientsByName(s, 0, GlobalConst.Records.LandingTake);
            PatientSearchViewModel objPatientList = new PatientSearchViewModel();

            objPatientList.PatientDetails = Mapper.Map <IEnumerable <Patient> >(_patientDetails.PatientDetails);
            objPatientList.TotalCount     = _patientDetails.TotalCount;
            ViewBag.SearchText            = s;
            return(View(objPatientList));
        }
コード例 #18
0
        public PatientSearch()
        {
            InitializeComponent();

            patientSearchViewModel = new PatientSearchViewModel();

            DataContext = patientSearchViewModel;

            tablePatients = new TablePatients();

            tablePatientCategorys = new TablePatientCategorys();
        }
コード例 #19
0
        public PatientSearchViewModel BuildPatientSearchViewModel(Patients patients)
        {
            if (patients == null)
            {
                throw new ArgumentNullException("patients");
            }

            var viewModel = new PatientSearchViewModel
            {
                Items = patients.Items.Select(Mapper.Map <Patient, PatientViewModel>),
                ClinicalIdDescription = _clinicalSystemIdDescriptionProvider.GetDescription(),
                CanEdit = _userRoleProvider.CurrentUserInAdministratorRole()
            };

            return(viewModel);
        }
コード例 #20
0
        public virtual ActionResult Index(PatientSearchViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var patientQuery = new PatientByClinicalIdQuery {
                    ClinicalId = viewModel.ClinicalSystemId
                };

                var result = _queryDispatcher.Dispatch <PatientByClinicalIdQuery, Patients>(patientQuery);

                var model = _patientViewModelBuilder.BuildPatientSearchViewModel(result);

                return(View(model));
            }

            return(View(viewModel));
        }
コード例 #21
0
        public IActionResult CriteriaPartial()
        {
            string klassName = Request.Query["searchClass"];
            Type   type      = Type.GetType("AspergillosisEPR.Models.Patients." + klassName);

            if (type == null)
            {
                type = Type.GetType("AspergillosisEPR.Models." + klassName);
            }
            var searchVm = new PatientSearchViewModel();

            searchVm.Index = (string)Request.Query["index"];
            dynamic instance = Activator.CreateInstance(type);
            Dictionary <string, string> searchableItems = instance.SearchableFields();

            ViewBag.SearchableItems = new SelectList(searchableItems, "Value", "Key");
            return(PartialView(searchVm));
        }
コード例 #22
0
        public async Task <IActionResult> Create([Bind("Index, SearchCriteria, SearchClass, Field, SearchValue, AndOr")]
                                                 PatientSearchViewModel[] patientSearchViewModel)
        {
            for (var index = 0; index < patientSearchViewModel.Count(); index++)
            {
                var criteria = patientSearchViewModel[index];
                criteria.Index = index.ToString();
                if (index == 0)
                {
                    criteria.AndOr     = "AND";
                    criteria.Predicate = PredicateBuilder.True <Patient>();
                }
                else
                {
                    criteria.AndOr = Request.Query["PatientSearchViewModel[" + index + "].AndOr"];
                    if (criteria.AndOr == "AND")
                    {
                        criteria.Predicate = PredicateBuilder.True <Patient>();
                    }
                    else
                    {
                        criteria.Predicate = PredicateBuilder.False <Patient>();
                    }
                }
            }
            var patients = await _aspergillosisContext.Patients
                           .Include(p => p.PatientDiagnoses).
                           ThenInclude(d => d.DiagnosisType)
                           .Include(p => p.PatientDrugs).
                           ThenInclude(d => d.Drug)
                           .Include(p => p.PatientDiagnoses)
                           .ThenInclude(d => d.DiagnosisCategory)
                           .Include(p => p.PatientDrugs)
                           .ThenInclude(d => d.SideEffects)
                           .ThenInclude(se => se.SideEffect)
                           .Include(p => p.PatientStatus)
                           .Include(p => p.STGQuestionnaires)
                           .Include(p => p.PatientSurgeries)
                           .Include(p => p.PatientAllergicIntoleranceItems)
                           .Where(PatientSearchViewModel.BuildPredicate(patientSearchViewModel))
                           .ToListAsync();

            return(Json(patients));
        }
コード例 #23
0
        public ActionResult Index()
        {
            var query     = BVSBusinessServices.Patients.GetAll();
            var viewModel = new PatientSearchViewModel();

            viewModel.Patients = new List <PatientGridViewModel>();

            foreach (Patient patient in query)
            {
                var u = new PatientGridViewModel()
                {
                    ID           = patient.ID,
                    EmailAddress = patient.EmailAddress,
                    FirstName    = patient.FirstName,
                    LastName     = patient.LastName,
                    IsVoided     = patient.IsVoided
                };
                viewModel.Patients.Add(u);
            }
            return(View(viewModel));
        }
コード例 #24
0
        public async Task <IActionResult> Search([FromForm] PatientSearchViewModel searchViewModel)
        {
            if (searchViewModel == null)
            {
                throw new ArgumentNullException(nameof(searchViewModel));
            }

            var searchCriteria = searchViewModel.SearchCriteria ?? throw new ArgumentNullException(nameof(searchViewModel.SearchCriteria));

            var searchResults = await _patientSvc.PerformPatientSearchAsync(searchCriteria);

            if (searchResults == null)
            {
                var message = "Patient search encountered an error.";
                _log.LogError(message);
                Alert(message, AlertType.danger);
                return(RedirectToAction(nameof(Index), "Patient"));
            }

            searchViewModel.SearchResults = searchResults;

            return(View(searchViewModel));
        }
コード例 #25
0
        public ActionResult GetSearchCondition(inputModel model, String txtVisitDateInc, String flag)
        {
            if (!Request.IsAjaxRequest())
            {
                return(PartialView("_PatientSearchResult"));
            }
            PatientSearchService   service = new PatientSearchService();
            PatientSearchViewModel patientSearchViewModel = new PatientSearchViewModel();

            //訪問日が日付型で無ければ、無視する。(空白として扱う)
            if (!DateTime.TryParse(txtVisitDateInc, out DateTime _))
            {
                txtVisitDateInc = "";
            }

            if (flag == "0")
            {
                patientSearchViewModel.ddlDrInc = "";
                patientSearchViewModel.ddlKbn   = "";
            }
            else if (flag == "1")
            {
                patientSearchViewModel.ddlDrInc = model.ddlDrInc;
                patientSearchViewModel.ddlKbn   = model.ddlKbn;
            }
            else if (flag == "2")
            {
                patientSearchViewModel.ddlDrInc = mySession.search_dr ?? "";
                patientSearchViewModel.ddlKbn   = mySession.search_kbn ?? "";
                patientSearchViewModel.ddlVisit = mySession.search_visit ?? "";
            }
            patientSearchViewModel.doctortList   = service.GetDoctorList(txtVisitDateInc);
            patientSearchViewModel.visitList     = service.GetVisitList(txtVisitDateInc);
            patientSearchViewModel.visitNameList = service.GetVisitNameList(txtVisitDateInc, model.ddlKbn);
            return(PartialView("_PatientSearchInput", patientSearchViewModel));
        }
コード例 #26
0
        public ActionResult Index(FormCollection values)
        {
            string searchCriteria = values["PatientSearchTextBox"];    //Get the value entered in the 'Search' field

            //If the search field is empty then return the top 25 default results
            if (string.IsNullOrEmpty(searchCriteria))
                return View(new PatientSearchViewModel(new PatientRepository().GetTop25()));

            IEnumerable<Patient> patients = new List<Patient>();
            string searchTerms = null;

            //Check if the search criteria contains a Date of Birth
            Regex dobRegEx = new Regex(this.dateRegExpression);
            Match m = dobRegEx.Match(searchCriteria);
            if (m.Success)
            {
                //Parse the DOB to English (en) Great Britain (GB) format 'DD/MM/YYYY' for Ghana
                DateTime dob = DateTime.Parse(m.ToString(), new CultureInfo("en-GB"));

                IList<Patient> dobPatients = new PatientRepository().FindByDateOfBirth(dob);    //Find any patients with this DOB

                patients = patients.Union<Patient>(dobPatients); //Add them to the result set

                //If there are results that matched then show this in the search criteria
                if (dobPatients.Count != 0)
                    searchTerms += string.Format("{0}|", m.ToString());
            }

            //Check if the search criteria contains a Phone Number
            Regex phoneRegEx = new Regex(this.phoneRegExpression); //Check for phone number
            m = phoneRegEx.Match(searchCriteria); //Check if the search string matches the phone number
            if (m.Success)
            {
                //Format the phone number to 'XXXXXXXXXX' format to search for it
                string formattedPhoneNumber = phoneRegEx.Replace(m.ToString(), "$1$2$3");

                //Find any patients with this Phone Number
                IList<Patient> phonePatients = new PatientRepository().FindByPhoneNumber(formattedPhoneNumber);

                patients = patients.Union<Patient>(phonePatients);  //Add them to the result set

                //If there are results that matched then show this in the search criteria
                if (phonePatients.Count != 0)
                    searchTerms += string.Format("{0}|", m.ToString());
            }

            //Check if the search criteria contains a Patient ID (6 character numeric string)
            Regex idRegEx = new Regex(this.patientIDRegExpression); //Check for Patient ID number
            m = idRegEx.Match(searchCriteria);  //Check if the search string contains the Patient ID
            if (m.Success)
            {
                //Find any patients with a matching ID
                IList<Patient> idPatients = new PatientRepository().FindByPatientId(Convert.ToInt32(m.ToString()));

                patients = patients.Union<Patient>(idPatients); //Add them to the result set

                //If there are results that matched then show this in the search criteria
                if (idPatients.Count != 0)
                    searchTerms += string.Format("{0}|", m.ToString());
            }

            //Check if the search criteria contains a Patient ID (6 character numeric string)
            Regex physicalIdRegEx = new Regex(this.physicalIDRegExpression); //Check for Patient ID number
            m = physicalIdRegEx.Match(searchCriteria);  //Check if the search string contains the Patient ID
            if (m.Success)
            {
                //Find any patients with a matching ID
                IList<Patient> physicalIdPatients = new PatientRepository().FindByOldPhysicalRecord(m.ToString());

                patients = patients.Union<Patient>(physicalIdPatients); //Add them to the result set

                //If there are results that matched then show this in the search criteria
                if (physicalIdPatients.Count != 0)
                    searchTerms += string.Format("{0}|", m.ToString());
            }

            //Check if the search criteria contains a Patient name
            Regex nameRegEx = new Regex(this.nameRegExpression); //Check for Patient name
            string[] names = searchCriteria.Split(' ');
            foreach (string name in names)
            {
                m = nameRegEx.Match(name);  //Check if the search string contains a Patient name
                if (m.Success)
                {
                    //Find any patients with a matching name
                    IList<Patient> namePatients = new PatientRepository().FindByFirstName(m.ToString());
                    patients = patients.Union<Patient>(namePatients); //Add them to the result set

                    //If there are results that matched then show this in the search criteria
                    if (namePatients.Count != 0)
                        searchTerms += string.Format("{0}|", m.ToString());

                    namePatients = new PatientRepository().FindByMiddleName(m.ToString());
                    patients = patients.Union<Patient>(namePatients); //Add them to the result set

                    //If there are results that matched then show this in the search criteria
                    if (namePatients.Count != 0)
                        searchTerms += string.Format("{0}|", m.ToString());

                    namePatients = new PatientRepository().FindByLastName(m.ToString());
                    patients = patients.Union<Patient>(namePatients); //Add them to the result set

                    //If there are results that matched then show this in the search criteria
                    if (namePatients.Count != 0)
                        searchTerms += string.Format("{0}|", m.ToString());
                }
            }

            var psvModel = new PatientSearchViewModel(patients, searchTerms);

            return View(psvModel);  //Return the merged result set with no duplicates
        }
コード例 #27
0
        // GET: /Patient/
        /// <summary>
        /// Get the index for patient searching
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var psvModel = new PatientSearchViewModel(new PatientRepository().GetTop25());

            return View(psvModel);
        }
コード例 #28
0
 private ValidationResult ValidationResult(PatientSearchViewModel model)
 {
     return(_patientSearchViewModelValidator.Validate(model));
 }
コード例 #29
0
        public void CanCreate_GivenNullOrganisations_ShouldReturnFalse()
        {
            var model = new PatientSearchViewModel();

            model.CanCreate().Should().BeFalse();
        }
コード例 #30
0
        public void HasOrganisations_GivenNullOrganisations_ShouldReturnFalse()
        {
            var model = new PatientSearchViewModel();

            model.HasResult().Should().BeFalse();
        }