internal static ICollection<Appointment> GenerateDayAppointmentsData(MyHealthContext context, DateTime day, string userEmail) { var totalAppointments = Randomize.Next(1, DataInitializerValues.MaxAppointmentsPerDay); var appointments = new List<Appointment>(); var allowedMaxDurationPerBlock = (DataInitializerValues.EndOfWorkingDay - DataInitializerValues.StartOfWorkingDay) / totalAppointments; for (var i = 0; i < totalAppointments; i++) { var duration = Randomize.Next(DataInitializerValues.MinAppointmentHours, DataInitializerValues.MaxAppointmentHours); var blockStartHour = DataInitializerValues.StartOfWorkingDay + i * allowedMaxDurationPerBlock; var blockEndHour = DataInitializerValues.StartOfWorkingDay + (i + 1) * allowedMaxDurationPerBlock; var startHour = Randomize.Next(blockStartHour, blockEndHour - duration); var start = new DateTime(day.Year, day.Month, day.Day, startHour, GenerateRandomBoolean() ? 0 : 30, 0); var endHour = start.AddHours(duration); var appointment = new Appointment { UserEmail = userEmail, Description = DataInitializerValues.AppointmentDescriptions[Randomize.Next(1, DataInitializerValues.AppointmentDescriptions.Length)], Start = start, End = endHour }; appointments.Add(appointment); }; context.Appointments.AddRange(appointments); context.SaveChanges(); return appointments; }
static int CreateTenants(MyHealthContext context) { var tenants = new List<Tenant>(); var defaultTenant = new Tenant() { Name = "HealthClinic.biz", Address = "Madison Ave 10037", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; context.Tenants.Add(defaultTenant); var tenant = new Tenant() { Name = "Madison HealthCare", Address = "Madison Ave 10037", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; tenants.Add(tenant); tenant = new Tenant() { Name = "HCR Global", Address = "Spring Studios, 50. Varick St", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; tenants.Add(tenant); context.Tenants.AddRange(tenants); context.SaveChanges(); return defaultTenant.TenantId; }
public TenantsRepository(IServiceProvider serviceProvider, MyHealthContext dbcontext, UserManager <ApplicationUser> userManager, MyHealthDataInitializer myHealthDataInitializer) { _context = dbcontext; _userManager = userManager; _myHealthDataInitializer = myHealthDataInitializer; _serviceProvider = serviceProvider; }
internal static ICollection <Appointment> GenerateDayAppointmentsData(MyHealthContext context, DateTime day, string userEmail) { var totalAppointments = Randomize.Next(1, DataInitializerValues.MaxAppointmentsPerDay); var appointments = new List <Appointment>(); var allowedMaxDurationPerBlock = (DataInitializerValues.EndOfWorkingDay - DataInitializerValues.StartOfWorkingDay) / totalAppointments; for (var i = 0; i < totalAppointments; i++) { var duration = Randomize.Next(DataInitializerValues.MinAppointmentHours, DataInitializerValues.MaxAppointmentHours); var blockStartHour = DataInitializerValues.StartOfWorkingDay + i * allowedMaxDurationPerBlock; var blockEndHour = DataInitializerValues.StartOfWorkingDay + (i + 1) * allowedMaxDurationPerBlock; var startHour = Randomize.Next(blockStartHour, blockEndHour - duration); var start = new DateTime(day.Year, day.Month, day.Day, startHour, GenerateRandomBoolean() ? 0 : 30, 0); var endHour = start.AddHours(duration); var appointment = new Appointment { UserEmail = userEmail, Description = DataInitializerValues.AppointmentDescriptions[Randomize.Next(1, DataInitializerValues.AppointmentDescriptions.Length)], Start = start, End = endHour }; appointments.Add(appointment); } ; context.Appointments.AddRange(appointments); context.SaveChanges(); return(appointments); }
public TenantsRepository(IServiceProvider serviceProvider, MyHealthContext dbcontext, UserManager<ApplicationUser> userManager, MyHealthDataInitializer myHealthDataInitializer) { _context = dbcontext; _userManager = userManager; _myHealthDataInitializer = myHealthDataInitializer; _serviceProvider = serviceProvider; }
static async Task CreateSampleData(IServiceProvider serviceProvider, MyHealthContext context) { _serviceProvider = serviceProvider; int tenantId = CreateSampleData(context); await CreateDefaultUser(serviceProvider, tenantId); }
static void CreateSummaryInfo(MyHealthContext context, int tenantId) { CreateClinicSummary(context, tenantId); CreatePatientsSummaries(context, tenantId); CreateExpensesSummaries(context, tenantId); }
public UsersController(ApplicationUsersRepository applicationUsersRepository, ApplicationUserValidators userValidators, MyHealthContext context) { _applicationUsersRepository = applicationUsersRepository; _Context = context; _userValidators = userValidators; _allowedClaims = new List<string>() { "ManageUsers", "ManageTenants" }; }
static void CreateMedicines(MyHealthContext context, int tenantId) { var data = new[] { new { Name = "Tylenol", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Dinner }, new { Name = "Tamiflu", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Breakfast }, new { Name = "Advil", Dose = 0.5, Unit = InternationalUnit.Milliliters, TimeOfDay = TimeOfDay.Lunch }, new { Name = "Cafergot", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Breakfast }, }; var medicines = new List <Medicine>(); var patients = context.Patients .Where(p => p.TenantId == tenantId) .Select(p => p.PatientId).ToList(); var globalIdx = 0; foreach (int patientId in patients) { foreach (var _ in Enumerable.Range(0, 4)) { var currentMedicineData = data[globalIdx]; var medicine = new Medicine { Name = currentMedicineData.Name, Dose = currentMedicineData.Dose, DoseUnit = currentMedicineData.Unit, PatientId = patientId, TimeOfDay = currentMedicineData.TimeOfDay, TenantId = tenantId }; medicines.Add(medicine); globalIdx++; globalIdx = globalIdx % data.Length; } } context.Medicines.AddRange(medicines); context.SaveChanges(); }
public ArticleController( ILogger <ArticleController> logger, MyHealthContext context, ITokenManager token) { _db = context; _logger = logger; _token = token; }
private static void GenerateRandomData(MyHealthContext context) { var startingMonth = _maxDay.AddMonths(DataInitializerValues.MonthsWithData * -1); for (var month = startingMonth; month.Month <= _maxDay.Month; month = month.AddMonths(1)) { GenerateMonthRandomData(context, month); } }
public UserController( ILogger <UserController> logger, MyHealthContext context, IConfiguration config, ITokenManager token) { _db = context; _logger = logger; _config = config; _token = token; }
public UsersController(ApplicationUsersRepository applicationUsersRepository, ApplicationUserValidators userValidators, MyHealthContext context) { _applicationUsersRepository = applicationUsersRepository; _Context = context; _userValidators = userValidators; _allowedClaims = new List <string>() { "ManageUsers", "ManageTenants" }; }
private static int CreateSampleData(MyHealthContext context, int tenantId) { CreateDoctors(context, tenantId); CreateSummaryInfo(context, tenantId); CreatePatients(context, tenantId); CreateMedicines(context, tenantId); CreateClinicAppointments(context, tenantId); CreateHomeAppointments(context, tenantId); CreateTips(context, tenantId); return(tenantId); }
static void CreateTips(MyHealthContext context, int tenantId) { var tip = new Tip() { Title = "Daily Health Tip", Content = "Drinking two glassess of water in the morning helps activate internal organs.\n\nDrinking one glass of water before a meal will help with digestion.\n\nDrinking one glass of water before taking a shower helps prevent high blood pressure.\n\nDrinking a glass of water before bedtime helps prevent strokes or heart attack.", Date = DateTime.UtcNow, TenantId = tenantId }; context.Tips.AddRange(tip); context.SaveChanges(); }
internal static void GenerateAppointmentsAttendessRelationData(MyHealthContext context, Appointment appointment, ICollection <Attendee> attendees) { foreach (var attendee in attendees) { appointment.AppointmentAttendees.Add(new AppointmentAttendee { AttendeeId = attendee.Id, AppointmentId = appointment.Id }); } context.SaveChanges(); }
internal static void GenerateAppointmentsWithRandomAttendessRelationData(MyHealthContext context, ICollection <Appointment> appointments) { var totalAttendees = DataInitializerValues.Attendees.Length; foreach (var appointment in appointments) { var attendeesOfAppointment = DataInitializerValues.Attendees .OrderBy(a => Randomize.Next()) .Take(Randomize.Next(1, totalAttendees)) .ToList(); GenerateAppointmentsAttendessRelationData(context, appointment, attendeesOfAppointment); } }
private static int CreateSampleData(MyHealthContext context) { var tenantId = CreateTenants(context); CreateDoctors(context, tenantId); CreateSummaryInfo(context, tenantId); CreatePatients(context, tenantId); CreateMedicines(context, tenantId); CreateClinicAppointments(context, tenantId); CreateHomeAppointments(context, tenantId); CreateTips(context, tenantId); return tenantId; }
internal static void GenerateAppointmentsAttendessRelationData(MyHealthContext context, Appointment appointment, ICollection<Attendee> attendees) { foreach (var attendee in attendees) { appointment.AppointmentAttendees.Add(new AppointmentAttendee { AttendeeId = attendee.Id, AppointmentId = appointment.Id }); } context.SaveChanges(); }
public DatabaseFixture() { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json"); builder.AddEnvironmentVariables(); var configuration = builder.Build(); _myHealthOptionsBuilder = new DbContextOptionsBuilder<MyHealthContext>(); _myHealthOptionsBuilder.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]); var myHealthContext = new MyHealthContext(_myHealthOptionsBuilder.Options); // Ensure the test database is deleted before starting the tests myHealthContext.Database.EnsureDeleted(); }
internal static void GenerateAppointmentsWithRandomAttendessRelationData(MyHealthContext context, ICollection<Appointment> appointments) { var totalAttendees = DataInitializerValues.Attendees.Length; foreach (var appointment in appointments) { var attendeesOfAppointment = DataInitializerValues.Attendees .OrderBy(a => Randomize.Next()) .Take(Randomize.Next(1, totalAttendees)) .ToList(); GenerateAppointmentsAttendessRelationData(context, appointment, attendeesOfAppointment); } }
public DatabaseFixture() { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json"); builder.AddEnvironmentVariables(); var configuration = builder.Build(); _myHealthOptionsBuilder = new DbContextOptionsBuilder <MyHealthContext>(); _myHealthOptionsBuilder.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]); var myHealthContext = new MyHealthContext(_myHealthOptionsBuilder.Options); // Ensure the test database is deleted before starting the tests myHealthContext.Database.EnsureDeleted(); }
static async Task <int> CreateDefaultTenant(MyHealthContext context) { var tenant = new Tenant() { Name = "HealthClinic.biz", Address = "Madison Ave 10037", City = "New York", WaitTimeAvg = Randomize.Next(1, 10), AssociatedUsername = _configuration["DefaultUsername"], Creator = _configuration["DefaultAdminUsername"] }; context.Tenants.Add(tenant); await context.SaveChangesAsync(); return(tenant.TenantId); }
private static void CreateClinicSummary(MyHealthContext context, int tenantId) { var clinicSummary = new ClinicSummary { AnualProfit = Randomize.Next(50000, 60000), AnualProfitVariation = Randomize.Next(1, 5), MonthProfit = Randomize.Next(4000, 6000), MonthProfitVariation = Randomize.Next(1, 5), NewPatients = Randomize.Next(100, 500), NewPatientsVariation = Randomize.Next(1, 10), Date = DateTime.UtcNow, TenantId = tenantId }; context.ClinicSummaries.Add(clinicSummary); context.SaveChanges(); }
public async Task RemoveTenantSampleData(MyHealthContext context, UserManager<ApplicationUser> userManager, int tenantId) { if (context.Tenants.Any(t => t.TenantId == tenantId)) { context.HomeAppointments.RemoveRange(context.HomeAppointments.Where(t => t.TenantId == tenantId)); context.ClinicAppointments.RemoveRange(context.ClinicAppointments.Where(t => t.TenantId == tenantId)); context.Medicines.RemoveRange(context.Medicines.Where(t => t.TenantId == tenantId)); var usersToDelete = context.Users.Where(t => t.TenantId == tenantId).ToList(); foreach (var user in usersToDelete) await userManager.DeleteAsync(user); context.Tenants.Remove(context.Tenants.FirstOrDefault(t => t.TenantId == tenantId)); await context.SaveChangesAsync(); } }
public async Task RemoveTenantSampleData(MyHealthContext context, UserManager <ApplicationUser> userManager, int tenantId) { if (context.Tenants.Any(t => t.TenantId == tenantId)) { context.HomeAppointments.RemoveRange(context.HomeAppointments.Where(t => t.TenantId == tenantId)); context.ClinicAppointments.RemoveRange(context.ClinicAppointments.Where(t => t.TenantId == tenantId)); context.Medicines.RemoveRange(context.Medicines.Where(t => t.TenantId == tenantId)); var usersToDelete = context.Users.Where(t => t.TenantId == tenantId).ToList(); foreach (var user in usersToDelete) { await userManager.DeleteAsync(user); } context.Tenants.Remove(context.Tenants.FirstOrDefault(t => t.TenantId == tenantId)); await context.SaveChangesAsync(); } }
private static void GenerateDayHealthReportsData(MyHealthContext context, DateTime day) { var healthReports = new List <HealthReport>(); var prevHeartValue = Randomize.Next(DataInitializerValues.MinHeartValue, DataInitializerValues.MaxHeartValue); var prevGlucoseValue = Randomize.Next(DataInitializerValues.MinGlucoseValue, DataInitializerValues.MaxGlucoseValue); var prevStressValue = Randomize.Next(DataInitializerValues.MinStressValue, DataInitializerValues.MaxStressValue); for (var i = DataInitializerValues.StartOfWorkingDay; i < DataInitializerValues.EndOfWorkingDay; i++) { var time = new DateTime(day.Year, day.Month, day.Day, i, 0, 0); var healthReportInSameHour = context.HealthReports.FirstOrDefault(hr => hr.Time == time); if (healthReportInSameHour != null) { prevHeartValue = healthReportInSameHour.Heart; prevGlucoseValue = healthReportInSameHour.Glucose; prevStressValue = healthReportInSameHour.Stress; } else { var heartValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevHeartValue + Randomize.Next(DataInitializerValues.HeartStep) : prevHeartValue - Randomize.Next(DataInitializerValues.HeartStep); var glucoseValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevGlucoseValue + Randomize.Next(DataInitializerValues.GlucoseStep) : prevGlucoseValue - Randomize.Next(DataInitializerValues.GlucoseStep); var stressValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevStressValue + Randomize.Next(DataInitializerValues.StressStep) : prevStressValue - Randomize.Next(DataInitializerValues.StressStep); healthReports.Add(new HealthReport { UserEmail = _defaultUserEmail, Time = time, Heart = heartValue, Glucose = glucoseValue, Stress = stressValue, }); prevHeartValue = heartValue; prevGlucoseValue = glucoseValue; prevStressValue = stressValue; } } ; context.HealthReports.AddRange(healthReports); context.SaveChanges(); }
async Task InitializeDatabaseData(IServiceProvider serviceProvider, MyHealthContext context) { _serviceProvider = serviceProvider; _userManager = serviceProvider.GetService<UserManager<ApplicationUser>>(); _applicationEnvironment = serviceProvider.GetService<IApplicationEnvironment>(); var builder = new ConfigurationBuilder() .SetBasePath(_applicationEnvironment.ApplicationBasePath) .AddJsonFile("appsettings.json"); _configuration = builder.Build(); await CreateDefaultAdmin(); var tenantId = await CreateDefaultTenant(context); CreateTenantSampleData(serviceProvider, tenantId); await CreateDefaultUser(tenantId); }
private static void CreatePatientsSummaries(MyHealthContext context, int tenantId) { var patientsSummaries = new List <PatientsSummary>(); for (int i = 0; i < 24; i++) { var patientsSummary = new PatientsSummary { Year = DateTime.UtcNow.AddMonths(-i).Year, Month = DateTime.UtcNow.AddMonths(-i).Month, PatientsCount = Randomize.Next(500, 600), TenantId = tenantId }; patientsSummaries.Add(patientsSummary); } context.PatientsSummaries.AddRange(patientsSummaries); context.SaveChanges(); }
private static void GenerateMonthRandomData(MyHealthContext context, DateTime month) { //Generate appointments for (var i = 0; i < DataInitializerValues.DaysWithAppointmentsPerMonth; i++) { var day = new DateTime(month.Year, month.Month, Randomize.Next(1, DateTime.DaysInMonth(month.Year, month.Month))); //Avoid appointments on saturday/sunday day = FixAppointmentsOnWeekend(day); //Avoid appointments after the max day if (day.Date >= _maxDay.Date) { continue; } var appointmentInSameDay = context.Appointments.FirstOrDefault(a => a.Start.Date == day.Date); //Avoid random appointments in days with existing appointments if (appointmentInSameDay != null) { continue; } var appointments = DataInitializerHelpers.GenerateDayAppointmentsData(context, day, _defaultUserEmail); DataInitializerHelpers.GenerateAppointmentsWithRandomAttendessRelationData(context, appointments); } //Generate HealthReports for (var i = 1; i <= DateTime.DaysInMonth(month.Year, month.Month); i++) { var day = new DateTime(month.Year, month.Month, i); //Avoid appointments after the max day if (day.Date >= _maxDay.Date) { break; } GenerateDayHealthReportsData(context, day); } }
async Task InitializeDatabaseData(IServiceProvider serviceProvider, MyHealthContext context) { _serviceProvider = serviceProvider; _userManager = serviceProvider.GetService <UserManager <ApplicationUser> >(); _applicationEnvironment = serviceProvider.GetService <IApplicationEnvironment>(); var builder = new ConfigurationBuilder() .SetBasePath(_applicationEnvironment.ApplicationBasePath) .AddJsonFile("appsettings.json"); _configuration = builder.Build(); await CreateDefaultAdmin(); var tenantId = await CreateDefaultTenant(context); CreateTenantSampleData(serviceProvider, tenantId); await CreateDefaultUser(tenantId); }
private static void CreateExpensesSummaries(MyHealthContext context, int tenantId) { var expensesSummaries = new List <ExpensesSummary>(); for (int i = 0; i < 24; i++) { var expensesSummary = new ExpensesSummary { Year = DateTime.UtcNow.AddMonths(-i).Year, Month = DateTime.UtcNow.AddMonths(-i).Month, Incomes = Randomize.Next(120000, 150000), Expenses = Randomize.Next(70000, 80000), TenantId = tenantId }; expensesSummaries.Add(expensesSummary); } context.ExpensesSummaries.AddRange(expensesSummaries); context.SaveChanges(); }
static int CreateTenants(MyHealthContext context) { var tenants = new List <Tenant>(); var defaultTenant = new Tenant() { Name = "HealthClinic.biz", Address = "Madison Ave 10037", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; context.Tenants.Add(defaultTenant); var tenant = new Tenant() { Name = "Madison HealthCare", Address = "Madison Ave 10037", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; tenants.Add(tenant); tenant = new Tenant() { Name = "HCR Global", Address = "Spring Studios, 50. Varick St", City = "New York", WaitTimeAvg = Randomize.Next(1, 10) }; tenants.Add(tenant); context.Tenants.AddRange(tenants); context.SaveChanges(); return(defaultTenant.TenantId); }
private static void GenerateAttendees(MyHealthContext context) { context.Attendees.AddRange(DataInitializerValues.Attendees); context.SaveChanges(); }
public DoctorsRepository(MyHealthContext dbcontext) { _context = dbcontext; }
private static void GenerateDayHealthReportsData(MyHealthContext context, DateTime day) { var healthReports = new List<HealthReport>(); var prevHeartValue = Randomize.Next(DataInitializerValues.MinHeartValue, DataInitializerValues.MaxHeartValue); var prevGlucoseValue = Randomize.Next(DataInitializerValues.MinGlucoseValue, DataInitializerValues.MaxGlucoseValue); var prevStressValue = Randomize.Next(DataInitializerValues.MinStressValue, DataInitializerValues.MaxStressValue); for (var i = DataInitializerValues.StartOfWorkingDay; i < DataInitializerValues.EndOfWorkingDay; i++) { var time = new DateTime(day.Year, day.Month, day.Day, i, 0, 0); var healthReportInSameHour = context.HealthReports.FirstOrDefault(hr => hr.Time == time); if (healthReportInSameHour != null) { prevHeartValue = healthReportInSameHour.Heart; prevGlucoseValue = healthReportInSameHour.Glucose; prevStressValue = healthReportInSameHour.Stress; } else { var heartValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevHeartValue + Randomize.Next(DataInitializerValues.HeartStep) : prevHeartValue - Randomize.Next(DataInitializerValues.HeartStep); var glucoseValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevGlucoseValue + Randomize.Next(DataInitializerValues.GlucoseStep) : prevGlucoseValue - Randomize.Next(DataInitializerValues.GlucoseStep); var stressValue = DataInitializerHelpers.GenerateRandomBoolean() ? prevStressValue + Randomize.Next(DataInitializerValues.StressStep) : prevStressValue - Randomize.Next(DataInitializerValues.StressStep); healthReports.Add(new HealthReport { UserEmail = _defaultUserEmail, Time = time, Heart = heartValue, Glucose = glucoseValue, Stress = stressValue, }); prevHeartValue = heartValue; prevGlucoseValue = glucoseValue; prevStressValue = stressValue; } }; context.HealthReports.AddRange(healthReports); context.SaveChanges(); }
static void CreateClinicAppointments(MyHealthContext context, int tenantId) { var appointments = new List<ClinicAppointment>(); var patients = context.Patients.Select(p => p.PatientId).ToList(); var doctors = context.Doctors.ToList(); foreach (int patientId in patients) { for (int i = 1; i <= AppointmentMonths; i++) { var doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; var appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, IsUrgent = true }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, IsUrgent = false }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Evaluate the diagnosis received", TenantId = tenantId, IsUrgent = true }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Evaluate the effectiveness of treatment received", TenantId = tenantId, IsUrgent = false }; appointments.Add(appointment); } } context.ClinicAppointments.AddRange(appointments); context.SaveChanges(); }
static void CreateDoctors(MyHealthContext context, int tenantId) { var doctors = new List <Doctor>(); var doctor = new Doctor { Name = "Amanda Silver", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(4), TenantId = tenantId, Speciality = Specialities.Cardiologist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = "D0ACA653-2AB1-4160-87FC-21E72FD2ED44", Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 4, 12) }; doctors.Add(doctor); doctor = new Doctor { Name = "Casey Snider", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(1), TenantId = tenantId, Speciality = Specialities.Cardiologist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 4, 10) }; doctors.Add(doctor); doctor = new Doctor { Name = "Clay McKnight", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(2), TenantId = tenantId, Speciality = Specialities.Neurosurgeon, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 5, 19) }; doctors.Add(doctor); doctor = new Doctor { Name = "Jasper Strader", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(3), TenantId = tenantId, Speciality = Specialities.Ophthalmologist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 3, 22) }; doctors.Add(doctor); doctor = new Doctor { Name = "Eldon Caraway", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(4), TenantId = tenantId, Speciality = Specialities.Orthopedist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 6, 11) }; doctors.Add(doctor); doctor = new Doctor { Name = "Irving Ingraham", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(5), TenantId = tenantId, Speciality = Specialities.Orthopedist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 5, 30) }; doctors.Add(doctor); doctor = new Doctor { Name = "Denis Slattery", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(6), TenantId = tenantId, Speciality = Specialities.Ophthalmologist, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 3, 16) }; doctors.Add(doctor); doctor = new Doctor { Name = "Peter Ingraham", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetDoctorPicture(7), TenantId = tenantId, Speciality = Specialities.Neurosurgeon, Synchronized = true, PatientCount = Randomize.Next(50, 100), CurrentRoomNumber = Randomize.Next(3, 15), Id = Guid.NewGuid().ToString(), Description = "Monitoring and providing general care to patients on hospital wards and in outpatient clinics.", Phone = "555-135-2245", Mobile = "1-(546)-345-5678", CreatedAt = new DateTime(2015, 7, 26) }; doctors.Add(doctor); context.Doctors.AddRange(doctors); context.SaveChanges(); }
public ApplicationUsersRepository(MyHealthContext context, UserManager <ApplicationUser> userManager) { _context = context; _userManager = userManager; }
static void CreateHomeAppointments(MyHealthContext context, int tenantId) { var visits = new List<HomeAppointment>(); var patients = context .Patients.OrderBy(p => p.PatientId).Select(p => p.PatientId) .Skip(1).Take(4).ToList(); var doctors = context.Doctors.Select(p => p.DoctorId).ToList(); foreach (int doctorId in doctors) { for (int i = 1; i <= AppointmentMonths; i++) { var visit = new HomeAppointment { PatientId = patients[0], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = false, TenantId = tenantId, IsUrgent = true, Description = "Follow up in order to determine the effectiveness of treatment received", Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[1], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = false, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[0], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[1], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = true, IsUrgent = true, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[2], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = false, IsUrgent = true, TenantId = tenantId, Description = "Follow up in order to determine the effectiveness of treatment received", Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[3], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", IsUrgent = true, Visited = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[2], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[3], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); } } context.HomeAppointments.AddRange(visits); context.SaveChanges(); }
public ClinicAppointmentsRepository(MyHealthContext dbcontext) { _context = dbcontext; }
static void CreatePatients(MyHealthContext context, int tenantId) { var patients = new List <Patient>(); var doctor = context.Doctors.First(); var patient = new Patient { Name = "Kavin Gallo", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(17), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "DFG-111128-32001", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-234-234", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Scott Hanselman", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(3), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "XHW-238928-32121", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-126-785", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Cesar de la Torre", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(1), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-322-111", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Scott Guthrie", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(2), BloodType = "A+", Gender = Gender.Male, Height = 6.1, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-456-654", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "David Carmona", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(5), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 45), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-983-768", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "David Salgado", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(6), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-459-345", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Dmitry Lyalin", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(7), BloodType = "A+", Gender = Gender.Male, Height = 6, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-158-163", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Erika Ehrli Cabral", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(8), BloodType = "A+", Gender = Gender.Female, Height = 5.6, Weight = 132, ClinicId = "TJI-228928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-694-153", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Mitra Azizirad", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(10), BloodType = "A+", Gender = Gender.Female, Height = 5.6, Weight = 132, ClinicId = "TJI-228928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-694-153", Doctors = new List <Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); context.Patients.AddRange(patients); context.SaveChanges(); }
public LocalAppointmentsRepository(MyHealthContext dbcontext) { _context = dbcontext; }
private static void CreatePatientsSummaries(MyHealthContext context, int tenantId) { var patientsSummaries = new List<PatientsSummary>(); for (int i = 0; i < 24; i++) { var patientsSummary = new PatientsSummary { Year = DateTime.UtcNow.AddMonths(-i).Year, Month = DateTime.UtcNow.AddMonths(-i).Month, PatientsCount = Randomize.Next(500, 600), TenantId = tenantId }; patientsSummaries.Add(patientsSummary); } context.PatientsSummaries.AddRange(patientsSummaries); context.SaveChanges(); }
private static void GenerateDemoData(MyHealthContext context) { GenerateAttendees(context); GenerateRandomData(context); }
static void CreatePatients(MyHealthContext context, int tenantId) { var patients = new List<Patient>(); var doctor = context.Doctors.First(); var patient = new Patient { Name = "Kavin Gallo", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(17), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "DFG-111128-32001", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-234-234", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Scott Hanselman", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(3), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "XHW-238928-32121", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-126-785", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Cesar de la Torre", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(1), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-322-111", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Scott Guthrie", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(2), BloodType = "A+", Gender = Gender.Male, Height = 6.1, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-456-654", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "David Carmona", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(5), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 45), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-983-768", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "David Salgado", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(6), BloodType = "A+", Gender = Gender.Male, Height = 5.9, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-459-345", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Dmitry Lyalin", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(7), BloodType = "A+", Gender = Gender.Male, Height = 6, Weight = 165, ClinicId = "HJI-198928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-158-163", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Erika Ehrli Cabral", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(8), BloodType = "A+", Gender = Gender.Female, Height = 5.6, Weight = 132, ClinicId = "TJI-228928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-694-153", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); patient = new Patient { Name = "Mitra Azizirad", Address = "Madison Ave 10037, New York, NY 10037", Email = "*****@*****.**", Deleted = false, Picture = GetPatientPicture(10), BloodType = "A+", Gender = Gender.Female, Height = 5.6, Weight = 132, ClinicId = "TJI-228928-39012", TenantId = tenantId, Age = Randomize.Next(35, 38), DateOfBirth = DateTime.UtcNow.AddDays(-Randomize.Next(1, 30)).AddMonths(-Randomize.Next(1, 12)).AddYears(-Randomize.Next(30, 38)), Phone = "555-694-153", Doctors = new List<Doctor>() { doctor }, Id = Guid.NewGuid().ToString() }; patients.Add(patient); context.Patients.AddRange(patients); context.SaveChanges(); }
static void CreateClinicAppointments(MyHealthContext context, int tenantId) { var appointments = new List <ClinicAppointment>(); var patients = context.Patients.Select(p => p.PatientId).ToList(); var doctors = context.Doctors.ToList(); foreach (int patientId in patients) { for (int i = 1; i <= AppointmentMonths; i++) { var doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; var appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, IsUrgent = true }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, IsUrgent = false }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Evaluate the diagnosis received", TenantId = tenantId, IsUrgent = true }; appointments.Add(appointment); doctor = doctors[Randomize.Next(0, doctors.Count - 1)]; appointment = new ClinicAppointment { PatientId = patientId, DoctorId = doctor.DoctorId, DateTime = GetAppointmentDate(i), Speciality = doctor.Speciality, RoomNumber = Randomize.Next(3, 15), Description = "Evaluate the effectiveness of treatment received", TenantId = tenantId, IsUrgent = false }; appointments.Add(appointment); } } context.ClinicAppointments.AddRange(appointments); context.SaveChanges(); }
private static void CreateExpensesSummaries(MyHealthContext context, int tenantId) { var expensesSummaries = new List<ExpensesSummary>(); for (int i = 0; i < 24; i++) { var expensesSummary = new ExpensesSummary { Year = DateTime.UtcNow.AddMonths(-i).Year, Month = DateTime.UtcNow.AddMonths(-i).Month, Incomes = Randomize.Next(120000, 150000), Expenses = Randomize.Next(70000, 80000), TenantId = tenantId }; expensesSummaries.Add(expensesSummary); } context.ExpensesSummaries.AddRange(expensesSummaries); context.SaveChanges(); }
static void CreateHomeAppointments(MyHealthContext context, int tenantId) { var visits = new List <HomeAppointment>(); var patients = context .Patients.OrderBy(p => p.PatientId).Select(p => p.PatientId) .Skip(1).Take(4).ToList(); var doctors = context.Doctors.Select(p => p.DoctorId).ToList(); foreach (int doctorId in doctors) { for (int i = 1; i <= AppointmentMonths; i++) { var visit = new HomeAppointment { PatientId = patients[0], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = false, TenantId = tenantId, IsUrgent = true, Description = "Follow up in order to determine the effectiveness of treatment received", Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[1], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = false, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[0], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[1], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = true, IsUrgent = true, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[2], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = false, IsUrgent = true, TenantId = tenantId, Description = "Follow up in order to determine the effectiveness of treatment received", Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[3], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", IsUrgent = true, Visited = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[2], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "48 Wall St, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); visit = new HomeAppointment { PatientId = patients[3], DoctorId = doctorId, DateTime = GetAppointmentDate(i), Latitude = 40.721847, Longitude = -74.007326, Address = "Madison Ave 10037, New York, NY 10037", Visited = true, IsUrgent = false, Description = "Follow up in order to determine the effectiveness of treatment received", TenantId = tenantId, Id = Guid.NewGuid().ToString() }; visits.Add(visit); } } context.HomeAppointments.AddRange(visits); context.SaveChanges(); }
public PatientsRepository(MyHealthContext dbcontext) { _context = dbcontext; }
public TenantsRepository(MyHealthContext dbcontext) { _context = dbcontext; }
static void CreateMedicines(MyHealthContext context, int tenantId) { var data = new[] { new { Name="Tylenol", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Dinner }, new { Name="Tamiflu", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Breakfast }, new { Name="Advil", Dose = 0.5, Unit = InternationalUnit.Milliliters, TimeOfDay = TimeOfDay.Lunch }, new { Name="Cafergot", Dose = 100.0, Unit = InternationalUnit.Milligrams, TimeOfDay = TimeOfDay.Breakfast }, }; var medicines = new List<Medicine>(); var patients = context.Patients.Select(p => p.PatientId).ToList(); var globalIdx = 0; foreach (int patientId in patients) { foreach (var _ in Enumerable.Range(0, 4)) { var currentMedicineData = data[globalIdx]; var medicine = new Medicine { Name = currentMedicineData.Name, Dose = currentMedicineData.Dose, DoseUnit = currentMedicineData.Unit, PatientId = patientId, TimeOfDay = currentMedicineData.TimeOfDay, TenantId = tenantId }; medicines.Add(medicine); globalIdx++; globalIdx = globalIdx % data.Length; } context.Medicines.AddRange(medicines); } context.SaveChanges(); }