public IActionResult Index()
        {
            var model = new PatientsListViewModel
            {
                Patients = patientBL.GetAllPatients().Select(p => new Patient
                {
                    DbPatient       = p,
                    IsHeightVIsible = true
                })
            };

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult ListPatients(string sortBy = "date", string search = "", int id = 1)
        {
            var page           = id;
            var allItemsCount  = this.patients.GetAll(sortBy, search, this.User.Identity.GetUserId()).Count();
            var totalPages     = (int)Math.Ceiling(allItemsCount / (decimal)ItemsPerPage);
            var itemsToSkip    = (page - 1) * ItemsPerPage;
            var patientsToList = this.patients.GetAll(sortBy, search, this.User.Identity.GetUserId())
                                 .Skip(itemsToSkip).Take(ItemsPerPage)
                                 .To <PatientViewModel>().ToList();

            var viewModel = new PatientsListViewModel
            {
                CurrentPage = page,
                TotalPages  = totalPages,
                Patients    = patientsToList
            };

            return(this.View(viewModel));
        }
Esempio n. 3
0
        public ActionResult PatientGrid(int?patientNumber = null, string activityState = null, bool needFindPatient = false,
                                        int pageSize      = 8)
        {
            User doctor = userRepository.GetUserByLogin(User.Identity.Name);

            if (doctor == null)
            {
                return(null);
            }

            int selectedPatientNumber = patientNumber ?? -1;

            if (RouteData.Values["patientNumber"] != null)
            {
                int.TryParse(RouteData.Values["patientNumber"].ToString(), out selectedPatientNumber);
            }
            bool patientActivityState = true;

            if (string.Equals("inactive", activityState))
            {
                patientActivityState = false;
            }

            if (needFindPatient && selectedPatientNumber > 0)
            {
                Patient pat = patientRepository.GetPatientByUniqueNumber(selectedPatientNumber);
                if (pat != null)
                {
                    patientActivityState = pat.IsActive;
                }
            }

            var formDataQuery = from formData in demographicFormDataRepository.GetAll()
                                select formData;

            var patients = (from patient in patientRepository.GetAll()
                            from visit in patient.Visits
                            from form in visit.Forms
                            from formData in formDataQuery
                            where patient.Doctor.Id == doctor.Id &&
                            visit.VisitTypeValue == (int)VisitType.Baseline &&
                            form.FormTypeValue == (int)FormType.Demographics &&
                            form.Id == formData.Form.Id &&
                            patient.IsActive == patientActivityState
                            orderby patient.Caption descending
                            select new PatientLinkViewModel {
                Id = patient.Id,
                Caption = patient.Caption,
                PatientNumber = patient.PatientNumber,
                Sex = formData.Sex.Value,
                DateOfBirth = formData.DateOfBirth.Value,
                IsSelected = patient.PatientNumber == selectedPatientNumber
            }).ToList();

            var model = new PatientsListViewModel {
                PatientsList            = patients,
                CertainPatientRequested = needFindPatient,
                CertainPatientIsActive  = patientActivityState,
                CertainPatientPageIndex =
                    needFindPatient ? (patients.FindIndex(x => x.PatientNumber == selectedPatientNumber) / pageSize) : -1
            };

            return(PartialView("_PatientGrid", model));
        }
Esempio n. 4
0
 public PatientsListView()
 {
     InitializeComponent();
     _viewModel     = new PatientsListViewModel();
     BindingContext = _viewModel;
 }
Esempio n. 5
0
 public PatientsListPage(PatientsListViewModel viewModel)
 {
     InitializeComponent();
     BindingContext = viewModel;
 }