示例#1
0
        public bool Update(DiseaseHistory model)
        {
            HR_DISEASEHISTORY modelDB = _repository.FindOne(u => u.DISEASEHISTORYID == model.DISEASEHISTORYID);

            if (modelDB != null)
            {
                modelDB.DISEASENAME        = model.DISEASENAME;
                modelDB.TREATPROCESS       = model.TREATPROCESS;
                modelDB.CREATTIME          = model.CREATTIME;
                modelDB.HOSPITAL           = model.HOSPITAL;
                modelDB.STARTTIME          = model.STARTTIME;
                modelDB.RECOVERTIME        = model.RECOVERTIME;
                modelDB.CONFIRMEDTIME      = model.CONFIRMEDTIME;
                modelDB.EDITTIME           = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
                modelDB.CONFIRMEDAGE       = model.CONFIRMEDAGE;
                modelDB.CONFIRMEDADDRESS   = model.CONFIRMEDADDRESS;
                modelDB.CONFIRMEDMODE      = model.CONFIRMEDMODE;
                modelDB.CONFIRMEDRELUST    = model.CONFIRMEDRELUST;
                modelDB.SYMPTOMDESCRIPTION = model.SYMPTOMDESCRIPTION;
                modelDB.ISCANCER           = model.ISCANCER;
                modelDB.CANCERNAME         = model.CANCERNAME;
                modelDB.CANCERCODE         = model.CANCERCODE;
                modelDB.CANCERPOSITION     = model.CANCERPOSITION;
                modelDB.CELLULATYPE        = model.CELLULATYPE;
                modelDB.CLINICALSTAGES     = model.CLINICALSTAGES;
                modelDB.TUMOR      = model.TUMOR;
                modelDB.N          = model.N;
                modelDB.M          = model.M;
                modelDB.GENE       = model.GENE;
                modelDB.ISREAPPEAR = model.ISREAPPEAR;
                return(_repository.Update(modelDB));
            }
            return(false);
        }
        public IActionResult CreateDiseaseHistory(PatientViewModel model)
        {
            var result = Execute(() =>
            {
                bool isMedEmployee = _userManager.IsUserInMedEmployeeRole(User.Identity.Name);
                if (!isMedEmployee)
                {
                    throw new UnauthorizedAccessException("You have not appropriate rights to access this action");
                }


                var patientUserInfo = _userInfoService.RegisterPatient(model);


                var diseaseHistory = new DiseaseHistory()
                {
                    PatientInfoId = patientUserInfo.UserInfoId,
                    PatientInfo   = patientUserInfo,
                    Message       = model.Message
                };


                _diseaseHistoryService.AddDiseaseHistory(diseaseHistory);
            });

            return(Json(result));
        }
示例#3
0
 public DiseaseHistoryDetailsViewModel(DiseaseHistory history)
 {
     Id          = history.Id;
     Message     = history.Message;
     PatientInfo = new UserInfoDetailedViewModel(history.PatientInfo);
     Metrics     = history.Metrics.Select(h => new MetricListItemViewModel(h)).ToList();
     Treatments  = history.Treatments.Select(h => new TreatmentListItemViewModel(h)).ToList();
 }
示例#4
0
 private void listBoxHistories_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentHistory3             = LogicProvider.Logic.GetHistoryById((listBoxHistories.SelectedItem as History).Id);
     textBoxAnamnesis3.Text      = currentHistory3.Anamnesis;
     textBoxPreDiagnoses.Text    = string.Join(", ", LogicProvider.Logic.GetDiagnosesByHistoryId(currentHistory3.Id));
     textBoxFinalDiagnoses.Text  = currentHistory3.FinalDiagnoses;
     textBoxTreatmentPlan.Text   = currentHistory3.TreatmentPlan;
     listBoxAnalyses3.DataSource = LogicProvider.Logic.GetAnalysesByHistoryId(currentHistory3.Id);
 }
 public DiseaseHistoryListItemViewModel(DiseaseHistory history)
 {
     Id            = history.Id;
     PatientInfoId = history.PatientInfoId;
     Email         = history.PatientInfo.Email;
     FirstName     = history.PatientInfo.FirstName;
     SecondName    = history.PatientInfo.SecondName;
     BirthDate     = history.PatientInfo.BirthDate;
 }
示例#6
0
        public async Task <ActionResult> DeleteConfirmed(int?id)
        {
            DiseaseHistory diseaseHistory = await db.DiseaseHistories.FindAsync(id);

            db.DiseaseHistories.Remove(diseaseHistory);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#7
0
        public IActionResult Update(DiseaseHistory dishis)
        {
            var item = _context.DiseaseHistories.Find(dishis.DisHisID);

            item.DiseaseName = dishis.DiseaseName;
            item.duration    = dishis.duration;
            item.Type        = dishis.Type;
            _context.DiseaseHistories.Update(item);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#8
0
        // GET: DiseaseHistories/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DiseaseHistory diseaseHistory = await db.DiseaseHistories.FindAsync(id);

            if (diseaseHistory == null)
            {
                return(HttpNotFound());
            }
            return(View(diseaseHistory));
        }
示例#9
0
        // GET: DiseaseHistories/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DiseaseHistory diseaseHistory = await db.DiseaseHistories.FindAsync(id);

            if (diseaseHistory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.animalID    = new SelectList(db.Animals, "name", "name", diseaseHistory.Animal.name);
            ViewBag.diseaseName = new SelectList(db.Diseases, "name", "name", diseaseHistory.Disease.name);
            return(View(diseaseHistory));
        }
示例#10
0
        public string GetReportText(int historyId)
        {
            //Загрузить всю известную инфу о истории болезни
            DiseaseHistory history = DataAccessProvider.DBAccessor.GetFullInfoByHistoryId(historyId);
            //Привязать жалобы
            IEnumerable <Symptom> symptoms = DataAccessProvider.DBAccessor.GetSymptomsByHistoryId(historyId);
            //Привязать предварительные диагнозы
            IEnumerable <string> diseases = DataAccessProvider.DBAccessor.GetDiagnosesByHistoryId(historyId);
            //Привязать анализы
            IEnumerable <Analysis> analyses = DataAccessProvider.DBAccessor.GetAnalysesByHistoryId(historyId);
            //
            StringBuilder sb = new StringBuilder();

            sb.AppendLine($"История болезни № {history.Id} от {history.Created:d}");
            sb.AppendLine();
            sb.AppendLine($"Пациент № {history.PatientId} - {history.Lname} {history.Fname} {history.Patronymic}, родился {history.DateBirth:d} г.");
            sb.AppendLine($"Поступление: {history.StatusText}");
            sb.AppendLine();
            sb.AppendLine($"Анамнез: ");
            sb.AppendLine($"{history.Anamnesis}");
            sb.AppendLine();

            sb.AppendLine($"Жалобы:");
            foreach (Symptom symptom in symptoms)
            {
                sb.AppendLine($"- {symptom.Name}");
            }
            sb.AppendLine();
            sb.AppendLine($"Предварительные диагнозы:");
            sb.AppendLine($"{string.Join(", ", diseases)}");
            sb.AppendLine();
            sb.AppendLine($"Назначенные анализы:");
            foreach (Analysis analysis in analyses)
            {
                sb.AppendLine($"\t{analysis.ShowName}, выполнен {analysis.DateCompleted:d}");
                sb.AppendLine($" - {analysis.Conclusion}");
            }
            sb.AppendLine();
            sb.AppendLine($"Окончательные диагнозы:");
            sb.AppendLine($"{history.FinalDiagnoses}");
            sb.AppendLine();
            sb.AppendLine($"План лечения:");
            sb.AppendLine($"{history.TreatmentPlan}");

            return(sb.ToString());
        }
示例#11
0
 private DiseaseHistory EntityToModel(HR_DISEASEHISTORY entity)
 {
     if (entity != null)
     {
         var model = new DiseaseHistory()
         {
             DISEASEHISTORYID   = entity.DISEASEHISTORYID,
             PERSONID           = entity.PERSONID,
             DISEASENAME        = entity.DISEASENAME,
             ANNUALINCOME       = entity.ANNUALINCOME,
             TREATPROCESS       = entity.TREATPROCESS,
             CREATTIME          = entity.CREATTIME,
             HOSPITAL           = entity.HOSPITAL,
             CREATUSER          = entity.CREATUSER,
             EDITUSER           = entity.EDITUSER,
             EDITTIME           = entity.EDITTIME,
             STARTTIME          = entity.STARTTIME,
             RECOVERTIME        = entity.RECOVERTIME,
             CONFIRMEDTIME      = entity.CONFIRMEDTIME,
             CONFIRMEDAGE       = entity.CONFIRMEDAGE,
             CONFIRMEDADDRESS   = entity.CONFIRMEDADDRESS,
             CONFIRMEDMODE      = entity.CONFIRMEDMODE,
             CONFIRMEDRELUST    = entity.CONFIRMEDRELUST,
             SYMPTOMDESCRIPTION = entity.SYMPTOMDESCRIPTION,
             ISCANCER           = entity.ISCANCER,
             CANCERCODE         = entity.CANCERCODE,
             CANCERNAME         = entity.CANCERNAME,
             CANCERPOSITION     = entity.CANCERPOSITION,
             CELLULATYPE        = entity.CELLULATYPE,
             CLINICALSTAGES     = entity.CLINICALSTAGES,
             TUMOR      = entity.TUMOR,
             N          = entity.N,
             M          = entity.M,
             GENE       = entity.GENE,
             ISREAPPEAR = entity.ISREAPPEAR
         };
         return(model);
     }
     return(null);
 }
示例#12
0
 private HR_DISEASEHISTORY ModelToEntity(DiseaseHistory model)
 {
     if (model != null)
     {
         var entity = new HR_DISEASEHISTORY()
         {
             DISEASEHISTORYID   = model.DISEASEHISTORYID,
             PERSONID           = model.PERSONID,
             DISEASENAME        = model.DISEASENAME,
             ANNUALINCOME       = model.ANNUALINCOME,
             TREATPROCESS       = model.TREATPROCESS,
             CREATTIME          = model.CREATTIME,
             HOSPITAL           = model.HOSPITAL,
             CREATUSER          = model.CREATUSER,
             EDITUSER           = model.EDITUSER,
             EDITTIME           = model.EDITTIME,
             STARTTIME          = model.STARTTIME,
             RECOVERTIME        = model.RECOVERTIME,
             CONFIRMEDTIME      = model.CONFIRMEDTIME,
             CONFIRMEDAGE       = model.CONFIRMEDAGE,
             CONFIRMEDADDRESS   = model.CONFIRMEDADDRESS,
             CONFIRMEDMODE      = model.CONFIRMEDMODE,
             CONFIRMEDRELUST    = model.CONFIRMEDRELUST,
             SYMPTOMDESCRIPTION = model.SYMPTOMDESCRIPTION,
             ISCANCER           = model.ISCANCER,
             CANCERCODE         = model.CANCERCODE,
             CANCERNAME         = model.CANCERNAME,
             CANCERPOSITION     = model.CANCERPOSITION,
             CELLULATYPE        = model.CELLULATYPE,
             CLINICALSTAGES     = model.CLINICALSTAGES,
             TUMOR      = model.TUMOR,
             N          = model.N,
             M          = model.M,
             GENE       = model.GENE,
             ISREAPPEAR = model.ISREAPPEAR
         };
         return(entity);
     }
     return(null);
 }
示例#13
0
        public static void Initialize(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();
            // Look for any students.
            if (context.Doctors.Any())
            {
                return; // DB has been seeded
            }
            var doctors = new Doctor[]
            {
                new Doctor {
                    Name = "Carson", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "new", Hospital = "lates"
                },
                new Doctor {
                    Name = "Carson1", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "new", Hospital = "lates"
                },
                new Doctor {
                    Name = "villa", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "nedasw", Hospital = "latasdes"
                },
                new Doctor {
                    Name = "nilla", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "nedaw", Hospital = "latwervces"
                },
                new Doctor {
                    Name = "illa", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "neqdew", Hospital = "laxtes"
                },
                new Doctor {
                    Name = "giila", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "new3", Hospital = "latesfwers"
                },
                new Doctor {
                    Name = "darson", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "new2", Hospital = "laerewtes"
                },
                new Doctor {
                    Name = "sarson", Email = "*****@*****.**", Password = "******", CNIC = "324213", Age = 12, Qualification = "new1", Hospital = "lawertes"
                }
            };

            foreach (Doctor s in doctors)
            {
                context.Doctors.Add(s);
            }
            context.SaveChanges();
            var patients = new Patient[]
            {
                new Patient {
                    Name = "Carson", Email = "*****@*****.**", Password = 123, Age = 11, CNIC = "3501-33", Disease = "none"
                },
                new Patient {
                    Name = "Carson1", Email = "*****@*****.**", Password = 123, CNIC = "3501-33"
                },
                new Patient {
                    Name = "villa", Email = "*****@*****.**", Password = 1234325, CNIC = "3501-33", Age = 12,
                },
                new Patient {
                    Name = "nilla", Email = "*****@*****.**", Password = 12453, CNIC = "3501-33", Age = 12,
                },
                new Patient {
                    Name = "illa", Email = "*****@*****.**", Password = 541312, CNIC = "3501-33", Age = 12,
                },
                new Patient {
                    Name = "giila", Email = "*****@*****.**", Password = 2353, CNIC = "3501-33", Age = 12,
                },
                new Patient {
                    Name = "darson", Email = "*****@*****.**", Password = 32423, CNIC = "3501-33", Age = 12,
                },
                new Patient {
                    Name = "sarson", Email = "*****@*****.**", Password = 23423, CNIC = "3501-33", Age = 12,
                }
            };

            foreach (Patient p in patients)
            {
                context.Patients.Add(p);
            }
            context.SaveChanges();
            var Mrecords = new MedicalRecord[]
            {
                new MedicalRecord {
                    PatientId = 1, ShortDescription = "jasgdahsda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 2, ShortDescription = "jasgdahsda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 3, ShortDescription = "jasgdahasdnsahdsasda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 4, ShortDescription = "jasgdahsjhsadsjadda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 5, ShortDescription = "jasgdaasdgagshsda", images = "sdjkawerewsdgasj"
                },
                new MedicalRecord {
                    PatientId = 2, ShortDescription = "jasgdaashdasghsda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 1, ShortDescription = "jasgdasdyasahsda", images = "sdjkasdgasj"
                },
                new MedicalRecord {
                    PatientId = 3, ShortDescription = "jasgdhsadghahsda", images = "sdjkaskdsajhduysadasdgasj"
                },
                new MedicalRecord {
                    PatientId = 1, ShortDescription = "asdashfdsytaujasgdahsda", images = "sasdhasgdjkasdgasj"
                },
            };

            foreach (MedicalRecord m in Mrecords)
            {
                context.MedicalRecords.Add(m);
            }
            context.SaveChanges();
            var dishist = new DiseaseHistory[]
            {
                new DiseaseHistory {
                    DiseaseName = "new1", Type = "dfqeqweqw", duration = "werqwe", patientId = 1
                },
                new DiseaseHistory {
                    DiseaseName = "a1", Type = "eqwkjlqk", duration = "ywqrqw", patientId = 1
                },
                new DiseaseHistory {
                    DiseaseName = "d2", Type = "krqwiu", duration = "yqwrwer", patientId = 1
                },
                new DiseaseHistory {
                    DiseaseName = "sadas", Type = "retwterfwe", duration = "rwqerwe", patientId = 4
                },
                new DiseaseHistory {
                    DiseaseName = "hgtrewe", Type = "rqyrew", duration = "rweqrwe", patientId = 3
                },
                new DiseaseHistory {
                    DiseaseName = "yewter", Type = "hweerq", duration = "rwerasda", patientId = 4
                },
                new DiseaseHistory {
                    DiseaseName = "weytre", Type = "werwe", duration = "asdswherw", patientId = 3
                },
                new DiseaseHistory {
                    DiseaseName = "eyter", Type = "werwerwerw", duration = "wqrwed", patientId = 2
                },
                new DiseaseHistory {
                    DiseaseName = "tuyrewf", Type = "erwtert", duration = "qdfq3t23", patientId = 2
                },
            };

            foreach (DiseaseHistory d in dishist)
            {
                context.DiseaseHistories.Add(d);
            }
            context.SaveChanges();
            //var ad = new Admin[]
            //{
            //    new Admin{Name="shakeel",Password="******",Email="*****@*****.**"},
            //    new Admin{Name="shakeel Ur Rehman",Password="******",Email="*****@*****.**"},
            //    new Admin{Name="admin",Password="******",Email="*****@*****.**"},
            //    new Admin{Name="User",Password="******",Email="*****@*****.**"},
            //    new Admin{Name="Irfanullah",Password="******",Email="*****@*****.**"},
            //};
            //foreach(Admin adm in ad)
            //{
            //    context.Admins.Add(adm);
            //}
            //context.SaveChanges();
        }
示例#14
0
 public void Update(DiseaseHistory history)
 {
     _diseaseHistoryRepository.Update(history);
 }
示例#15
0
 public bool Add(DiseaseHistory model)
 {
     model.DISEASEHISTORYID = _repository.GetMaxId("HEALTHRECORD", "DISEASEHISTORYID").ToString();
     return(_repository.Insert(ModelToEntity(model)));
 }
示例#16
0
        public async Task <ActionResult> Create([Bind(Include = "beginDate,endDate")] DiseaseHistory diseaseHistory)
        {
            string disease = Request.Form["diseaseName"];
            string animal  = Request.Form["animalID"];

            diseaseHistory.diseaseId = db.Diseases.Where(x => x.name == disease).FirstOrDefault().id;
            diseaseHistory.animalID  = db.Animals.Where(x => x.name == animal).FirstOrDefault().id;
            if (diseaseHistory.beginDate > DateTime.Today)
            {
                ModelState.AddModelError("beginDate", "Data nie może być większa od obecnej");
            }
            if (diseaseHistory.endDate != null)
            {
                if (diseaseHistory.endDate > DateTime.Today)
                {
                    ModelState.AddModelError("endDate", "Data nie może być większa od obecnej");
                }
                else if (diseaseHistory.endDate < diseaseHistory.beginDate)
                {
                    ModelState.AddModelError("endDate", "Data zakończenianie musi być większa od daty rozpoczęcia");
                }
            }
            if (db.DiseaseHistories.Any(x => x.beginDate == diseaseHistory.beginDate &&
                                        x.animalID == diseaseHistory.animalID &&
                                        x.diseaseId == diseaseHistory.diseaseId &&
                                        x.id != diseaseHistory.id))
            {
                ModelState.AddModelError("beginDate", "Wpis z takimi parametrami już istnieje");
                ModelState.AddModelError("animalID", "Wpis z takimi parametrami już istnieje");
                ModelState.AddModelError("diseaseId", "Wpis z takimi parametrami już istnieje");
            }
            Animal   dbAnimal  = db.Animals.Where(x => x.id == diseaseHistory.animalID).FirstOrDefault();;
            TimeSpan animalAge = new TimeSpan(365 * dbAnimal.age, 0, 0, 0);
            DateTime birth     = DateTime.Today;

            try
            {
                birth = DateTime.Today - animalAge;
            }
            catch (Exception e)
            {
                ModelState.AddModelError("beginDate", "Zwierzę nie może zachorować zanim się urodziło");
            };
            if (diseaseHistory.beginDate < birth)
            {
                ModelState.AddModelError("beginDate", "Zwierzę nie może zachorować zanim się urodziło");
            }
            if (db.DiseaseHistories.
                Where(x => x.animalID == diseaseHistory.animalID &&
                      x.diseaseId == diseaseHistory.diseaseId &&
                      (x.endDate == null || x.endDate > diseaseHistory.beginDate) &&
                      x.id != diseaseHistory.id).Any())
            {
                ModelState.AddModelError("beginDate", "Zwierzę nie morze dwa razy zachorować na tę samą chorobę!");
                ModelState.AddModelError("animalID", "Zwierzę nie morze dwa razy zachorować na tę samą chorobę!");
                ModelState.AddModelError("diseaseId", "Zwierzę nie morze dwa razy zachorować na tę samą chorobę!");
            }
            if (ModelState.IsValid)
            {
                db.DiseaseHistories.Add(diseaseHistory);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.animalID    = new SelectList(db.Animals, "name", "name");
            ViewBag.diseaseName = new SelectList(db.Diseases, "name", "name");
            return(View(diseaseHistory));
        }
示例#17
0
 public IActionResult Register(DiseaseHistory diseasehistory)
 {
     _context.DiseaseHistories.Add(diseasehistory);
     _context.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#18
0
 public DiseaseHistory AddDiseaseHistory(DiseaseHistory history)
 {
     return(_diseaseHistoryRepository.Add(history));
 }