Пример #1
0
        private void AddDevice_Click(object sender, EventArgs e)
        {
            int row      = PatientsList.SelectedCells[0].RowIndex;
            int userCode = int.Parse(PatientsList.Rows[row].Cells[0].Value.ToString());

            Patient selectedPat = _container.PatientSet.Find(userCode);

            AddDeviceForm newDeviceType = new AddDeviceForm();

            if (newDeviceType.ShowDialog() != DialogResult.Cancel)
            {
                DeviceFunction type = newDeviceType.function;

                bool exist = false;

                foreach (Device d in selectedPat.Device)
                {
                    if (d.Function == type)
                    {
                        exist = true;
                    }
                }

                if (exist)
                {
                    MessageBox.Show("Данный тип прибора уже закреплен за пациентом.");
                }
                else
                {
                    Device newDevice = InformationSystem.CreateDevice(selectedPat, type);
                    InformationSystem.AddDevice(newDevice, selectedPat);
                }
            }
        }
Пример #2
0
        private void Delete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Вы действительно хотите удалить данную запись?", "Удаление записи",
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                int row = MedicalResults.SelectedCells[0].RowIndex;

                HealthStatus deleted =
                    _container.HealthStatusSet.Find(int.Parse(MedicalResults.Rows[row].Cells[3].Value.ToString()));
                InformationSystem.DeleteHealthStatus(deleted);
                _container.SaveChanges();
                RefreshMedicalResults();
            }
        }
Пример #3
0
        private void LogInButton_Click(object sender, EventArgs e)
        {
            string login    = Login.Text;
            string password = Password.Text;

            User.UserType type;
            User          searchResult;

            EntityModelContainer container = new EntityModelContainer();

            bool correct = InformationSystem.CheckLoginPassword(login, password, out type, out searchResult);

            if (!correct)
            {
                MessageBox.Show("Неверное имя пользователя или пароль");
            }
            else
            {
                if (type == User.UserType.administrator)
                {
                    AdministratorForm adminForm = new AdministratorForm();
                    Administrator     result    = searchResult as Administrator;

                    adminForm.user = container.AdministratorSet.Find(result.UserCode);;
                    adminForm.ShowDialog();
                }
                else
                {
                    if (type == User.UserType.doctor)
                    {
                        DoctorForm doctorForm = new DoctorForm();
                        Doctor     result     = searchResult as Doctor;

                        doctorForm.user = container.DoctorSet.Find(result.UserCode);

                        doctorForm.ShowDialog();
                    }
                    else
                    {
                        PatientForm patientForm = new PatientForm();
                        Patient     result      = searchResult as Patient;

                        patientForm.user = container.PatientSet.Find(result.UserCode);
                        patientForm.ShowDialog();
                    }
                }
            }
        }
Пример #4
0
        private void AddPatient_Click(object sender, EventArgs e)
        {
            EntityModelContainer container = new EntityModelContainer();

            int row = SearchResults.SelectedCells[0].RowIndex;

            Patient selectedPat =
                container.PatientSet.Find(int.Parse(SearchResults.Rows[row].Cells[0].Value.ToString()));

            AddDeviceForm newDeviceType = new AddDeviceForm();

            if (newDeviceType.ShowDialog() == DialogResult.OK)
            {
                DeviceFunction type  = newDeviceType.function;
                bool           exist = false;

                foreach (Device d in selectedPat.Device)
                {
                    if (d.Function == type)
                    {
                        exist = true;
                    }
                }

                if (exist)
                {
                    if (MessageBox.Show(
                            "Данный тип прибора уже закреплен за пациентом. Добавить пациента в список пациентов?", "",
                            MessageBoxButtons.YesNo) ==
                        DialogResult.Yes)
                    {
                        InformationSystem.AddDoctorPatientConnection(user, selectedPat);
                        this.Close();
                    }
                }
                else
                {
                    Device newDevice = InformationSystem.CreateDevice(selectedPat, type);
                    InformationSystem.AddDevice(newDevice, selectedPat);

                    InformationSystem.AddDoctorPatientConnection(user, selectedPat);
                    this.Close();
                }
            }

            container.SaveChanges();
        }
Пример #5
0
        private void SignUpPatient_Click(object sender, EventArgs e)
        {
            string login, password;
            bool   exist;

            InformationSystem.GiveLoginPassword(docMessage.Text, out login, out password, out exist);

            if (exist)
            {
                MessageBox.Show("Данному пациенту уже предоставлен доступ");
            }
            else
            {
                string info = "Логин - " + login + ". \nПароль - " + password;
                MessageBox.Show(info);
            }

            SignUpPatient.Enabled = false;
        }
Пример #6
0
        private void SignUp_Click(object sender, EventArgs e)
        {
            string   name      = NewName.Text;
            DateTime birthDate = NewDateBirth.Value;
            Male     male      = NewMale.Checked ? Male.Male : Male.Female;
            byte     height    = byte.Parse(NewHeight.Text);
            byte     weight    = byte.Parse(NewWeight.Text);

            _container = new EntityModelContainer();
            Patient newPatient = InformationSystem.CreatePatient(name, birthDate, male, height, weight, user);

            InformationSystem.AddPatient(newPatient, user);

            DeviceFunction deviceType = 0;

            switch (NewDeviceType.SelectedIndex)
            {
            case 0:
                deviceType = DeviceFunction.Glucometer;
                break;

            case 1:
                deviceType = DeviceFunction.HeartRateMonitor;
                break;

            case 2:
                deviceType = DeviceFunction.BloodPressureMonitor;
                break;
            }

            Device newDevice = InformationSystem.CreateDevice(newPatient, deviceType);

            InformationSystem.AddDevice(newDevice, newPatient);

            DoctorMessage informMessage = InformationSystem.CreatePatientMessage(user, newPatient, AllowAccess.Checked);

            InformationSystem.AddDoctorMessage(informMessage);

            MessageBox.Show("Пациент успешно зарегистрирован");

            this.Close();
        }
Пример #7
0
        private void AddHealthStatus_Click(object sender, EventArgs e)
        {
            bool[] symptoms = new bool[14];

            if (Ailment.Checked)     // недомогание
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Недомогание")] = true;
            }

            if (Dizziness.Checked)     // головокружение
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Головокружение")] = true;
            }

            if (HighBloodPressure.Checked)     // повышенное давление
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Повышенное артериальное давление")] = true;
            }

            if (LowBloodPressure.Checked)     // пониженное давление
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Пониженное артериальное давление")] = true;
            }

            if (Fever.Checked)     // жар
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Жар")] = true;
            }

            if (Headache.Checked)     // головная боль
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Головная боль")] = true;
            }

            if (Insomnia.Checked)     // бессонница
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Бессонница")] = true;
            }

            if (Nausea.Checked)     // тошнота
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Тошнота")] = true;
            }

            if (Fatigue.Checked)     // усталость
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Усталость")] = true;
            }

            if (DryMouth.Checked)     // сухость во рту
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Сухость во рту")] = true;
            }

            if (IncreasedWeigh.Checked)     // прибавление веса
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Прибавление веса")] = true;
            }

            if (DecreasedWeigh.Checked)     // потеря веса
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Потеря веса")] = true;
            }

            if (Weakness.Checked)     // слабость
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Слабость")] = true;
            }

            if (Thirst.Checked)     // жажда
            {
                symptoms[Array.IndexOf(HealthStatus.SymptomsNames, "Жажда")] = true;
            }

            string generatedStatus = HealthStatus.GetHealthStatus(symptoms);

            if (newStatus)
            {
                InformationSystem.AddHealthStatus(generatedStatus, DateTime.Now, user);
            }
            else
            {
                EntityModelContainer container = new EntityModelContainer();

                status = container.HealthStatusSet.Find(status.Number);
                InformationSystem.ChangeHealthStatus(status, generatedStatus);
            }

            this.Close();
        }