public List <MedOrg> GenerateMedOrgs() { List <MedOrg> medOrgs = new List <MedOrg>(); DirectoryInfo directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent?.Parent; XDocument xdoc = XDocument.Load(directory?.FullName + ".DAL/Classes/Addresses.xml"); List <string> elem = xdoc.Root?.Elements().Elements().Select(s => s.Value).ToList(); for (int i = 0; i < random.Next(1, 10); i++) { MedOrg medOrg = new MedOrg() { Name = NameGenerator.GenerateLastName().ToLower(), PhoneNumber = $"+7({random.Next(100, 1000)})-" + $"{random.Next(100, 1000)}-" + $"{random.Next(10, 100)}-" + $"{random.Next(10, 100)}", Address = elem?[random.Next(elem.Count)], Patients = GeneratePatients(), UsersOfMedOrg = GenerateUsers() }; Thread.Sleep(30); medOrgs.Add(medOrg); } return(medOrgs); }
public static void AddPatientToOrganization(ref ModulPatientAttach modul) { MedOrg patientsMedOrg = null; foreach (QueryToAdd query in modul.QueriesToAdd) { if (query.Active) { query.PrintInfo(); Patient pat = query.Patient; Console.WriteLine("1 - принять 0 - отклонить"); string value = Console.ReadLine(); foreach (MedOrg item in modul.MedOrgs) { foreach (Patient p in item.Patients) { if (p == query.Patient) { patientsMedOrg = item; break; } } } if (value == "1") { patientsMedOrg.Patients.RemoveAt(patientsMedOrg.Patients.IndexOf(query.Patient)); query.MedOrg.Patients.Add(pat); query.Obrabotka = DateTime.Now; query.Active = false; Console.WriteLine("Пациент успешно перенесен в новую организацию"); } else if (value == "0") { query.Obrabotka = DateTime.Now; query.Active = false; Console.WriteLine("Пациент не добавлен"); } else { Console.WriteLine("Проверьте ввод"); break; } Console.WriteLine("Для продолжения нажмите пробел"); if (Console.ReadKey().Key != ConsoleKey.Spacebar) { break; } } } }
public QueryToAdd CreateQuaryToAdd(DateTime date, ref Patient patient, ref MedOrg medOrg) { QueryToAdd query = new QueryToAdd() { Patient = patient, MedOrg = medOrg, CreateDate = date, Active = true }; if (QueriesToAdd != null) { QueriesToAdd.Add(query); } else { QueriesToAdd = new List <QueryToAdd>(); QueriesToAdd.Add(query); } Console.WriteLine("Запрос был отправлен в обработку"); return(query); }
public Patient Search(out MedOrg med) { int i = 0; MedOrg org = null; Patient patient = null; QueryToAdd query = null; Console.WriteLine("Введите название мед. организации"); foreach (MedOrg item in MedOrgs) { Console.WriteLine($"{++i} {item.Name} {item.Address}"); } string name = Console.ReadLine(); foreach (var o in MedOrgs) { if (o.Name == name) { org = o; break; } } if (org != null) { foreach (Patient item in org.Patients) { query = null; if (QueriesToAdd != null) { foreach (QueryToAdd q in QueriesToAdd) { if (q.Patient == item) { query = q; break; } } } if (query == null || query.Patient != item) { item.PrintInfo(); } } Console.WriteLine("Введите имя, фамилию,отчество или ИИН пациента"); string fio = Console.ReadLine(); foreach (var o in org.Patients) { string f = $"{o.LastName} {o.FirstName} {o.SecondName}"; if (f.Contains(fio ?? throw new InvalidOperationException()) || o.IIN == fio) { patient = o; break; } } } med = org; return(patient); }