Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="earCastID"></param>
        /// <returns></returns>
        public Patient GetPatientFromEarCast(int earCastID)
        {
            EarCast earCast = _dbContext.EarCast.Single(x => x.EarCastID == earCastID);
            Patient patient = GetPatient(earCast.PatientFK);

            return(patient);
        }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="earCast"></param>
 public void CreateEarCast(EarCast earCast)
 {
     try
     {
         _dbContext.EarCast.Add(earCast);
         _dbContext.SaveChanges();
     }
     catch
     {
     }
 }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            generalSpec = new GeneralSpec();
            earCast     = new EarCast();

            if (Cb_LeftEar.IsChecked == true && Cb_RightEar.IsChecked == true)
            {
                MessageBox.Show("Vælg kun ét øre");
                Cb_LeftEar.IsChecked  = false;
                Cb_RightEar.IsChecked = false;
            }
            else
            {
                if (Cb_LeftEar.IsChecked == true)
                {
                    generalSpec.EarSide = Ear.Left;
                    earCast.EarSide     = Ear.Left;
                }
                else if (Cb_RightEar.IsChecked == true)
                {
                    generalSpec.EarSide = Ear.Right;
                    earCast.EarSide     = Ear.Right;
                }

                generalSpec.PatientFK    = _clinicianMainWindow.Patient.PatientId;
                generalSpec.CreateDate   = DateTime.Now;
                generalSpec.StaffLoginFK = _clinicianMainWindow.clinician.StaffID;

                generalSpec.Color = (PlugColor)CbNewColor.SelectionBoxItem;
                generalSpec.Type  = (Material)CbNewType.SelectionBoxItem;

                earCast.CastDate  = DateTime.Now;
                earCast.PatientFK = _clinicianMainWindow.Patient.PatientId;

                _manageHA.CreateHA(generalSpec);

                _manageHA.createEC(earCast);

                CbNewType.SelectedIndex  = -1;
                CbNewColor.SelectedIndex = -1;
                Cb_LeftEar.IsChecked     = false;
                Cb_RightEar.IsChecked    = false;

                MessageBox.Show("Høreapparatet er bestilt", "Bekræftigelse", MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
Beispiel #4
0
        /// <summary>
        /// ID på earcast bliver brugt til at hente informationer omkring en patient.
        /// Den patient som passer med det specifikke earcast ID returneres.
        /// </summary>
        /// <param name="EarCastID"></param>
        /// <returns></returns>
        public Patient GetPatientInformations(string EarCastID)
        {
            try
            {
                int     earCastId = Convert.ToInt32(EarCastID);
                EarCast earCast   = _dbContext.EarCast.OrderBy(x => x.CastDate).Last(x => x.EarCastID == earCastId);
                Patient patient   = _dbContext.Patient.Single(x => x.PatientId == earCast.PatientFK);

                patient.EarCasts.Add(earCast);

                return(patient);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #5
0
        /// <summary>
        /// ID på earcast bliver brugt til at hente informationer omkring en patient.
        /// Den patient som passer med det specifikke earcast ID returneres.
        /// </summary>
        /// <param name="EarCastID"></param>
        /// <returns></returns>
        public Patient GetPatientInformations(string EarCastID)
        {
            try
            {
                int     earCastId = Convert.ToInt32(EarCastID);
                EarCast earCast   = _dbContext.EarCast.OrderBy(x => x.CastDate).Last(x => x.EarCastID == earCastId);
                Patient patient   = GetPatientWithGeneralSpecAndTechnicalSpec(earCast.PatientCPR);

                patient.EarCasts.Add(earCast);

                return(patient);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #6
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            generalSpec = new GeneralSpec();
            earCast     = new EarCast();

            if (Cb_LeftEar.IsChecked == true)
            {
                generalSpec.EarSide = Ear.Left;
                earCast.EarSide     = Ear.Left;
            }
            else if (Cb_RightEar.IsChecked == true)
            {
                generalSpec.EarSide = Ear.Right;
                earCast.EarSide     = Ear.Right;
            }

            generalSpec.PatientFK = _clinicianMainWindow.Patient.PatientId;
            //generalSpec.Patient = _clinicianMainWindow.Patient;
            generalSpec.CreateDate   = DateTime.Now;
            generalSpec.StaffLoginFK = _clinicianMainWindow.clinician.StaffID;
            //generalSpec.StaffLogin = _clinicianMainWindow.clinician;
            CbNewColor.Text = generalSpec.Color.ToString();
            CbNewType.Text  = generalSpec.Type.ToString();

            earCast.CastDate  = DateTime.Now;
            earCast.PatientFK = _clinicianMainWindow.Patient.PatientId;
            //earCast.Patient = _clinicianMainWindow.Patient;

            manageHA.CreateHA(generalSpec);

            manageHA.createEC(earCast);

            CbNewType.SelectedIndex  = -1;
            CbNewColor.SelectedIndex = -1;

            MessageBox.Show("Høreapparatet er bestilt", "Bekræftigelse", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Beispiel #7
0
 public void createEC(EarCast earCast)
 {
     clinicDatabase.CreateEarCast(earCast);
 }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="earCast"></param>
 public void DeleteEarCast(EarCast earCast)
 {
     _dbContext.EarCast.Remove(earCast);
     _dbContext.SaveChanges();
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            ClinicDBContext  dbContext        = new ClinicDBContext();
            ClinicianDBLogic clinicianDbLogic = new ClinicianDBLogic(dbContext);

            ProgramHL7 program = new ProgramHL7();

            program.metode();


            #region Create (CRUD)

            #region Create patient
            Patient newPatient = new Patient()
            {
                CPR         = "123456-2332",
                Name        = "Accepttest",
                Lastname    = "Patient",
                Adress      = "Testvej 1",
                zipcode     = 4321,
                Age         = 20,
                City        = "TestBy",
                Email       = "*****@*****.**",
                MobilNummer = "30405060"
            };

            clinicianDbLogic.CreatePatient(newPatient);


            #endregion

            #region Create Staff

            StaffLogin newStaffLogin = new StaffLogin()
            {
                Name        = "Kliniker",
                Password    = "******",
                StaffStatus = Status.Clinician,
            };

            //clinicianDbLogic.CreateStaffLogin(newStaffLogin);

            StaffLogin nStaffLogin = new StaffLogin()
            {
                Name        = "Tekniker",
                Password    = "******",
                StaffStatus = Status.Technician
            };

            //clinicianDbLogic.CreateStaffLogin(nStaffLogin);

            #region Create EarCast 2

            EarCast newCast = new EarCast()
            {
                EarSide = Ear.Right,
            };

            //clinicianDbLogic.CreateEarCast(newCast);

            #endregion

            #endregion

            #region Create GeneralSpec

            GeneralSpec newGeneralSpecL = new GeneralSpec()
            {
                //CPR = "111111-1111",
                Type         = Material.AntiAllergi,
                Color        = PlugColor.Honey,
                EarSide      = Ear.Left,
                CreateDate   = DateTime.Now,
                StaffLoginFK = 1,
            };

            //clinicianDbLogic.CreateNewGeneralSpec(newGeneralSpecL);

            GeneralSpec newGeneralSpecR = new GeneralSpec()
            {
                //CPR = "111111-1111",
                Type         = Material.AntiAllergi,
                Color        = PlugColor.Honey,
                EarSide      = Ear.Right,
                CreateDate   = DateTime.Now,
                StaffLoginFK = 1,
            };

            //clinicianDbLogic.CreateNewGeneralSpec(newGeneralSpecR);

            #endregion

            #region Create TecnicalSpec

            TecnicalSpec newTecnicalSpecR = new TecnicalSpec()
            {
                EarSide      = Ear.Right,
                CreateDate   = DateTime.Now,
                StaffLoginFK = 1,
                //CPR = "111111-1111"
            };

            //clinicianDbLogic.CreateTechnicalSpec(newTecnicalSpecR);

            TecnicalSpec newTecnicalSpecL = new TecnicalSpec()
            {
                EarSide      = Ear.Left,
                CreateDate   = DateTime.Now,
                StaffLoginFK = 1,
                //CPR = "111111-1111",
            };

            //clinicianDbLogic.CreateTechnicalSpec(newTecnicalSpecL);

            #endregion

            #region Create rawEarPrint

            RawEarPrint print = new RawEarPrint()
            {
                EarSide      = Ear.Left,
                StaffLoginFK = 1,
                PrintDate    = DateTime.Now,
            };

            //clinicianDbLogic.SavePrint(print, "111111-1111");

            #endregion

            #endregion

            #region Delete (CRUD)

            #region Delete patient

            //Patient DeletePatient = new Patient()
            //{
            //   PCPR = "110396-0000",
            //};

            //clinicianDbLogic.DeletePatient(DeletePatient);

            #endregion

            #region Delete EarCast

            //EarCast DeleteEarCast = new EarCast()
            //{
            //   EarCastID = 2,
            //};

            // clinicianDbLogic.DeleteEarCast(DeleteEarCast);

            #endregion

            #endregion

            #region Update (CRUD)

            #region Update patient

            //Patient UpdatePatient = new Patient()
            //{
            //   PCPR = "110396-0000",
            //   Lastname = "Nedergaard Enevoldsen",
            //   Adress = "Trøjbordvej 72",

            //};

            //clinicianDbLogic.UpdatePatient(UpdatePatient);

            #endregion

            #endregion

            #region Retrive (CRUD)

            #region Retrieve Alle patienter

            //List<Patient> Patients = clinicianDbLogic.GetAllPatients();

            //foreach (Patient patient in Patients)
            //{
            //   Console.WriteLine(patient.Name);
            //}

            #endregion

            #region Retrieve Patient tilhørende øre afstøbning

            //Patient Patient = clinicianDbLogic.GetPatientFromEarCast(2);

            //Console.WriteLine(Patient.Name);

            #endregion

            #region Create afstøbning

            //EarCast earCast = clinicianDbLogic.Get
            //Patient Patient = clinicianDbLogic.GetPatient("250997-0000");

            // Console.WriteLine(Patient.Name);

            #endregion

            #region Retrieve Patient tilhørende øre afstøbning

            //Patient earPatient = clinicianDbLogic.GetPatientWithEarCast("250997-0000");

            //foreach (EarCast earPatientEarCast in earPatient.EarCasts)
            //{
            //    Console.WriteLine($"PCPR: {earPatientEarCast.PCPR} Øre side: {earPatientEarCast.EarSide.ToString()} ID: {earPatientEarCast.EarCastID}");
            //}

            #endregion

            #region Hent en patient med alle parametre udfyldt

            //Patient patient = clinicianDbLogic.GetPatientWithGeneralSpecAndTechnicalSpec("111111-1111");

            #endregion


            #endregion
        }
Beispiel #10
0
        public Patient GetPatientInformations(string EarCastID)
        {
            Thread.Sleep(1000);

            if (EarCastID == "1")
            {
                Patient testPatient = new Patient();
                testPatient.CPR      = "123456-7891";
                testPatient.Name     = "Børge";
                testPatient.Lastname = "Andersen";
                testPatient.Age      = 69;

                testPatient.TecnicalSpecs = new List <TecnicalSpec>();

                TecnicalSpec testTecnicalSpecLeft = new TecnicalSpec();
                testTecnicalSpecLeft.EarSide    = Ear.Left;
                testTecnicalSpecLeft.RawEarScan = new RawEarScan();

                TecnicalSpec testTecnicalSpecRight = new TecnicalSpec();
                testTecnicalSpecRight.EarSide = Ear.Right;
                testTecnicalSpecRight.Printed = true;

                testTecnicalSpecRight.RawEarScan = new RawEarScan();

                testPatient.TecnicalSpecs.Add(testTecnicalSpecLeft);
                testPatient.TecnicalSpecs.Add(testTecnicalSpecRight);


                testPatient.GeneralSpecs = new List <GeneralSpec>();

                GeneralSpec testGeneralSpecLeft = new GeneralSpec();
                testGeneralSpecLeft.Color = PlugColor.Almond;
                testGeneralSpecLeft.Type  = Material.Silhuet;

                GeneralSpec testGeneralSpecRight = new GeneralSpec();
                testGeneralSpecRight.Color = PlugColor.Honey;
                testGeneralSpecRight.Type  = Material.Blød;

                EarCast earCastRight = new EarCast();
                EarCast earCastLeft  = new EarCast();

                earCastRight.EarCastID = 1;
                earCastRight.EarSide   = Ear.Right;


                earCastLeft.EarCastID = 2;
                earCastLeft.EarSide   = Ear.Left;

                testPatient.EarCasts = new List <EarCast>();
                testPatient.EarCasts.Add(earCastRight);

                testPatient.EarCasts.Add(earCastLeft);

                testPatient.GeneralSpecs.Add(testGeneralSpecLeft);
                testPatient.GeneralSpecs.Add(testGeneralSpecRight);

                return(testPatient);
            }
            else
            {
                return(null);
            }
        }