Пример #1
0
 public void fillVisitData(Patient patient, Dictionary<string, List<Visit>> visitByDate, Action<Visit[]> actionForVisit, Action<Patient, bool> actionForPatient)
 {
     HelperFrame.deleteButton(this, listVisitButton, 0);
     this.patient = patient;
     this.actionForVisit = actionForVisit;
     this.actionForPatient = actionForPatient;
     addButtonToFrame(patient, visitByDate, actionForVisit, actionForPatient);
 }
Пример #2
0
        public void drawPatientsPath(Patient patient, bool reDraw = true)
        {
            selectedPatient = patient;
            drawVisitsPath(patient.visitList.ToArray());
            if (reDraw)
            {
                mainPanel.clearBottomFrames();
                var bottomFrame = mainPanel.createBottomFrame();

                HelperFrame.GroupType groupType;
                Dictionary<string, List<Visit>> visitByDate;
                bottomFrame.getFrameVisitFromLevel(patient.visitList, out groupType, out visitByDate);
                if(HelperFrame.isUpdatedLevel(groupType))
                {
                    bottomFrame.setLevel((int) groupType);
                    mainPanel.AddBottomFrame(bottomFrame);
                    bottomFrame.fillVisitData(patient, visitByDate, drawVisitsPath, drawPatientsPath);
                }
               }
        }
Пример #3
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;
            //                }
            //            }
        }
Пример #4
0
        private void addButtonToFrame(Patient patient, Dictionary<string, List<Visit>> dateToVisits, Action<Visit[]> actionForVisit, Action<Patient, bool> actionForPatient)
        {
            int maxVisits = dateToVisits.Max(x => x.Value.Count);
            int elementNumber = 0;
            foreach (var dateVisits in dateToVisits)
            {
                var date = dateVisits.Key;
                var visits = dateVisits.Value;
                var radius = ((float)visits.Count / maxVisits) * (ConstantFrame.RADIUS_MAX - ConstantFrame.RADIUS_MIN) + ConstantFrame.RADIUS_MIN;
                int positionX = ConstantFrame.RADIUS_MAX * elementNumber; // depends of elementNumber
                int positionYdate = this.Height - LineHeight;
                var offset = (ConstantFrame.RADIUS_MAX - (int)radius) / 2;
                listVisitButton.Add(HelperFrame.AddButton(this, this.Font, positionX, positionYdate, ConstantFrame.RADIUS_MAX, LineHeight, date, FrameAnchor.Top | FrameAnchor.Left, () => { }, Color.Zero));
                // add image
                var buttonImage = HelperFrame.AddMapButton(this, this.Font, positionX + offset, positionYdate + (ConstantFrame.RADIUS_MAX - (int)radius) / 2 - ConstantFrame.RADIUS_MAX, (int)radius, (int)radius, "node",
                    visits.Count.ToString(), () => { });
                buttonImage.MouseIn += (s, e) => actionForVisit(visits.ToArray());
                buttonImage.MouseOut += (s, e) => actionForPatient(patient, false);
                buttonImage.Click += (s, e) =>
                {
                    buttonImage.BackColor = new Color(25, 71, 138, 255);
                    if (level< (int)HelperFrame.GroupType.DAY)
                    {
                        MainFrame mainFrame = (MainFrame) this.Parent;
                        mainFrame.RemoveBottomFrame(position+1);

                        HelperFrame.GroupType groupType;
                        Dictionary<string, List<Visit>> visitByDate = null;
                        BottomFrame bottomFrame = mainFrame.createBottomFrame();
                        bottomFrame.getFrameVisitFromLevel(dateVisits.Value, out groupType, out visitByDate);
                        if (HelperFrame.isUpdatedLevel(groupType))
                        {
                            bottomFrame.setLevel((int)groupType);
                            mainFrame.AddBottomFrame(bottomFrame);
                            bottomFrame.fillVisitData(patient, visitByDate, actionForVisit, actionForPatient);
                        }
                    }
                };
                listVisitButton.Add(buttonImage);
                elementNumber++;
            }
        }