public static void Seed(OMCS.DAL.Model.OMCSDBContext _db) { Doctor bsNguyenVanA = _db.Doctors.Where(d => d.Email.Equals("*****@*****.**")).FirstOrDefault(); Patient sutran = _db.Patients.Where(p => p.Email.Equals("*****@*****.**")).FirstOrDefault(); Conversation suTranVsBacSiA = new Conversation { Doctor = bsNguyenVanA, Patient = sutran }; ConversationDetail line1 = new ConversationDetail { Conversation = suTranVsBacSiA, Content = "Chào bác sĩ", User = sutran, CreatedDate = new DateTime(2014, 6, 1, 8, 20, 12) }; ConversationDetail line2 = new ConversationDetail { Conversation = suTranVsBacSiA, Content = "Chào bạn", User = bsNguyenVanA, CreatedDate = new DateTime(2014, 6, 1, 8, 20, 40) }; ConversationDetail line3 = new ConversationDetail { Conversation = suTranVsBacSiA, Content = "Em xin hỏi, nếu đau đầu mà tai và mắt cứ giật liên hồi, " + "sau mỗi lần giật lại càng đau đầu hơn, kèm theo sốt, thì nguyên nhân do đâu?", User = sutran, CreatedDate = new DateTime(2014, 6, 1, 8, 22, 12) }; ConversationDetail line4 = new ConversationDetail { Conversation = suTranVsBacSiA, Content = "Đau đầu là một trong những triệu chứng thường gặp "+ "nhất của nhiều bệnh, có nhiều nguyên nhân khác nhau gây đau đầu, "+ "cảm giác đau ở một trong những điểm như: đau ở ngay phía trên 2 mắt, "+ "2 tai, đau ở phía sau gáy, vùng trên của cổ.", User = bsNguyenVanA, CreatedDate = new DateTime(2014, 6, 1, 8, 25, 12) }; ConversationDetail line5 = new ConversationDetail { Conversation = suTranVsBacSiA, Content = "Đau đầu là một trong những triệu chứng thường gặp " + "nhất của nhiều bệnh, có nhiều nguyên nhân khác nhau gây đau đầu, " + "cảm giác đau ở một trong những điểm như: đau ở ngay phía trên 2 mắt, " + "2 tai, đau ở phía sau gáy, vùng trên của cổ.", User = sutran, CreatedDate = new DateTime(2014, 6, 1, 8, 27, 12) }; _db.ConversationDetails.Add(line1); _db.ConversationDetails.Add(line2); _db.ConversationDetails.Add(line3); _db.ConversationDetails.Add(line4); _db.ConversationDetails.Add(line5); _db.SaveChanges(); }
public static void Seed(OMCS.DAL.Model.OMCSDBContext _db) { #region HospitalInformation var hopsital = new HospitalInformation { Name = "FPT Hospital", Address = "Công viên phần mềm Quang Trung", Email = "*****@*****.**", Fax = "08.53453465", Phone = "08.423423434", Logo = "" }; _db.HospitalInformations.AddOrUpdate(p => p.Name, hopsital); _db.SaveChanges(); #endregion HospitalInformation #region Role var roles = new List<Role> { new Role { RoleName = "Admin" }, new Role { RoleName = "User" }, new Role { RoleName = "Doctor" } }; roles.ForEach(s => _db.Roles.AddOrUpdate(p => p.RoleName, s)); _db.SaveChanges(); Role roleAdmin = _db.Roles.Where(x => x.RoleName == "Admin").Single(); Role roleUser = _db.Roles.Where(x => x.RoleName == "User").Single(); Role roleDoctor = _db.Roles.Where(x => x.RoleName == "Doctor").Single(); #endregion Role #region SpecialtyField var specialtyFieldParents = new List<SpecialtyField> { new SpecialtyField { Name = "Ngoại khoa" }, new SpecialtyField { Name = "Nội khoa" }, new SpecialtyField { Name = "Nhi Khoa" } }; specialtyFieldParents.ForEach(s => _db.SpecialtyFields.AddOrUpdate(p => p.Name, s)); _db.SaveChanges(); SpecialtyField NgoaiKhoa = _db.SpecialtyFields.Where(x=>x.Name=="Ngoại khoa").Single(); SpecialtyField NoiKhoa = _db.SpecialtyFields.Where(x => x.Name == "Nội khoa").Single(); var specialtyFields = new List<SpecialtyField> { new SpecialtyField { Name = "Ngoại tim mạch", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Ngoại lồng ngực", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Ngoại tiêu hóa", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Phẫu thuật mắt", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Ngoại tổng quát", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Ngoại thần kinh", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Phẫu thuật miệng & hàm mặt", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Chấn thương chỉnh hình", ParentId = NgoaiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Dị ứng", ParentId = NoiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Miễn dịch học", ParentId = NoiKhoa.SpecialtyFieldId }, new SpecialtyField { Name = "Nội tim mạch", ParentId = NoiKhoa.SpecialtyFieldId } }; specialtyFields.ForEach(s => _db.SpecialtyFields.AddOrUpdate(p => p.Name, s)); _db.SaveChanges(); var NhiKhoa = _db.SpecialtyFields.Where(x=>x.Name=="Nhi Khoa").Single(); #endregion SpecialtyField #region User var users = new List<User> { new User { Email = "*****@*****.**", FirstName = "Admin", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {roleAdmin}, ProfilePicture = "photo.jpg" } }; users.ForEach(s => _db.Users.AddOrUpdate(p => p.Email, s)); _db.SaveChanges(); var doctors = new List<Doctor> { new Doctor { Email = "*****@*****.**", FirstName = "Doctor 1", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, SpecialtyField = NhiKhoa, Roles = new List<Role>() {roleDoctor}, ProfilePicture = "photo.jpg" }, new Doctor { Email = "*****@*****.**", FirstName = "A", LastName = "Nguyễn Văn", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, SpecialtyField = NhiKhoa, Roles = new List<Role>() {roleDoctor}, ProfilePicture = "photo.jpg" }, new Doctor { Email = "*****@*****.**", FirstName = "Tùng", LastName = "Tôn Thất", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, SpecialtyField = NhiKhoa, Roles = new List<Role>() {roleDoctor}, ProfilePicture = "photo.jpg" }, new Doctor { Email = "*****@*****.**", FirstName = "Di", LastName = "Hồ Đắc", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, SpecialtyField = NhiKhoa, Roles = new List<Role>() {roleDoctor}, ProfilePicture = "photo.jpg" }, new Doctor { Email = "*****@*****.**", FirstName = "Ngữ", LastName = "Đặng Văn", Password = "******", IsActive = true, Birthday = DateTime.UtcNow, CreatedDate = DateTime.UtcNow, SpecialtyField = NhiKhoa, Roles = new List<Role>() {roleDoctor}, ProfilePicture = "photo.jpg" } }; foreach (var doctor in doctors) { var existOne = _db.Doctors.Where(x => x.Email.Equals(doctor.Email)).FirstOrDefault(); if (existOne == null) _db.Doctors.Add(doctor); } _db.SaveChanges(); #endregion User }
public static void Seed(OMCS.DAL.Model.OMCSDBContext _db) { var rolePatient = _db.Roles.Where(role => role.RoleName.Equals("User")).FirstOrDefault(); var patients = new List<Patient> { new Patient { FirstName = "Su", LastName = "Tran", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "M", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Thôn 1, xa CuEbur, Buôn Ma Thuột", SecondaryAddress = "201/9 Đường Số 9, Gò Vấp", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Lập trình viên", WhereToWork = "39B Trường Sơn, Tân Bình", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "Su.JPG" }, new Patient { FirstName = "Danh", LastName = "Trần Cao", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "M", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Tiền gian", SecondaryAddress = "Quận 12", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Lập trình viên", WhereToWork = "FPT Software", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "photo.jpg" }, new Patient { FirstName = "Tuấn", LastName = "Mai Anh", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "M", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Tiền gian", SecondaryAddress = "Quận 12", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Lập trình viên", WhereToWork = "FPT Software", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "photo.jpg" }, new Patient { FirstName = "Nguồn", LastName = "Nguyễn Hồng Ngọc", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "F", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Tiền gian", SecondaryAddress = "Quận 12", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Sinh Vien", WhereToWork = "Hoa Sen", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "photo.jpg" }, new Patient { FirstName = "Nhân", LastName = "Nguyễn Toàn", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "F", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Tiền gian", SecondaryAddress = "Quận 12", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Sinh Vien", WhereToWork = "Hoa Sen", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "photo.jpg" }, new Patient { FirstName = "Lịnh", LastName = "Nguyễn Nhật", Email = "*****@*****.**", Password = "******", IsActive = true, CreatedDate = DateTime.UtcNow, Roles = new List<Role>() {rolePatient}, Gender = "M", Birthday = new DateTime(1992, 2, 19), Phone = "0933056722", PrimaryAddress = "Quảng Ngãi", SecondaryAddress = "Quận 12", Ethnicity = "Kinh", Nationality = "Việt Nam", Job = "Sinh Vien", WhereToWork = "F Soft", ContactPerson = "Mỹ Linh", ContactPersonAddress = "1 Lý Thường Kiệt", HealthInsuranceId = "234234VSD", HealthInsuranceIssued = new DateTime(2013, 1, 1), HealthInsuranceDateExpired = new DateTime(2014, 1, 1), ProfilePicture = "photo.jpg" } }; patients.ForEach(s => _db.Patients.AddOrUpdate(p => (p.Email), s)); _db.SaveChanges(); Patient suTran = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); Patient danhtran = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); Patient tuanMai = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); Patient nguonNguyen = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); Patient nhanNguyen = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); Patient linhNguyen = _db.Patients.Where(x => x.Email == "*****@*****.**").Single(); var personalHealthRecords = new List<PersonalHealthRecord> { new PersonalHealthRecord { PatientId = suTran.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Đá banh", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 }, new PersonalHealthRecord { PatientId = danhtran.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Đá banh", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 }, new PersonalHealthRecord { PatientId = tuanMai.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Đá banh", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 }, new PersonalHealthRecord { PatientId = nguonNguyen.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Cầu Lông", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 }, new PersonalHealthRecord { PatientId = nhanNguyen.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Cầu Lông", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 }, new PersonalHealthRecord { PatientId = linhNguyen.UserId, Height = 170, Weight = 70.5, EyeColor = "Đen", HairColor = "Đen", BloodType = "B", AlcoholPerWeek = 1.2, AlcoholNumOfYear = 4, IsBeer = true, SmokePackPerWeek = 1, SmokeNumOfYear = 2, SportName = "Cầu Lông", SportPerWeek = 4, ExerciseType = "Yoga", ExercisePerWeek = 2 } }; personalHealthRecords.ForEach(s => _db.PersonalHealthRecords.AddOrUpdate(p => (p.PatientId), s)); _db.SaveChanges(); }
void whiteBoardConnector1_ConnectEnded(OMCS.Passive.ConnectResult result) { if (this.InvokeRequired) { this.BeginInvoke(new CbGeneric<ConnectResult>(this.whiteBoardConnector1_ConnectEnded), result); } else { if (result != ConnectResult.Succeed) { this.ShowSystemMessage( string.Format("电子白板连接失败!{0}", result.ToString())); } } }
public static void Seed(OMCS.DAL.Model.OMCSDBContext _db) { Patient suTran = _db.Patients.Where(pt => pt.Email.Equals("*****@*****.**")).Single(); Doctor doctor1 = _db.Doctors.Where(pt => pt.Email.Equals("*****@*****.**")).Single(); MedicalProfile suTranMedicalProfile = _db.MedicalProfiles.Where( mp => mp.MedicalProfileKey.Equals("OMCS.0000001.01")).FirstOrDefault(); #region TreatmentHistory var treatmentHistories = new List<TreatmentHistory> { new TreatmentHistory { DateCreated = DateTime.Now, DoctorId = doctor1.UserId, MedicalProfileId = suTranMedicalProfile.MedicalProfileId, Note = "Bệnh năng", OnSetDate = new DateTime(2014, 5, 1, 8, 20, 40) }, new TreatmentHistory { DateCreated = DateTime.Now, DoctorId = doctor1.UserId, MedicalProfileId = suTranMedicalProfile.MedicalProfileId, Note = "Bệnh tiến triển bình thường", OnSetDate = new DateTime(2014, 6, 1, 8, 20, 40) } }; treatmentHistories.ForEach(s => _db.TreatmentHistories.AddOrUpdate(p => p.DateCreated, s)); _db.SaveChanges(); #endregion TreatmentHistory var treatmentOne = treatmentHistories.ElementAt(0); #region FilmType var filmTypes = new List<FilmType> { new FilmType { Name = "Webcam" }, new FilmType { Name = "X-quang" }, new FilmType { Name = "CT-Scanner" }, new FilmType { Name = "Siêu âm" }, new FilmType { Name = "Nội soi" }, new FilmType { Name = "Xét nghiệm" }, new FilmType { Name = "Khác" } }; filmTypes.ForEach(s => _db.FilmTypes.AddOrUpdate(p => p.Name, s)); var filmTypeOne = filmTypes.ElementAt(0); _db.SaveChanges(); #endregion FilmType #region FilmDocument var filmDocuments = new List<FilmDocument> { new FilmDocument { TreatmentHistory = treatmentOne, FilmTypeId = filmTypeOne.FilmTypeId, ImagePath = "viemphoidotucau.gif", Conclusion = "Viêm phổi tụ cầu", DoctorId = doctor1.UserId, DateCreated = DateTime.Now, Description = "Hình ảnh viêm phổi" }, new FilmDocument { TreatmentHistory = treatmentOne, FilmTypeId = filmTypeOne.FilmTypeId, ImagePath = "viem_amydal_cap.jpg", Conclusion = "Viêm amydal cấp", DoctorId = doctor1.UserId, DateCreated = DateTime.Now, Description = "Bệnh nhân bị amydal" } }; filmDocuments.ForEach(s => _db.FilmDocuments.AddOrUpdate(p => p.ImagePath, s)); #endregion FilmDocument _db.SaveChanges(); }
public static void Seed(OMCS.DAL.Model.OMCSDBContext _db) { #region MedicalProfile List<MedicalProfileTemplate> medicalProfileTemplates = new List<MedicalProfileTemplate>{ //Default medical profile new MedicalProfileTemplate { MedicalProfileTemplateName = "Bệnh Án Mẫu" }, new MedicalProfileTemplate { MedicalProfileTemplateName = "Bệnh Án Nội Khoa" }, new MedicalProfileTemplate { MedicalProfileTemplateName = "Bệnh Án Truyền Nhiễm" }, new MedicalProfileTemplate { MedicalProfileTemplateName = "Bệnh Án Ngoài Da - BV Da Liễu" }, }; medicalProfileTemplates.ForEach(s => _db.MedicalProfileTemplates. AddOrUpdate(p => (p.MedicalProfileTemplateName), s)); _db.SaveChanges(); #endregion MedicalProfile Patient suTran = _db.Patients.Where(pt => pt.Email.Equals("*****@*****.**")).Single(); Patient caodanh = _db.Patients.Where(pt => pt.Email.Equals("*****@*****.**")).Single(); Doctor doctor1 = _db.Doctors.Where(pt => pt.Email.Equals("*****@*****.**")).Single(); MedicalProfileTemplate benhAnMau = _db.MedicalProfileTemplates.Find(1); MedicalProfileTemplate benhAnNoiKhoa = _db.MedicalProfileTemplates.Find(2); List<MedicalProfile> medicalProfiles = new List<MedicalProfile>{ new MedicalProfile { PatientId = suTran.UserId, DoctorId = doctor1.UserId, CreatedDate = DateTime.UtcNow, MedicalProfileTemplateId = benhAnMau.MedicalProfileTemplateId, MedicalProfileKey = "OMCS.0000001.01" }, new MedicalProfile { PatientId = caodanh.UserId, DoctorId = doctor1.UserId, CreatedDate = DateTime.Today.AddDays(-10), MedicalProfileTemplateId = benhAnNoiKhoa.MedicalProfileTemplateId, MedicalProfileKey = "OMCS.0000002.02" }, new MedicalProfile { PatientId = caodanh.UserId, DoctorId = doctor1.UserId, CreatedDate = DateTime.Today.AddDays(-5), MedicalProfileTemplateId = benhAnMau.MedicalProfileTemplateId, MedicalProfileKey = "OMCS.0000001.03" }, new MedicalProfile { PatientId = suTran.UserId, DoctorId = doctor1.UserId, CreatedDate = DateTime.Today.AddDays(-5), MedicalProfileTemplateId = benhAnNoiKhoa.MedicalProfileTemplateId, MedicalProfileKey = "OMCS.0000001.03" } }; medicalProfiles.ForEach(s => _db.MedicalProfiles.AddOrUpdate(p => (p.MedicalProfileKey), s)); _db.SaveChanges(); var suTranMedicalProfile = medicalProfiles.ElementAt(0); #region Immunization var imunizations = new List<Immunization> { new Immunization { BoosterTime = 1, MedicalProfileId = suTranMedicalProfile.MedicalProfileId, DateImmunized = new DateTime(1992, 3, 15), Name = "Sởi" } }; imunizations.ForEach(s => _db.Immunizations.AddOrUpdate(p => (p.Name), s)); _db.SaveChanges(); #endregion Immunization #region Allergy var allergyTypes = new List<AllergyType> { new AllergyType { Name = "Thuốc", Description = "Dị ứng với các loại thuốc" }, new AllergyType { Name = "Thức Ăn" }, new AllergyType { Name = "Môi Trường" }, new AllergyType { Name = "Khác" } }; allergyTypes.ForEach(s => _db.AllergyTypes.AddOrUpdate(p => (p.Name), s)); _db.SaveChanges(); var allergyTypeThuoc = allergyTypes.Where(x => x.Name == "Thuốc").Single(); var allergies = new List<Allergy> { new Allergy { Name = "Thuốc kháng sinh", MedicalProfileId = suTranMedicalProfile.MedicalProfileId, AllergyTypeId = allergyTypeThuoc.AllergyTypeId, Reaction = "Đau bụng nhẹ", DateLastOccurred = new DateTime(2013,1,1) } }; allergies.ForEach(s => _db.Allergies.AddOrUpdate(p => (p.Name), s)); _db.SaveChanges(); #endregion Allergy }