private void Add_Form_Click(object sender, RoutedEventArgs e)
        {
            if (!checkIfSomethingLeft())
            {
                ErrorMessage.Visibility = Visibility.Visible;
            }
            else
            {
                if ((bool)Yes.IsChecked)
                {
                    EmergencyRequest emergencyRequest = new EmergencyRequest();
                    emergencyRequest.MedicalRecord     = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);
                    emergencyRequest.Scheduled         = false;
                    emergencyRequest.SideNotes         = ShortDescr.Text;
                    emergencyRequest.Specialization    = doctor.Specializations[0];
                    emergencyRequest.TypeOfAppointment = TypeOfAppointment.examination;
                    emergencyRequestController.CreateEmergencyRequest(emergencyRequest);

                    MyEvents.CloseAddFormHandler.RaiseMyCustomEvent(this, new MyEvents.CloseAddForm());
                    NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative));
                }
                else
                {
                    Appointment a = new Appointment();
                    a.Doctor           = doctor;
                    a.ShortDescription = ShortDescr.Text;
                    string[] parts = ((string)TimeBox.SelectedItem).Split(":");
                    a.MedicalRecord = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);

                    a.TypeOfAppointment = TypeOfAppointment.examination;
                    a.Room = doctor.ExaminationRoom;
                    DateTime date = (DateTime)DateSelected.SelectedDate;
                    a.StartTime = new DateTime(date.Year, date.Month, date.Day, int.Parse(parts[0]), int.Parse(parts[1]), 0);
                    a.Urgent    = false;
                    try
                    {
                        appointemntController.AddAppointment(a, false);

                        MyEvents.CloseAddFormHandler.RaiseMyCustomEvent(this, new MyEvents.CloseAddForm());
                        NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative));
                    }
                    catch (PatientAlreadyHasAnAppointment)
                    {
                        Error.Text = "Pacijent već ima zakazan pregled u budućnosti";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                    catch (AlreadyScheduled)
                    {
                        Error.Text = "U međuvremenu, termin se zakazao!";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                    catch (NotValidTimeForScheduling)
                    {
                        Error.Text = "Vreme je nevalidno za zakazivanje";
                        ErrorMessage.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            Diagnosis diagnosis = null;

            diagnosis = diagnosisController.FindByName((string)Dijagnoze.SelectedItem);
            medicalRecordController.UpdateIllnessHistory(diagnosis, medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord));
            Informations.currentRecord.MedicalRecord = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);
            NavigationService.Navigate(new Uri("/Pages/MedicalRecord/Informations.xaml", UriKind.Relative));
        }
        public Appointments()
        {
            currentExamination = null;
            MyEvents.ShowMessageBoxEventHandler.CustomEvent  += ShowMessageBox;
            MyEvents.CloseMessageBoxEventHandler.CustomEvent += CloseMessageBox;
            MyEvents.ShowLanguage.CustomEvent  += showLanguage;
            MyEvents.CloseLanguage.CustomEvent += closeLanguage;

            var app = Application.Current as App;

            appointemntController        = app.appointmentController;
            medicalRecordController      = app.medicalRecordController;
            examinationSurgeryController = app.examinationSurgeryController;
            reportController             = app.reportController;

            DateTime todaysDate = DateTime.ParseExact("01.05.2020.", "dd.MM.yyyy.", null);



            foreach (Appointment appointment in appointemntController.NotFinishedByDoctorAndDay(MainWindow.doctor, DateTime.Today))
            {
                Patient patient = medicalRecordController.GetMedicalRecord(appointment.MedicalRecord.IdRecord).Patient;
                todayAppointments.Add(new ModelHCI.AppointmentHCI()
                {
                    Gender      = patient.Gender == Model.Users.Gender.FEMALE ? "ŽENSKI" : "MUŠKI",
                    Age         = ((DateTime.Today.Year - (medicalRecordController.GetMedicalRecord(appointment.MedicalRecord.IdRecord)).Patient.DateOfBirth.Year).ToString()), Date = appointment.StartTime.Date,
                    FullName    = patient.Name + " " + patient.Surname, HealthProblem = appointment.ShortDescription,
                    appointment = appointment, RoomNumber = appointment.Room.RoomNumber, timeString = appointment.StartTime.ToString("HH:mm"),
                    patient     = new ModelHCI.Patient()
                    {
                        record = new ModelHCI.MedicalRecordHCI()
                        {
                            MedicalRecord = appointment.MedicalRecord
                        }
                    }
                });
            }


            InitializeComponent();

            SetPatients();
        }
예제 #4
0
        public Informations()
        {
            MyEvents.DemoEvents.ContinueDemoInformations.CustomEvent += continueDemo;
            MyEvents.DemoEvents.PropagateCancellation.CustomEvent    += cancelDemo;
            var app = Application.Current as App;

            medicalRecordController = app.medicalRecordController;
            medicationController    = app.medicationController;
            diagnosisController     = app.diagnosisController;

            if (Patients.SelectedRow != null)
            {
                currentRecord = new ModelHCI.MedicalRecordHCI()
                {
                    MedicalRecord = medicalRecordController.GetMedicalRecord(Patients.SelectedRow.record.MedicalRecord.IdRecord)
                };
            }
            else if (Appointments.currentExamination != null)
            {
                currentRecord = new ModelHCI.MedicalRecordHCI()
                {
                    MedicalRecord = medicalRecordController.GetMedicalRecord(Appointments.currentExamination.record.MedicalRecord.IdRecord)
                };
            }


            InitializeComponent();

            MyEvents.ChangeInformation.CustomEvent += ChangeInfo;
            TherapyList.ItemsSource          = new List <ModelHCI.TherapyHCI>();
            AllergiesList.ItemsSource        = new List <ModelHCI.AllergensHCI>();
            IllnessHistory.ItemsSource       = new List <ModelHCI.DiagnosisHCI>();
            FamilyIllnessHistory.ItemsSource = new List <ModelHCI.DiagnosisHCI>();

            SetValues();
        }
        public Vaccines()
        {
            var app = Application.Current as App;

            medicalRecordController = app.medicalRecordController;

            InitializeComponent();
            var record = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord);


            List <ShowLabTest> list = new List <ShowLabTest>();

            LabTest.ItemsSource = new List <ShowLabTest>();
            var result = medicalRecordController.GetLastLabResult(record);

            if (result != null)
            {
                foreach (LabResults results in result.LabResults)
                {
                    list.Add(new ShowLabTest()
                    {
                        name = results.ResultType, maxRefValue = results.MaxRefValue, minRefValue = results.MinRefValue, values = results.Value
                    });
                }

                Date.Text = result.DateOfTesting.ToString("dd.MM.yyyy.");
            }
            List <ModelHCI.VaccineHCI> listVaccine = new List <ModelHCI.VaccineHCI>();

            foreach (var vaccines in record.Vaccines)
            {
                listVaccine.Add(new ModelHCI.VaccineHCI()
                {
                    vaccine = vaccines.Name, vaccines = vaccines
                });
            }

            VaccineList.ItemsSource = listVaccine;
            LabTest.ItemsSource     = list;
        }
예제 #6
0
        private void setListBoxes()
        {
            AllergiesList.ItemsSource = new List <ModelHCI.AllergensHCI>();
            TherapyList.ItemsSource   = new List <ModelHCI.TherapyHCI>();
            ModelHCI.MedicalRecordHCI currentRecord = new ModelHCI.MedicalRecordHCI()
            {
                MedicalRecord = medicalRecordController.GetMedicalRecord(Informations.currentRecord.MedicalRecord.IdRecord)
            };


            List <ModelHCI.AllergensHCI> source = new List <ModelHCI.AllergensHCI>();

            foreach (Allergens allergens in currentRecord.MedicalRecord.Allergies)
            {
                source.Add(new ModelHCI.AllergensHCI()
                {
                    allergen = allergens.Allergen, allergens = allergens
                });
            }

            AllergiesList.ItemsSource = source;

            List <ModelHCI.TherapyHCI> therapies = new List <ModelHCI.TherapyHCI>();

            foreach (Therapy therapy in currentRecord.MedicalRecord.Therapies)
            {
                therapies.Add(new ModelHCI.TherapyHCI()
                {
                    medication = new ModelHCI.MedicationHCI()
                    {
                        name       = therapy.Medication.Med,
                        medication = therapy.Medication
                    },
                    therapy = therapy
                });
            }

            TherapyList.ItemsSource = therapies;
        }