Beispiel #1
0
 public ActionResult Confirm(PatientForm form)
 {
     return
         (form.Patient == null
             ? RedirectTo <PatientsController>(a => a.List())
             : View(form));
 }
Beispiel #2
0
        public async Task <ActionResult> Create(PatientViewModel vm, IFormCollection collection)
        {
            var pvm = new PatientForm
            {
                Fullname = vm.Fullname,
                //Department = vm.Department,
                Age = vm.Age,

                ClinicalDiagnosis = vm.ClinicalDiagnosis,
                DateOfRequest     = vm.DateOfRequest,
                ClinicNo          = vm.ClinicNo,
                //Test = new PatientTest {
                testId = vm.TestId,

                //},
                //PhysicianId = vm.PhysicianId,
                DepartmentId = vm.DepartmentId,
                PhysicianId  = vm.PhysicianId
            };

            try
            {
                _repository.AddPatient(pvm);

                await _repository.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Index"));
            }
        }
Beispiel #3
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            PatientForm pat = new PatientForm();

            pat.Show();
            this.Hide();
        }
Beispiel #4
0
        private void patientButton_Click(object sender, EventArgs e)
        {
            PatientForm patientForm = new PatientForm(operation);

            patientForm.Show();
            this.Hide();
        }
        public async Task <IHttpActionResult> PutPatientForm(int id, PatientForm patientForm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != patientForm.PatientFormId)
            {
                return(BadRequest());
            }

            _db.Entry(patientForm).State = EntityState.Modified;

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PatientFormExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #6
0
        public IHttpActionResult GetQuestions(int id)
        {
            PatientForm patientForm = _db.PatientForms.FirstOrDefault(x => x.PatientFormId == id);

            if (patientForm == null)
            {
                return(NotFound());
            }

            IQueryable <AnswerListView> col = _db.AnswerListViews.Where(p => p.PatientFormId == id).OrderBy(x => x.QuestionIndex);

            List <QuestionDto> questions = new List <QuestionDto>();

            foreach (AnswerListView item in col)
            {
                questions.Add(Mapper.MapToDto(item));
            }

            FormDetailDto formDetails = new FormDetailDto {
                Id           = id,
                FormDate     = patientForm.FormDate,
                FormTypeName = patientForm.FormType.FormTypeName,
                FormTypeId   = patientForm.FormType.FormTypeId,
                PatientId    = patientForm.PatientId,
                Questions    = questions
            };

            return(Ok(formDetails));
        }
Beispiel #7
0
 public ActionResult AddSubmit(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get <IPatientRepository>().Save(form.Patient);
         return(RedirectTo <PatientsController>(a => a.Confirm(form)));
     }
     return(RedirectTo <PatientsController>(a => a.Add(form)));
 }
Beispiel #8
0
        private void OnAddClick(object sender, EventArgs e)
        {
            Patient obj = new Patient();

            if (PatientForm.ShowForm(obj))
            {
                this.LoadListData(obj);
            }
        }
Beispiel #9
0
        private void linkLabelPatient_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            PatientForm patientForm = new PatientForm(MainForm.Mpps);

            if (patientForm.ShowDialog(this) == DialogResult.OK)
            {
                SetPatientInfo();
            }
        }
Beispiel #10
0
 public ActionResult Led(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get <IAttendingDoctorService>().SetLedDoctorForPatient(form.Patient.Doctor.Id, form.Patient.Id);
         form.Patient = Get <IPatientRepository>().GetById(form.Patient.Id);
         return(RedirectTo <PatientsController>(a => a.Confirm(form)));
     }
     return(RedirectTo <PatientsController>(a => a.Led(form.Patient.Id, form)));
 }
Beispiel #11
0
        private void addPatient_Click(object sender, EventArgs e)
        {
            formPanel.Controls.Clear();
            var form = new PatientForm {
                TopLevel = false
            };

            formPanel.Controls.Add(form);
            form.Dock = DockStyle.Fill;
            form.Show();
        }
Beispiel #12
0
 public ActionResult Edit(PatientForm form)
 {
     if (ModelState.IsValid)
     {
         Get <IPatientRepository>().Update(form.Patient);
         Get <IAttendingDoctorService>().SetLedDoctorForPatient(form.Patient.Doctor.Id, form.Patient.Id);
         form.Message = "Пациент отредактирован";
         return(RedirectTo <PatientsController>(a => a.Confirm(form)));
     }
     return(RedirectTo <PatientsController>(a => a.Edit(form.Patient.Id, form)));
 }
        public async Task <IHttpActionResult> PostPatientForm(PatientForm patientForm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _db.PatientForms.Add(patientForm);
            await _db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = patientForm.PatientFormId }, patientForm));
        }
Beispiel #14
0
        public async Task <ActionResult> Edit(int id, PatientViewModel vm, IFormCollection collection)
        {
            var patient = new PatientForm
            {
                Id       = vm.Id,
                Fullname = vm.Fullname,

                Age = vm.Age,
                //Department = vm.Department,
                ClinicalDiagnosis = vm.ClinicalDiagnosis,
                ClinicNo          = vm.ClinicNo,
                DateOfRequest     = vm.DateOfRequest,
                DepartmentId      = vm.DepartmentId,
                PhysicianId       = vm.PhysicianId,

                //Test = new PatientTest
                //{
                testId = vm.TestId
            };

            try
            {
                //if (vm.Image == null)
                //{
                //    post.Image = vm.CurrentImage;
                //}
                //else
                //{
                //    if (!string.IsNullOrEmpty(vm.CurrentImage))
                //    {
                //        _fileMgr.RemoveImage(vm.CurrentImage);
                //    }
                //    post.Image = await _fileMgr.SaveImage(vm.Image);
                //}

                if (patient.Id > 0)
                {
                    _repository.UpdatePatient(patient);
                }
                else
                {
                    _repository.AddPatient(patient);
                }
                await _repository.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(patient));
            }
        }
Beispiel #15
0
        private void OnOpenClick(object sender, EventArgs e)
        {
            Patient obj = this.GetSelected();

            if (obj != null)
            {
                obj.RefershData();
            }
            if (PatientForm.ShowForm(obj))
            {
                this.LoadListData(obj);
            }
        }
Beispiel #16
0
 public ActionResult Edit(int?id, PatientForm form)
 {
     if (!id.HasValue)
     {
         return(RedirectTo <PatientsController>(a => a.List()));
     }
     form.Patient = form.Patient ?? Get <IPatientRepository>().GetById(id.Value);
     form.Doctors = Get <IDoctorRepository>().GetAll();
     return
         (form.Patient == null
             ? RedirectTo <PatientsController>(a => a.List())
             : View(form));
 }
        public async Task <IHttpActionResult> DeletePatientForm(int id)
        {
            PatientForm patientForm = await _db.PatientForms.FindAsync(id);

            if (patientForm == null)
            {
                return(NotFound());
            }

            _db.PatientForms.Remove(patientForm);
            await _db.SaveChangesAsync();

            return(Ok(patientForm));
        }
 //Metoda dodająca nowy element do bazy
 private void AddNewButtonClick(object sender, RoutedEventArgs e)
 {
     if (TabsComboBox.SelectedIndex == 1)
     {
         PatientForm PatientWindow = new PatientForm();
         PatientWindow.DataChanged += PatientWindow_DataChanged;
         PatientWindow.Show();
     }
     else if (TabsComboBox.SelectedIndex == 0)
     {
         AppointmentForm AppointmentTab = new AppointmentForm();
         AppointmentTab.DataChanged += AppoinmentWindow_DataChanged;
         AppointmentTab.Show();
         TodayAppointmentsButton.Content = "Dzisiejsze wizyty";
     }
 }
Beispiel #19
0
        public ActionResult Led([PRGInRoute] int?id, PatientForm form)
        {
            if (!id.HasValue)
            {
                return(RedirectTo <PatientsController>(a => a.List()));
            }
            Patient patient = Get <IPatientRepository>().GetById(id.Value);

            if (patient == null)
            {
                return(RedirectTo <PatientsController>(a => a.List()));
            }
            form.Patient = patient;
            form.Doctors = Get <IDoctorRepository>().GetAll();
            return(View(form));
        }
Beispiel #20
0
        public ActionResult Show(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectTo <PatientsController>(a => a.List()));
            }
            Patient patient = Get <IPatientRepository>().GetById(id.Value);
            var     form    = new PatientForm {
                Patient = patient
            };

            return
                (patient == null
                    ? RedirectTo <PatientsController>(a => a.List())
                    : View(form));
        }
Beispiel #21
0
        public static PatientFormDto MapToDto(PatientForm classMapFrom)
        {
            PatientFormDto retval = null;

            if (classMapFrom != null)
            {
                retval = new PatientFormDto
                {
                    Id           = classMapFrom.PatientFormId,
                    PatientId    = classMapFrom.PatientId,
                    FormTypeId   = classMapFrom.FormTypeId,
                    FormTypeName = classMapFrom.FormType.FormTypeName,
                    FormDate     = classMapFrom.FormDate
                };
            }
            return(retval);
        }
Beispiel #22
0
        public static PatientForm MapFromDto(PatientFormDto classMapFrom)
        {
            PatientForm retval = null;

            if (classMapFrom != null)
            {
                retval = new PatientForm
                {
                    PatientFormId = classMapFrom.Id,
                    PatientId     = classMapFrom.PatientId,
                    FormTypeId    = classMapFrom.FormTypeId,
                    FormDate      = classMapFrom.FormDate,
                    LastUpdatedOn = DateTime.Now
                };
            }
            return(retval);
        }
Beispiel #23
0
        public ActionResult AddPatient(PatientForm patientForm)
        {
            using (var db = new AuthenticationDB())
            {
                db.Patients.Add(new Patient
                {
                    FirstName     = patientForm.FirstName,
                    LastName      = patientForm.LastName,
                    Doctor        = db.Docs.FirstOrDefault(d => d.RefUser.UserId == ((OrdPrincipal)HttpContext.User).UserID),
                    Height        = patientForm.Height,
                    Weight        = patientForm.Weight,
                    InsuranceName = patientForm.InsuranceName,
                    Medicines     = new List <Medicine>(),
                });
                db.SaveChanges();
            }

            return(RedirectToAction("Patients"));
        }
Beispiel #24
0
 public ActionResult Delete(int?id, bool?confirm)
 {
     if (!id.HasValue)
     {
         return(RedirectTo <PatientsController>(a => a.List()));
     }
     if (!confirm.HasValue)
     {
         Patient patient = Get <IPatientRepository>().GetById(id.Value);
         var     form    = new PatientForm {
             Patient = patient
         };
         return
             (patient == null
                 ? RedirectTo <PatientsController>(a => a.List())
                 : View(form));
     }
     if (confirm.Value)
     {
         Get <IPatientRepository>().DeleteById(id.Value);
     }
     return(RedirectTo <PatientsController>(a => a.List()));
 }
Beispiel #25
0
 public void AddPatient(PatientForm patient)
 {
     _ctx.Patients.Add(patient);
 }
Beispiel #26
0
 public ActionResult Add(PatientForm form)
 {
     form.Patient = form.Patient ?? new Patient();
     form.Doctors = Get <IDoctorRepository>().GetAll();
     return(View(form));
 }
Beispiel #27
0
 public void RemovePatient(PatientForm patient)
 {
     _ctx.Patients.Remove(patient);
     //_ctx.Tests.Remove(GetPatientTest(Id));
 }
Beispiel #28
0
 public void UpdatePatient(PatientForm patient)
 {
     _ctx.Patients.Update(patient);
 }
 private void btnPatientAdd_Click(object sender, RoutedEventArgs e)
 {
     PatientForm form = new PatientForm();
     form.ShowDialog();
 } 
Beispiel #30
0
        public static void Seed(IServiceProvider serviceProvider)
        {
            using (var context = new AppDbContext(serviceProvider.GetRequiredService <DbContextOptions <AppDbContext> >()))
            {
                //AppDbContext context = applicationBuilder.ApplicationServices.GetRequiredService<AppDbContext>();

                //UserManager<IdentityUser> userManager = serviceProvider.GetRequiredService<UserManager<IdentityUser>>();


                // Add Customers
                //var justin = new PatientForm
                //{
                //var user = new IdentityUser("tenece");
                // userManager.CreateAsync(user, "%ten");

                var mike = new Physician
                {
                    Id            = 2,
                    PhysicianName = "Dave bane"
                };

                context.Physicians.Add(mike);

                var pat = new PatientForm
                {
                    Id                = 1,
                    Fullname          = "Justin Noon",
                    Age               = 27,
                    ClinicalDiagnosis = "RVS",
                    ClinicNo          = 3,

                    DepartmentId = 3,
                    //Test = new PatientTest
                    //{
                    //    t
                    //}
                    //PhysicianId = 2,
                    //Test = 5,


                    //Department = "Infection and Disease"
                };
                context.Patients.Add(pat);

                var arv = new PatientTest
                {
                    TestId       = 5,
                    TestName     = "HIV",
                    DepartmentId = 3
                };
                context.Tests.Add(arv);

                var vir = new TestDepartment
                {
                    DeptId     = 3,
                    Department = "Virus"
                };
                context.Departments.Add(vir);
                //};

                var ruth = new TestRegister
                {
                    Id        = 1,
                    Date      = DateTime.Now,
                    PatientId = 1,
                    TId       = 5,
                    ResultId  = 8
                };
                context.Appointments.Add(ruth);
                var res = new TestResult
                {
                    Id          = 8,
                    IsCompleted = true
                };
                context.Results.Add(res);
                context.SaveChanges();
            }
        }