Exemple #1
0
        private XmlDoctorData GetReportDataSource(Doctor doctor, int?patientId, bool isPdf)
        {
            var docUser   = doctor.Users.Single();
            var docPerson = docUser.Person;

            var medicalEntity    = UsersController.GetDoctorEntity(this.db.SYS_MedicalEntity, doctor);
            var medicalSpecialty = UsersController.GetDoctorSpecialty(this.db.SYS_MedicalSpecialty, doctor);

            // Getting all patients data.
            var doctorData = isPdf ? new PdfDoctorData() : new XmlDoctorData();

            PatientsController.FillPersonViewModel(this.practice, docPerson, doctorData);
            UsersController.FillUserViewModel(docUser, this.practice, doctorData);
            UsersController.FillDoctorViewModel(docUser, medicalEntity, medicalSpecialty, doctorData, doctor);

            doctorData.Address = PatientsController.GetAddressViewModel(docPerson.Addresses.SingleOrDefault());

            if (patientId != null)
            {
                doctorData.Patients = doctor.Patients
                                      .Where(p => p.Id == patientId)
                                      .Select(p => this.GetPatientData(p, isPdf))
                                      .OrderBy(x => x.FullName)
                                      .ToList();
            }
            else
            {
                doctorData.Patients = doctor.Patients
                                      .Select(p => this.GetPatientData(p, isPdf))
                                      .OrderBy(x => x.FullName)
                                      .ToList();
            }

            return(doctorData);
        }
Exemple #2
0
        private XmlPatientData GetPatientData(Patient patient, bool isPdf)
        {
            var result = isPdf ? new PdfPatientData() : new XmlPatientData();

            PatientsController.FillPersonViewModel(this.practice, patient.Person, result);

            result.Id           = patient.Id;
            result.Observations = patient.Person.Observations;

            result.Address = PatientsController.GetAddressViewModel(patient.Person.Addresses.FirstOrDefault())
                             ?? new AddressViewModel();

            result.Sessions = this.GetAllSessionsData(patient);

            return(result);
        }