Example #1
0
        public ActionResult Registering(string name, string cpf, DateTime Birthday, char genre, string identity)
        {
            try
            {
                var patient = new Patient
                    {
                        Name = name,
                        CPF = cpf,
                        DateBirthday = Birthday,
                        Genre = genre,
                        Identity = identity
                    };

                FactoryController.GetController(ControllerEnum.Patient).Registering(patient);

                this.ShowMessage(MessageTypeEnum.Success, "Paciente cadastrado com sucesso.");

                return View("Index");
            }
            catch (Exception ex)
            {
                this.ShowMessage(MessageTypeEnum.Error, ex.Message);
                return View("Index");
            }
        }
        public List<IPatient> RemoveExistingPatients(List<IPatient> patients)
        {
            foreach (var patientGroup in patients.GroupBy(p => p.GetCPF()).GroupBy(e => e.Key))
            {
                foreach (var patientValue in patientGroup)
                {
                    IPatient patientUnique = new Patient();

                    foreach (var patient in patientValue)
                    {
                        if (string.IsNullOrEmpty(patientUnique.Id))
                        {
                            patientUnique = patient;
                            patient.AddRecord(new Record() { Code = patient.Id, Hospital = patient.Hospital });
                            PatientsDb.Add(patient);
                        }
                        else
                        {
                            if (patientUnique.Records != null)
                            {
                                var record = patientUnique.Records.Find(r => r.Code == patient.Id);

                                if (record != null)
                                    continue;
                            }

                            patientUnique.AddRecord(new Record() { Code = patient.Id, Hospital = patient.Hospital });
                        }
                    }
                }
            }

            return PatientsDb;
        }
Example #3
0
 public string SearchPeaple(string query)
 {
     try
     {
         var patient = new Patient { Name = query };
         var patientController = FactoryController.GetController(ControllerEnum.Patient);
         var patients = PatientMapper.MapPatientModelFrom(patientController.GetBy(patient));
         return BuildResultsOfSimpleSearchOfPatients(patients);
     }
     catch (Exception ex)
     {
         this.ShowMessage(MessageTypeEnum.Error, ex.Message);
         return null;
     }
 }
Example #4
0
 public ActionResult Index(string query)
 {
     try
     {
         Session["Date"] = null;
         var patient = new Patient { Name = query };
         var patientController = FactoryController.GetController(ControllerEnum.Patient);
         ViewBag.Patients = patientController.GetBy(patient, new List<String>()).Take(10);
         ViewBag.Hospitals =
             HospitalMapper.MapHospitalModelFrom(
                 FactoryController.GetController(ControllerEnum.Hospital).GetAllHospitals());
         Session["Name"] = query;
         return PartialView("_Search");
     }
     catch (Exception ex)
     {
         this.ShowMessage(MessageTypeEnum.Error, ex.Message);
         return null;
     }
 }
Example #5
0
 public void AddUpdateLuceneIndex(Patient patients)
 {
     AddUpdateLuceneIndex(new List<Patient> { patients });
     Optimize();
 }
Example #6
0
        private IPatient _mapLuceneDocumentToData(Document doc)
        {
            var patient = new Patient()
            {
                Id = doc.Get("Id"),
                Name = doc.Get("Name"),
                CPF = doc.Get("CPF"),
                Hospital = new Hospital { Key = doc.Get("Hospital") },
            };

            if (!string.IsNullOrEmpty(doc.Get("DateBirthday")))
            {
                patient.DateBirthday = DateTime.Parse(doc.Get("DateBirthday"), CultureInfo.GetCultureInfo("pt-br") );
            }
            if (!string.IsNullOrEmpty(doc.Get("CheckOutDate")))
            {
                patient.DateBirthday = DateTime.Parse(doc.Get("CheckOutDate"), CultureInfo.GetCultureInfo("pt-br"));
            }
            if (!string.IsNullOrEmpty(doc.Get("EntryDate")))
            {
                patient.EntryDate = DateTime.Parse(doc.Get("EntryDate"), CultureInfo.GetCultureInfo("pt-br"));
            }

            return patient;
        }
 private void PatientConverter(IList<PatientDTO> patients, Hospital hospital)
 {
     foreach (var patient in patients)
     {
         var patientDto = new Patient
                              {
                                  Id = patient.Id,
                                  CPF =
                                      patient.Cpf == null
                                          ? null
                                          : Regex.Replace(patient.Cpf, "[^0-9]", string.Empty),
                                  DateBirthday = patient.DateBirthday,
                                  Identity = patient.Identity,
                                  Name = patient.Name,
                                  Genre = patient.Genre,
                                  Hospital = hospital,
                                  Records = new List<Record>()
                              };
         PatientsDTO.Add(patientDto);
     }
 }
Example #8
0
        private IEnumerable<IPatient> GetPatients(Patient patient, bool skip)
        {
            var patientController = FactoryController.GetController(ControllerEnum.Patient);

            return skip ? patientController.GetBy(patient, (List<string>)Session["SearchHospital"]).Skip((int)Session["Skip"]).Take(10) : patientController.GetBy(patient, (List<string>)Session["SearchHospital"]).Take(10);
        }
Example #9
0
        private Patient FillPatients()
        {
            var patient = new Patient { Name = Session["Name"].ToString() };

            if (Session["Date"] != null && !string.IsNullOrEmpty(Session["Date"].ToString()) && (string)Session["Date"] != "-1/-1/-1")
                patient.DateBirthday = Convert.ToDateTime(Session["Date"]);
            return patient;
        }