예제 #1
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;
            //                }
            //            }
        }
예제 #2
0
        /// <summary>
        /// Draws game
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="stereoEye"></param>
        protected override void Draw(GameTime gameTime, StereoEye stereoEye)
        {
            base.Draw(gameTime, stereoEye);

            //		time += gameTime.Elapsed.Milliseconds;

            var cam = GetService<GreatCircleCamera>();
            var dr = GetService<DebugRender>();
            var pSys = GetService<GraphSystem>();

            dr.View = cam.GetViewMatrix(stereoEye);
            dr.Projection = cam.GetProjectionMatrix(stereoEye);
            var ds = GetService<DebugStrings>();
            if (isSelected)
            {
                selectedDoctor = doctorToPatients.Keys.First(x => x.id == selectedNodeIndex );
                pSys.Select(selectedNodeIndex);
                //вывод в панель пациентов и врача
                mainPanel.Children.ElementAt( 0 ).Text = "Id # " + selectedNodeIndex;
            }
            else
            {

                //ds.Add(Color.Orange, "No selection");
                //pSys.Deselect();
            }
            if(selectedDoctor!=null)
                printInfoDoctor(selectedDoctor.fio + ": " + selectedDoctor.category);
            var offsetY = this.GraphicsDevice.DisplayBounds.Height*95/100;
            // TODO:
            //            foreach (var level in mainPanel.listLevel)
            //		    {
            //                printInfo(level.ToString(), (200 - level.ToString().Count() * 5) / 2, offsetY);
            //		        offsetY -= 90;
            //		    }
        }