public ActionResult GetPatientInfo(string pesel)
        {
            var person = MapSingle <PersonTransferObject, PersonViewModel>(_personInfoFetcher.GetPersonInfo(pesel));

            if (person == null)
            {
                return(new HttpStatusCodeResult(69, "Osoba o podanym numerze PESEL nie istnieje."));
            }

            TempData["CurrentPerson"] = person;

            return(PartialView("_PersonInfo", person));
        }
        public byte[] GenerateRaportBytes(string patientPesel, string username)
        {
            var personInfo = _personInfoFetcher.GetPersonInfo(patientPesel);

            if (personInfo == null)
            {
                return(null);
            }

            var patient = new WcfDataFetcher(_institutionRepository, _searchHistoryRepository, username).GetPatient <PatientTransferObject>(patientPesel, true);

            return(GeneratePdf(personInfo, patient));
        }
        public ActionResult ReadInstitutionData(DataSourceRequest request, Guid institutionId)
        {
            var displayList = new List <PersonViewModel>();
            var ptos        = _patientFetcher.GetAllPatientsFromInstitution <PatientTransferObject>(institutionId);

            foreach (var pto in ptos)
            {
                var personInfo = _personInfoFetcher.GetPersonInfo(pto.Pesel);
                displayList.Add(new PersonViewModel
                {
                    Pesel = pto.Pesel,
                    LastHospitalizationTime = pto.Hospitalizations.Any()
                        ? pto.Hospitalizations.Max(d => d.HospitalizationEndTime)
                        : (DateTime?)null,
                    FirstName = personInfo.FirstName,
                    LastName  = personInfo.LastName,
                    BirthDate = personInfo.BirthDate
                });
            }

            return(JsonDataSourceResult(request, displayList));
        }