コード例 #1
0
 Patient Build(Patient patient)
 {
     return new Patient()
     {
         PatientId = patient.PatientId,
         Gender = patient.Gender,
         Name = patient.Name,
         ClinicId = patient.ClinicId,
         Picture = patient.Picture,
         Age = patient.Age,
         DateOfBirth = patient.DateOfBirth,
         Email = patient.Email,
         Phone = patient.Phone,
         BloodType = patient.BloodType,
         Weight = patient.Weight,
         Height = patient.Height
     };
 }
コード例 #2
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();
        }