예제 #1
0
        private async void EraseDoWork(object sender, DoWorkEventArgs e)
        {
            foreach (int item in EraseInt)
            {
                try
                {
                    using (me = new MedicalModel(ConfigurationManager.Connect()))
                    {
                        await me.Database.Connection.OpenAsync();

                        scheduledata sd = me.scheduledata.Where(s => s.IdSD == item).FirstOrDefault();
                        if (sd.StillNotVisitedSD)
                        {
                            me.newperson.Remove(me.newperson.Where(np => np.IdNP == me.scheduleperson_st.
                                                                   Where(sps => sps.IdSP == sd.PatientIdSD).FirstOrDefault().NewPersonIdSP).Single());
                        }
                        me.scheduleperson_st.Remove(me.scheduleperson_st.Where(sps => sps.IdSP == sd.PatientIdSD).Single());
                        me.scheduledata.Remove(sd);
                        await me.SaveChangesAsync();
                    }
                    workingConn = true;
                }
                catch (Exception ex)
                {
                    Log.WriteException(ex);
                    workingConn = false;
                }
            }
        }
예제 #2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            MedicalModel md = MedicalGrid.DataContext as MedicalModel;

            dC.CopyFileFirstViewToDocFirstView(md.Name);
            dC.AddToTemplateFirstDoc(md);
        }
예제 #3
0
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    PatientListM.FullZipCodeList    = me.zipcode_fx.ToList();
                    PatientListM.FullSettlementList = me.settlement_fx.ToList();
                    PatientListM.FullUsersList      = me.userdata.Where(a => !me.accountdata.FirstOrDefault(b => b.IdAD == a.AccountDataIdUD).DeletedAD).ToList()
                                                      .Where(n => me.priviledges.FirstOrDefault(p => p.IdP == me.accountdata.FirstOrDefault(b => b.IdAD == n.AccountDataIdUD).PriviledgesIdAD).IsDoctorP)
                                                      .Select(a => new PatientListM.UserList
                    {
                        Id   = a.IdUD,
                        Name = a.NameUD
                    }).ToList();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #4
0
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    FacilityDataMDataSet.FullZipCodeList     = me.zipcode_fx.ToList();
                    FacilityDataMDataSet.FullSettlementList  = me.settlement_fx.ToList();
                    FacilityDataMDataSet.SettlementZipSwitch = me.settlementzipcode_st.ToList();
                    temp = me.companydata
                           .Select(a => new FacilityDataMDataSet.Company
                    {
                        ID   = a.IdCD,
                        Name = a.NameCD
                    }).ToList();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    PatientDetailsMDataSet.FullGenderList      = me.gender_fx.ToList();
                    PatientDetailsMDataSet.FullZipCodeList     = me.zipcode_fx.ToList();
                    PatientDetailsMDataSet.FullSettlementList  = me.settlement_fx.ToList();
                    PatientDetailsMDataSet.SettlementZipSwitch = me.settlementzipcode_st.ToList();
                    if (!newForm)
                    {
                        selected = me.patientdata.Where(a => a.IdPD == selectedId).Single();
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #6
0
        }// doc

        public MedicalModel AddFromFileDbFile(object path)// doc doctemplateservice
        {
            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            object miss = System.Reflection.Missing.Value;

            object readOnly = true;

            Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
            string allText = docs.Content.Text;

            string[] needTxt = allText.Split(new char[] { ' ', '\n', '\r' });

            MedicalModel md = new MedicalModel
            {
                Complaints     = GetDataFromDoc("Жалобы:", "Анамнез:", needTxt),
                Anamnes        = GetDataFromDoc("Анамнез:", "ОбщийСтатус:", needTxt),
                StatusPraesens = GetDataFromDoc("ОбщийСтатус:", "МестныйСтатус:", needTxt),
                LocalStatus    = GetDataFromDoc("МестныйСтатус:", "ПредварительныйДиагноз:", needTxt),
                Diagnos        = GetDataFromDoc("ПредварительныйДиагноз:", "Рекомендации:", needTxt)
            };

            docs.Close();
            word.Quit();
            return(md);
        }
        private async void EraseDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    if (CompanyDataM.SelectedCompany.ID == null)
                    {
                        eraseable = true;
                    }
                    else
                    {
                        eraseable = !(me.billing.Any(b => b.CompanyIdFromB == CompanyDataM.SelectedCompany.ID ||
                                                     b.CompanyIdToB == CompanyDataM.SelectedCompany.ID) ||
                                      me.examinationdata.Any(ex => ex.CompanyIdEX == CompanyDataM.SelectedCompany.ID) ||
                                      me.evidencedata.Any(ex => ex.CompanyIdED == CompanyDataM.SelectedCompany.ID) ||
                                      me.importedexaminationdata.Any(ex => ex.CompanyIdIEX == CompanyDataM.SelectedCompany.ID) ||
                                      me.importedevidencedata.Any(ex => ex.CompanyIdIED == CompanyDataM.SelectedCompany.ID));
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #8
0
        public async Task <IActionResult> Add([FromQuery] string token)
        {
            var user = await _context.User.FirstOrDefaultAsync(u => u.token == token);

            if (user != null)
            {
                var model = new MedicalModel();
                model.Hash = user.Hash;
                user.token = await ShaEncoder.GenerateSHA256String($"{user.Login}{user.Password}{DateTime.Now}");

                _context.User.Update(user);
                await _context.SaveChangesAsync();

                var codeGenerator = new QRCodeGenerator();
                var webRootPath   = _hostingEnvironment.WebRootPath;

                var medicalQRCode = new QRCode(codeGenerator.CreateQrCode(
                                                   $"http://blockchain.whisperq.ru/medical/add?token={user.token}",
                                                   QRCodeGenerator.ECCLevel.Q));

                var medicalQRImage = medicalQRCode.GetGraphic(10, Color.Black, Color.White,
                                                              (Bitmap)Image.FromFile($"{webRootPath}/images/piedPiper.png"));

                medicalQRImage.Save($"{webRootPath}/images/QR/{user.Login}.jpg");

                return(View(model));
            }

            return(RedirectToAction("Index", "Home"));
        }
예제 #9
0
        } //textService

        public void SavePacient(MedicalModel md, int id)
        {
            string text = "ФИО:" + md.Name + "\n" + "\n" + "Жалобы:" + md.Complaints + "\n" + "Анамнез:" + md.Anamnes + "\n" + "ОбщийСтатус:" + md.StatusPraesens +
                          "\n" + "МестныйСтатус:" + md.LocalStatus + "\n" + "ПредварительныйДиагноз:" + md.Diagnos;
            string name = md.Name;
            var    path = $"C:\\Users\\Husia\\Documents\\Pacients\\Templates\\{name}первичный.rtf";

            if (id != 0)
            {
                var pacient = db.PacientsDb.Where(p => p.Id == id).FirstOrDefault();
                pacient.FirstViewFile = path;
                db.PacientsDb.Add(pacient);
                db.SaveChanges();
            }
            else
            {
                db.PacientsDb.Add(new DbPacientModel {
                    Name = md.Name, Age = md.Age, Diagnos = md.Diagnos, FirstViewFile = path
                });
                db.SaveChanges();
            }
            if (!File.Exists($"C:\\Users\\Husia\\Documents\\Pacients\\Templates\\{name}.rtf"))
            {
                FileStream   fileStream = new FileStream($"C:\\Users\\Husia\\Documents\\Pacients\\Templates\\{name}.rtf", FileMode.CreateNew);
                StreamWriter writer     = new StreamWriter(fileStream);
                writer.Write(text);
                writer.Close();
                fileStream.Close();
            }
        } //RtfTemplateService
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            ud = new userdata();
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    DetailsModifyMDataSet.UserID = (int)GlobalVM.GlobalM.AccountID;
                    if (!GlobalVM.GlobalM.UserID.Equals(null))
                    {
                        ud       = me.userdata.Where(b => b.IdUD == GlobalVM.GlobalM.UserID).Single();
                        nonexist = false;
                    }
                    else
                    {
                        nonexist = true;
                    }
                    DetailsModifyMDataSet.FullGenderList      = me.gender_fx.ToList();
                    DetailsModifyMDataSet.FullZipCodeList     = me.zipcode_fx.ToList();
                    DetailsModifyMDataSet.FullSettlementList  = me.settlement_fx.ToList();
                    DetailsModifyMDataSet.SettlementZipSwitch = me.settlementzipcode_st.ToList();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #11
0
        private async void EraseBackgroundDoWork(object sender, DoWorkEventArgs e)
        {
            if (!PriviledgeSelectedRow.Selected.New)
            {
                int temp = PriviledgesM.PriviledgesList.Where(b => b.IdP == PriviledgeSelectedRow.Selected.IdP).Select(b => b.IdP).Single();
                try
                {
                    using (me = new MedicalModel(ConfigurationManager.Connect()))
                    {
                        await me.Database.Connection.OpenAsync();

                        listtemp = me.accountdata.Where(a => a.PriviledgesIdAD == temp).Count();
                    }
                    workingConn = true;
                }
                catch (Exception ex)
                {
                    Log.WriteException(ex);
                    workingConn = false;
                }
                if (listtemp == 0)
                {
                    PriviledgesM.Erased.Add(PriviledgesM.Priviledges.Where(a => a.IdP == PriviledgeSelectedRow.Selected.IdP).Select(a => a.IdP).Single());
                }
            }
        }
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    foreach (servicesdata row in me.servicesdata.Where(a => a.DeletedTD == null).ToList())
                    {
                        ExaminationPlanM.Services.Add(new ExaminationPlanM.Service
                        {
                            ID      = row.IdTD,
                            Name    = row.NameTD,
                            Vat     = me.pricesforeachservice.Where(pfs => pfs.ServiceDataIdPFS == row.IdTD).OrderByDescending(pfs => pfs.IdPFS).FirstOrDefault().VatPFS,
                            Price   = me.pricesforeachservice.Where(pfs => pfs.ServiceDataIdPFS == row.IdTD).OrderByDescending(pfs => pfs.IdPFS).FirstOrDefault().PricePFS,
                            Details = row.DetailsTD
                        });
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
        private async void EraseDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    eraseable = false;

                    if (ExaminationsM.SelectedExamination.Imported)
                    {
                        eraseable = !me.importedexaminationeachevidence_st.Any(ieee => ieee.IdIEX == ExaminationsM.SelectedExamination.Id) ||
                                    !me.importedexaminationeachimportedevidence_st.Any(ieee => ieee.IdIEX == ExaminationsM.SelectedExamination.Id);
                    }
                    else
                    {
                        eraseable = !me.examinationeachevidence_st.Any(ieee => ieee.IdEX == ExaminationsM.SelectedExamination.Id) ||
                                    !me.examinationeachimportedevidence_st.Any(ieee => ieee.IdEX == ExaminationsM.SelectedExamination.Id);
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #14
0
        } //нет ссылок

        public MedicalModel AddFromFileClass(object path)
        {
            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            object miss = System.Reflection.Missing.Value;

            object readOnly = true;

            Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
            string allText = docs.Content.Text;

            string[] needTxt = allText.Split(new char[] { ' ', '\n', '\r' });

            MedicalModel md = new MedicalModel
            {
                Complaints     = GetDataFromDoc("Жалобы:", "Anamnes:", needTxt),
                Anamnes        = GetDataFromDoc("Anamnes:", "StatusPraesens:", needTxt),
                StatusPraesens = GetDataFromDoc("StatusPraesens:", "LocalStatus:", needTxt),
                LocalStatus    = GetDataFromDoc("LocalStatus:", "Diagnos:", needTxt),
                Diagnos        = GetDataFromDoc("Diagnos:", "Рекомендации:", needTxt)
            };

            docs.Close();
            word.Quit();
            return(md);
        }// doc
        private async void ExecuteDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    RegistrationM.PriviledgesID = me.priviledges.Where(b => b.NameP == RegistrationM.PriviledgesSelected).Select(b => b.IdP).Single();
                    accountdata ad = new accountdata();
                    ad.UserNameAD = RegistrationM.Username;
                    PasswordManager pwm = new PasswordManager();
                    RegistrationM.PassSalt = pwm.GetSaltString();
                    ad.PassSaltAD          = RegistrationM.PassSalt;
                    ad.PasswordAD          = pwm.GenerateHashWithSalt(RegistrationM.Password, RegistrationM.PassSalt);
                    ad.PriviledgesIdAD     = RegistrationM.PriviledgesID;
                    ad.RegistrateTimeAD    = DateTime.Now;
                    me.accountdata.Add(ad);
                    await me.SaveChangesAsync();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #16
0
        private async void ExecuteDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    foreach (EvidencesM.ErasedItem item in EvidencesM.Erased)
                    {
                        if (item.Imported)
                        {
                            me.examinationeachimportedevidence_st.RemoveRange
                                (me.examinationeachimportedevidence_st.Where(ex => ex.IdIED == item.Id).ToList());

                            me.importedexaminationeachimportedevidence_st.RemoveRange
                                (me.importedexaminationeachimportedevidence_st.Where(ex => ex.IdIED == item.Id).ToList());

                            me.evidencedatadocuments.RemoveRange
                                (me.evidencedatadocuments.Where(ex => me.importedevidencedatadocuments_st.Where
                                                                    (ied => ied.IdIED == item.Id).Select(ied => ied.IdEDD).ToList().Any(c => c == ex.IdEDD)));

                            me.importedevidencedatadocuments_st.RemoveRange
                                (me.importedevidencedatadocuments_st.Where(ied => ied.IdIED == item.Id));

                            me.importedevidencedata.Remove
                                (me.importedevidencedata.Where(ex => ex.IdIED == item.Id).Single());
                        }

                        else
                        {
                            me.examinationeachevidence_st.RemoveRange
                                (me.examinationeachevidence_st.Where(ex => ex.IdED == item.Id).ToList());

                            me.importedexaminationeachevidence_st.RemoveRange
                                (me.importedexaminationeachevidence_st.Where(ex => ex.IdED == item.Id).ToList());

                            me.evidencedatadocuments.RemoveRange
                                (me.evidencedatadocuments.Where(ex => me.evidencedatadocuments_st.Where
                                                                    (ied => ied.IdED == item.Id).Select(ied => ied.IdEDD).ToList().Any(c => c == ex.IdEDD)));

                            me.evidencedatadocuments_st.RemoveRange
                                (me.evidencedatadocuments_st.Where(ied => ied.IdED == item.Id));

                            me.evidencedata.Remove
                                (me.evidencedata.Where(ex => ex.IdED == item.Id).Single());
                        }
                    }

                    await me.SaveChangesAsync();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
        protected internal async Task <ObservableCollection <ChartM.Record> > StatusDistibution()
        {
            return(await Task.Run(async() =>
            {
                try
                {
                    List <ChartM.Record> collection = new List <ChartM.Record>();

                    using (me = new MedicalModel(ConfigurationManager.Connect()))
                    {
                        await me.Database.Connection.OpenAsync();

                        List <int> patients = Members.Count == 0 ? patients = me.scheduleperson_st.Select(st => st.IdSP).ToList() :
                                                                              me.scheduleperson_st.Where(sc => Members.Any(m => m == sc.ExistedIdSP)).Select(u => u.IdSP).ToList();
                        List <status_fx> statuses = me.status_fx.ToList();

                        DateTime LocalStart = StartTime == null ? Correction(true, me.scheduledata.OrderBy(sc => sc.StartSD).FirstOrDefault().StartSD).Date :
                                              Correction(true, (DateTime)StartTime).Date;
                        DateTime LocalFinish = FinishTime == null ? (StartTime != null ? Correction(false, (DateTime)StartTime).Date :
                                                                     Correction(false, DateTime.Now).Date) : Correction(false, (DateTime)FinishTime).Date;
                        FinishTime = LocalFinish;

                        while (LocalStart.Date < ((DateTime)FinishTime).Date)
                        {
                            LocalFinish = NextStep(LocalStart);
                            List <scheduledata> schedule = me.scheduledata.Where(sc => patients.Contains(sc.PatientIdSD) &&
                                                                                 sc.StartSD > LocalStart && sc.FinishSD < LocalFinish).ToList();
                            foreach (status_fx element in statuses)
                            {
                                collection.Add(new ChartM.Record()
                                {
                                    Id = statuses.IndexOf(element),
                                    Name = element.DataS,
                                    Date = LocalStart,
                                    Value1 = schedule.Count(sc => sc.StatusSD == element.IdS)
                                });
                            }
                            LocalStart = NextStep(LocalStart);
                        }
                    }
                    workingConn = true;
                    return new ObservableCollection <ChartM.Record>(collection);
                }
                catch (Exception ex)
                {
                    Log.WriteException(ex);
                    workingConn = false;
                    return null;
                }
            }, CancellationToken.None).ContinueWith(task =>
            {
                if (!workingConn)
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => ConnectionMessage()));
                }
                return task.Result;
            }));
        }
        protected internal async Task <ObservableCollection <ChartM.Record> > ExecutedService()
        {
            return(await Task.Run(async() =>
            {
                try
                {
                    List <ChartM.Record> collection = new List <ChartM.Record>();

                    using (me = new MedicalModel(ConfigurationManager.Connect()))
                    {
                        await me.Database.Connection.OpenAsync();

                        List <object> services = Members.Count == 0 ? me.servicesdata.Select(s => new { s.IdTD, s.NameTD }).ToList <object>() :
                                                 me.servicesdata.Where(s => Members.Any(m => m == s.IdTD)).Select(s => new { s.IdTD, s.NameTD }).ToList <object>();

                        DateTime LocalStart = StartTime == null ? Correction(true, me.examinationdata.OrderBy(e => e.DateTimeEX).FirstOrDefault().DateTimeEX.Date) :
                                              Correction(true, (DateTime)StartTime).Date;
                        DateTime LocalFinish = FinishTime == null ? (StartTime != null ? Correction(false, (DateTime)StartTime).Date :
                                                                     Correction(false, DateTime.Now).Date) : Correction(false, (DateTime)FinishTime).Date;
                        FinishTime = LocalFinish;

                        while (LocalStart.Date < ((DateTime)FinishTime).Date)
                        {
                            LocalFinish = NextStep(LocalStart);

                            List <int> examinations = me.examinationdata.Where(e => e.DateTimeEX > LocalStart && e.DateTimeEX < LocalFinish).Select(e => e.ServiceIdEX).ToList();

                            foreach (object service in services)
                            {
                                collection.Add(new ChartM.Record()
                                {
                                    Id = services.IndexOf(service),
                                    Name = (string)service.GetType().GetProperty("NameTD").GetValue(service),
                                    Date = LocalStart,
                                    Value1 = examinations.Count(e => e == (int)service.GetType().GetProperty("IdTD").GetValue(service))
                                });
                            }
                            LocalStart = NextStep(LocalStart);
                        }
                    }
                    workingConn = true;
                    return new ObservableCollection <ChartM.Record>(collection);
                }
                catch (Exception ex)
                {
                    Log.WriteException(ex);
                    workingConn = false;
                    return null;
                }
            }, CancellationToken.None).ContinueWith(task =>
            {
                if (!workingConn)
                {
                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => ConnectionMessage()));
                }
                return task.Result;
            }));
        }
예제 #19
0
        private async void ExecuteDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    if (PatientListM.Erased.Count != 0)
                    {
                        foreach (int patient in PatientListM.Erased)
                        {
                            me.belong_st.RemoveRange(me.belong_st.Where(a => a.IdPD == patient));
                            me.examinationeachevidence_st.RemoveRange(me.examinationeachevidence_st.Where
                                                                          (b => me.examinationdata.Where(a => a.PatientIdEX == patient).Select(a => a.IdEX).ToList().Any(c => c == b.IdEX)));
                            me.examinationdata.RemoveRange(me.examinationdata.Where(a => a.PatientIdEX == patient));
                            me.evidencedata.RemoveRange(me.evidencedata.Where(a => a.PatientIdED == patient));
                            me.scheduledata.RemoveRange(me.scheduledata.Where(a => a.PatientIdSD == patient));
                            me.patientdata.Remove(me.patientdata.Where(a => a.IdPD == patient).Single());
                            await me.SaveChangesAsync();
                        }
                    }
                    foreach (PatientListM.Patient patient in PatientListM.PatientList)
                    {
                        if (!patient.BelongUsers.Where(a => a.Belong == true).Select(a => a.Id).ToList().SequenceEqual(patient.Belong))
                        {
                            foreach (PatientListM.UserList user in patient.BelongUsers)
                            {
                                belong_st temp = me.belong_st.Where(a => a.IdPD == patient.Id && a.IdUD == user.Id).FirstOrDefault();
                                if (user.Belong && temp == null)
                                {
                                    me.belong_st.Add(new belong_st
                                    {
                                        IdPD         = patient.Id,
                                        IdUD         = user.Id,
                                        WhenBelongBS = DateTime.Now
                                    });
                                    patient.Belong.Add(user.Id);
                                }
                                if (!user.Belong && temp != null)
                                {
                                    me.belong_st.Remove(me.belong_st.Where(a => a.IdPD == patient.Id && a.IdUD == user.Id).Single());
                                    patient.Belong.Remove(user.Id);
                                }
                            }
                        }
                    }
                    await me.SaveChangesAsync();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #20
0
        private void clickedEpicris(object sender, RoutedEventArgs e)
        {
            MedicalModel   model   = rtfTemplate.AddFromFileDbFileRtfFirstView(pacient.FirstViewFile);
            EpicrisisModel epModel = new EpicrisisModel
            {
                Anamnes = model.Anamnes, Age = pacient.Age, Name = pacient.Name,
                Diagnos = model.Diagnos, StatusPraesens = model.StatusPraesens
            };

            EpicrisisPage epPage = new EpicrisisPage(epModel, pacient.Id);

            epPage.Show();
        }
예제 #21
0
 protected internal async void Start()
 {
     await Task.Run(async() =>
     {
         try
         {
             using (me = new MedicalModel(ConfigurationManager.Connect()))
             {
                 await me.Database.Connection.OpenAsync();
                 LoginM.ExistUsers = me.accountdata.Where(a => a.DeletedAD != true).Select(a => a.UserNameAD).ToList();
             }
             workingConn = true;
             if (ConfigurationManager.ConfigurationManagerM.FacilityId != string.Empty)
             {
                 GlobalVM.GlobalM.CompanyId = Convert.ToInt32(ConfigurationManager.ConfigurationManagerM.FacilityId);
             }
         }
         catch (Exception ex)
         {
             Log.WriteException(ex);
             workingConn = false;
         }
         finally
         {
             if (!workingConn)
             {
                 LoginM.ExistUsers = new List <string> {
                     ConfigurationManager.ConfigurationManagerM.SecurityUsername
                 }
             }
             ;
         }
     }, CancellationToken.None).ContinueWith(async task =>
     {
         LoginM.AcceptChanges();
         if (!workingConn)
         {
             dialog         = new Dialog(true, "Nem sikerült elérni az adatbázist", async() => await Utilities.Loading.Hide());
             dialog.content = new TextBlock("Adatbáziskapcsolat nélkül nem lehet megfelelően használni az alkalmazást\n" +
                                            "Első használat alkalmával be kell konfigurálni az adatbázis kapcsolatot\n" +
                                            "Kérjük jelezze a problémát a rendszergazdának");
             dialog.Start();
             (GlobalVM.StockLayout.verticalMenu.Children[0] as StockVerticalMenuItem).IsEnabledTrigger = false;
         }
         else
         {
             await Utilities.Loading.Hide();
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
예제 #22
0
        private async void ExecuteDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    examinationdata ed = new examinationdata()
                    {
                        PatientIdEX = NewExaminationM.PatientId,
                        DoctorIdEX  = (int)GlobalVM.GlobalM.UserID,
                        DateTimeEX  = (DateTime)NewExaminationM.ExaminationDate,
                        ServiceIdEX = me.servicesdata.Where(t => t.NameTD == NewExaminationM.SelectedTreat).Single().IdTD,
                        CodeEX      = NewExaminationM.ExaminationCode,
                        CompanyIdEX = (int)GlobalVM.GlobalM.CompanyId
                    };
                    me.examinationdata.Add(ed);
                    await me.SaveChangesAsync();

                    int id = ed.IdEX;

                    for (int i = 0; i < NewExaminationM.ExaminationList.Count - 1; i++)
                    {
                        examinationdatadocuments edd = new examinationdatadocuments()
                        {
                            DataEXD     = NewExaminationM.ExaminationList[i].File.ToArray(),
                            TypeEXD     = NewExaminationM.ExaminationList[i].ButtonType,
                            FileTypeEXD = NewExaminationM.ExaminationList[i].FileType
                        };
                        me.examinationdatadocuments.Add(edd);
                        await me.SaveChangesAsync();

                        int ide = edd.IdEXD;
                        me.examinationdatadocuments_st.Add(new examinationdatadocuments_st()
                        {
                            IdEX  = id,
                            IdEXD = ide
                        });
                        await me.SaveChangesAsync();
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
        private void Datagrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var          webModel = (WebModelPacient)datagrid.SelectedItem;
            MedicalModel pacient  = new MedicalModel()
            {
                Name    = webModel.Name,
                Age     = webModel.Age,
                Diagnos = webModel.Diagnos
            };
            var targetWindow = Application.Current.Windows.Cast <Window>().
                               FirstOrDefault(w => w is PacientPage) as PacientPage;

            targetWindow.ChangeNameAge = pacient;
        }
        private async void ExecuteDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    importedexaminationdata ied = new importedexaminationdata()
                    {
                        PatientIdIEX = ImportExaminationM.PatientId,
                        DoctorIdIEX  = (int)GlobalVM.GlobalM.UserID,
                        DateTimeIEX  = (DateTime)ImportExaminationM.ExaminationDate,
                        NameIEX      = ImportExaminationM.ExaminationName,
                        CodeIEX      = ImportExaminationM.ExaminationCode,
                        CompanyIdIEX = (int)GlobalVM.GlobalM.CompanyId
                    };
                    me.importedexaminationdata.Add(ied);
                    await me.SaveChangesAsync();

                    int id = ied.IdIEX;

                    for (int i = 0; i < ImportExaminationM.ExaminationList.Count - 1; i++)
                    {
                        examinationdatadocuments ed = new examinationdatadocuments()
                        {
                            DataEXD     = ImportExaminationM.ExaminationList[i].File.ToArray(),
                            TypeEXD     = ImportExaminationM.ExaminationList[i].ButtonType,
                            FileTypeEXD = ImportExaminationM.ExaminationList[i].FileType
                        };
                        me.examinationdatadocuments.Add(ed);
                        await me.SaveChangesAsync();

                        int ide = ed.IdEXD;
                        me.importedexaminationdatadocuments_st.Add(new importedexaminationdatadocuments_st()
                        {
                            IdIEX = id,
                            IdEXD = ide
                        });
                        await me.SaveChangesAsync();
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #25
0
        private async void RefreshTableDoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    if (!PatientListM.SelectedUser.Id.Equals(0))
                    {
                        List <int> belongToCurr = me.belong_st.Where(a => a.IdUD == PatientListM.SelectedUser.Id).Select(a => a.IdPD).ToList();
                        temp = me.patientdata.Where(a => belongToCurr.Contains(a.IdPD)).Select(a => new PatientListM.Patient
                        {
                            Id           = a.IdPD,
                            Name         = a.NamePD,
                            BirthName    = a.BirthNamePD,
                            BirthPlaceId = a.BirthPlacePD,
                            BirthDate    = a.BirthDatePD,
                            TajNumber    = a.TAJNumberPD,
                            ZipCodeId    = a.ZipCodePD,
                            SettlementId = a.SettlementPD,
                            Address      = a.AddressPD,
                            Belong       = me.belong_st.Where(b => b.IdPD == a.IdPD).Select(b => b.IdUD).ToList()
                        }).ToList();
                    }
                    else if (GlobalVM.GlobalM.AllSee)
                    {
                        temp = me.patientdata.Select(a => new PatientListM.Patient
                        {
                            Id           = a.IdPD,
                            Name         = a.NamePD,
                            BirthName    = a.BirthNamePD,
                            BirthPlaceId = a.BirthPlacePD,
                            BirthDate    = a.BirthDatePD,
                            TajNumber    = a.TAJNumberPD,
                            ZipCodeId    = a.ZipCodePD,
                            SettlementId = a.SettlementPD,
                            Address      = a.AddressPD,
                            Belong       = me.belong_st.Where(b => b.IdPD == a.IdPD).Select(b => b.IdUD).ToList()
                        }).ToList();
                    }
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #26
0
        public void AddToTemplateFirstDoc(MedicalModel model) //сохранение в docx файле первичного осмотра
        {
            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            word.Visible = false;
            var document = word.Documents.Open(tS.MainPath + $"{model.Name}\\{model.Name}первичный.docx");

            tS.ReplaceWords("{name}", model.Name, document);
            tS.ReplaceWords("{Anamnes}", model.Anamnes, document);
            tS.ReplaceWords("{StatusPraesens}", model.StatusPraesens, document);
            tS.ReplaceWords("{LocalStatus}", model.LocalStatus, document);
            tS.ReplaceWords("{Diagnos}", model.Diagnos, document);
            document.Save();
            document.Close();
            word.Quit();
        }
예제 #27
0
        } //DocTemplateService

        public void AddToTemplateFirstDoc(MedicalModel model)// DocTemplateService
        {
            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            word.Visible = false;
            var document = word.Documents.Open($"C:\\Users\\Husia\\Documents\\Pacients\\{model.Name}\\{model.Name}первичный.docx");

            ReplaceWords("{name}", model.Name, document);
            ReplaceWords("{Anamnes}", model.Anamnes, document);
            ReplaceWords("{StatusPraesens}", model.StatusPraesens, document);
            ReplaceWords("{LocalStatus}", model.LocalStatus, document);
            ReplaceWords("{Diagnos}", model.Diagnos, document);
            document.Save();
            document.Close();
            word.Quit();
        }
예제 #28
0
        public ActionResult EHRInformation()
        {
            Patientm patm;

            if (Session["Patient"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                patm = (Patientm)Session["Patient"];
            }
            MedicalModel pm = new MedicalModel(patm);

            return(View(pm));
        }
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    SurgeryTimeM.UserRegistrateDate = me.accountdata.Where(a => a.IdAD == GlobalVM.GlobalM.AccountID).Single().RegistrateTimeAD;

                    for (int i = 1; i <= 7; i++)
                    {
                        usersschedule item = me.usersschedule.Where(u => u.UserDataIdUS == GlobalVM.GlobalM.UserID && u.DayOfWeekUS == i).OrderByDescending(u => u.WhenCreateUS).FirstOrDefault();
                        if (item != null)
                        {
                            SurgeryTimeM.GetType().GetProperty(DayOfWeek(item.DayOfWeekUS)).SetValue(SurgeryTimeM, true);
                            SurgeryTimeM.GetType().GetProperty("Start" + DayOfWeek(item.DayOfWeekUS)).SetValue(SurgeryTimeM, item.StartTimeUS);
                            SurgeryTimeM.GetType().GetProperty("Finish" + DayOfWeek(item.DayOfWeekUS)).SetValue(SurgeryTimeM, item.FinishTimeUS);
                            SetActual(i, item.StartTimeUS, item.FinishTimeUS);
                        }
                    }

                    foreach (SurgeryTimeM.Exception item in me.exceptedschedule.Where(ex => ex.UserDataIdES == GlobalVM.GlobalM.UserID).ToList().
                             Select(ex => new SurgeryTimeM.Exception()
                    {
                        DBId = ex.IdES,
                        Included = ex.IncludedES,
                        StartDateTime = ex.StartDateES,
                        FinishDateTime = ex.FinishDateED,
                        Valid = true
                    }))
                    {
                        SurgeryTimeM.Exceptions.Add(item);
                    }

                    CollectionChange();
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }
예제 #30
0
        private async void LoadingModel(object sender, DoWorkEventArgs e)
        {
            try
            {
                using (me = new MedicalModel(ConfigurationManager.Connect()))
                {
                    await me.Database.Connection.OpenAsync();

                    ViewBillM.Stream = new MemoryStream(me.billing.Where(b => b.IdB == ViewBillM.Id).Single().BillB);
                }
                workingConn = true;
            }
            catch (Exception ex)
            {
                Log.WriteException(ex);
                workingConn = false;
            }
        }