Inheritance: JourneyViewModel
Exemplo n.º 1
0
 private static bool ShouldOverrideDefault(OutcomeViewModel outcomeModel)
 {
     return(outcomeModel != null &&
            outcomeModel.OutcomeGroup != null &&
            (outcomeModel.OutcomeGroup.Equals(OutcomeGroup.Isolate111) ||
             outcomeModel.OutcomeGroup.Equals(OutcomeGroup.ItkPrimaryCareNer)));
 }
        public async Task<OutcomeViewModel> DispositionBuilder(OutcomeViewModel model)
        {
            //TODO -- DUMMY DATA, REMOVE
            var user = Users.GetRandomUser();
            var years = (DateTime.Now - user.DoB).Days / 365;
            model.UserInfo.Age = years;
            model.UserInfo.Gender = user.Gender;
            //-----------------------------

            model.UserId = Guid.NewGuid();
            var journey = JsonConvert.DeserializeObject<Journey>(model.JourneyJson);
            var itkMessage = new ItkMessageBuilder(_cacheManager).WithExample().SetSummaryItems(
                journey.Steps.Select(a => new ItkMessageBuilder.SummaryItem(a.QuestionNo, a.QuestionTitle, a.Answer.Title))
                )
                .SetGender(model.UserInfo.Gender)
                .SetDateOfBirth(DateTime.Now.AddYears(-model.UserInfo.Age).ToShortDateString())
                .SetDispositionCode(model.Id.Replace("Dx", string.Empty))
                .SetProvider("111Digital")
                .SetInformantType("NotSpecified")
                .SetSendToRepeatCaller(false)
                .SetForename(user.GivenName)
                .SetSurname(user.FamilyName)
                .SetDateOfBirth(user.DoB.ToString("yyyy-MM-dd"))
                .SetGender(user.Gender)
                .SetHomeAddress(new ItkMessageBuilder.Address(string.Format("{0} {1} {2}", user.AddressLine1, user.AddressLine2, user.AddressLine3),
                    string.Format("{0} {1}", user.AddressLine4, user.AddressLine5),
                    user.Postcode))
                .Build(model.UserId.ToString());

            model.CareAdvices = await _careAdviceBuilder.FillCareAdviceBuilder(model.UserInfo.Age, model.UserInfo.Gender, model.CareAdviceMarkers.ToList());
            model.SymptomGroup = await _restfulHelper.GetAsync(string.Format(_configuration.BusinessApiPathwaySymptomGroupUrl,
                string.Join(",", journey.Steps.Select(s => s.QuestionId.Split('.').First()).Distinct())));

            return model;
        }
Exemplo n.º 3
0
 public static ServiceViewModel SelectedServiceForPharmacistReferral(OutcomeViewModel outcomeViewModel)
 {
     return(outcomeViewModel.DosCheckCapacitySummaryResult
            .Success.Services
            .FilterByServiceTypeId(_emergencyNationalResponse_ServiceTypeId)
            .FilterByOnlineDOSServiceType(OnlineDOSServiceType.Callback)
            .FirstOrDefault());
 }
Exemplo n.º 4
0
        public async Task<DosCheckCapacitySummaryRequest> BuildCheckCapacitySummaryRequest(
            OutcomeViewModel outcomeViewModel, Surgery surgery)
        {
            var model = _mappingEngine.Map<DosViewModel>(outcomeViewModel);

            var dosCase = _mappingEngine.Map<OutcomeViewModel, DosCase>(outcomeViewModel);
            dosCase.Surgery = surgery.SurgeryId;
            return new DosCheckCapacitySummaryRequest(_configuration.DosUsername, _configuration.DosPassword, dosCase);
        }
Exemplo n.º 5
0
        protected string ResolveConfirmationViewByOutcome(OutcomeViewModel outcomeModel)
        {
            //todo:this needs a rethink with a combination of service type / outcome to route to correct page

            if (ShouldOverrideDefault(outcomeModel))
            {
                return(outcomeModel.OutcomeGroup.Id);
            }

            return("default");
        }
        public async Task<OutcomeViewModel> SearchSurgeryBuilder(string input)
        {
            var model = new OutcomeViewModel();
            if (!string.IsNullOrEmpty(input))
            {
                var surgeriers = JsonConvert.DeserializeObject<List<Surgery>>(await _restfulHelper.GetAsync(string.Format(_configuration.GPSearchByIdUrl, input)));
                model.SurgeryViewModel.Surgeries = surgeriers;
            }

            return model;
        }
Exemplo n.º 7
0
        public static bool ShouldDisplayPharmacistReferral(OutcomeViewModel outcomeViewModel)
        {
            var hasEmergencyNationalResponseDosServiceType =
                outcomeViewModel.DosCheckCapacitySummaryResult.ContainsServiceTypeById(_emergencyNationalResponse_ServiceTypeId);

            var dispositionIdsWithPharmacistReferral = new List <string>()
            {
                "Dx09", "Dx10", "Dx16", "Dx75"
            };

            var hasSelectedServiceForPharmacistReferral = SelectedServiceForPharmacistReferral(outcomeViewModel) != null;

            return(hasEmergencyNationalResponseDosServiceType && dispositionIdsWithPharmacistReferral.Contains(outcomeViewModel.Id) && hasSelectedServiceForPharmacistReferral);
        }
        public ActionResult PersonalDetails()
        {
            var model = new OutcomeViewModel();
            var config = new Configuration();
            model.AddressSearchViewModel.PostcodeApiAddress = config.PostcodeSearchByIdApiUrl;
            model.AddressSearchViewModel.PostcodeApiSubscriptionKey = config.PostcodeSubscriptionKey;

            model.Id = "Dx38";
            model.UserInfo = new UserInfo() { Age = 38, Gender = "Female" };
            model.SymptomGroup = "1203";
            model.SymptomDiscriminator = "4003";
            
            return View("PersonalDetails", model);
        }
Exemplo n.º 9
0
        public static string GetServiceTypeAliasValue(OutcomeViewModel model)
        {
            if (!model.OutcomeGroup.IsServiceFirst && !model.OutcomeGroup.IsAccidentAndEmergencySexualAssault)
            {
                return(string.Empty);
            }
            if (model.DosCheckCapacitySummaryResult.ResultListEmpty)
            {
                return("no-results");
            }
            var firstService       = model.DosCheckCapacitySummaryResult.Success.FirstService;
            var recommendedService = Mapper.Map <RecommendedServiceViewModel>(firstService);

            return(recommendedService.IsCallbackServiceNotOfferingCallback ? string.Empty : firstService.ServiceTypeAlias);
        }
Exemplo n.º 10
0
        public static string GetHeaderText(OutcomeViewModel outcomeViewModel)
        {
            var dispositionsWithCustomHeading = new Dictionary <string, string>()
            {
                { "Dx09", "Book a GP appointment if you don't feel better in a few days" },
                { "Dx10", "Book a non-urgent GP appointment" },
                { "Dx16", "Contact your GP if you don't feel better in a few days" },
                { "Dx75", "Contact your GP within the next few days" },
            };

            return(dispositionsWithCustomHeading.ContainsKey(outcomeViewModel.Id)
                ?
                   dispositionsWithCustomHeading[outcomeViewModel.Id]
                :
                   string.Format("{0} {1}", outcomeViewModel.OutcomeGroup.Text, outcomeViewModel.DispositionUrgencyText));
        }
Exemplo n.º 11
0
        public async Task<DosViewModel> DosResultsBuilder(OutcomeViewModel outcomeViewModel)
        {
            var model = _mappingEngine.Map<DosViewModel>(outcomeViewModel);
            var surgery = await GetSelectedSurgery(model);

            var capacitySummaryRequest = await BuildCheckCapacitySummaryRequest(outcomeViewModel, surgery);
            var request = new HttpRequestMessage { Content = new StringContent(JsonConvert.SerializeObject(capacitySummaryRequest), Encoding.UTF8, "application/json") };
            var response = await _restfulHelper.PostAsync(_configuration.BusinessDosCheckCapacitySummaryUrl, request);
            if (response.StatusCode == HttpStatusCode.OK)
            {
                var val = await response.Content.ReadAsStringAsync();
                model.CheckCapacitySummaryResultListJson = HttpUtility.HtmlDecode(val);
                var jObj = (JObject)JsonConvert.DeserializeObject(val);
                var result = jObj["CheckCapacitySummaryResult"];
                model.CheckCapacitySummaryResultList = result.ToObject<CheckCapacitySummaryResult[]>();
            }
            else
            {
                model.CheckCapacitySummaryResultList = new CheckCapacitySummaryResult[0];
            }

            return model;
        }
        public async Task<OutcomeViewModel> PersonalDetailsBuilder(OutcomeViewModel model)
        {
            if (!string.IsNullOrEmpty(model.AddressSearchViewModel.PostCode))
            {
                return await PostCodeSearchBuilder(model);
            }

            model.AddressSearchViewModel.PostcodeApiAddress = _configuration.PostcodeSearchByIdApiUrl;
            model.AddressSearchViewModel.PostcodeApiSubscriptionKey = _configuration.PostcodeSubscriptionKey;

            model.CareAdvices = await _careAdviceBuilder.FillCareAdviceBuilder(model.UserInfo.Age, model.UserInfo.Gender, model.CareAdviceMarkers.ToList());
            return model;
        }
 public async Task<OutcomeViewModel> PostCodeSearchBuilder(OutcomeViewModel model)
 {
     var addresses = await SearchPostcodeBuilder(model.AddressSearchViewModel.PostCode);
     model.AddressSearchViewModel.AddressInfoList = addresses;
     model.AddressSearchViewModel.PostcodeApiAddress = _configuration.PostcodeSearchByIdApiUrl;
     model.AddressSearchViewModel.PostcodeApiSubscriptionKey = _configuration.PostcodeSubscriptionKey;
     return model;
 }
 public async Task<ActionResult> DosResults(OutcomeViewModel model)
 {
     var viewModel = await _dosBuilder.DosResultsBuilder(model);
     return View("../DOS/DosResults", viewModel);
 }
 public async Task<ActionResult> PostCodeSearch(OutcomeViewModel model)
 {
     model = await _outcomeViewModelBuilder.PostCodeSearchBuilder(model);
     return View("PersonalDetails", model);
 }
 public async Task<ActionResult> TempDosResults(OutcomeViewModel model)  //TODO remove as soon as postcode autosuggest is in place
 {
     model.UserInfo.CurrentAddress.PostCode = model.AddressSearchViewModel.PostCode;
     var viewModel = await _dosBuilder.DosResultsBuilder(model);
     return View("../DOS/DosResults", viewModel);
 }
 protected JourneyResultViewModel(OutcomeViewModel outcomeViewModel)
 {
     OutcomeModel = outcomeViewModel;
 }
 public OutcomeResultViewModel(OutcomeViewModel outcomeViewModel, bool isTestJourneyResult) : base(outcomeViewModel)
 {
     IsTestJourney = isTestJourneyResult;
 }
 public async Task<ActionResult> DispositionNo(OutcomeViewModel model)
 {
     model = await _outcomeViewModelBuilder.PersonalDetailsBuilder(model);
     return View("DispositionNo", model);
 }
 public async Task<ActionResult> DispositionNo2(OutcomeViewModel model) //TODO this is realyl ugly, bad code duplication, rethink it
 {
     return await DispositionNo(model);
 }