예제 #1
0
        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);
        }
        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 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();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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 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();
        }
예제 #7
0
        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();
        }
예제 #8
0
        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 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();
        }
예제 #10
0
        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();
        }
예제 #11
0
        public async Task <IActionResult> RegisterUser([FromBody] User u)
        {
            var chekLoginExist = _db.Users.FirstOrDefault(x => x.Login == u.Login);

            if (chekLoginExist != null)
            {
                return(BadRequest($"User with login {u.Login} already exist."));
            }

            string hash = HashCalculator.GetHash(u.Password);
            var    user = new User()
            {
                Login       = u.Login,
                DisplayName = u.DisplayName,
                Password    = hash
            };

            _db.Users.Add(user);
            _db.SaveChanges();

            return(Ok());
        }
예제 #12
0
        public async Task <IActionResult> CreateArticle([FromHeader] string Authorization, [FromBody] Article a)
        {
            if (string.IsNullOrEmpty(Authorization))
            {
                return(Unauthorized());
            }
            else
            {
                var tokenPayload = _token.VerifyToken(Authorization);
                if (tokenPayload == null)
                {
                    return(Unauthorized());
                }
                else
                {
                    a.UserID = tokenPayload.UserId;
                }
            }
            var userId = await _db.Articles.AddAsync(a).ConfigureAwait(false);

            _db.SaveChanges();
            return(Ok());
        }
        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();
 }
        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;
        }
        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 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();
        }
        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();
        }
        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();
        }
예제 #20
0
        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();
        }
예제 #21
0
        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();
        }
예제 #22
0
        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();
        }
예제 #24
0
        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();
        }
        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();
        }
        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();
        }
        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();
        }
        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();
        }
 private static void GenerateAttendees(MyHealthContext context)
 {
     context.Attendees.AddRange(DataInitializerValues.Attendees);
     context.SaveChanges();
 }
        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();
        }