Ejemplo n.º 1
0
        public async Task <IActionResult> SearchPatient(PatientSearchVM search)
        {
            AppUserDetailsVM currentUser = await GetCurrentUser();

            //## search the patient using the Search VM
            search.FirstName = "car";
            var matchingPatients = await _patientService.SearchPatient(search);

            //## Doctor will Search Patients and Create a new Prescription
            PrescriptionCreateInitialVM vm = new PrescriptionCreateInitialVM()
            {
                DoctorId   = currentUser.Id,
                HospitalId = currentUser.CurrentRole.OrganisationId,
                //PatientId = 1,

                SearchVM = search,

                PatientsList      = matchingPatients,
                PatientsListTitle = $"Matching records",
                HospitalDetails   = null,
                DoctorDetails     = null
            };

            return(View(vm));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> FindPatient(PatientSearchVM searchVM)
        {
            //## Create a new Record in the Prescription Table- with Patient, Doctor and Hospital Id-
            // then capture the remaining info from the UI

            var searchResult = await _patientService.SearchPatient(searchVM);

            return(View(searchResult));
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <AppUserDetailsVM> > SearchPatient(PatientSearchVM searchVM)
        {
            bool hasMobileNumber = (!string.IsNullOrEmpty(searchVM.Mobile) && searchVM.Mobile.Length >= 10);
            bool hasShortId      = (!string.IsNullOrEmpty(searchVM.ShortId) && searchVM.ShortId.Length >= 5);
            bool hasFirstName    = (!string.IsNullOrEmpty(searchVM.FirstName) && searchVM.FirstName.Length >= 3);
            bool hasLastName     = (!string.IsNullOrEmpty(searchVM.LastName) && searchVM.LastName.Length >= 3);

            Expression <Func <User, bool> > userSearch = u => ((hasMobileNumber && u.Mobile.Equals(searchVM.Mobile)) ||
                                                               (hasShortId && u.ShortId.Equals(searchVM.ShortId)) ||
                                                               (
                                                                   (hasFirstName && u.FirstName.Contains(searchVM.FirstName))
                                                                   ||
                                                                   (hasLastName && u.LastName.Contains(searchVM.FirstName))
                                                               )
                                                               );

            var patientList = await Search(userSearch);

            var mappedResult = MapSeachResultToAppUserViewModel(patientList);

            return(mappedResult);
        }