public ChaperoneFormModel GetChaperoneFormModel(long eventCustomerId) { var chaperoneSignature = _chaperoneSignatureRepository.GetByEventCustomerId(eventCustomerId); var staffSignatureFile = chaperoneSignature != null?_fileRepository.GetById(chaperoneSignature.StaffSignatureFileId) : null; if (staffSignatureFile == null) { return(new ChaperoneFormModel { EventCustomerId = eventCustomerId, CustomerAnswers = null, PatientSignatureBytes = null, }); } var chaperoneQuestions = _chaperoneQuestionRepository.GetAllQuestions(); var chaperoneAnswers = _chaperoneAnswerRepository.GetByEventCustomerId(eventCustomerId); var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); var mediaLocation = _mediaRepository.GetChaperoneSignatureLocation(eventCustomer.EventId, eventCustomer.CustomerId); string signatureFilePath = string.Empty; var signatureFile = chaperoneSignature != null && chaperoneSignature.SignatureFileId.HasValue ? _fileRepository.GetById(chaperoneSignature.SignatureFileId.Value) : null; if (signatureFile != null) { signatureFilePath = Path.Combine(mediaLocation.PhysicalPath, signatureFile.Path); } var staffSignatureFilePath = Path.Combine(mediaLocation.PhysicalPath, staffSignatureFile.Path); var chaperoneFormModel = new ChaperoneFormModel(); chaperoneFormModel.EventCustomerId = eventCustomerId; chaperoneFormModel.CustomerAnswers = chaperoneAnswers .Select(x => new ChaperoneAnswerModel { QuestionId = x.QuestionId, Answer = x.Answer }) .ToArray(); if (!string.IsNullOrEmpty(signatureFilePath) && File.Exists(signatureFilePath)) { var signatureFileByte = File.ReadAllBytes(signatureFilePath); chaperoneFormModel.PatientSignatureBytes = Convert.ToBase64String(signatureFileByte); } if (File.Exists(staffSignatureFilePath)) { var staffSignatureFileByte = File.ReadAllBytes(staffSignatureFilePath); chaperoneFormModel.StaffSignatureBytes = Convert.ToBase64String(staffSignatureFileByte); } return(chaperoneFormModel); }
private ProspectCustomer GetProspectCustomer(long eventCustomerId) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer == null) { return(null); } var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(eventCustomer.CustomerId); if (prospectCustomer == null) { var customer = _customerRepository.GetCustomer(eventCustomer.CustomerId); prospectCustomer = new ProspectCustomer { FirstName = customer.Name.FirstName, LastName = customer.Name.LastName, Gender = customer.Gender, Address = customer.Address, CallBackPhoneNumber = customer.HomePhoneNumber, Email = customer.Email, BirthDate = customer.DateOfBirth, MarketingSource = customer.MarketingSource, CustomerId = customer.CustomerId, Source = ProspectCustomerSource.CallCenter }; } return(prospectCustomer); }
public bool Save(ParticipationConsentSignatureModel model, long orgRoleUserId) { var eventCustomer = _eventCustomerRepository.GetById(model.EventCustomerId); if (eventCustomer == null) { return(false); } var signatureLocation = _mediaRepository.GetParticipationConsentSignatureLocation(eventCustomer.EventId, eventCustomer.CustomerId); var version = _participationConsentSignatureRepository.GetLatestVersion(model.EventCustomerId); var participationConsentSignature = new ParticipationConsentSignature() { EventCustomerId = model.EventCustomerId, Version = version, IsActive = true, CreatedBy = orgRoleUserId, DateCreated = DateTime.Now }; if (!string.IsNullOrWhiteSpace(model.SignatureBytes)) { var fileName = "Signature_" + Guid.NewGuid() + ".jpg"; var signatureImageFile = SaveSignatureImage(model.SignatureBytes, orgRoleUserId, signatureLocation, fileName); participationConsentSignature.SignatureFileId = signatureImageFile.Id; participationConsentSignature.ConsentSignedDate = DateTime.Now; } if (!string.IsNullOrWhiteSpace(model.InsuranceSignatureBytes)) { var fileName = "InsuranceSignature_" + Guid.NewGuid() + ".jpg"; var technicianImageFile = SaveSignatureImage(model.InsuranceSignatureBytes, orgRoleUserId, signatureLocation, fileName); participationConsentSignature.InsuranceSignatureFileId = technicianImageFile.Id; participationConsentSignature.InsuranceConsentSignedDate = DateTime.Now; } _participationConsentSignatureRepository.Save(participationConsentSignature); if (participationConsentSignature.SignatureFileId > 0 && participationConsentSignature.InsuranceSignatureFileId > 0) { eventCustomer.HIPAAStatus = RegulatoryState.Signed; eventCustomer.IsParticipationConsentSigned = true; _eventCustomerRepository.Save(eventCustomer); } else { eventCustomer.IsParticipationConsentSigned = false; _eventCustomerRepository.Save(eventCustomer); } return(true); }
public void UpdateMedicareVisitStatus(long eventCustomerId, int visitStatus, string sessionId, ISessionContext sessionContext) { if (!_settings.SyncWithHra) { return; } var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer.AwvVisitId.HasValue) { try { _medicareApiService.Connect(sessionContext.UserSession.UserLoginLogId); } catch (Exception) { var userSession = sessionContext.UserSession; var token = (sessionId + "_" + userSession.UserId + "_" + userSession.CurrentOrganizationRole.RoleId + "_" + userSession.CurrentOrganizationRole.OrganizationId).Encrypt(); var auth = new MedicareAuthenticationModel { UserToken = token, CustomerId = 0, OrgName = _settings.OrganizationNameForHraQuestioner, Tag = _settings.OrganizationNameForHraQuestioner, IsForAdmin = false, RoleAlias = "CallCenterRep" }; _medicareApiService.PostAnonymous <string>(_settings.MedicareApiUrl + MedicareApiUrl.AuthenticateUser, auth); _medicareApiService.Connect(sessionContext.UserSession.UserLoginLogId); } _medicareApiService.Get <bool>(MedicareApiUrl.UpdateVisitStatus + "?visitId=" + eventCustomer.AwvVisitId.Value + "&status=" + visitStatus + "&unlock=true"); } }
private void QueueNotificationToCustomerForResutlReady(NotificationPhone phoneNotification) { var eventCustomerNotification = _eventCustomerNotificationRepository.GetById(phoneNotification.Id); if (eventCustomerNotification == null) { _logger.Error(string.Format("No EventCustomer found for notification Id {0} \n", phoneNotification.Id)); return; } var eventCustomer = _eventCustomerRepository.GetById(eventCustomerNotification.EventCustomerId); var eventData = _eventRepository.GetById(eventCustomer.EventId); var customer = _customerRepository.GetCustomer(eventCustomer.CustomerId); if (eventData.NotifyResultReady) { var primaryCarePhysician = _primaryCarePhysicianRepository.Get(customer.CustomerId); if (primaryCarePhysician == null) { _logger.Error("No primary Care Physician found \n"); } var resultReadyNotification = _emailNotificationModelsFactory.GetPpCustomerResultNotificationModel(customer, primaryCarePhysician); _notifier.NotifySubscribersViaEmail(NotificationTypeAlias.PhysicianPartnersCustomerResultReady, EmailTemplateAlias.PhysicianPartnersCustomerResultReady, resultReadyNotification, customer.Id, customer.CustomerId, "EFax System"); } }
public EventCustomerPcpAppointmentEditModel GetEventCustomerEventModel(long eventcustomerId) { var eventCustomer = _eventCustomerRepository.GetById(eventcustomerId); var account = _corporateAccountRepository.GetbyEventId(eventCustomer.EventId); var customer = _customerRepository.GetCustomer(eventCustomer.CustomerId); var theEvent = _eventRepository.GetById(eventCustomer.EventId); var host = _hostRepository.GetHostForEvent(eventCustomer.EventId); var order = _orderRepository.GetOrder(eventCustomer.CustomerId, eventCustomer.EventId); var eventPackage = _eventPackageRepository.GetPackageForOrder(order.Id); var eventTest = _eventTestRepository.GetTestsForOrder(order.Id); var pcpDispositions = _pcpDispositionRepository.GetByCustomerIdEventId(eventCustomer.CustomerId, eventCustomer.EventId); var pcpAppointment = GetPcpAppointment(eventCustomer, pcpDispositions); PcpDisposition pcpDisposition = null; if (!pcpDispositions.IsNullOrEmpty()) { pcpDisposition = pcpDispositions.OrderByDescending(pd => pd.DataRecorderMetaData.DateCreated).First(); } var customerTest = new List<string>(); if (eventPackage != null) { customerTest.AddRange(eventPackage.Tests.Select(x => x.Test.Name)); } if (eventTest != null && eventTest.Any()) { customerTest.AddRange(eventTest.Select(x => x.Test.Name)); } var model = new EventCustomerPcpAppointmentEditModel { EventCustomerId = eventCustomer.Id, EventId = eventCustomer.EventId, CustomerId = customer.CustomerId, CustomerName = customer.Name, PhoneNumber = customer.HomePhoneNumber, CustomerEmail = customer.Email, ScreeningDate = theEvent.EventDate, HostName = host.OrganizationName, Location = host.Address, ScreenedForTest = customerTest, BookAfterNumberOfDays = account != null ? account.NumberOfDays : 0, NotAbleToSchedule = (pcpAppointment == null && pcpDisposition != null), DispositionId = (pcpAppointment == null && pcpDisposition != null) ? (long)pcpDisposition.Disposition : 0, Notes = (pcpAppointment == null && pcpDisposition != null) ? pcpDisposition.Notes : string.Empty, AppointmentDate = pcpAppointment != null ? pcpAppointment.AppointmentOn.Date : (DateTime?)null, AppointmentTime = pcpAppointment != null ? pcpAppointment.AppointmentOn.ToString("hh:mm: tt") : null, PreferredContactMethod = pcpAppointment != null ? pcpAppointment.PreferredContactMethod : -1, EventDate = theEvent.EventDate }; return model; }
public IEnumerable <ExitInterviewQuestionAnswerEditModel> GetQuestions(long eventCustomerId) { var list = new List <ExitInterviewQuestionAnswerEditModel>(); var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer == null) { return(list); } var questions = _exitInterviewQuestionRepository.GetAllQuestions(); var answers = _exitInterviewAnswerRepository.GetByEventCustomerId(eventCustomerId); var account = _corporateAccountRepository.GetbyEventId(eventCustomer.EventId); if (account == null || !account.AttachGiftCard) { questions = questions.Where(q => !GiftCertificateQuestions.Contains(q.Id)); } foreach (var question in questions) { var model = new ExitInterviewQuestionAnswerEditModel { QuestionId = question.Id, Question = question.Question, Index = question.Index }; var answer = answers.FirstOrDefault(x => x.QuestionId == question.Id); if (answer != null && !string.IsNullOrWhiteSpace(answer.Answer)) { model.Answer = answer.Answer.ToLower() == Boolean.TrueString.ToLower(); } list.Add(model); } return(list); }
public bool UpdateCheckinCheckOutTime(long eventCustomerId, long appointmentId, DateTime?checkInTime, DateTime?checkOutTime) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer == null) { return(false); } _eventCustomerRepository.UpdateCheckInCheckOutTime(eventCustomer.Id, appointmentId, checkInTime, checkOutTime); return(true); }
public void UndoCdRemoveRequest(RefundRequest refundRequest) { var order = _orderRepository.GetOrder(refundRequest.OrderId); var activeOrderDetail = _orderController.GetActiveOrderDetail(order); var cancelledProductDetail = order.OrderDetails.Where(od => od.DetailType == OrderItemType.ProductItem && !od.IsCompleted) .Select(od => od).OrderByDescending(od => od.Id).FirstOrDefault(); if (cancelledProductDetail == null) { throw new Exception("No CD Removal item found in the order."); } var eventCustomer = _eventCustomerRepository.GetById(activeOrderDetail.EventCustomerOrderDetail.EventCustomerId); var isExclusivelyRequested = _shippingDetailService.CheckShippingIsExclusivelyRequested(eventCustomer.EventId, eventCustomer.CustomerId); var product = _productRepository.GetById(cancelledProductDetail.OrderItem.ItemId); product.Price = refundRequest.RequestedRefundAmount; var forOrganizationRoleUser = new OrganizationRoleUser(cancelledProductDetail.ForOrganizationRoleUserId); var creatorOrganizationRoleUser = new OrganizationRoleUser(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); _orderController.AddItem(product, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, OrderStatusState.FinalSuccess); _orderController.PlaceProductOrder(order); SaveProductShipping(cancelledProductDetail, activeOrderDetail, isExclusivelyRequested); var repository = ((IRepository <RefundRequest>)_refundRequestRepository); refundRequest.RequestStatus = (long)RequestStatus.Reverted; refundRequest.RefundRequestResult = new RefundRequestResult { ProcessedOn = DateTime.Now, ProcessedByOrgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId }; repository.Save(refundRequest); }
public ActionResult AdjustAppointment(long eventId, long eventCustomerId, int screeningTime, IEnumerable <long> selectedSlotIds, long packageId, IEnumerable <long> testIds) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); Appointment appointment = null; if (eventCustomer.AppointmentId.HasValue) { appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value); } IEnumerable <EventSchedulingSlot> slots = null; if (appointment == null) { return(Json(new { IsAdjusted = false, IsSlotsAvailable = false, Slots = slots, Message = "Order has been cancelled." }, JsonRequestBehavior.AllowGet)); } if (testIds != null && testIds.Any() && screeningTime > 0) { var eventTests = _eventTestRepository.GetByEventAndTestIds(eventId, testIds); testIds = eventTests.Select(et => et.TestId).ToArray(); } var alreadyBookedSlotIds = appointment.SlotIds; if (!selectedSlotIds.IsNullOrEmpty()) { alreadyBookedSlotIds = alreadyBookedSlotIds.Concat(selectedSlotIds); } var theEvent = _eventRepository.GetById(eventId); slots = _eventSchedulingSlotService.AdjustAppointmentSlot(eventId, screeningTime, alreadyBookedSlotIds, packageId, testIds, theEvent.LunchStartTime, theEvent.LunchDuration); if (slots.IsNullOrEmpty()) { var bookedSlots = _eventSchedulingSlotRepository.GetbyIds(appointment.SlotIds); var timeFrames = _eventSchedulingSlotService.GetAvailableTimeFrames(eventId, screeningTime, null, packageId, testIds, bookedSlots); if (timeFrames.IsNullOrEmpty()) { return(Json(new { IsAdjusted = false, IsSlotsAvailable = false, Slots = slots, Message = "No Slots Available." }, JsonRequestBehavior.AllowGet)); } return(Json(new { IsAdjusted = false, IsSlotsAvailable = true, Slots = slots, Message = "Please select another appointment." }, JsonRequestBehavior.AllowGet)); } //slots = slots.Where(s => !appointment.SlotIds.Contains(s.Id)).ToArray(); return(Json(new { IsAdjusted = true, IsSlotsAvailable = true, Slots = slots, Message = "Appointment Adjusted" }, JsonRequestBehavior.AllowGet)); }
public void DoNoShowCallQueueCustomerChanges(long eventCustomerId, bool isNoShow, DateTime?noShowDateTime) { var appointmentCallQueueId = _callQueueRepository.GetCallQueueByCategory(HealthPlanCallQueueCategory.AppointmentConfirmation).Id; var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer == null) //if wrong eventcustomerId provided { return; } var appointmentDate = _eventCustomerRepository.GetFutureMostAppointmentDateForEventCustomerByCustomerId(eventCustomer.CustomerId); if (appointmentDate != null) { noShowDateTime = null; } _callQueueCustomerRepository.UpdateCallQueueCustomerForNoShow(eventCustomer.CustomerId, appointmentDate, noShowDateTime, appointmentCallQueueId); }
public bool SaveAnswers(FluVaccineConsentModel model, long orgRoleUserId) { var evenntCustomer = _eventCustomerRepository.GetById(model.EventCustomerId); if (evenntCustomer == null) { return(false); } var signatureLocation = _mediaRepository.GetFluVaccineConsentSignatureLocation(evenntCustomer.EventId, evenntCustomer.CustomerId); var version = _fluConsentSignatureRepository.GetLatestVersion(model.EventCustomerId); var fluConsentSignature = new FluConsentSignature { EventCustomerId = model.EventCustomerId, Version = version, IsActive = true, CreatedBy = orgRoleUserId, DateCreated = DateTime.Now }; var answers = new List <FluConsentAnswerModel>(); if (!model.CustomerAnswers.IsNullOrEmpty()) { answers.AddRange(model.CustomerAnswers); } if (!model.ClinicalAnswers.IsNullOrEmpty()) { answers.AddRange(model.ClinicalAnswers); } if (!answers.IsNullOrEmpty()) { var fluConsentAnswers = new List <FluConsentAnswer>(); var answerVersion = _fluConsentAnswerRepository.GetLatestVersion(model.EventCustomerId); foreach (var answer in answers) { var fluConsentAnswer = new FluConsentAnswer { EventCustomerId = model.EventCustomerId, QuestionId = answer.QuestionId, Answer = answer.Answer, Version = answerVersion + 1, IsActive = true, DateCreated = DateTime.Now, CreatedBy = orgRoleUserId }; fluConsentAnswers.Add(fluConsentAnswer); } _fluConsentAnswerRepository.SaveAnswer(fluConsentAnswers); } if (!string.IsNullOrWhiteSpace(model.PatientSignatureBytes)) { var fileName = "PatientSignature_" + Guid.NewGuid() + ".jpg"; var patientImageFile = SaveSignatureImage(model.PatientSignatureBytes, orgRoleUserId, signatureLocation, fileName); fluConsentSignature.SignatureFileId = patientImageFile.Id; fluConsentSignature.ConsentSignedDate = DateTime.Now; } //If Clinical Provider Signature provided before Patient Signature, we will not save the consent data. if (!string.IsNullOrWhiteSpace(model.ClinicalProviderSignatureBytes)) { var fileName = "ClinicalProviderSignature_" + Guid.NewGuid() + ".jpg"; var clinicalProviderImageFile = SaveSignatureImage(model.ClinicalProviderSignatureBytes, orgRoleUserId, signatureLocation, fileName); fluConsentSignature.ClinicalProviderSignatureFileId = clinicalProviderImageFile.Id; } _fluConsentSignatureRepository.Save(fluConsentSignature); var consentQuestion = model.CustomerAnswers.FirstOrDefault(x => x.QuestionId == ReceiveVaccinationQuestionId); if (consentQuestion != null && consentQuestion.Answer.ToLower() == Boolean.TrueString.ToLower()) { evenntCustomer.IsFluVaccineConsentSigned = true; _eventCustomerRepository.Save(evenntCustomer); } else { evenntCustomer.IsFluVaccineConsentSigned = false; _eventCustomerRepository.Save(evenntCustomer); } return(true); }
public CustomerAppointmentViewModel GetPatientDetail(long eventCustomerId) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer == null) { return(null); } var customer = _customerRepository.GetCustomer(eventCustomer.CustomerId); var account = !string.IsNullOrWhiteSpace(customer.Tag) ? _corporateAccountRepository.GetByTagWithOrganization(customer.Tag) : null; var appointment = eventCustomer.AppointmentId.HasValue ? _appointmentRepository.GetById(eventCustomer.AppointmentId.Value) : null; var order = _orderRepository.GetOrderByEventCustomerId(eventCustomerId); var eventPackages = _eventPackageRepository.GetPackagesForEvent(eventCustomer.EventId); var eventTests = _eventTestRepository.GetTestsForEvent(eventCustomer.EventId); var eventpackageId = order.OrderDetails.Where(od => od.OrderItemStatus.OrderStatusState == OrderStatusState.FinalSuccess && od.OrderItem.OrderItemType == OrderItemType.EventPackageItem) .Select(od => od.OrderItem.ItemId).SingleOrDefault(); var eventPackage = eventPackages.SingleOrDefault(ep => eventpackageId == ep.Id); var eventTestIds = order.OrderDetails.Where(od => od.OrderItemStatus.OrderStatusState == OrderStatusState.FinalSuccess && od.OrderItem.OrderItemType == OrderItemType.EventTestItem).Select(od => od.OrderItem.ItemId).ToArray(); var eventTestsonOrder = eventTests.Where(et => eventTestIds.Contains(et.Id)).ToArray(); var address = Mapper.Map <Address, AddressViewModel>(customer.Address); var pcp = _primaryCarePhysicianRepository.Get(eventCustomer.CustomerId); var isParticipationConsentSaved = _participationConsentSignatureRepository.IsSaved(eventCustomerId); var isGiftCardSaved = _eventCustomerGiftCardRepository.IsSaved(eventCustomerId); var isFluConsentSaved = _fluConsentSignatureRepository.IsSaved(eventCustomerId); var isPhysicianRecordRequestSaved = _physicianRecordRequestSignatureRepository.IsSaved(eventCustomerId); var chaperoneSignature = _chaperoneSignatureRepository.GetByEventCustomerId(eventCustomer.Id); var model = new CustomerAppointmentViewModel { CustomerId = customer.CustomerId, EventCustomerId = eventCustomer.Id, FirstName = customer.Name.FirstName, MiddleName = customer.Name.MiddleName, LastName = customer.Name.LastName, Email = customer.Email.ToString(), Address = address, HomePhone = customer.HomePhoneNumber.FormatPhoneNumber, MobileNumber = customer.MobilePhoneNumber.FormatPhoneNumber, MemberId = customer.InsuranceId, Dob = customer.DateOfBirth, Gender = customer.Gender.GetDescription(), HealthPlan = account != null ? account.Name : "", EventId = eventCustomer.EventId, AppointmentId = appointment != null ? appointment.Id : (long?)null, AppointmentTime = appointment != null ? appointment.StartTime : (DateTime?)null, CheckInTime = appointment != null ? appointment.CheckInTime : null, CheckOutTime = appointment != null ? appointment.CheckOutTime : null, Packages = eventPackage != null ? eventPackage.Package.Name : "", Tests = !eventTestsonOrder.IsNullOrEmpty() ? string.Join(", ", eventTestsonOrder.Select(t => t.Test.Name)) : "", HipaaConsent = eventCustomer.HIPAAStatus, PcpConsent = eventCustomer.PcpConsentStatus, MatrixConsent = isParticipationConsentSaved, PhysicianRecordRequest = isPhysicianRecordRequestSaved, GiftCard = isGiftCardSaved, FluVaccine = isFluConsentSaved, Survey = false, ExitInterview = false, NoShow = eventCustomer.AppointmentId.HasValue && eventCustomer.NoShow, LeftWithoutScreening = eventCustomer.AppointmentId.HasValue && eventCustomer.LeftWithoutScreeningReasonId.HasValue, ChaperoneConsent = chaperoneSignature != null ? true : false }; if (pcp != null) { var pcpAddress = pcp.Address != null?Mapper.Map <Address, AddressViewModel>(pcp.Address) : null; model.PrimaryCarePhysician = new PcpInfoViewModel { Name = pcp.Name.FullName, Address = pcpAddress, PhoneNumber = pcp.Primary != null ? pcp.Primary.FormatPhoneNumber : pcp.Secondary != null ? pcp.Secondary.FormatPhoneNumber : "", Fax = pcp.Fax != null ? pcp.Fax.FormatPhoneNumber : "" }; } return(model); }
public bool EndHealthPlanActiveCall([FromBody] EndHealthPlanCallEditModel model) { var isCallQueueRequsted = false; var removeFromCallQueue = false; var callQueueCustomer = _callQueueCustomerRepository.GetById(model.CallQueueCustomerId); if (model.IsSkipped && model.AttemptId > 0) { var attempt = _customerCallQueueCallAttemptRepository.GetById(model.AttemptId); attempt.IsCallSkipped = true; if (!string.IsNullOrEmpty(model.SkipCallNote)) { attempt.SkipCallNote = model.SkipCallNote; } _customerCallQueueCallAttemptRepository.Save(attempt); _callQueueCustomerLockRepository.RelaseCallQueueCustomerLock(attempt.CallQueueCustomerId); var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; callQueueCustomer.Status = CallQueueStatus.Initial; callQueueCustomer.DateModified = DateTime.Now; callQueueCustomer.ModifiedByOrgRoleUserId = orgRoleUserId; callQueueCustomer.CallStatus = (long)CallStatus.CallSkipped; callQueueCustomer.ContactedDate = DateTime.Now; _callQueueCustomerRepository.Save(callQueueCustomer); var customerId = callQueueCustomer.CustomerId.HasValue ? callQueueCustomer.CustomerId.Value : 0; var prospectCustomerId = callQueueCustomer.ProspectCustomerId.HasValue ? callQueueCustomer.ProspectCustomerId.Value : 0; _callQueueCustomerRepository.UpdateOtherCustomerAttempt(attempt.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, false, callQueueCustomer.CallQueueId, callQueueCustomer.CallStatus, callQueueCustomer.ContactedDate); } else if (model.CallId != 0) { Call callCenterCalll = null; if (model.CallId > 0) { callCenterCalll = _callCenterCallRepository.GetById(model.CallId); //if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.IncorrectPhoneNumber) if (callCenterCalll != null && callCenterCalll.Status == (long)CallStatus.TalkedtoOtherPerson) { removeFromCallQueue = true; } } if (!string.IsNullOrEmpty(model.SelectedDisposition)) { var tag = (ProspectCustomerTag)System.Enum.Parse(typeof(ProspectCustomerTag), model.SelectedDisposition); if (tag == ProspectCustomerTag.CallBackLater) { isCallQueueRequsted = true; } else if (tag == ProspectCustomerTag.BookedAppointment || tag == ProspectCustomerTag.HomeVisitRequested || tag == ProspectCustomerTag.MobilityIssue || tag == ProspectCustomerTag.DoNotCall || tag == ProspectCustomerTag.Deceased || tag == ProspectCustomerTag.NoLongeronInsurancePlan || tag == ProspectCustomerTag.MobilityIssues_LeftMessageWithOther || tag == ProspectCustomerTag.DebilitatingDisease || tag == ProspectCustomerTag.InLongTermCareNursingHome || tag == ProspectCustomerTag.PatientConfirmed || tag == ProspectCustomerTag.CancelAppointment || tag == ProspectCustomerTag.ConfirmLanguageBarrier) { removeFromCallQueue = true; } if (tag == ProspectCustomerTag.LanguageBarrier && callQueueCustomer.CustomerId.HasValue && callQueueCustomer.CustomerId.Value > 0) { _customerService.UpdateIsLanguageBarrier(callQueueCustomer.CustomerId.Value, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } if (tag == ProspectCustomerTag.RescheduleAppointment && callQueueCustomer.EventCustomerId.HasValue) { var eventCustomer = _eventCustomerRepository.GetById(callQueueCustomer.EventCustomerId.Value); if (eventCustomer.AppointmentId.HasValue) { var appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value); var eventInfo = _eventService.GetById(eventCustomer.EventId); callQueueCustomer.EventId = eventCustomer.EventId; callQueueCustomer.AppointmentDate = appointment.StartTime; callQueueCustomer.AppointmentDateTimeWithTimeZone = _smsHelper.ConvertToServerTime(appointment.StartTime, eventInfo.EventTimeZone, !DaylightSavingNotApplicableStates.Contains(eventInfo.State)); } } if (tag == ProspectCustomerTag.PatientConfirmed && callQueueCustomer.EventCustomerId.HasValue) { var eventCustomer = _eventCustomerRepository.GetById(callQueueCustomer.EventCustomerId.Value); eventCustomer.IsAppointmentConfirmed = true; eventCustomer.ConfirmedBy = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _eventCustomerRepository.Save(eventCustomer); } } var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _callQueueCustomerContactService.EndActiveCall(callQueueCustomer, model.CallId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue, model.CallOutcomeId, model.SkipCallNote); var customerId = callQueueCustomer.CustomerId ?? 0; var prospectCustomerId = callQueueCustomer.ProspectCustomerId ?? 0; if (prospectCustomerId == 0) { var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); if (prospectCustomer != null) { prospectCustomerId = prospectCustomer.Id; } } _callQueueCustomerRepository.UpdateOtherCustomerAttempt(model.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, model.CallOutcomeId); } //_callQueueCustomerRepository.UpdateOtherCustomerAttempt(model.CallQueueCustomerId, customerId, prospectCustomerId, orgRoleUserId, callQueueCustomer.CallDate, removeFromCallQueue, callQueueCustomer.CallQueueId, model.CallOutcomeId); return(true); }
public EventCustomerAggregate GetEventCustomerAggregate(long eventCustomerId) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); return(_eventCustomerAggregateFactory.CreateEventCustomerAggregate(eventCustomer)); }
private void PostResultAccountWise(CorporateAccount corporateAccount, string destinationFolderPdf) { try { _resultPdfPostedXml = null; //_anthemPdfCrossWalkVeiwModel = null; _resultPdfNotPosted = null; var customerResultObject = new AnthemResultPostedViewModel { Tag = corporateAccount.Tag, DestinationFilePath = destinationFolderPdf, ExportToTime = DateTime.Now.AddHours(-1), CorporateAccount = corporateAccount, }; var customerResults = GetEventCustomersToPostResult(customerResultObject); foreach (var ecr in customerResults) { try { customerResultObject.EventCustomerResult = ecr; SetSourcePath(customerResultObject); if (File.Exists(customerResultObject.SourceFilePath)) { var ec = _eventCustomerRepository.GetById(ecr.Id); if (ec.AwvVisitId.HasValue) { try { _logger.Info(" fetching NPI info for VistId :" + ec.AwvVisitId.Value); var visitDetails = new EhrAssignedNursePractitionerDetails { VisitId = ec.AwvVisitId.Value }; // var model = _medicareApiService.PostAnonymous<EhrAssignedNursePractitionerDetails>(_settings.MedicareApiUrl + MedicareApiUrl.AssignedNursePractitionerDetails, visitDetails); var npi = string.Empty; if (!string.IsNullOrWhiteSpace(npi)) { customerResultObject.Npi = npi; _logger.Info("NPI: " + npi + " for VistId :" + ec.AwvVisitId.Value); } else { var mssage = "NPI Is Null or Empty"; mssage = mssage + " for visit id: " + ec.AwvVisitId.Value; _logger.Info(mssage); } } catch (Exception ex) { _logger.Error("exception while fetching NPI information"); _logger.Error("Message: " + ex.Message); _logger.Error("stack Trace: " + ex.StackTrace); AddToResultNotPosted(customerResultObject); continue; } } SetEventCustomerDetail(customerResultObject); SetDestinationFileNameWithoutExt(customerResultObject); PostResultPdf(customerResultObject); } else { AddToResultNotPosted(customerResultObject); } } catch (Exception exception) { _logger.Error(string.Format("some error occurred for the customerId {0}, {1},\n Message {2} \n Stack Trace {3}", ecr.CustomerId, ecr.EventId, exception.Message, exception.StackTrace)); } } SaveExportStartTime(customerResultObject); CreateResultPostedLoger(corporateAccount); SetResultPostedList(corporateAccount.Tag, _resultPdfPostedXml); SaveResultNotPosted(corporateAccount.Tag); } catch (Exception ex) { _logger.Error(string.Format("some error occurred for custom tag: {0} Exception Message: \n{1}, \n stack Trace: \n\t {2} ", corporateAccount.Id, ex.Message, ex.StackTrace)); } finally { _resultPdfPostedXml = null; //_anthemPdfCrossWalkVeiwModel = null; _resultPdfNotPosted = null; _customSettings = null; } }
public bool SendCannedMessage(long eventCustomerId, long customerId) { var customerRepository = IoC.Resolve <ICustomerRepository>(); var customer = customerRepository.GetCustomer(customerId); if (customer.Email == null || string.IsNullOrEmpty(customer.Email.ToString())) { return(true); } var eventCustomerNotificationrepository = IoC.Resolve <IEventCustomerNotificationRepository>(); var messageAlreadySent = eventCustomerNotificationrepository.GetByEventCustomerId(eventCustomerId, NotificationTypeAlias.CannedMessageNotification); if (messageAlreadySent != null) { return(true); } var currentSession = _sessionContext.UserSession.CurrentOrganizationRole; var bodyText = string.Empty; var userService = IoC.Resolve <IUserService>(); var careCoordinatorUser = userService.GetUser(currentSession.OrganizationRoleUserId); if (currentSession.GetSystemRoleId == (long)Roles.HospitalPartnerCoordinator) { var eventCustomer = _eventCustomerRepository.GetById(eventCustomerId); if (eventCustomer.HospitalFacilityId.HasValue && eventCustomer.HospitalFacilityId.Value > 0) { var hospitalFacility = _hospitalFacilityRepository.GetHospitalFacility(eventCustomer.HospitalFacilityId.Value); if (!string.IsNullOrEmpty(hospitalFacility.CannedMessage)) { bodyText = hospitalFacility.CannedMessage; } } if (string.IsNullOrEmpty(bodyText)) { var hospitalPartnerId = currentSession.OrganizationId; var hospitalPartner = _hospitalPartnerRepository.GetHospitalPartnerforaVendor(hospitalPartnerId); bodyText = hospitalPartner.CannedMessage; } } else if (currentSession.CheckRole((long)Roles.HospitalFacilityCoordinator)) { var hospitalFacilityId = currentSession.OrganizationId; var hospitalFacility = _hospitalFacilityRepository.GetHospitalFacility(hospitalFacilityId); if (!string.IsNullOrEmpty(hospitalFacility.CannedMessage)) { bodyText = hospitalFacility.CannedMessage; } else { var hospitalPartnerId = _hospitalFacilityRepository.GetHospitalPartnerId(hospitalFacilityId); if (hospitalPartnerId > 0) { var hospitalPartner = _hospitalPartnerRepository.GetHospitalPartnerforaVendor(hospitalPartnerId); bodyText = hospitalPartner.CannedMessage; } } } var subjectText = "Mail from Care coordinator"; var notifier = IoC.Resolve <INotifier>(); var notification = notifier.NotifyCannedEmail(NotificationTypeAlias.CannedMessageNotification, careCoordinatorUser.Email, customer.Email.ToString(), subjectText, bodyText, customer.Id, currentSession.OrganizationRoleUserId, "Canned Message"); if (notification != null) { var eventCustomerNotification = new EventCustomerNotification { EventCustomerId = eventCustomerId, NotificationId = notification.Id, NotificationTypeId = notification.NotificationType.Id }; eventCustomerNotificationrepository.Save(eventCustomerNotification); } return(true); }
public void SaveCheckListAnswer(CheckListAnswerEditModel model, long orgUserId, long userLoginLogId, string token) { if (model.Answers.IsNullOrEmpty()) { return; } var eventCustomer = ((IUniqueItemRepository <EventCustomer>)_eventCustomerRepository).GetById(model.EventCustomerId); var lastestVersion = model.Version; if (model.Version == 0) { lastestVersion = _checkListAnswerRepository.GetLatestVersion(model.EventCustomerId); } if (model.Answers.IsNullOrEmpty()) { return; } var checklistAnswer = new List <CheckListAnswer>(); foreach (var answer in model.Answers) { checklistAnswer.Add(new CheckListAnswer { Answer = answer.Answer, QuestionId = answer.QuestionId, Version = lastestVersion + 1, Id = model.EventCustomerId, IsActive = true, DataRecorderMetaData = new DataRecorderMetaData(orgUserId, DateTime.Now, null), Type = (long)CheckListType.CheckList }); } _checkListAnswerRepository.SaveAnswer(checklistAnswer); try { var result = _eventCustomerResultRepository.GetById(model.EventCustomerId); if (token != "" && (result == null || result.ResultState < (long)TestResultStateNumber.PreAudit)) { var questionIds = model.Answers.Where(x => TestQuestionList.Contains(x.QuestionId)).Select(x => x.QuestionId); if (!questionIds.IsNullOrEmpty()) { var testIdsToBeUpdated = GetStandingOrderTest(questionIds); if (!testIdsToBeUpdated.IsNullOrEmpty()) { UpdateCustomerOrder(eventCustomer.EventId, eventCustomer.CustomerId, testIdsToBeUpdated, orgUserId); } } } } catch (Exception ex) { _logger.Error(string.Format("Some Error Occurred While Customer Updating Order. Exception Message {0} \t\n Stack Trace: {1}", ex.Message, ex.StackTrace)); } if (_settings.SyncWithHra) { if (token != "") { try { var visitId = _eventCustomerRepository.GetById(model.EventCustomerId).AwvVisitId; if (visitId.HasValue) { var answers = new MedicareStandingOrderViewModel { PatientVisitId = visitId.Value, Version = lastestVersion + 1, IsSync = true, Questions = model.Answers.Select(answer => new MedicareCheckListQuestionViewModel { Answer = answer.Answer, QuestionId = answer.QuestionId }).ToList() }; try { _medicareApiService.Connect(userLoginLogId); } catch (Exception) { var auth = new MedicareAuthenticationModel { UserToken = token, CustomerId = 0, OrgName = _settings.OrganizationNameForHraQuestioner, Tag = _settings.OrganizationNameForHraQuestioner, IsForAdmin = false, RoleAlias = "CallCenterRep" }; _medicareApiService.PostAnonymous <string>(_settings.MedicareApiUrl + MedicareApiUrl.AuthenticateUser, auth); _medicareApiService.Connect(userLoginLogId); } _medicareApiService.Post <bool>(MedicareApiUrl.SaveCheckList, answers); } } catch (Exception ex) { _logger.Error(string.Format("Some Error Occured Whicle Saving Checklist Answer To MEDICARE\n Exception Message {0} \t\n Stack Trace: {1}", ex.Message, ex.StackTrace)); } } } else { _logger.Info("Syncing with HRA is off "); } }
public bool Save(GiftCertificateSignatureModel model, long orgRoleUserId) { var evenntCustomer = _eventCustomerRepository.GetById(model.EventCustomerId); if (evenntCustomer == null) { return(false); } var signatureLocation = _mediaRepository.GetGiftCardSignatureLocation(evenntCustomer.EventId, evenntCustomer.CustomerId); var version = _eventCustomerGiftCardRepository.GetLatestVersion(model.EventCustomerId); var giftCardSignature = new EventCustomerGiftCard() { EventCustomerId = model.EventCustomerId, GiftCardReceived = model.GiftCardReceived, Version = version, IsActive = true, CreatedBy = orgRoleUserId, DateCreated = DateTime.Now }; if (!string.IsNullOrWhiteSpace(model.PatientSignatureBytes)) { var fileName = "PatientSignature_GiftCard_" + Guid.NewGuid() + ".jpg"; var patientImageFile = SaveSignatureImage(model.PatientSignatureBytes, orgRoleUserId, signatureLocation, fileName); giftCardSignature.PatientSignatureFileId = patientImageFile.Id; } if (!string.IsNullOrWhiteSpace(model.TechnicianSignatureBytes)) { var fileName = "TechnicianSignature_GiftCard_" + Guid.NewGuid() + ".jpg"; var technicianImageFile = SaveSignatureImage(model.TechnicianSignatureBytes, orgRoleUserId, signatureLocation, fileName); giftCardSignature.TechnicianSignatureFileId = technicianImageFile.Id; } _eventCustomerGiftCardRepository.Save(giftCardSignature); if (model.GiftCardReceived) { evenntCustomer.IsGiftCertificateDelivered = true; evenntCustomer.GiftCode = model.GiftCardNumber; _eventCustomerRepository.Save(evenntCustomer); } else { if (model.GcNotGivenReasonId != null && model.GcNotGivenReasonId > 0) { evenntCustomer.GcNotGivenReasonId = model.GcNotGivenReasonId; evenntCustomer.IsGiftCertificateDelivered = false; _eventCustomerRepository.Save(evenntCustomer); } } return(true); }