public EditPatientView(CombinedPatientViewModel originalModel,
                        CombinedPatientViewModel patientModel,
                        PatientService patientService,
                        PersonService personService,
                        WardService wardService,
                        BedService bedService,
                        VisitService visitService,
                        TreatmentService treatmentService,
                        ProcedureService procedureService,
                        PhysicianService physicianService,
                        DiagnosisService diagnosisService,
                        ConditionService conditionService,
                        VitalRecordService vitalRecordService,
                        EmployeeService nurseService,
                        OrderServiceLayer orderServiceLayer,
                        OrderServiceService orderServiceService,
                        PatientOrderService patientOrderService,
                        OrderItemService orderItemService)
 {
     InitializeComponent();
     InfoTab.Content = new PatientInfoView(originalModel, patientModel, patientService, personService, wardService,
                                           bedService, visitService);
     TreatmentTab.Content = new TreatmentView(treatmentService, originalModel.PatientModel.PersonId, procedureService, physicianService);
     DiagnosisTab.Content = new DiagnosisView(diagnosisService, originalModel.PatientModel.PersonId,
                                              conditionService, physicianService);
     VitalRecordTab.Content =
         new VitalRecordView(vitalRecordService, originalModel.PatientModel.PersonId, nurseService);
     OrderTab.Content = new OrderView(orderServiceLayer, originalModel.PatientModel.PersonId, orderServiceService,
                                      physicianService);
     PatientOrderTab.Content = new PatientOrderView(patientOrderService, originalModel.PatientModel.PersonId, orderItemService);
 }
        public IActionResult SetAccess(CombinedPatientViewModel combined)
        {
            combined.Input = this.service.GetUserInformationByUserName <PatientPersonalInfoViewModel>(this.User.Identity.Name);
            if (combined.Input == null)
            {
                this.TempData["Infomessage"] = this.NotFound();
                return(this.Redirect("/Identity/Account/Login")); // not needed maybe?
            }

            return(this.View(combined));
        }
        public async Task <IActionResult> SetAccessAsync(CombinedPatientViewModel combined)
        {
            combined.Output.FirstName       = combined.Input.FirstName;
            combined.Output.LastName        = combined.Input.LastName;
            combined.Output.EGN             = combined.Input.EGN;
            combined.Output.AddressId       = combined.Input.AddressId;
            combined.Output.DoctorId        = combined.Input.DoctorId;
            combined.Output.MedicalRecordId = combined.Input.MedicalRecordId;

            if (!this.ModelState.IsValid)
            {
                this.TempData["Infomessage"] = "Please verify the data input";
                return(this.View(combined));
            }

            if (combined.Output.FirstName == "Dummy" ||
                combined.Output.LastName == "Dummy" ||
                combined.Output.AddressId < 0 ||
                combined.Output.DoctorId < 0 ||
                combined.Output.MedicalRecordId < 0 ||
                combined.Output.EGN.Length < 10 ||
                combined.Output.EGN.Length > 10 ||
                string.IsNullOrEmpty(combined.Output.FirstName) ||
                string.IsNullOrEmpty(combined.Output.LastName) ||
                string.IsNullOrEmpty(combined.Output.EGN))
            {
                this.TempData["Infomessage"] = "Please verify the data input";
                return(this.View(combined));
            }

            if (this.service.PatientExists(combined.Output.FirstName, combined.Output.LastName, combined.Output.EGN))
            {
                this.TempData["Infomessage"] = "Patient is already registered";
                // service to update the details of the patient
                return(this.Redirect("/")); // to update the patient edit page - UpdatepatientProfile or move to next page?
            }

            await this.service.CreatePatientAsync(
                combined.Output.FirstName,
                combined.Output.LastName,
                combined.Output.EGN,
                combined.Output.AddressId,
                combined.Output.DoctorId,
                combined.Output.MedicalRecordId);

            return(this.View(combined)); // to update adress, GP, Record or do that before the patient creation
        }
Пример #4
0
 public PatientInfoView(CombinedPatientViewModel originalModel,
                        CombinedPatientViewModel editPatient,
                        PatientService patientService,
                        PersonService personService,
                        WardService wardService,
                        BedService bedService,
                        VisitService visitService)
 {
     InitializeComponent();
     _originalModel  = originalModel;
     _editPatient    = editPatient;
     _patientService = patientService;
     _personService  = personService;
     _wardService    = wardService;
     _bedService     = bedService;
     _visitService   = visitService;
     _toEditPatient  = new EditPatientViewModel(_originalModel, _editPatient, _patientService, _personService, _wardService, _bedService, _visitService);
     DataContext     = _toEditPatient;
     MakeAllEditableFieldsReadOnly();
     SetupWindow();
 }
Пример #5
0
        private void PatientGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var selectedPatient = (CombinedPatientViewModel)PatientGrid.SelectedItem;

            if (selectedPatient == null)
            {
                e.Handled = true;
                return;
            }

            // --- code from here
            // for convenience, create a CreateCopy() method in the InPatient class
            if (!selectedPatient.IsOutpatient)
            {
                var patientDuplicate = new CombinedPatientViewModel(selectedPatient.InpatientModel.CreateCopy(selectedPatient.InpatientModel));
                // TODO: create EditPatientVm
                // make sure to add method SavedEdit() to inform this object that you saved
                // your changes during edit
                var editPatientView = new EditPatientView(selectedPatient,
                                                          patientDuplicate,
                                                          _patientService,
                                                          _personService,
                                                          _wardService,
                                                          _bedService,
                                                          _visitService,
                                                          _treatmentService,
                                                          _procedureService,
                                                          _physicianService,
                                                          _diagnosisService,
                                                          _conditionService,
                                                          _vitalRecordService,
                                                          _employeeService,
                                                          _orderServiceLayer,
                                                          _orderServiceService,
                                                          _patientOrderService,
                                                          _orderItemService);
                editPatientView.Show();
            }
            else
            {
                var patientDuplicate = new CombinedPatientViewModel(selectedPatient.OutpatientModel.CreateCopy(selectedPatient.OutpatientModel));
                // TODO: create EditPatientVm
                // make sure to add method SavedEdit() to inform this object that you saved
                // your changes during edit
                var editPatientView = new EditPatientView(selectedPatient,
                                                          patientDuplicate,
                                                          _patientService,
                                                          _personService,
                                                          _wardService,
                                                          _bedService,
                                                          _visitService,
                                                          _treatmentService,
                                                          _procedureService,
                                                          _physicianService,
                                                          _diagnosisService,
                                                          _conditionService,
                                                          _vitalRecordService,
                                                          _employeeService,
                                                          _orderServiceLayer,
                                                          _orderServiceService,
                                                          _patientOrderService,
                                                          _orderItemService);
                editPatientView.Show();
            }

            // assuming you display another window

            // replace the associated model to the edited model
            // remember the model to be edited was a COPY
            //if (editPatientVm.SavedEdit())
            //    InpatientModel = patientToEdit;
        }