private string PrintHealthAssessmentForm(HealthAssessmentFormEditModel model) { var mediaLocation = _mediaRepository.GetTempMediaFileLocation(); var fileName = model.EventId + "_" + model.CustomerId + ".pdf"; var url = _settings.AppUrl + "/Medical/Results/HealthAssessment?customerId=" + model.CustomerId + "&eventId=" + model.EventId + "&Print=" + model.Print + "&PrintBlank=" + model.PrintBlank + "&LoadLayout=false"; var basicBiometricFile = string.Empty; if (model.PrintKynBasicBiomertic && model.IsKynPurchased) { var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId); var kynBasicBiometricPdf = PrintKynBasicBiometric(eventCustomer.Id, mediaLocation); basicBiometricFile = mediaLocation.PhysicalPath + kynBasicBiometricPdf; } else if (model.PrintLipidBasicBiomertic) { var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId); var lipidBasicBiometricPdf = PrintLipidBasicBiometric(eventCustomer.Id, mediaLocation); basicBiometricFile = mediaLocation.PhysicalPath + lipidBasicBiometricPdf; } _pdfGenerator.GeneratePdfForHaf(url, mediaLocation.PhysicalPath + fileName, "", basicBiometricFile, ""); _pdfGenerator.PaperSize = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PaperSize); return(mediaLocation.Url + fileName); }
public void UpdateHippaStatusforEventIdCustomerId(long eventId, long customerId, short hippaStatus) { var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); if (eventCustomer == null) { return; } _eventCustomerRepository.UpdateHippaStatus(eventCustomer.Id, hippaStatus); }
public bool CodingCompleted(MedicareCustomerResultCodedViewModel codingCompleted) { try { _logger.Info("Running CodingCompled API for Aces for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId); if (string.IsNullOrWhiteSpace(codingCompleted.EmployeeId)) { _logger.Info("EmployeeId is blank. CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId); return(false); } var oru = _organizationRoleUserRepository.GetOrganizationRoleUserByEmployeeIdandRoleId(codingCompleted.EmployeeId, (long)Roles.Coder); if (oru == null) { _logger.Info("EmployeeId or Coder role not exist. CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId); return(false); } var account = _corporateAccountRepository.GetbyEventId(codingCompleted.EventId); if (account != null && account.IsHealthPlan) { var eventCustomer = _eventCustomerRepository.Get(codingCompleted.EventId, codingCompleted.CustomerId); var isTestPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV); var theEvent = _eventRepository.GetById(codingCompleted.EventId); var questionnaireType = _accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(account.Id, theEvent.EventDate); if ((questionnaireType != QuestionnaireType.HraQuestionnaire) || !isTestPurchased) { _testResultService.SaveCustomerResultCoded(codingCompleted, oru); _logger.Info("customer result state Updated for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId); } else { _logger.Info("Only HRA is allowed to update for customer Id: " + codingCompleted.CustomerId + " EventId: " + codingCompleted.EventId); return(false); } } else { _logger.Info("Coding Completed can be marked only for HealthPlan Events. Customer Id: " + codingCompleted.CustomerId + " EventId: " + codingCompleted.EventId); return(false); } _logger.Info("completed CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId + " Successfully"); return(true); } catch (Exception ex) { _logger.Info("completed CodingCompleted API for Customer Id: " + codingCompleted.CustomerId + " EventId : " + codingCompleted.EventId + " With Error"); _logger.Error("Message: " + ex.Message); _logger.Error("StackTrace: " + ex.StackTrace); return(false); } }
public void UpdateEventCustomerPreApprovedTest(long eventId, long customerId) { var preApprovedTest = _preApprovedTestRepository.GetByCustomerId(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var preApprovedPackages = _preApprovedPackageRepository.GetByCustomerId(customerId); if (preApprovedTest != null && preApprovedTest.Any() && eventCustomer != null) { _eventCustomerPreApprovedTestRepository.Save(eventCustomer.Id, preApprovedTest.Select(x => x.TestId)); } _eventCustomerPreApprovedPackageTestRepository.DeletePreApprovedPackageTests(eventCustomer.Id); if (preApprovedPackages != null && preApprovedPackages.Any()) { foreach (var preApprovedPackage in preApprovedPackages) { var preApprovedPacakgeTests = _packageTestRepository.GetbyPackageId(preApprovedPackage.PackageId); if (preApprovedPacakgeTests != null && preApprovedPacakgeTests.Any()) { _eventCustomerPreApprovedPackageTestRepository.Save(eventCustomer.Id, preApprovedPackage.PackageId, preApprovedPacakgeTests.Select(x => x.TestId)); } } } }
public ActionResult EditHospitalPartnerCustomer(HospitalPartnerCustomerEditModel model) { try { if (ModelState.IsValid) { var currentSession = _sessionContext.UserSession.CurrentOrganizationRole; var customer = Mapper.Map <HospitalPartnerCustomerEditModel, HospitalPartnerCustomer>(model); customer.CareCoordinatorOrgRoleUserId = currentSession.OrganizationRoleUserId; customer.DataRecorderMetaData = new DataRecorderMetaData(currentSession.OrganizationRoleUserId, DateTime.Now, DateTime.Now); _hospitalPartnerCustomerRepository.Save(customer); var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId); SavePcp(model.CustomerId, model.PrimaryCarePhysicianName, currentSession.OrganizationRoleUserId, eventCustomer.Id); model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("The Information updated uccessfully"); return(View(model)); } return(View(model)); } catch (Exception ex) { model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Failure. Message: " + ex.Message); return(View(model)); } }
public PatientWorksheet GetPatientWorksheetModel(long customerId, long eventId) { var customer = _customerRepository.GetCustomer(customerId); var theEvent = _eventRepository.GetById(eventId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); return(GetPatientWorksheetModel(customer, theEvent, eventCustomer)); }
public CheckListFormEditModel GetCustomerCheckListEdtiModel(long customerId, long eventId) { var customer = _customerRepository.GetCustomer(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var account = _corporateAccountRepository.GetForEventIdWithOrganizationDetail(eventId); return(GetCustomerCheckListEdtiModel(customer, account, eventCustomer)); }
public bool ProcessPayment(PaymentEditModel model) { var customer = _customerRepository.GetCustomer(model.CustomerId); var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId); var instruments = new List <PaymentInstrumentEditModel>(); var paymentEditModel = new PaymentModel(); if (model.GcPayment != null && !string.IsNullOrEmpty(model.GcPayment.ClaimCode)) { var giftCertificate = _giftCertificateService.GetGiftCertificatebyClaimCode(model.GcPayment.ClaimCode); instruments.Add(new PaymentInstrumentEditModel { Amount = model.GcPayment.Amount, PaymentType = PaymentType.GiftCertificate.PersistenceLayerId, GiftCertificate = new GiftCertificatePaymentEditModel { GiftCertificate = giftCertificate, GiftCertificatePayment = new GiftCertificatePayment { GiftCertificateId = giftCertificate.Id, Amount = model.GcPayment.Amount } } }); } if (model.Payments != null) { model.Payments.BillingAddress = model.BillingAddress; CreatePaymentModels(model); instruments.Add(model.Payments); } paymentEditModel.Amount = model.UnPaidAmount; paymentEditModel.IsModeMultiple = false; paymentEditModel.PaymentFlow = PaymentFlow.In; paymentEditModel.Payments = instruments; paymentEditModel.ExistingBillingAddress = model.BillingAddress; paymentEditModel.ExistingShippingAddress = model.BillingAddress; _eventSchedulerService.ProcessPayment(paymentEditModel, eventCustomer.Id, model.CustomerId, true); try { _order = _orderRepository.GetOrder(model.CustomerId, model.EventId); if (paymentEditModel.Payments != null && paymentEditModel.Payments.Any(p => p.ChargeCard != null || p.ECheck != null || p.GiftCertificate != null || p.Check != null || p.PaymentType == PaymentType.Cash.PersistenceLayerId)) { var paymentId = _paymentController.SavePayment(paymentEditModel, model.CustomerId); _orderRepository.ApplyPaymentToOrder(_order.Id, paymentId); } } catch (Exception exception) { throw new Exception("Some error occured while saving payment detail", exception); } return(true); }
public EventCustomerPcpAppointmentViewModel GetEventCustomerPcpAppointmentViewModel(long eventId, long customerId) { var account = _corporateAccountRepository.GetbyEventId(eventId); var customer = _customerRepository.GetCustomer(customerId); var theEventData = _eventRepository.GetById(eventId); var pcp = _primaryCarePhysicianRepository.Get(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); return GetEventCustomerPcpAppointmentViewModel(theEventData, customer, account, pcp, eventCustomer); }
public GiftCertificateViewModel GetModel(long eventId, long customerId) { var eventData = _eventRepository.GetById(eventId); var customer = _customerRepository.GetCustomer(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var account = _corporateAccountRepository.GetbyEventId(eventId); var patientGiftCardSignatureUrl = string.Empty; var technicianGiftCardSignatureUrl = string.Empty; var giftCardSignatureMediaLocation = _mediaRepository.GetGiftCardSignatureLocation(eventId, customerId); var giftCertificateSignature = _eventCustomerGiftCardRepository.GetByEventCustomerId(eventCustomer.Id); if (giftCertificateSignature != null && (giftCertificateSignature.PatientSignatureFileId.HasValue || giftCertificateSignature.TechnicianSignatureFileId.HasValue)) { var signatureFileIds = new List <long>(); if (giftCertificateSignature.PatientSignatureFileId.HasValue) { signatureFileIds.Add(giftCertificateSignature.PatientSignatureFileId.Value); } if (giftCertificateSignature.TechnicianSignatureFileId.HasValue) { signatureFileIds.Add(giftCertificateSignature.TechnicianSignatureFileId.Value); } var signatureFiles = _fileRepository.GetByIds(signatureFileIds); if (giftCertificateSignature.PatientSignatureFileId.HasValue) { var patientFile = signatureFiles.First(x => x.Id == giftCertificateSignature.PatientSignatureFileId.Value); patientGiftCardSignatureUrl = giftCardSignatureMediaLocation.Url + patientFile.Path; } if (giftCertificateSignature.TechnicianSignatureFileId.HasValue) { var technicianFile = signatureFiles.First(x => x.Id == giftCertificateSignature.TechnicianSignatureFileId.Value); technicianGiftCardSignatureUrl = giftCardSignatureMediaLocation.Url + technicianFile.Path; } } return(new GiftCertificateViewModel { CustomerId = customer.CustomerId, CustomerName = customer.Name, EventDate = eventData.EventDate, GiftAmmount = account.GiftCardAmount ?? 0, GiftCardReceived = giftCertificateSignature != null ? giftCertificateSignature.GiftCardReceived : (bool?)null, PatientSignatureUrl = patientGiftCardSignatureUrl, TechnicianSignatureUrl = technicianGiftCardSignatureUrl }); }
private void SaveBasicBiometric(DataRow dr) { var systolicRight = GetDataReading(ColumnForSystolicRight, dr); var systolicLeft = GetDataReading(ColumnForSystolicLeft, dr); var diastolicRight = GetDataReading(ColumnForDiastolicRight, dr); var diastolicLeft = GetDataReading(ColumnForDiastolicLeft, dr); if (systolicLeft == null && systolicRight == null && diastolicLeft == null && diastolicRight == null) { return; } var funcIscomplete = new Func <int?, int?, bool>((a, b) => a != null && b != null); var funcIsPartial = new Func <int?, int?, bool>((a, b) => a != null || b != null); var isLeftComplete = funcIscomplete(systolicLeft, diastolicLeft); var isRightComplete = funcIscomplete(systolicRight, diastolicRight); var isLeftPartial = funcIsPartial(systolicLeft, diastolicLeft); var isRightPartial = funcIsPartial(systolicRight, diastolicRight); if (!isLeftPartial && !isLeftComplete && !isRightPartial && !isRightComplete) { return; } var eventCustomer = _eventCustomerRepository.Get(_eventId, _customerId); var biometric = new BasicBiometric { Id = eventCustomer.Id, SystolicPressure = systolicRight, DiastolicPressure = diastolicRight, IsRightArmBpMeasurement = true, CreatedByOrgRoleUserId = _updatedBy, CreatedOn = DateTime.Now }; if (!isRightComplete && isLeftComplete) { biometric.SystolicPressure = systolicLeft; biometric.DiastolicPressure = diastolicLeft; } _basicBiometricRepository.Save(biometric); }
public HealthAssessmentHeaderEditModel GetModel(long eventId, long customerId) { var eventData = _eventRepository.GetById(eventId); var customer = _customerRepository.GetCustomer(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var pcp = _primaryCarePhysicianRepository.Get(customerId); var physicianName = string.Empty; if (pcp != null && pcp.Name != null) { physicianName = pcp.Name.FullName; } var participationConsent = new ParticipationConsentModel(); var participationConsentMediaLocation = _mediaRepository.GetParticipationConsentSignatureLocation(eventId, customerId); var participationConsentSignature = _participationConsentSignatureRepository.GetByEventCustomerId(eventCustomer.Id); if (participationConsentSignature != null) { var signatureFileIds = new[] { participationConsentSignature.SignatureFileId, participationConsentSignature.InsuranceSignatureFileId }; var signatureFiles = _fileRepository.GetByIds(signatureFileIds); var participationSignatreFile = signatureFiles.First(x => x.Id == participationConsentSignature.SignatureFileId); participationConsent.SignatureImageUrl = participationConsentMediaLocation.Url + participationSignatreFile.Path; participationConsent.ConsentSignedDate = participationConsentSignature.ConsentSignedDate.ToString("MM/dd/yyyy"); var insuranceSignatureFile = signatureFiles.First(x => x.Id == participationConsentSignature.InsuranceSignatureFileId); participationConsent.InsuranceSignatureImageUrl = participationConsentMediaLocation.Url + insuranceSignatureFile.Path; participationConsent.InsuranceConsentSignedDate = participationConsentSignature.InsuranceConsentSignedDate.ToString("MM/dd/yyyy"); } return(new HealthAssessmentHeaderEditModel { CustomerId = customer.CustomerId, CustomerName = customer.Name, DateofBirth = customer.DateOfBirth, EventDate = eventData.EventDate, EventId = eventData.Id, PhysicianName = physicianName, ParticipationConsent = participationConsent }); }
public AwvPcpConsentViewModel GetAwvPcpConsentViewModel(long customerId, long eventId) { var customer = _customerRepository.GetCustomer(customerId); var pcp = _primaryCarePhysicianRepository.Get(customer.CustomerId); var eventData = _eventRepository.GetById(eventId); string signatureUrl = string.Empty; DateTime?signedDate = null; var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var mediaLocation = _mediaRepository.GetPhysicianRecordRequestSignatureLocation(eventId, customerId); var physicianRecordRequest = _physicianRecordRequestSignatureRepository.GetByEventCustomerId(eventCustomer.Id); if (physicianRecordRequest != null) { var signatureFile = _fileRepository.GetById(physicianRecordRequest.SignatureFileId); signatureUrl = mediaLocation.Url + signatureFile.Path; signedDate = physicianRecordRequest.ConsentSignedDate; } return(GetAwvPcpConsentViewModel(customer, eventData, pcp, signatureUrl, signedDate)); }
public FluVaccinationConsentViewModel GetFluVaccinationConsentViewModel(long eventId, long customerId) { var eventData = _eventRepository.GetById(eventId); var host = _hostRepository.GetHostForEvent(eventId); var customer = _customerRepository.GetCustomer(customerId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var answers = _fluConsentAnswerRepository.GetByEventCustomerId(eventCustomer.Id); var questions = _fluConsentQuestionRepository.GetAllQuestions(); var signature = _fluConsentSignatureRepository.GetByEventCustomerId(eventCustomer.Id); var signatureFileIds = signature != null ? new[] { signature.SignatureFileId } : null; if (signature != null && signature.ClinicalProviderSignatureFileId.HasValue) { signatureFileIds = new[] { signature.SignatureFileId, signature.ClinicalProviderSignatureFileId.Value }; } var signatureFiles = !signatureFileIds.IsNullOrEmpty() ? _fileRepository.GetByIds(signatureFileIds) : null; return(GetFluVaccinationConsentViewModel(eventData, customer, host, questions, answers, signature, signatureFiles)); }
public void CreateOrder(TempCart tempCart, PaymentEditModel paymentEditModel = null) { if (tempCart.EventId == null || tempCart.CustomerId == null || tempCart.AppointmentId == null || (tempCart.EventPackageId == null && string.IsNullOrEmpty(tempCart.TestId))) { return; } var customer = _customerRepository.GetCustomer(tempCart.CustomerId.Value); var inDb = _eventCustomerRepository.Get(tempCart.EventId.Value, tempCart.CustomerId.Value); var eventCustomer = new EventCustomer { Id = inDb != null ? inDb.Id : 0, EventId = tempCart.EventId.Value, CustomerId = tempCart.CustomerId.Value, DataRecorderMetaData = new DataRecorderMetaData { DataRecorderCreator = new OrganizationRoleUser(tempCart.CustomerId.Value), DateCreated = DateTime.Now }, OnlinePayment = true, MarketingSource = tempCart.MarketingSource, NoShow = false, TestConducted = false, HIPAAStatus = RegulatoryState.Unknown, EnableTexting = customer.EnableTexting }; using (var scope = new TransactionScope()) { var appointment = _eventAppointmentService.CreateAppointment(tempCart.InChainAppointmentSlotIds, tempCart.CustomerId.Value); eventCustomer.AppointmentId = appointment.Id; eventCustomer = _eventCustomerRepository.Save(eventCustomer); //Moved code into ProcessPayment to Extract Common Code for API and Service ProcessPayment(paymentEditModel, eventCustomer.Id, customer.CustomerId, false); var orderables = new List <IOrderable>(); if (tempCart.EventPackageId.HasValue) { orderables.Add(_eventPackageRepository.GetById(tempCart.EventPackageId.Value)); } var testIds = new List <long>(); if (!string.IsNullOrEmpty(tempCart.TestId)) { string[] testIdStrings = tempCart.TestId.Split(new[] { ',' }); foreach (var testIdString in testIdStrings) { int i = 0; if (int.TryParse(testIdString, out i)) { testIds.Add(i); } } } if (testIds.Count > 0) { var eventTests = _eventTestRepository.GetbyIds(testIds); if (tempCart.EventPackageId.HasValue) { foreach (var eventTest in eventTests) { eventTest.Price = eventTest.WithPackagePrice; } } orderables.AddRange(eventTests); } IEnumerable <ElectronicProduct> products = null; var productIds = new List <long>(); if (!string.IsNullOrEmpty(tempCart.ProductId)) { string[] productIdStrings = tempCart.ProductId.Split(new[] { ',' }); foreach (var productIdIdString in productIdStrings) { int i = 0; if (int.TryParse(productIdIdString, out i)) { productIds.Add(i); } } } if (productIds.Count > 0) { products = _productRepository.GetByIds(productIds); orderables.AddRange(products); } if (orderables.IsNullOrEmpty()) { return; } SourceCode sourceCode = null; if (tempCart.SourceCodeId.HasValue && tempCart.SourceCodeId.Value > 0) { var sourceCodeModel = GetSourceCodeApplied(tempCart); sourceCode = new SourceCode { Id = sourceCodeModel.SourceCodeId, CouponCode = sourceCodeModel.SourceCode, CouponValue = sourceCodeModel.DiscountApplied }; } var shippingAddress = tempCart.ShippingAddressId.HasValue ? _addressRepository.GetAddress(tempCart.ShippingAddressId.Value) : null; ShippingDetail shippingDetail = null; if (tempCart.ShippingId != null && tempCart.ShippingId.Value > 0) { var shippingOption = _shippingOptionRepository.GetById(tempCart.ShippingId.Value); shippingDetail = new ShippingDetail { ShippingOption = shippingOption, ShippingAddress = shippingAddress, Status = ShipmentStatus.Processing, ActualPrice = shippingOption.Price, DataRecorderMetaData = new DataRecorderMetaData(tempCart.CustomerId.Value, DateTime.Now, null) }; shippingDetail = _shippingController.OrderShipping(shippingDetail); } bool indentedLineItemsAdded = false; // TODO: applying hook to the system all the indented line items will be attached to the first order item. foreach (var orderable in orderables) { if (!indentedLineItemsAdded && (orderable.OrderItemType == OrderItemType.EventPackageItem || orderable.OrderItemType == OrderItemType.EventTestItem)) { _orderController.AddItem(orderable, 1, tempCart.CustomerId.Value, tempCart.CustomerId.Value, sourceCode, eventCustomer, shippingDetail, OrderStatusState.FinalSuccess); indentedLineItemsAdded = true; } else { _orderController.AddItem(orderable, 1, tempCart.CustomerId.Value, tempCart.CustomerId.Value, OrderStatusState.FinalSuccess); } } var order = _orderRepository.GetOrder(tempCart.CustomerId.Value, tempCart.EventId.Value); order = order == null?_orderController.PlaceOrder(OrderType.Retail, tempCart.CustomerId.Value) : _orderController.ActivateOrder(order); if (products != null && products.Count() > 0 && shippingDetail != null) { foreach (var electronicProduct in products) { SaveProductShippingDetail(electronicProduct.Id, order, shippingAddress, customer.CustomerId); } } if (paymentEditModel != null && paymentEditModel.Payments != null && paymentEditModel.Payments.Any(p => p.ChargeCard != null || p.ECheck != null || p.GiftCertificate != null)) { var paymentId = _paymentController.SavePayment(paymentEditModel, tempCart.CustomerId.Value); _orderRepository.ApplyPaymentToOrder(order.Id, paymentId); } scope.Complete(); } }
public EventCustomerConsents UpdateConsentsStatusforEventIdCustomerId(EventCustomerConsents model) { var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId); if (eventCustomer == null) { return(model); } if (model.Hipaa != null) { try { _eventCustomerRepository.UpdateHippaStatus(eventCustomer.Id, (short)model.Hipaa.Status); model.Hipaa.Message = "Updated Successfully"; model.Hipaa.IsSuccess = true; } catch (Exception exception) { model.Hipaa.Message = exception.Message; model.Hipaa.IsSuccess = false; } } if (model.PcpConsent != null) { try { _eventCustomerRepository.UpdatePcpConsentStatus(eventCustomer.Id, (short)model.PcpConsent.Status); model.PcpConsent.Message = "Updated Successfully"; model.PcpConsent.IsSuccess = true; } catch (Exception exception) { model.PcpConsent.Message = exception.Message; model.PcpConsent.IsSuccess = false; } } if (model.PartnerRelease != null) { try { _eventCustomerRepository.UpdatePartnerReleaseStatus(eventCustomer.Id, (short)model.PartnerRelease.Status); model.PartnerRelease.Message = "Updated Successfully"; model.PartnerRelease.IsSuccess = true; } catch (Exception exception) { model.PartnerRelease.Message = exception.Message; model.PartnerRelease.IsSuccess = false; } } if (model.AbnConsent != null) { try { _eventCustomerRepository.UpdateAbnStatus(eventCustomer.Id, (short)model.AbnConsent.Status); model.AbnConsent.Message = "Updated Successfully"; model.AbnConsent.IsSuccess = true; } catch (Exception exception) { model.AbnConsent.Message = exception.Message; model.AbnConsent.IsSuccess = false; } } if (model.InsuranceRelease != null) { try { _eventCustomerRepository.UpdateInsuranceReleaseStatus(eventCustomer.Id, (short)model.InsuranceRelease.Status); model.InsuranceRelease.Message = "Updated Successfully"; model.InsuranceRelease.IsSuccess = true; } catch (Exception exception) { model.InsuranceRelease.Message = exception.Message; model.InsuranceRelease.IsSuccess = false; } } return(model); }
private bool ParseValidationCheck(string fileName, string filePath, out long eventId, out long customerId, out TestType testTypeId) { EventCustomer eventCustomer = null; string errorMessage = string.Empty; string testName = string.Empty; eventId = 0; customerId = 0; testTypeId = 0; try { var temp = fileName.Split('_'); if (temp.Length < 3) { _loggerForClient.Info("Incorrect format Name formate for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } var customerIdString = temp[0]; var eventIdString = temp[1]; testName = Convert.ToString(temp[2]); if (!long.TryParse(eventIdString, out eventId)) { _loggerForClient.Info("Incorrect format of Event Id : " + eventIdString + " for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } if (eventId <= 0) { _loggerForClient.Info("Incorrect Event Id : " + customerIdString + " for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } string labParseLogger = "LabParseLogger_" + eventIdString; _labParseEventLogger = _logManager.GetLogger(labParseLogger); if (!Enum.TryParse(testName, true, out testTypeId)) { errorMessage = "Test Name incorrect :" + testName + " for pdf filename (" + fileName + ")."; _labParseEventLogger.Error(errorMessage); _loggerForClient.Info("Test Name incorrect :" + testName + " for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } if (!long.TryParse(customerIdString, out customerId)) { _labParseEventLogger.Info("Incorrect format of Customer Id : " + customerIdString + " for pdf filename (" + fileName + ")."); _loggerForClient.Info("Incorrect format of Customer Id : " + customerIdString + " for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } if (customerId <= 0) { _labParseEventLogger.Info("Incorrect Customer Id : " + customerIdString + " for pdf filename (" + fileName + ")."); _loggerForClient.Info("Incorrect Customer Id : " + customerIdString + " for pdf filename (" + fileName + ")."); MovedParsedFile(filePath); return(false); } eventCustomer = _eventCustomerRepository.Get(eventId, customerId); if (eventCustomer == null) { var message = "customer : " + customerId + " has not been " + eventId + " booked appointment for pdf filename (" + fileName + ")."; _labParseEventLogger.Info(message); _loggerForClient.Info(message); MovedParsedFile(filePath); return(false); } if (eventCustomer.AppointmentId.HasValue == false) { errorMessage = "customer appointment has been canceled Customer Id: " + customerId + ", EventId : " + eventId + " for pdf filename (" + fileName + ")."; _labParseEventLogger.Info(errorMessage); _loggerForClient.Info(errorMessage); MovedParsedFile(filePath); return(false); } if (eventCustomer.NoShow == true) { errorMessage = "customer has been marked as No Show Customer Id: " + customerId + ", EventId : " + eventId + " for pdf filename (" + fileName + ")."; _labParseEventLogger.Info(errorMessage); _loggerForClient.Info(errorMessage); MovedParsedFile(filePath); return(false); } if (eventCustomer.LeftWithoutScreeningReasonId.HasValue) { errorMessage = "customer has been marked as Left without screening Id: " + customerId + ", EventId : " + eventId + " for pdf filename (" + fileName + ")."; _labParseEventLogger.Info(errorMessage); _loggerForClient.Info(errorMessage); MovedParsedFile(filePath); return(false); } } catch (Exception ex) { errorMessage = "PDF File name (" + fileName + ") is incorrect format. Exception is :" + ex.Message; _labParseEventLogger.Error(errorMessage); _loggerForClient.Info("PDF File name: " + fileName + " is incorrect format."); MovedParsedFile(filePath); return(false); } var isTestPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)testTypeId); if (!isTestPurchased) { errorMessage = string.Format("Customer Id :" + customerId + " Test: " + testName + " not purchased for event Id :" + eventId + " and pdf filename (" + fileName + ")"); _labParseEventLogger.Info(errorMessage); _loggerForClient.Info("Customer Id :" + customerId + " is not purchased test (" + testName + ") for event Id: " + eventId + " and pdf filename (" + fileName + ")"); MovedParsedFile(filePath); return(false); } return(true); }
public void SendAppointmentConfirmationMail(Customer customer, Event eventData, long createdByOrgRoleUserId, string source, CorporateAccount account) { var sendNotification = false; if (eventData.EventType == EventType.Retail) { sendNotification = true; } else if (eventData.AccountId.HasValue && eventData.AccountId.Value > 0 && account != null) { // account = ((IUniqueItemRepository<CorporateAccount>)_corporateAccountRepository).GetById(eventData.AccountId.Value); sendNotification = account.SendAppointmentMail && account.AppointmentConfirmationMailTemplateId > 0; } if (sendNotification) { var appointmentConfirmationViewModel = _emailNotificationModelsFactory.GetAppointmentConfirmationModel(eventData.Id, customer.CustomerId); string emailTemplateAlias = EmailTemplateAlias.AppointmentConfirmationWithEventDetails; if (account != null && account.AppointmentConfirmationMailTemplateId > 0) { var emailTemplate = _emailTemplateRepository.GetById(account.AppointmentConfirmationMailTemplateId); emailTemplateAlias = emailTemplate.Alias; } _notifier.NotifySubscribersViaEmail(NotificationTypeAlias.AppointmentConfirmationWithEventDetails, emailTemplateAlias, appointmentConfirmationViewModel, customer.Id, createdByOrgRoleUserId, source, useAlternateEmail: true); } var eventCustomer = _eventCustomerRepository.Get(eventData.Id, customer.CustomerId); if (customer.IsSubscribed == null || customer.IsSubscribed.Value == false) { _logger.Info("Customer has not subscribed for SMS " + customer.CustomerId); return; } if (account != null && !account.EnableSms) { _logger.Info("SMS feature has been disabled by corporate account: " + account.Tag + " EventId: " + eventData.Id); return; } var messageAlreadySentList = _eventCustomerNotificationRepository.GetAllByEventCustomerId(eventCustomer.Id, NotificationTypeAlias.AppointmentConfirmation); var messageCount = (messageAlreadySentList != null && messageAlreadySentList.Any()) ? messageAlreadySentList.Count() : 0; if (account != null && messageCount >= account.MaximumSms) { _logger.Info(string.Format("Maximum Number of reminder message sms has been sent for this event. eventId {0} Customer Id: {1}", eventCustomer.EventId, eventCustomer.Id)); return; } var smsTemplateAlias = EmailTemplateAlias.AppointmentConfirmation; if (account != null && account.ConfirmationSmsTemplateId.HasValue && account.ConfirmationSmsTemplateId.Value > 0) { var smsTemplate = _emailTemplateRepository.GetById(account.ConfirmationSmsTemplateId.Value); smsTemplateAlias = smsTemplate.Alias; } if (eventCustomer.EnableTexting) { var smsAppointmentConfirmation = _smsNotificationModelsFactory.GetScreeningReminderSmsNotificationModel(customer, eventData); var notification = _notifier.NotifyViaSms(NotificationTypeAlias.AppointmentConfirmation, smsTemplateAlias, smsAppointmentConfirmation, customer.Id, createdByOrgRoleUserId, source); if (notification != null) { var eventCustomerNotification = new EventCustomerNotification { EventCustomerId = eventCustomer.Id, NotificationId = notification.Id, NotificationTypeId = notification.NotificationType.Id }; _eventCustomerNotificationRepository.Save(eventCustomerNotification); } } }
public CustomerScreeningViewData GetCustomerScreeningViewData(long customerId, long eventId) { var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var customer = _customerRepository.GetCustomer(customerId); var theEvent = _eventRepository.GetById(eventId); var isNewResultFlow = theEvent.EventDate >= _settings.ResultFlowChangeDate; var testResults = GetTestResults(customerId, eventId, isNewResultFlow); var appointment = _appointmentRepository.GetEventCustomerAppointment(eventId, customerId); var order = _orderRepository.GetOrder(customerId, eventId); var package = _packageRepository.GetPackageForOrder(order.Id); var tests = _testRepository.GetTestsForOrder(order.Id); var evaluatingPhysicians = _physicianEvaluationRepsoitory.GetPhysicianEvaluation(eventCustomer.Id); var primaryEvalRecord = evaluatingPhysicians != null?evaluatingPhysicians.Where(p => p.IsPrimaryEvaluator).OrderByDescending(p => p.EvaluationEndTime ?? p.EvaluationStartTime).FirstOrDefault() : null; var primaryPhysicianId = primaryEvalRecord != null ? primaryEvalRecord.PhysicianId : 0; var overreadPhysicianId = primaryEvalRecord != null?evaluatingPhysicians.Where(p => !p.IsPrimaryEvaluator && p.EvaluationStartTime > primaryEvalRecord.EvaluationStartTime).OrderByDescending( p => p.EvaluationEndTime ?? p.EvaluationStartTime).Select(p => p.PhysicianId).FirstOrDefault() : 0; if (primaryPhysicianId < 1) { var assignment = _physicianAssignmentService.GetPhysicianIdsAssignedtoaCustomer(eventId, customerId); if (assignment != null) { primaryPhysicianId = assignment.First(); overreadPhysicianId = assignment.ElementAtOrDefault(1); } else // Should be Skip Evaluation Case { var physicians = testResults.Where(tr => tr.EvaluatedbyOrgRoleUserId > 0).Select(tr => tr.EvaluatedbyOrgRoleUserId).Distinct().ToArray(); if (physicians.Any()) { primaryPhysicianId = physicians.First(); } if (physicians.Count() > 1) { overreadPhysicianId = physicians.Last(); } } } if (primaryPhysicianId < 1) { //todo:default for the state primaryPhysicianId = _physicianRepository.GetDefaultPhysicianforEvent(eventId); } var primaryPhysician = _physicianRepository.GetPhysician(primaryPhysicianId); var overreadPhysician = overreadPhysicianId > 0 ? _physicianRepository.GetPhysician(overreadPhysicianId) : null; var host = _hostRepository.GetHostForEvent(eventId); var basicBiometric = _basicBiometricRepository.Get(eventId, customerId); CustomerScreeningViewData viewData = _factory.Create(testResults, customer, appointment, theEvent, package != null ? package.Package : null, tests != null ? tests.Select(t => t.Test).ToArray() : null, host, primaryPhysician, overreadPhysician, order, basicBiometric); if (order.PaymentsApplied != null) { var chargeCardPayments = order.PaymentsApplied.Where(pa => pa.PaymentType == PaymentType.CreditCard).Select( pa => (ChargeCardPayment)pa).ToArray(); if (chargeCardPayments.Count() > 0) { viewData.ChargeCards = _chargeCardRepository.GetByIds(chargeCardPayments.Select(cp => cp.ChargeCardId).ToArray()); } var checkPayments = order.PaymentsApplied.Where(pa => pa.PaymentType == PaymentType.Check).Select( pa => (CheckPayment)pa).ToArray(); if (checkPayments.Count() > 0) { viewData.Checks = _checkRepository.GetByIds(checkPayments.Select(c => c.CheckId).ToArray()); } } var eventHospitalPartner = _hospitalPartnerRepository.GetEventHospitalPartnersByEventId(eventId); if (eventHospitalPartner != null && eventHospitalPartner.RestrictEvaluation) { var eventPhysicianTests = _eventPhysicianTestRepository.GetByEventId(eventId); if (eventPhysicianTests != null && eventPhysicianTests.Any()) { viewData.EventPhysicianTests = eventPhysicianTests; } } return(viewData); }
private void UpdateBloodPressure(string filePath, long customerId) { const string bpDiastolicAttrNameString = "BLOOD_PRESSURE_DIASTOLIC"; const string bpSystolicNameString = "BLOOD_PRESSURE_SYSTOLIC"; const string bpCaptureArmAttrNameString = "BLOODPRESSURE_CAPTURE_ARM"; var xDoc = new XmlDocument(); xDoc.Load(filePath); _logger.Info(string.Format("Values from XML for BP for Customer [{0}] ------------------------------------------", customerId)); var elements = xDoc.GetElementsByTagName(BiomarkerTagName); int? diastolic = null; int? systolic = null; bool isRightArmBpMeasurement = false; foreach (XmlNode element in elements) { if (element.Attributes == null || element.Attributes[NameAttrString] == null || element.Attributes[ValueAttrString] == null || string.IsNullOrEmpty(element.Attributes[NameAttrString].Value) || string.IsNullOrEmpty(element.Attributes[ValueAttrString].Value)) { continue; } var valueAttr = element.Attributes[NameAttrString].Value.ToLower(); if (valueAttr == bpDiastolicAttrNameString.ToLower()) { int s; int.TryParse(element.Attributes[ValueAttrString].Value, out s); if (s > 0) { diastolic = s; } } if (valueAttr == bpSystolicNameString.ToLower()) { int s; int.TryParse(element.Attributes[ValueAttrString].Value, out s); if (s > 0) { systolic = s; } } if (valueAttr == bpCaptureArmAttrNameString.ToLower()) { if (element.Attributes[ValueAttrString].Value.ToLower() == "right") { isRightArmBpMeasurement = true; } } } if (systolic.HasValue && diastolic.HasValue) { var eventCustomer = _eventCustomerRepository.Get(_eventId, customerId); var biometric = new BasicBiometric { Id = eventCustomer.Id, SystolicPressure = systolic, DiastolicPressure = diastolic, IsRightArmBpMeasurement = isRightArmBpMeasurement, CreatedByOrgRoleUserId = _uploadedBy, CreatedOn = DateTime.Now, IsBloodPressureElevated = (systolic.Value >= 140 || diastolic.Value >= 90) }; _basicBiometricRepository.Save(biometric); ParseDataForHypertension(customerId, biometric); } }
private void SaveTestResults(KynHealthAssessmentEditModel model, long uploadedby) { TestResultRepository testResultRepository; var customerId = model.CustomerId; var eventId = model.EventId; var isNewResultFlow = _eventRepository.IsEventHasNewResultFlow(eventId); var service = new Service.TestResultService(); var eventCustomerResultId = SaveEventCustomerResult(eventId, customerId, uploadedby); //basic biometric var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var basicBiometric = _basicBiometricRepository.Get(eventId, customerId); basicBiometric = _kynHealthAssessmentFactory.GetBasicTestResultBiometricDomain(model, basicBiometric, uploadedby); if (basicBiometric != null) { basicBiometric.Id = eventCustomer.Id; ((IRepository <BasicBiometric>)_basicBiometricRepository).Save(basicBiometric); } long[] kynTestIds = { (long)TestType.Kyn, (long)TestType.HKYN, (long)TestType.MyBioCheckAssessment }; var eventTests = _eventTestRepository.GetByEventAndTestIds(eventId, kynTestIds); //Kyn Test Result var isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.Kyn); var isKynPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.HKYN); var isMyBioCheckPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.MyBioCheckAssessment); if (isPurchased) { var kynTest = eventTests.First(x => x.TestId == (int)TestType.Kyn).Test; SaveKynLabResult(model, uploadedby, customerId, eventId, eventCustomerResultId, (int)TestType.Kyn, kynTest.IsRecordable, isNewResultFlow); } else if (isKynPurchased) { var hKynTest = eventTests.First(x => x.TestId == (int)TestType.HKYN).Test; SaveKynLabResult(model, uploadedby, customerId, eventId, eventCustomerResultId, (int)TestType.HKYN, hKynTest.IsRecordable, isNewResultFlow); } else if (isMyBioCheckPurchased) { var mybioCheckAssessment = eventTests.First(x => x.TestId == (int)TestType.MyBioCheckAssessment).Test; SaveKynLabResult(model, uploadedby, customerId, eventId, eventCustomerResultId, (int)TestType.MyBioCheckAssessment, mybioCheckAssessment.IsRecordable, isNewResultFlow); } //lipidTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.Lipid); if (isPurchased) { testResultRepository = new LipidTestRepository(ReadingSource.Manual); var lipidTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); lipidTestresult = _kynHealthAssessmentFactory.GetLipidTestResultDomain(model, lipidTestresult as LipidTestResult, uploadedby, isNewResultFlow); if (lipidTestresult != null) { testResultRepository.SaveTestResults(lipidTestresult, customerId, eventId, uploadedby); } } //AwvLipidTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.AwvLipid); if (isPurchased) { testResultRepository = new AwvLipidTestRepository(ReadingSource.Manual); var awvLipidTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); awvLipidTestresult = _kynHealthAssessmentFactory.GetAwvLipidTestResultDomain(model, awvLipidTestresult as AwvLipidTestResult, uploadedby, isNewResultFlow); if (awvLipidTestresult != null) { testResultRepository.SaveTestResults(awvLipidTestresult, customerId, eventId, uploadedby); } } //AwvGlucoseTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.AwvGlucose); if (isPurchased) { testResultRepository = new AwvGlucoseTestRepository(ReadingSource.Manual); var awvGlucoseTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); awvGlucoseTestresult = _kynHealthAssessmentFactory.GetAwvGlucoseTestResultDomain(model, awvGlucoseTestresult as AwvGlucoseTestResult, uploadedby, isNewResultFlow); if (awvGlucoseTestresult != null) { testResultRepository.SaveTestResults(awvGlucoseTestresult, customerId, eventId, uploadedby); } } //AwvLipidTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.Cholesterol); if (isPurchased) { testResultRepository = new CholesterolTestRepository(ReadingSource.Manual); var cholesterolTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); cholesterolTestresult = _kynHealthAssessmentFactory.GetCholesterolTestResultDomain(model, cholesterolTestresult as CholesterolTestResult, uploadedby, isNewResultFlow); if (cholesterolTestresult != null) { testResultRepository.SaveTestResults(cholesterolTestresult, customerId, eventId, uploadedby); } } //AwvGlucoseTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.Diabetes); if (isPurchased) { testResultRepository = new DiabetesTestRepository(ReadingSource.Manual); var diabetesTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); diabetesTestresult = _kynHealthAssessmentFactory.GetDiabetesTestResultDomain(model, diabetesTestresult as DiabetesTestResult, uploadedby, isNewResultFlow); if (diabetesTestresult != null) { testResultRepository.SaveTestResults(diabetesTestresult, customerId, eventId, uploadedby); } } //Hypertension Test Result isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.Hypertension); if (isPurchased) { testResultRepository = new HypertensionTestRepository(ReadingSource.Manual); var hypertensionTestresult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); hypertensionTestresult = _kynHealthAssessmentFactory.GetHypertensionTestResultDomain(model, hypertensionTestresult as HypertensionTestResult, uploadedby, isNewResultFlow); if (hypertensionTestresult != null) { testResultRepository.SaveTestResults(hypertensionTestresult, customerId, eventId, uploadedby); } } isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.A1C); if (isPurchased) { testResultRepository = new HemaglobinTestRepository(ReadingSource.Manual); var hemaglobinTestResult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); hemaglobinTestResult = _kynHealthAssessmentFactory.GetHemaglobinA1CTestResultDomain(model, hemaglobinTestResult as HemaglobinA1CTestResult, uploadedby, isNewResultFlow); if (hemaglobinTestResult != null) { testResultRepository.SaveTestResults(hemaglobinTestResult, customerId, eventId, uploadedby); } } isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.AwvHBA1C); if (isPurchased) { testResultRepository = new AwvHemaglobinTestRepository(ReadingSource.Manual); var awvHemaglobinTestResult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); awvHemaglobinTestResult = _kynHealthAssessmentFactory.GetAwvHemaglobinTestResultDomain(model, awvHemaglobinTestResult as AwvHemaglobinTestResult, uploadedby, isNewResultFlow); if (awvHemaglobinTestResult != null) { testResultRepository.SaveTestResults(awvHemaglobinTestResult, customerId, eventId, uploadedby); } } //MyBioCheckTestresult isPurchased = service.IsTestPurchasedByCustomer(eventId, customerId, (long)TestType.MyBioCheckAssessment); if (isPurchased) { testResultRepository = new MyBioAssessmentTestRepository(ReadingSource.Manual); var myBioAssessmentTestResult = testResultRepository.GetTestResults(customerId, eventId, isNewResultFlow); myBioAssessmentTestResult = _kynHealthAssessmentFactory.GetMyBioCheckAssessmentTestResultDomain(model, myBioAssessmentTestResult as MyBioAssessmentTestResult, uploadedby, isNewResultFlow); if (myBioAssessmentTestResult != null) { testResultRepository.SaveTestResults(myBioAssessmentTestResult, customerId, eventId, uploadedby); } } }
public PreAssessmentCustomerContactViewModel GetByCustomerId(long customerId, long callId, long orgRoleUserId) { if (customerId <= 0) { return(null); } var call = _callCenterCallRepository.GetById(callId); var eventCustomer = _eventCustomerRepository.Get(call.EventId, customerId); CallQueue callQueue = null; if (call != null) { callQueue = _callQueueRepository.GetById((long)call.CallQueueId); } var customer = _customerRepository.GetCustomer(customerId); var memberIdLabel = string.Empty; CorporateAccount corporateAccount = null; CustomerEligibility customerEligibility = null; if (customer != null) { customerEligibility = _customerEligibilityRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); if (!string.IsNullOrEmpty(customer.Tag)) { corporateAccount = _corporateAccountRepository.GetByTag(customer.Tag); memberIdLabel = corporateAccount != null ? corporateAccount.MemberIdLabel : string.Empty; } } var prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(customerId); CallQueuePatientInfomationViewModel patientInfo = null; if (customer != null) { Falcon.App.Core.Medical.Domain.ActivityType activityType = null; if (customer.ActivityId.HasValue) { activityType = _activityTypeRepository.GetById(customer.ActivityId.Value); } patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerInfo(customer, customerEligibility, activityType); } else { patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetProspectCustomerInfo(prospectCustomer); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } var additionalFileds = new List <OrderedPair <string, string> >(); if (corporateAccount != null) { var accountAdditionalFields = _accountAdditionalFieldRepository.GetByAccountId(corporateAccount.Id); if (accountAdditionalFields.Any()) { additionalFileds.AddRange(accountAdditionalFields.Select(additionalField => new OrderedPair <string, string>(additionalField.DisplayName, GetCustomerAdditionalField(customer, additionalField.AdditionalFieldId)))); } if (corporateAccount.ShowCallCenterScript && corporateAccount.CallCenterScriptFileId > 0) { var callCenterScriptPdf = _fileRepository.GetById(corporateAccount.CallCenterScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + callCenterScriptPdf.Path; } if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue) { if (corporateAccount.ShowCallCenterScript && corporateAccount.ConfirmationScriptFileId > 0) { var confirmationScriptPdf = _fileRepository.GetById(corporateAccount.ConfirmationScriptFileId); var mediaLocation = _mediaRepository.GetCallCenterScriptPdfFolderLocation(); patientInfo.CallCenterScriptUrl = mediaLocation.Url + confirmationScriptPdf.Path; } } } var hasMammo = customer != null && _preApprovedTestRepository.CheckPreApprovedTestForCustomer(customer.CustomerId, TestGroup.BreastCancer); patientInfo.HasMammo = hasMammo; patientInfo.MammoTestAsPreApproved = hasMammo; patientInfo.CustomerId = customerId; patientInfo.ProspectCustomerId = prospectCustomer != null ? prospectCustomer.Id : 0; patientInfo = _preAssessmentCallQueuePatientInfomationFactory.SetCustomerTagInfo(prospectCustomer, patientInfo); if (patientInfo != null && callQueue != null && callQueue.IsHealthPlan) { patientInfo.PrimaryCarePhysician = _primaryCarePhysicianHelper.GetPrimaryCarePhysicianViewModel(customerId); } if (customer != null) { var customerCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerId(customer.CustomerId); if (!customerCustomTags.IsNullOrEmpty()) { var customTags = customerCustomTags.OrderByDescending(x => x.DataRecorderMetaData.DateCreated).Select(x => x.Tag).ToArray(); patientInfo.CustomCorporateTags = customTags.IsNullOrEmpty() ? string.Empty : string.Join(",", customTags); } } IEnumerable <string> preApprovedTests = null; var preApprovedTestsList = _preApprovedTestRepository.GetPreApprovedTests(customerId); if (preApprovedTestsList.Count() > 0) { preApprovedTests = preApprovedTestsList; } IEnumerable <Package> preApprovedPackages = null; var preApprovedPackageList = _preApprovedPackageRepository.GetByCustomerId(customerId); var packageIds = preApprovedPackageList != null?preApprovedPackageList.Select(x => x.PackageId) : null; if (packageIds != null) { preApprovedPackages = _packageRepository.GetByIds(packageIds.ToList()); } if (customer != null && customer.Address != null && customer.Address.StateId > 0 && corporateAccount != null) { patientInfo.HealthPlanPhoneNumber = _customerAccountGlocomNumberService.GetGlocomNumber(corporateAccount.Id, customer.Address.StateId, customer.CustomerId, callId); } if (patientInfo.HealthPlanPhoneNumber == null) { patientInfo.HealthPlanPhoneNumber = corporateAccount != null ? corporateAccount.CheckoutPhoneNumber : null; } if (patientInfo.HealthPlanPhoneNumber != null) { string dialerUrl; var callCenterRepProfile = _callCenterRepProfileRepository.Get(orgRoleUserId); if (callCenterRepProfile != null && !string.IsNullOrEmpty(callCenterRepProfile.DialerUrl)) { dialerUrl = callCenterRepProfile.DialerUrl.ToLower().Replace(CallCenterAgentUrlKeywords.CallerId.ToLower(), (patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number)) .Replace(CallCenterAgentUrlKeywords.PatientId.ToLower(), patientInfo.CustomerId.ToString()); } else { dialerUrl = "Glocom://*65*" + patientInfo.HealthPlanPhoneNumber.AreaCode + patientInfo.HealthPlanPhoneNumber.Number + "*1" + CallCenterAgentUrlKeywords.PatientContact.ToLower(); } if (patientInfo.CallBackPhoneNumber != null) { patientInfo.CallBackPhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.CallBackPhoneNumber.AreaCode + patientInfo.CallBackPhoneNumber.Number)); } if (patientInfo.OfficePhoneNumber != null) { patientInfo.OfficePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.OfficePhoneNumber.AreaCode + patientInfo.OfficePhoneNumber.Number)); } if (patientInfo.MobilePhoneNumber != null && !string.IsNullOrEmpty(patientInfo.MobilePhoneNumber.Number)) { patientInfo.MobilePhoneNumberUrl = dialerUrl.Replace(CallCenterAgentUrlKeywords.PatientContact.ToLower(), (patientInfo.MobilePhoneNumber.AreaCode + patientInfo.MobilePhoneNumber.Number)); } } var preAssessmentCustomerCallQueueCallAttempt = _preAssessmentCustomerCallQueueCallAttemptRepository.GetByCallId(callId); RegisteredEventViewModel registeredEventModel = null; var isCancelled = false; if (callQueue != null && callQueue.Category == HealthPlanCallQueueCategory.PreAssessmentCallQueue && call.EventId > 0) { var isEawvPurchased = _testResultService.IsTestPurchasedByCustomer(eventCustomer.Id, (long)TestType.eAWV); Appointment appointment = null; if (eventCustomer.AppointmentId.HasValue) { appointment = _appointmentRepository.GetById(eventCustomer.AppointmentId.Value); } else { isCancelled = true; } var theEvent = _eventService.GetById(eventCustomer.EventId); var hostAddress = new AddressViewModel { StreetAddressLine1 = theEvent.StreetAddressLine1, StreetAddressLine2 = theEvent.StreetAddressLine2, City = theEvent.City, State = theEvent.State, ZipCode = theEvent.Zip }; QuestionnaireType questionnaireType = QuestionnaireType.None; if (corporateAccount != null && corporateAccount.IsHealthPlan && theEvent != null) { questionnaireType = _accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(corporateAccount.Id, theEvent.EventDate); } registeredEventModel = new RegisteredEventViewModel { EventId = theEvent.EventId, EventDate = theEvent.EventDate, AppointmentTime = appointment != null ? appointment.StartTime : (DateTime?)null, HostName = theEvent.OrganizationName, HostAddress = hostAddress.ToString(), EventNotes = "", EventCustomerId = eventCustomer.Id, TimeZone = theEvent.EventTimeZone, IsCanceled = isCancelled, HraQuestionerAppUrl = _settings.HraQuestionerAppUrl, OrganizationNameForHraQuestioner = _settings.OrganizationNameForHraQuestioner, CorporateAccountTag = corporateAccount.Tag, MedicareVisitId = eventCustomer.AwvVisitId.HasValue ? eventCustomer.AwvVisitId.Value : 0, Pods = theEvent.Pods.IsNullOrEmpty() ? "" : theEvent.PodNames(), ShowHraQuestionnaire = questionnaireType == QuestionnaireType.HraQuestionnaire ? true : false, IsEawvPurchased = isEawvPurchased, ShowChatQuestionnaire = questionnaireType == QuestionnaireType.ChatQuestionnaire ? true : false, ChatQuestionerAppUrl = _settings.ChatQuestionerAppUrl, AllowNonMammoPatients = theEvent.AllowNonMammoPatients, CaptureHaf = corporateAccount != null && corporateAccount.CaptureHaf, }; preAssessmentCustomerCallQueueCallAttempt.IsNotesReadAndUnderstood = true; } if (corporateAccount != null) { var organization = _organizationRepository.GetOrganizationbyId(corporateAccount.Id); patientInfo.HealthPlan = organization.Name; } var warmTransfer = false; if (customer != null && corporateAccount != null && corporateAccount.WarmTransfer) { var customerWarmTransfer = _customerWarmTransferRepository.GetByCustomerIdAndYear(customer.CustomerId, DateTime.Today.Year); warmTransfer = customerWarmTransfer != null && customerWarmTransfer.IsWarmTransfer.HasValue && customerWarmTransfer.IsWarmTransfer.Value; } var model = new PreAssessmentCustomerContactViewModel { PatientInfomation = patientInfo, // CallHistory = callHistoryModel, PreApprovedTests = preApprovedTests, // ReadAndUnderstood = currentCall != null && currentCall.ReadAndUnderstood.HasValue && currentCall.ReadAndUnderstood.Value, AdditionalFields = additionalFileds, MemberIdLabel = memberIdLabel, // IsCallEnded = currentCall != null && currentCall.Status == (long)CallStatus.CallSkipped && currentCall.EndTime.HasValue, PreApprovedPackages = !preApprovedPackages.IsNullOrEmpty() ? preApprovedPackages.Select(x => x.Name).ToList() : null, CallId = callId, HealthPlanId = corporateAccount != null ? corporateAccount.Id : 0, CallQueueCustomerAttempt = preAssessmentCustomerCallQueueCallAttempt ?? new PreAssessmentCustomerCallQueueCallAttempt { IsNotesReadAndUnderstood = true }, EventInformation = registeredEventModel, WarmTransfer = warmTransfer, // RequiredTests = requiredTests, }; var isHealthPlanCallQueue = call != null; var patientInfoEditModel = _preAssessmentCallQueuePatientInfomationFactory.GetCallQueueCustomerEditModel(model, isHealthPlanCallQueue); model.PatientInfoEditModel = patientInfoEditModel; model.PatientInfoEditViewModel = patientInfoEditModel; return(model); }
public ChaperoneFormViewModel GetModel(long eventId, long customerId) { var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); if (eventCustomer == null) { return(new ChaperoneFormViewModel()); } var customer = _customerRepository.GetCustomer(customerId); var answers = _chaperoneAnswerRepository.GetByEventCustomerId(eventCustomer.Id); var questions = _chaperoneQuestionRepository.GetAllQuestions(); var signature = _chaperoneSignatureRepository.GetByEventCustomerId(eventCustomer.Id); var eventData = _eventRepository.GetById(eventId); var signatureFile = signature != null && signature.SignatureFileId.HasValue ? _fileRepository.GetById(signature.SignatureFileId.Value) : null; var staffSignatureFile = signature != null?_fileRepository.GetById(signature.StaffSignatureFileId) : null; var model = new ChaperoneFormViewModel(); model.CustomerName = customer.Name; model.CustomerId = customer.CustomerId; model.DateofBirth = customer.DateOfBirth; model.EventDate = eventData.EventDate; var questionAnswers = new List <ChaperoneQuestionAnswerViewModel>(); if (!answers.IsNullOrEmpty()) { foreach (var answer in answers) { var question = questions.First(x => x.Id == answer.QuestionId); var questionAnswer = new ChaperoneQuestionAnswerViewModel { QuestionId = answer.QuestionId, Question = question.Question, Answer = answer.Answer, ControlValue = !string.IsNullOrWhiteSpace(question.ControlValues) ? question.ControlValues.Split(',') : null, Type = (CheckListQuestionType)question.TypeId, Index = question.Index, ParentId = question.ParentId }; questionAnswers.Add(questionAnswer); } model.Answers = questionAnswers; } if (signatureFile != null) { var mediaLocation = _mediaRepository.GetChaperoneSignatureLocation(eventId, customerId); model.SignatureImageUrl = mediaLocation.Url + signatureFile.Path; } if (staffSignatureFile != null) { var mediaLocation = _mediaRepository.GetChaperoneSignatureLocation(eventId, customerId); model.StaffSignatureImageUrl = mediaLocation.Url + staffSignatureFile.Path; } return(model); }
public IEnumerable <EventCustomerScreeningAggregate> Parse() { var eventCustomerAggregates = new List <EventCustomerScreeningAggregate>(); var directoryPath = GetFolderPathfor(_resultOutputPath); if (string.IsNullOrEmpty(directoryPath)) { return(null); } var pdfFiles = DirectoryOperationsHelper.GetFiles(directoryPath, "*.pdf"); //GetPdfFiles(directoryPath); if (pdfFiles != null && pdfFiles.Any()) { _logger.Info("Number of Files to Parse : " + pdfFiles.Count()); foreach (var filePath in pdfFiles) { var fileName = Path.GetFileName(filePath); long customerId = 0; string errorMessage = string.Empty; _logger.Info("=============== Parsing Started for file: " + fileName + " ================="); var pdfText = GetTextFromPdf(filePath); if (string.IsNullOrWhiteSpace(pdfText)) { continue; } var lstText = pdfText.Replace("\r", "").Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); var customerIdString = lstText.Where(x => x.Contains("Patient ID:")).FirstOrDefault(); if (string.IsNullOrWhiteSpace(customerIdString) || !long.TryParse(customerIdString.Replace("Patient ID:", "").Trim(), out customerId)) { errorMessage = "DPN: CustomerId could be blank or not an numeric value in Pdf file @" + filePath + " and text is: " + customerIdString; _logger.Info(errorMessage); continue; } var eventCustomer = _eventCustomerRepository.Get(_eventId, customerId); if (eventCustomer == null) { errorMessage = "DPN: Customer: " + customerId + " is not registered on Event Id :" + _eventId + " for file path: " + filePath; _logger.Info(errorMessage); continue; } var isTestPurchased = _eventCustomerRepository.IsTestPurchasedByEventIdCustomerId(_eventId, customerId, (long)TestType.DPN); if (!isTestPurchased) { errorMessage = "DPN: Test not purchased for Customer Id :" + customerId + " Event Id :" + _eventId + " and file path: " + filePath; _logger.Info(errorMessage); continue; } var resultState = _eventCustomerResultRepository.GetByCustomerIdAndEventId(customerId, _eventId); if (resultState != null && _isNewResultFlow && resultState.ResultState >= (int)NewTestResultStateNumber.PostAuditNew) { errorMessage = "DPN (New Result Flow): Pdf can not parsed because current result state is " + NewTestResultStateNumber.PostAuditNew.ToString() + " for Customer Id :" + customerId + " Event Id :" + _eventId + " and file path: " + filePath; _logger.Info(errorMessage); continue; } if (resultState != null && !_isNewResultFlow && resultState.ResultState >= (int)TestResultStateNumber.PostAudit) { errorMessage = "DPN (Old Result Flow): Pdf can not parsed because current result state is " + TestResultStateNumber.PostAudit.ToString() + " for Customer Id :" + customerId + " Event Id :" + _eventId + " and file path: " + filePath; _logger.Info(errorMessage); continue; } try { string folderToSavePdf = _mediaRepository.GetResultMediaFileLocation(customerId, _eventId).PhysicalPath; var resultMedia = GetMediaFromPdfFile(filePath, folderToSavePdf, TestType.DPN); if (resultMedia != null) { resultMedia.ReadingSource = ReadingSource.Automatic; TestResult testResult = new DpnTestResult { ResultImage = resultMedia }; _resultParserHelper.AddTestResulttoEventCustomerAggregate(eventCustomerAggregates, _eventId, customerId, testResult); _resultParserHelper.AddResultArchiveLog(string.Empty, TestType.DPN, customerId, MedicalEquipmentTag.Vatica); _logger.Info(string.Concat("\nParsing succeeded for Customer Id: ", customerId, "\n")); } } catch (Exception ex) { errorMessage = "DPN: System Failure! Message: " + ex.Message + "\n\t" + ex.StackTrace; _logger.Error(errorMessage); _resultParserHelper.AddResultArchiveLog(ex.Message, TestType.DPN, customerId, MedicalEquipmentTag.Vatica, false); } _logger.Info("=============== Parsing Ended for file: " + fileName + " ================="); } } return(eventCustomerAggregates); }
private void UpdateBloodPressure(string filePath, long customerId) { const string bpDiastolicTagNameString = "diastolic_bloodpressure"; const string bpSystolicTagNameString = "systolic_bloodpressure"; const string bpCaptureArmTagNameString = "arm_bloodpressure"; var xDoc = new XmlDocument(); xDoc.Load(filePath); _logger.Info(string.Format("Values from XML for BP for Customer [{0}] ------------------------------------------", customerId)); int? diastolic = null; int? systolic = null; bool isRightArmBpMeasurement = false; var element = xDoc.GetElementsByTagName(bpDiastolicTagNameString); if (element.Count > 0) { int s; int.TryParse(element[0].InnerXml, out s); if (s > 0) { diastolic = s; } } element = xDoc.GetElementsByTagName(bpSystolicTagNameString); if (element.Count > 0) { int s; int.TryParse(element[0].InnerXml, out s); if (s > 0) { systolic = s; } } element = xDoc.GetElementsByTagName(bpCaptureArmTagNameString); if (element.Count > 0) { if (element[0].InnerXml.ToLower() == "right") { isRightArmBpMeasurement = true; } } if (systolic.HasValue && diastolic.HasValue) { var eventCustomer = _eventCustomerRepository.Get(_eventId, customerId); var biometric = new BasicBiometric { Id = eventCustomer.Id, SystolicPressure = systolic, DiastolicPressure = diastolic, IsRightArmBpMeasurement = isRightArmBpMeasurement, CreatedByOrgRoleUserId = _uploadedBy, CreatedOn = DateTime.Now, IsBloodPressureElevated = (systolic.Value >= 140 || diastolic.Value >= 90) }; _basicBiometricRepository.Save(biometric); ParseDataForHypertension(customerId, biometric); } }
//[HttpPost] public JsonResult SendConfirmationSms(long eventId, long customerId) { var currentSession = _sessionContext.UserSession; var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); var customer = _customerRepository.GetCustomer(customerId); var message = string.Empty; if (customer.IsSubscribed == null || customer.IsSubscribed.Value == false) { _logger.Info("customer has not Subscribed for SMS customerId " + customer.CustomerId); message = "customer has not Subscribed for SMS"; _logger.Info(message); return(Json(new { message }, JsonRequestBehavior.AllowGet)); } if (eventCustomer.EnableTexting) { var account = _corporateAccountRepository.GetbyEventId(eventId); if (account != null && !account.EnableSms) { message = "SMS has been disabled for Corporate Account Tag: " + account.Tag; _logger.Info(message); return(Json(new { message }, JsonRequestBehavior.AllowGet)); } var messageAlreadySentList = _eventCustomerNotificationRepository.GetAllByEventCustomerId(eventCustomer.Id, NotificationTypeAlias.AppointmentConfirmation); var messageCount = (messageAlreadySentList != null && messageAlreadySentList.Any()) ? messageAlreadySentList.Count() : 0; if (account != null && messageCount >= account.MaximumSms) { _logger.Info("Maximum SMS has Been Sent "); _logger.Info(string.Format("Allowed SMS {0}, SMS Already Sent {0} " + account.MaximumSms, messageCount)); message = "Maximum SMS limit has been reached."; return(Json(new { message }, JsonRequestBehavior.AllowGet)); } if (account == null && messageCount > 0) { message = "Appointment confirmation SMS has already been sent."; _logger.Info(message); return(Json(new { message }, JsonRequestBehavior.AllowGet)); } var eventData = _eventRepository.GetById(eventId); var smsNotificaionModel = _phoneNotificationModelsFactory.GetScreeningReminderSmsNotificationModel(customer, eventData); var smsTemplateAlias = EmailTemplateAlias.AppointmentConfirmation; if (account != null && account.ConfirmationSmsTemplateId.HasValue && account.ConfirmationSmsTemplateId.Value > 0) { var smsTemplate = _emailTemplateRepository.GetById(account.ConfirmationSmsTemplateId.Value); smsTemplateAlias = smsTemplate.Alias; } var notification = _notifier.NotifyViaSms(NotificationTypeAlias.AppointmentConfirmation, smsTemplateAlias, smsNotificaionModel, customer.Id, currentSession.CurrentOrganizationRole.OrganizationRoleUserId, Request.Url.AbsolutePath); if (notification != null) { var eventCustomerNotification = new EventCustomerNotification { EventCustomerId = eventCustomer.Id, NotificationId = notification.Id, NotificationTypeId = notification.NotificationType.Id }; _eventCustomerNotificationRepository.Save(eventCustomerNotification); } else { message = "Queuing is disabled for Appointment Confirmation SMS."; _logger.Info(message); return(Json(new { message }, JsonRequestBehavior.AllowGet)); } } else { message = "Customer has not opted for SMS"; _logger.Info(message); return(Json(new { message }, JsonRequestBehavior.AllowGet)); } message = "Message Sent Successfully"; return(Json(new { message }, JsonRequestBehavior.AllowGet)); }
public void PollForDiagnosisReportParsing() { var outboundUploads = _outboundUploadRepository.GetAllUploadedFilesByType((long)OutboundUploadType.DiagnosisReport); if (outboundUploads == null || !outboundUploads.Any()) { _logger.Info("No new files uploaded."); return; } var accountIds = _accountIds.Split(','); foreach (var accountId in accountIds) { var account = _corporateAccountRepository.GetById(Convert.ToInt32(accountId)); var fileLocation = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "DiagnosisReport"); var archivedFileLocation = _mediaRepository.GetOutboundUploadMediaFileLocation(account.FolderName, "DiagnosisReportArchived"); foreach (var outboundUpload in outboundUploads) { try { outboundUpload.StatusId = (long)OutboundUploadStatus.Parsing; outboundUpload.ParseStartTime = DateTime.Now; _outboundUploadRepository.Save(outboundUpload); var file = _fileRepository.GetById(outboundUpload.FileId); if (!System.IO.File.Exists(fileLocation.PhysicalPath + file.Path)) { _logger.Info("File not found : " + fileLocation.PhysicalPath + file.Path); continue; } _logger.Info("Importing File : " + file.Path); var dataTable = _csvReader.CsvToDataTable(fileLocation.PhysicalPath + file.Path, true); if (dataTable == null || dataTable.Rows.IsNullOrEmpty()) { _logger.Info("No rows found."); outboundUpload.ParseEndTime = DateTime.Now; outboundUpload.StatusId = (long)OutboundUploadStatus.Parsed; _outboundUploadRepository.Save(outboundUpload); continue; } var successRows = 0; foreach (DataRow row in dataTable.Rows) { var model = GetPatientDiagnosisModel(row); try { var customerId = Convert.ToInt64(model.CustomerId); var eventId = Convert.ToInt64(model.EventId); var eventCustomer = _eventCustomerRepository.Get(eventId, customerId); if (eventCustomer == null) { _logger.Info("No EventCustomer found for CustomerId : " + model.CustomerId + " and EventId : " + model.EventId); continue; } var eventCustomerDiagnosis = _diagnosisReportFactory.Create(model, eventCustomer.Id); _eventCustomerDiagnosisRepository.Save(eventCustomerDiagnosis); successRows++; } catch (Exception ex) { _logger.Error(string.Format("While Parsing Diagnosis Report for CustomerId : {0} and EventId : {1} and Icd Code : {2}", model.CustomerId, model.EventId, model.Icd)); _logger.Error("Message: " + ex.Message); _logger.Error("Stack Tracke: " + ex.StackTrace); } } outboundUpload.SuccessUploadCount = successRows; outboundUpload.FailedUploadCount = dataTable.Rows.Count - successRows; outboundUpload.ParseEndTime = DateTime.Now; outboundUpload.StatusId = successRows > 0 ? (long)OutboundUploadStatus.Parsed : (long)OutboundUploadStatus.ParseFailed; _outboundUploadRepository.Save(outboundUpload); if (successRows > 1) { System.IO.File.Move(fileLocation.PhysicalPath + file.Path, archivedFileLocation.PhysicalPath + file.Path); ((IFileRepository)_fileRepository).MarkasArchived(file.Id); } } catch (Exception ex) { _logger.Error("While Parsing File."); _logger.Error("Message: " + ex.Message); _logger.Error("Stack Tracke: " + ex.StackTrace); outboundUpload.StatusId = (long)OutboundUploadStatus.ParseFailed; _outboundUploadRepository.Save(outboundUpload); } } } }
public bool EndHealthPlanActiveCall(EndHealthPlanCallEditModel model) { var isCallQueueRequsted = false; var removeFromCallQueue = false; long customerId = 0; var call = _callCenterCallRepository.GetById(model.CallId); var eventCustomer = _eventCustomerRepository.Get(call.EventId, call.CalledCustomerId); customerId = call.CalledCustomerId; //update call status in CustomerCallQueueCallAttempt Table if (model.IsSkipped && model.AttemptId > 0) { var attempt = _preAssessmentCustomerCallQueueCallAttemptRepository.GetByCallId(model.CallId); attempt.IsCallSkipped = true; if (!string.IsNullOrEmpty(model.SkipCallNote)) { attempt.SkipCallNote = model.SkipCallNote; } _preAssessmentCustomerCallQueueCallAttemptRepository.Save(attempt); } else if (model.CallId != 0) { if (model.CallId > 0) { if (call != null && call.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 && customerId > 0) { _customerService.UpdateIsLanguageBarrier(customerId, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } if (tag == ProspectCustomerTag.IncorrectPhoneNumber && customerId > 0) { _customerService.UpdateIsIncorrectPhoneNumber(customerId, true, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } if (tag == ProspectCustomerTag.PatientConfirmed && call != null && eventCustomer.Id > 0) { eventCustomer.IsAppointmentConfirmed = true; eventCustomer.ConfirmedBy = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _eventCustomerRepository.Save(eventCustomer); } } var orgRoleUserId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; _preAssessmentCallQueueService.EndActiveCall(customerId, model.CallId, isCallQueueRequsted, orgRoleUserId, removeFromCallQueue, model.CallOutcomeId, model.SkipCallNote); } return(true); }