示例#1
0
 public PatientCard(int id, BloodType bloodType, RhFactorType rhFactor, string alergies,
                    string medicalHistory, bool hasInsurance, string lbo, string patientJmbg)
 {
     Id             = id;
     BloodType      = bloodType;
     RhFactor       = rhFactor;
     Alergies       = alergies;
     MedicalHistory = medicalHistory;
     HasInsurance   = hasInsurance;
     Lbo            = lbo;
     PatientJmbg    = patientJmbg;
 }
示例#2
0
        internal static RhFactor ToRhFactor(this RhFactorType rhFactor)
        {
            switch (rhFactor)
            {
            case RhFactorType.NEGATIVE:
                return(RhFactor.Negative);

            case RhFactorType.POSITIVE:
                return(RhFactor.Positive);

            default:
                return(RhFactor.Unknown);
            }
        }
 public PatientCard(PatientCard patientCard)
 {
     if (patientCard.patient == null)
     {
         this.patient = new Users.Patient();
     }
     else
     {
         this.patient = new Users.Patient(patientCard.patient);
     }
     this.BloodType       = patientCard.BloodType;
     this.RhFactor        = patientCard.RhFactor;
     this.Alergies        = patientCard.Alergies;
     this.MedicalHistory  = patientCard.MedicalHistory;
     this.HasInsurance    = patientCard.HasInsurance;
     this.Lbo             = patientCard.Lbo;
     this.examinationList = patientCard.examinationList;
 }
 public PatientCard(Model.Users.Patient patient, BloodType bloodType, RhFactorType rhFactor, string alergies, string medicalHistory, bool hasInsurance, string lbo)
 {
     if (patient == null)
     {
         this.patient = new Users.Patient();
     }
     else
     {
         this.patient = new Users.Patient(patient);
     }
     this.BloodType       = bloodType;
     this.RhFactor        = rhFactor;
     this.Alergies        = alergies;
     this.MedicalHistory  = medicalHistory;
     this.HasInsurance    = hasInsurance;
     this.Lbo             = lbo;
     this.examinationList = new List <Doctor.Examination>();
 }
示例#5
0
        private void btnYes_Click(object sender, RoutedEventArgs e)
        {
            Regex regexJmbg  = new Regex(@"^[0-9]{13}$");
            Match match      = regexJmbg.Match(txtJmbg.Text);
            Regex regexPhone = new Regex(@"^[0-9]+$");
            Match match1     = regexPhone.Match(txtPhone.Text);
            Regex regexLbo   = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match2     = regexLbo.Match(lboTextInput.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals("") || cmbGender.SelectedItem == null || datePicker.SelectedDate == null)
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena, JMBG-a, pola i datuma rođenja je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!lboTextInput.Text.Equals("") && !match2.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Lbo mora da bude u formatu xx000!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else if ((bool)completeRadioBtn.IsChecked && (txtUsername.Text.Equals("") || txtPassword.Password.Equals("")))
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos korisničkog imena i lozinke je obavezan za kompletnu registraciju!";
                okMbx.ShowDialog();
            }
            else
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    bloodType    = BloodType.O;
                RhFactorType rhFactorType = RhFactorType.Negativna;
                GenderType   gender       = GenderType.Z;
                DateTime     sd           = DateTime.Today;
                if (cmbBlood.SelectedItem != null)
                {
                    if (cmbBlood.Text.Equals("A"))
                    {
                        bloodType = BloodType.A;
                    }
                    else if (cmbBlood.Text.Equals("B"))
                    {
                        bloodType = BloodType.B;
                    }
                    else if (cmbBlood.Text.Equals("AB"))
                    {
                        bloodType = BloodType.AB;
                    }
                }
                if (cmbRh.SelectedItem != null)
                {
                    if (cmbRh.Text.Equals("+"))
                    {
                        rhFactorType = RhFactorType.Pozitivna;
                    }
                }
                if (datePicker.SelectedDate != null)
                {
                    sd = (DateTime)datePicker.SelectedDate;
                }
                if (cmbGender.SelectedItem != null)
                {
                    if (cmbGender.Text.Equals("M"))
                    {
                        gender = GenderType.M;
                    }
                }

                bool isGuest = false;
                if ((bool)quickRadioBtn.IsChecked)
                {
                    isGuest = true;
                }

                if (txtCity.SelectedItem != null)
                {
                    city = (City)txtCity.SelectedItem;
                }
                else
                {
                    city = new City();
                }

                string   medicalHistory = "";
                string[] partsDate      = txtDate.Text.Split('\n');
                string[] partsDesc      = txtDesc.Text.Split('\n');
                string[] partsTherapy   = txtTherapy.Text.Split('\n');


                if (partsDate.Length != partsDesc.Length || partsDate.Length != partsTherapy.Length || partsDate.Length != partsTherapy.Length)
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                    okMbx.ShowDialog();
                    return;
                }

                if (!txtDate.Text.Equals("") || !txtDesc.Text.Equals("") || !txtTherapy.Text.Equals(""))
                {
                    for (int i = 0; i < partsDate.Length; i++)
                    {
                        if (partsDate[i].Equals("") || partsDesc[i].Equals("") || partsTherapy[i].Equals(""))
                        {
                            var okMbx = new OKMessageBox(this, 2);
                            okMbx.titleMsgBox.Text = "Greška";
                            okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                            okMbx.ShowDialog();
                            return;
                        }
                        medicalHistory += partsDate[i] + ":" + partsDesc[i] + ":" + partsTherapy[i] + ";";
                    }
                }

                patient     = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, sd, gender, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, isGuest);
                patientCard = new PatientCard(patient, bloodType, rhFactorType, txtAllergy.Text, medicalHistory, hi, lboTextInput.Text);

                if (userController.Register(patient) != null && patientCardController.CreatePatientCard(patientCard) != null)
                {
                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste registrovali novog pacijenta.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Pacijent je već registrovan ili ste unijeli nedovoljan broj karaktera za korisničko ime/lozinku!";
                    okMbx.ShowDialog();
                }
            }
        }
示例#6
0
        private void yesBtn_Click(object sender, RoutedEventArgs e)
        {
            Regex regexJmbg  = new Regex(@"^[0-9]{13}$");
            Match match      = regexJmbg.Match(txtJmbg.Text);
            Regex regexPhone = new Regex(@"^[0-9]+$");
            Match match1     = regexPhone.Match(txtPhone.Text);
            Regex regexLbo   = new Regex(@"^[a-z]{2}[0-9]{3}$");
            Match match2     = regexLbo.Match(txtLbo.Text);
            Regex regexEmail = new Regex(@"^[a-z0-9\.\-_]{4,20}[@]{1}[a-z.]{4,10}");
            Match match3     = regexEmail.Match(txtEmail.Text);

            if (txtName.Text.Equals("") || txtSurname.Text.Equals("") || txtJmbg.Text.Equals(""))
            {
                var okMbx = new OKMessageBox(this, 1);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Unos imena, prezimena i jmbg-a je obavezan!";
                okMbx.ShowDialog();
            }
            else if (!match.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "JMBG mora da sadrži 13 cifara!";
                okMbx.ShowDialog();
            }
            else if (!txtPhone.Text.Equals("") && !match1.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Telefon može da sadrži samo cifre!";
                okMbx.ShowDialog();
            }
            else if (!txtLbo.Text.Equals("") && !match2.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Lbo mora da bude u formatu xx000!";
                okMbx.ShowDialog();
            }
            else if (!txtEmail.Text.Equals("") && !match3.Success)
            {
                var okMbx = new OKMessageBox(this, 2);
                okMbx.titleMsgBox.Text = "Greška";
                okMbx.textMsgBox.Text  = "Pogrešan format za email!";
                okMbx.ShowDialog();
            }
            else
            {
                bool hi = false;
                if ((bool)yesCheckBtn.IsChecked)
                {
                    hi = true;
                }
                BloodType    blood = BloodType.O;
                RhFactorType rh    = RhFactorType.Negativna;
                DateTime     date  = DateTime.Today;
                GenderType   gen   = GenderType.Z;

                if (cmbBloodType.Text.Equals("A"))
                {
                    blood = BloodType.A;
                }
                else if (cmbBloodType.Text.Equals("B"))
                {
                    blood = BloodType.B;
                }
                else if (cmbBloodType.Text.Equals("AB"))
                {
                    blood = BloodType.AB;
                }

                if (cmbRh.Text.Equals("+"))
                {
                    rh = RhFactorType.Pozitivna;
                }
                if (dpDateOfBirth.SelectedDate != null)
                {
                    date = (DateTime)dpDateOfBirth.SelectedDate;
                }
                if (cmbGender.Text.Equals("M"))
                {
                    gen = GenderType.M;
                }

                City city = (City)txtCity.SelectedItem;

                bool guest = false;
                if (txtUsername.Text.Equals("") || txtUsername.Text == null)
                {
                    guest = true;
                }


                Patient p = new Patient(txtJmbg.Text, txtName.Text, txtSurname.Text, date, gen, city, txtStreet.Text, txtPhone.Text, txtEmail.Text, txtUsername.Text, txtPassword.Password, DateTime.Today, guest);

                string   medicalHistory = "";
                string[] partsDate      = txtDate.Text.Split('\n');
                string[] partsDesc      = txtDesc.Text.Split('\n');
                string[] partsTherapy   = txtTherapy.Text.Split('\n');

                if (!txtDate.Text.Equals(dates) || !txtTherapy.Text.Equals(therapy) || !txtDesc.Text.Equals(desc))
                {
                    if (partsDate.Length != partsDesc.Length || partsDate.Length != partsTherapy.Length || partsDate.Length != partsTherapy.Length)
                    {
                        var okMbx = new OKMessageBox(this, 2);
                        okMbx.titleMsgBox.Text = "Greška";
                        okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                        okMbx.ShowDialog();
                        return;
                    }
                    if (!txtDate.Text.Equals("") || !txtDesc.Text.Equals("") || !txtTherapy.Text.Equals(""))
                    {
                        for (int i = 0; i < partsDate.Length; i++)
                        {
                            if (partsDate[i].Equals("") || partsDesc[i].Equals("") || partsTherapy[i].Equals(""))
                            {
                                var okMbx = new OKMessageBox(this, 2);
                                okMbx.titleMsgBox.Text = "Greška";
                                okMbx.textMsgBox.Text  = "Niste dobro unijeli istoriju bolesti!";
                                okMbx.ShowDialog();
                                return;
                            }
                            medicalHistory += partsDate[i] + ":" + partsDesc[i] + ":" + partsTherapy[i] + ";";
                        }
                    }
                }
                else
                {
                    medicalHistory = dates + desc + therapy;
                    medicalHistory = medicalHistory.Replace('\n', ':');
                    if (medicalHistory.Length > 0)
                    {
                        medicalHistory  = medicalHistory.Substring(0, medicalHistory.Length - 1);
                        medicalHistory += ";";
                    }
                }

                PatientCard pc = new PatientCard(p, blood, rh, txtAllergy.Text, medicalHistory, hi, txtLbo.Text);

                if (patientController.EditProfile(p) != null && patientCardController.EditPatientCard(pc) != null)
                {
                    List <Examination> examinations = examinationController.ViewExaminationsByPatient(p.Jmbg);
                    foreach (Examination exm in examinations)
                    {
                        exm.patientCard = pc;
                        examinationController.EditExamination(exm);
                    }
                    List <Therapy> therapies = therapyController.ViewAllTherapyByPatient(p.Jmbg);
                    foreach (Therapy t in therapies)
                    {
                        t.patientCard = pc;
                        therapyController.EditTherapy(t);
                    }
                    List <PlacemetnInARoom> placemetnInARooms = placementInSickRoomController.ViewPatientPlacements(p.Jmbg);
                    foreach (PlacemetnInARoom pr in placemetnInARooms)
                    {
                        pr.patientCard = pc;
                        placementInSickRoomController.EditPlacement(pr);
                    }

                    var okMb = new OKMessageBox(this, 3);
                    okMb.titleMsgBox.Text = "Obavještenje";
                    okMb.textMsgBox.Text  = "Uspješno ste izmijenili informacije o pacijentu.";
                    okMb.ShowDialog();
                }
                else
                {
                    var okMbx = new OKMessageBox(this, 2);
                    okMbx.titleMsgBox.Text = "Greška";
                    okMbx.textMsgBox.Text  = "Došlo je do greške prilikom izmjene informacija! Provjerite da li su korisničko ime/lozinka validni.";
                    okMbx.ShowDialog();
                }
            }
        }