Пример #1
0
 public void addNewVisit(Visit visit)
 {
     if (visitList == null)
     {
         visitList=new List<Visit>();
     }
     visitList.Add(visit);
 }
Пример #2
0
        public static void ReadFromFilePatientData(String dirName, Dictionary<String, int> dict, Dictionary<Doctor, HashSet<Patient>> doctorToPatients)
        {
            defaultId = 0;
            string[] files = Directory.GetFiles(dirName);
            // бегаем по пациентам
            foreach (string filename in files)
            {
                if (filename.EndsWith(".png"))
                    continue;
                //Получаем ID/имена пациентов в pacientid
                string pacientid = getNicePatientId(filename);
                Patient patient = new Patient(pacientid);
                var lines = File.ReadAllLines(filename);
                if (lines.Length > 0)
                {
                    // бегаем по докторам
                    foreach (var line in lines)

                    {
                        var parts = line.Split(';');
                        DateTime datedate = getNiceDate(parts[0]);
                        String fio = getNiceFIO(parts[1]);
                        int docId = findIdDoctor(dict, fio);
                        Visit visit = new Visit
                        {
                            id = docId,
                            date = datedate,
                            category = fio.Split(':')[0].Trim(),
                            fio = fio.Split(':')[1].Trim()
                        };
                        patient.addNewVisit(visit);

                        Doctor doctor = new Doctor
                        {
                            id = docId,
                            category = fio.Split(':')[0].Trim(),
                            fio = fio.Split(':')[1].Trim()
                        };

                        HashSet<Patient> listPatients;
                        if (doctorToPatients.TryGetValue(doctor, out listPatients))
                        {
                            listPatients.Add(patient);
                        }
                        else
                        {
                            listPatients = new HashSet<Patient>() { patient };
                            doctorToPatients.Add(doctor, listPatients);
                        }
                    }
                    //сортируем лист структур по дате
                    patient.visitList.Sort((one, two) => one.date.CompareTo(two.date));
                }
            }
            //            int limit = 100;
            //            using (StreamWriter sw = new StreamWriter("myfile.txt"))
            //            {
            //                foreach (HashSet<Patient> patients in doctorToPatients.Values)
            //                {
            //                    foreach (var patient in patients)
            //                    {
            //                        sw.Write(patient);
            //                    }
            //                    break;
            //                }
            //            }
            //File.WriteAllLines("myfile.txt",
               // doctorToPatients.Select(x => x.Key.id + ";" + x.Key.fio + ";" + x.Key.category).ToArray());

            //            using (StreamWriter sw = new StreamWriter("myfile.txt"))
            //            {
            //                foreach (var doc_patient in doctorToPatients)
            //                {
            //                    sw.Write(doc_patient.Key.id + ";" + doc_patient.Key.fio + ";" + doc_patient.Key.category + ";\n");
            //                    foreach (var patient in doc_patient.Value)
            //                    {
            //                        sw.Write(";"+patient+"\n");
            //                    }
            //
            //                    //break;
            //                }
            //            }
        }
Пример #3
0
 public void drawVisitsPath(Visit[] listVisit)
 {
     var graphSys = GetService<GraphSystem>();
     graphSys.SelectPath(listVisit.Select(visit => visit.id).ToList());
 }