Exemplo n.º 1
0
        /// <summary>
        /// Метод представления списка пациентов, с результатми поиска
        /// </summary>
        /// <param name="Vaccination">Параметры вакцинации</param>
        /// <param name="searchString">Строка с поиском пациента по Имени, фамили и снилс</param>
        /// <returns>
        /// Представление списка пациентов
        /// </returns>
        public IActionResult Index(int?Vaccination, string searchString)
        {
            IQueryable <Patient> Patients = db.Patients.Include(p => p.Vaccinations);

            if (Vaccination != null && Vaccination != 0)
            {
                Patients = Patients.Where(p => p.Id == Vaccination);
            }
            if (!String.IsNullOrEmpty(searchString))
            {
                Patients = Patients.Where(p => p.Name.Contains(searchString) || p.Family.Contains(searchString) || p.Snils.Contains(searchString));
            }
            List <Vaccination> vaccinations = db.Vaccinations.ToList();

            vaccinations.Insert(0, new Vaccination {
                Name = "Все", Id = 0
            });

            PatientListViewModel viewModel = new PatientListViewModel
            {
                Patients = Patients.ToList(),
            };

            return(View(viewModel));
        }
        public IActionResult Index()
        {
            var patientInfoService = new PatientInfo();

            var patientList = new List <PatientInfo>();

            if (!memoryCache.TryGetValue("PatientInfoCache", out patientList))
            {
                if (patientList == null || !patientList.Any())
                {
                    patientList = patientInfoService.GetPatientInfos();
                }

                var cacheEntryOptions = new MemoryCacheEntryOptions();
                cacheEntryOptions.SetSlidingExpiration(TimeSpan.FromSeconds(7));

                // here we need to set the value for cache memory
                memoryCache.Set("PatientInfoCache", patientList, cacheEntryOptions);

                //to remove
                memoryCache.Remove("PatientInfoCache");
            }

            var model = new PatientListViewModel
            {
                PatientInfos = patientList
            };

            return(View(model));
        }
 public AddPatientView(PatientListViewModel patientListViewModel,
                       PatientService patientService,
                       DiagnosisService diagnosisService,
                       PersonService personService,
                       EmployeeService employeeService,
                       WardService wardService,
                       BedService bedService,
                       PhysicianService physicianService,
                       VitalRecordService vitalRecordService,
                       ConditionService conditionService)
 {
     _toAddPatient = new AddPatientViewModel(patientListViewModel,
                                             patientService,
                                             personService,
                                             diagnosisService,
                                             physicianService,
                                             employeeService,
                                             wardService,
                                             bedService,
                                             vitalRecordService,
                                             conditionService);
     DataContext = _toAddPatient;
     InitializeComponent();
     InsuranceCheckBox.IsChecked = true;
 }
        private void SelectPatient(object o)
        {
            var vm     = new PatientListViewModel(Repository, _dialogRepository);
            var dialog = _dialogRepository.GetView(vm);

            if (dialog?.ShowDialog() == true)
            {
                Appointment.Patient   = _mapper.Map <PatientNewDto>(vm.SelectedPatient !.Patient);
                Appointment.PatientId = vm.SelectedPatient !.Id;
                OnPropertyChanged(nameof(Name));
            }
        }
Exemplo n.º 5
0
        public ActionResult Me()
        {
            var vm = new PatientListViewModel();

            var patient = PatientSvc.GetPatientByUserName(User.Identity.Name);

            if (patient == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("File", new { id = patient.ID }));
        }
Exemplo n.º 6
0
        public ActionResult Index()
        {
            var vm = new PatientListViewModel();

            var physician = physicianSvc.GetPhysician(User.Identity.Name);

            if (physician != null)
            {
                vm.Patients = physician.Patients;
            }

            return(View(vm));
        }
        /*
         * // POST: Patient/Delete/5
         * [System.Web.Http.HttpPost]
         * public ActionResult Delete(int id, FormCollection collection)
         * {
         *  try
         *  {
         *      bool deleted = _document.DeletePatient(id);
         *      return RedirectToAction("Index");
         *  }
         *  catch (Exception ex)
         *  {
         *
         *      throw;
         *  }
         * }
         */

        // GET: Patient/GetCollection
        public ActionResult PatientList()
        {
            try
            {
                List <Patient>       col   = _document.GetPatientCollection();
                PatientListViewModel model = new PatientListViewModel();
                model.PatientCollection = col;
                return(View("PatientList", model));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "User type is invalid !" + Environment.NewLine + ex.Message;
                return(RedirectToAction("Index", "Home"));
            }
        }
        public IActionResult Index(string searchString)
        {
            var patients = _fhirDataLoader.GetPatientList();

            if (!string.IsNullOrEmpty(searchString))
            {
                patients = patients.Where(s => s.Surname.Contains(searchString));
            }

            var patientsViewModel = new PatientListViewModel
            {
                Patients     = patients.ToList(),
                SearchString = searchString
            };

            return(View(patientsViewModel));
        }
        public ActionResult Index()
        {
            var model    = new PatientListViewModel();
            var patients = Patients.Get(db);
            var list     = new List <PatientViewModel>();

            foreach (var p in patients)
            {
                var patient = new PatientViewModel(p);
                patient.PatientId = p.PatientId;
                list.Add(patient);
            }
            model.Patients   = list;
            model.FooterData = new FooterViewModel("Tallinn Hospital");

            return(View("Index", model));
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            var nvm = new PatientListViewModel();

            using (var c = new DataModelContext())
            {
                nvm.Patients = c.Patients.Include("Therapist").Where(n => n.LastName != null).ToList();
            }

            object alertObject;

            if (TempData.TryGetValue("Alert", out alertObject))
            {
                ViewBag.Alert = alertObject;
            }

            return(View(nvm));
        }
        public List <PatientListViewModel> PatientlistToViewModel(List <Patient> patienten)
        {
            List <PatientListViewModel> Patienten = new List <PatientListViewModel>();

            foreach (Patient p in patienten)
            {
                PatientListViewModel patient = new PatientListViewModel
                {
                    UserId = p.Id,
                    Name   = p.Name,
                    Gender = p.Gender,
                    Birth  = p.Birth
                };

                Patienten.Add(patient);
            }

            return(Patienten);
        }
Exemplo n.º 12
0
        public async Task <ActionResult> Index(string search, PatientFilterColumns column = PatientFilterColumns.SSN, int?page = null)
        {
            int pageSize   = 25;
            int pageNumber = (page ?? 1);

            IQueryable <Patient> query = db.Patients;

            if (!string.IsNullOrWhiteSpace(search))
            {
                query = ApplyFilter(search, column, query);
            }

            var patients = await query.OrderBy(patient => patient.LastName)
                           .ThenBy(patient => patient.FirstName)
                           .ToPagedListAsync(pageNumber, pageSize);

            var viewModel = new PatientListViewModel(patients, search, column);

            return(View(viewModel));
        }
Exemplo n.º 13
0
 public PatientView()
 {
     _patientService       = new PatientService(new MVCHContext());
     _patientListViewModel = new PatientListViewModel(_patientService);
     _diagnosisService     = new DiagnosisService(new MVCHContext());
     _personService        = new PersonService(new MVCHContext());
     _employeeService      = new EmployeeService(new MVCHContext());
     _wardService          = new WardService(new MVCHContext());
     _bedService           = new BedService(new MVCHContext());
     _physicianService     = new PhysicianService(new MVCHContext());
     _vitalRecordService   = new VitalRecordService(new MVCHContext());
     _conditionService     = new ConditionService(new MVCHContext());
     _visitService         = new VisitService(new MVCHContext());
     _treatmentService     = new TreatmentService(new MVCHContext());
     _procedureService     = new ProcedureService(new MVCHContext());
     _orderServiceLayer    = new OrderServiceLayer(new MVCHContext());
     _orderServiceService  = new OrderServiceService(new MVCHContext());
     _patientOrderService  = new PatientOrderService(new MVCHContext());
     _orderItemService     = new OrderItemService(new MVCHContext());
     DataContext           = _patientListViewModel;
     InitializeComponent();
 }
Exemplo n.º 14
0
        public ActionResult Index(string sort, string searchByName, int?page)
        {
            int pageSize   = 3;
            int pageNumber = (page ?? 1);
            PatientListViewModel viewModel     = new PatientListViewModel();
            IQueryable <Patient> patientsQuery = db.Patients
                                                 .Include(p => p.PersonalDoctor);

            if (!string.IsNullOrEmpty(searchByName))
            {
                patientsQuery = patientsQuery.Where(p => p.FirstName.Contains(searchByName) || p.LastName.Contains(searchByName));
            }

            switch (sort)
            {
            case "name_desc":
                patientsQuery = patientsQuery.OrderByDescending(p => p.LastName).ThenByDescending(p => p.FirstName);
                break;

            default:
                patientsQuery = patientsQuery.OrderBy(p => p.LastName).ThenBy(p => p.FirstName);
                break;
            }

            PatientTranslator patientTranslator = new PatientTranslator();

            viewModel.Patients = patientsQuery
                                 .Select(patientTranslator.ToViewModel)
                                 .ToPagedList(pageNumber, pageSize);

            viewModel.CurrentSort = sort;
            viewModel.SortByname  = string.IsNullOrEmpty(sort) ? "name_desc" : "";
            viewModel.NameFilter  = searchByName;

            return(View(viewModel));
        }
Exemplo n.º 15
0
 public virtual void SetPatientList(PatientListViewModel list)
 {
     _patientList = list;
     _patientList.SelectionChanged += _patientList_SelectionChanged;
 }
 public PatientListItemViewModel(PatientListViewModel parent)
 {
     Parent = parent;
 }
Exemplo n.º 17
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // open the Users screen
                MainWindow      mainWindow    = new MainWindow();
                MainViewModel   mainviewModel = new MainViewModel();
                PatientListView patientView   = null;

                string themeName = "Green";//default theme
                if (System.IO.File.Exists(APP_SETTING_PATH))
                {
                    var applicationThemeSetting = File.ReadAllText("PatientCARE_TEST_THEME.txt");
                    applicationThemeSetting = applicationThemeSetting.Replace(System.Environment.NewLine, "");
                    var listTheme = new string[] { "White", "Green", "Red", "Blue" };
                    foreach (var item in listTheme)
                    {
                        if (applicationThemeSetting.ToUpper() == item.ToUpper())
                        {
                            themeName     = item;
                            _settingTheme = themeName;
                            break;
                        }
                    }
                }
                // Loading theme
                LoadTheme(themeName);


                mainviewModel.ThemeChangeEvent            += (changeTheme) => { LoadTheme(changeTheme); };
                mainviewModel.NewPateintEvent             += (patientId) => { LoadPatient(patientId, mainWindow, mainviewModel); };
                mainviewModel.ClosePateintEvent           += () => { ClosePatient(mainWindow, mainviewModel); };
                mainviewModel.ShowPateintListScreenAction += () =>
                {
                    try
                    {
                        // ensure only one view is loaded, and the same one remains open for multiple requests
                        patientView = patientView ?? new PatientListView();

                        if (!patientView.IsLoaded)
                        {
                            var patientListViewModel = new PatientListViewModel();
                            patientView.Close();
                            patientView = new PatientListView();
                            patientListViewModel.ClosePateintListScreenAction += () => { patientView.Close(); };
                            patientListViewModel.PatientSelectedAction        += () =>
                            {
                                LoadPatient(patientListViewModel.SelectedPatient.PatientId, mainWindow, mainviewModel);
                                patientView.Close();
                            };
                            patientView.DataContext = patientListViewModel;
                        }

                        patientView.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                        Application.Current.Shutdown();
                    }
                };

                var loginView = new LoginView();

                var loginViewModel = new ViewModel.LoginViewModel();
                loginViewModel.LoginEvent += () =>
                {
                    loginView.Close();
                    TabControl addTabControl = new TabControl();
                    addTabControl.Name            = "tcMain";
                    addTabControl.BorderThickness = new Thickness(0);

                    mainWindow.mainPanel.Children.Add(addTabControl);
                    mainWindow.DataContext = mainviewModel;
                    mainWindow.Show();
                };
                loginViewModel.CancelLoginEvent += () => { App.Current.Shutdown(); };
                loginView.DataContext            = loginViewModel;
                loginView.Closed += new EventHandler(loginView_Closed);
                loginView.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
                Application.Current.Shutdown();
            }
        }
Exemplo n.º 18
0
        public ActionResult CreateBlank(string PatientFirstName, string PatientLastName,
                                        DateTime PatientBirthday, string PatientGender, int PatientFeet, int PatientInches,
                                        double PatientWeight, string PatientDoctor, string PatientArthritisType,
                                        string PatientAffectedExtremity, string PatientDeformity, string PatientCity, string PatientState,
                                        string PatientPhoneNumber, string PatientEmail)
        {
            var nvm = new PatientListViewModel();

            if (PatientFirstName == "")
            {
                ViewBag.UploadAlert = "Enter the patient's first name";

                using (var c = new DataModelContext())
                {
                    nvm.Patients = c.Patients.Include("Therapist").Where(n => n.LastName != null).ToList();
                }
                return(View("Index", nvm));
            }

            if (PatientLastName == "")
            {
                ViewBag.UploadAlert = "Enter the patient's last name";

                using (var c = new DataModelContext())
                {
                    nvm.Patients = c.Patients.Include("Therapist").Where(n => n.LastName != null).ToList();
                }
                return(View("Index", nvm));
            }

            using (var c = new DataModelContext())
            {
                var patient = new Patient();
                patient.ReportResult = ReportEngine.getInstance().GenerateReport(patient);
                patient.MedProfile   = new MedProfile();

                patient.FirstName         = PatientFirstName;
                patient.LastName          = PatientLastName;
                patient.Therapist         = UserDataEngine.getInstance().GetCurrentUser(c, HttpContext);
                patient.LastUpdate        = DateTime.Now;
                patient.Start             = DateTime.Now;
                patient.Birthday          = PatientBirthday;
                patient.Gender            = PatientGender;
                patient.Height            = (PatientFeet * 12) + PatientInches;
                patient.Weight            = PatientWeight;
                patient.Doctor            = PatientDoctor;
                patient.ArthritisType     = PatientArthritisType;
                patient.AffectedExtremity = PatientAffectedExtremity;
                patient.Deformity         = PatientDeformity;
                patient.ShankLength       = 0;
                patient.ThighLength       = 0;
                patient.PhoneNumber       = PatientPhoneNumber;
                patient.Email             = PatientEmail;
                patient.State             = PatientState;
                patient.City               = PatientCity;
                patient.ContactName        = "Not entered";
                patient.ContactRelation    = "Not entered";
                patient.ContactPhoneNumber = "Not entered";
                patient.ContactEmail       = "Not entered";

                DateTime today = DateTime.Today;
                int      age   = today.Year - PatientBirthday.Year;
                if (PatientBirthday > today.AddYears(-age))
                {
                    age--;
                }
                patient.Age = age;

                c.Patients.Add(patient);

                try
                {
                    c.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    foreach (var i in e.EntityValidationErrors)
                    {
                        Console.WriteLine(i.ValidationErrors);
                    }
                    throw e;
                }
                nvm.Patients = c.Patients.Include("Therapist").Where(n => n.LastName != null).ToList();

                ViewBag.NewPatientID = patient.ID;
            }

            ViewBag.Alert      = "Patient upload successful";
            ViewBag.AlertClass = "alert-success";
            return(View("Index", nvm));
        }
Exemplo n.º 19
0
 public PatientListPage()
 {
     InitializeComponent();
     BindingContext = _viewModel = new PatientListViewModel();
 }