public IList<IPatient> GetAll(IPatient patient)
        {
            Assertion.NotNull(patient, "Paticiente não informado.").Validate();

            if (patient.Hospital != null)
            {
                var patients = GetPatientsService.GetPatients(patient.Hospital, patient);
                return patients;
            }

            var repository = new Hospitals();
            var hospitals = repository.All<Hospital>();

            foreach (var item in hospitals)
            {
                var hospital = item;
                if (item.Key.Equals("Sumario"))
                    continue;

                //TODO Acessar query com filtro de 6 dias de Range.
                var patients = GetPatientsService.GetPatients(hospital, patient);

                if (patients != null)
                    Patients.ToList().AddRange(patients);
            }

            return Patients;
        }
示例#2
0
        public void IntegrarPacientesRedeDor()
        {
            var repository = new Hospitals();
            var hospital = repository.GetBy("QuintaDor");
            PatientDTORepository pacientes = new PatientDTORepository(FactorryNhibernate.GetSession(hospital.Database));

            var resultados = pacientes.All<EHRIntegracao.Domain.Domain.PatientDTO>();

            IList<EHRIntegracao.Domain.Domain.PatientDTO> patients = new List<EHRIntegracao.Domain.Domain.PatientDTO>();
            foreach (var paciente in resultados)
            {
                patients.Add(new EHRIntegracao.Domain.Domain.PatientDTO()
                {
                    Cpf = paciente.Cpf,
                    DateBirthday = paciente.DateBirthday,
                    Identity = paciente.Identity,
                    Id = paciente.Id,
                    Name = paciente.Name
                });
            }
            pacientes.Dispose();
            resultados = null;
            var patietsRepositrory = new PatientDTORepository(FactorryNhibernate.GetSession(hospital.Database));
            patietsRepositrory.SalvarLista(patients);
        }
        public void obter_todos_paciente_teste()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("QuintaDor");
            PatientsDbFor repository = new PatientsDbFor();
            IList<IPatient> patients = repository.Todos(new Patient() { }, hospital);

            Assert.NotNull(patients);
        }
示例#4
0
        public void AllPatientWithPeriod()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("QuintaDor");
            PatientDTORepository pacientes = new PatientDTORepository(FactorryNhibernate.GetSession(hospital.Database));

            var resultados = pacientes.GetPatientsWithPeriod();

            Assert.NotNull(resultados);
        }
示例#5
0
        public void AllPatientByCriterion()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("QuintaDor");
            PatientDTORepository pacientes = new PatientDTORepository(FactorryNhibernate.GetSession(hospital.Database));

            var resultados = pacientes.GetPatientsBy(new Patient() { Identity = "198000" });

            Assert.AreEqual(resultados.Count ,1);
        }
        public override sealed ISessionFactory CreateSessionFactory()
        {
            if (Factory == null && NotConsole())
            {
                var hospitals = new Hospitals();
                var hospital = hospitals.GetBy("Sumario");

                return FactorryNhibernate.GetSession(hospital.Database);
            }
            return Factory;
        }
        public void get_patients_by_hospital_witch_sucess()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("Bangu");
            GetPatientsByPatient service = new GetPatientsByPatient();
            service.GetPatientsService = MockRepository.GenerateMock<GetPatientsService>();
            service.GetPatientsService.Expect(s => s.GetPatients(hospital, new Patient())).IgnoreArguments().Return(new List<IPatient>());
            var patients = service.GetAll(new Patient() { Name = "Marcelo",Hospital = hospital});

            Assert.NotNull(patients);
        }
示例#8
0
        public void SalvarEdeletarPaciente()
        {
            var repository = new Hospitals();
            var hospital = repository.GetBy("QuintaDor");
            PatientDTORepository pacientes = new PatientDTORepository(FactorryNhibernate.GetSession(hospital.Database));
            var paciente = new EHRIntegracao.Domain.Domain.PatientDTO() { Id = "JK", DateBirthday = DateTime.Now, Identity = "sas", Name = "javet", Cpf = "234" };

            pacientes.Save<string>(paciente);

            pacientes.Delete<string>(paciente);
        }
        public void do_search_witch_sucess()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("CopaDor");
            var initialCharge = new InitialChargeByHospitalFillPatientService();

            initialCharge.GetPatientsService = MockRepository.GenerateMock<GetPatientsService>();
            initialCharge.GetPatientsService.Expect(g => g.GetPatients(hospital, new Patient())).IgnoreArguments()
                .Return(new List<IPatient>());

            initialCharge.DoSearch(hospital, new Patient());

            Assert.NotNull(initialCharge.Patients);
        }
        public void do_search_witch_patient_greater_witch_sucess()
        {
            var repositoryH = new Hospitals();
            var hospital = repositoryH.GetBy("CopaDor");
            var initialCharge = new InitialChargeByHospitalFillPatientService();

            initialCharge.GetPatientsService = MockRepository.GenerateMock<GetPatientsService>();
            initialCharge.GetPatientsService.Expect(g => g.GetPatients(hospital, new Patient())).IgnoreArguments()
                .Return(new List<IPatient>()
                            {
                                new Patient(){DateBirthday = new DateTime(1989,06,27),CPF = "14041907756"}
                            }
                );

            initialCharge.DoSearch(hospital, new Patient());

            Assert.IsTrue(initialCharge.Patients.Count == 1);
        }
示例#11
0
 public void c_Verify_if_get_all_hospitals_cached_return_object()
 {
     var repository = new Hospitals();
     var hospitals = repository.GetAllCached();
     Assert.Greater(hospitals.Count, 0, "Lista de hospitais vazia");
 }
示例#12
0
 public void b_Verify_if_get_all_hospitals_return_itens()
 {
     var repository = new Hospitals();
     var hospitals = repository.All<Hospital>();
     Assert.Greater(hospitals.Count, 0, "Lista de hospitais vazia");
 }
示例#13
0
 public void a_Verify_if_get_all_hospitals_return_object()
 {
     var repository = new Hospitals();
     var hospitals = repository.All<Hospital>();
     Assert.IsNotNull(hospitals, "Lista de hospitais nula");
 }
 public virtual IList<Hospital> GetValues()
 {
     var repository = new Hospitals();
     return repository.All<Hospital>();
 }