/// <summary> /// Translates the specified clinical payor coverage. /// </summary> /// <param name="clinicalPayorCoverage">The clinical payor coverage.</param> /// <returns>A billing PayorCoverage.</returns> public PayorCoverage Translate(PayorCoverageCache clinicalPayorCoverage) { if (clinicalPayorCoverage == null) { return null; } var payor = _payorRepository.GetByKey ( clinicalPayorCoverage.PayorCache.Key ); var clinicalPayorSubscriber = clinicalPayorCoverage.PayorSubscriberCache; var payorSubscriberRelationshipType = _lookupValueRepository.GetLookupByWellKnownName<PayorSubscriberRelationshipType> ( clinicalPayorSubscriber.PayorSubscriberRelationshipCacheType.WellKnownName ); var payorSubscriber = new PayorSubscriber ( clinicalPayorSubscriber.Address, clinicalPayorSubscriber.BirthDate, clinicalPayorSubscriber.AdministrativeGender, clinicalPayorSubscriber.Name, payorSubscriberRelationshipType ); var payorCoverageType = _lookupValueRepository.GetLookupByWellKnownName<PayorCoverageType> ( clinicalPayorCoverage.PayorCoverageCacheType.WellKnownName ); var billingPayorCoverage = new PayorCoverage ( payor, payorSubscriber, clinicalPayorCoverage.MemberNumber, clinicalPayorCoverage.EffectiveDateRange, payorCoverageType); return billingPayorCoverage; }
/// <summary> /// Adds the payor coverage. /// </summary> /// <param name="payorCoverage"> /// The payor coverage. /// </param> public virtual void AddPayorCoverage(PayorCoverageCache payorCoverage) { Check.IsNotNull(payorCoverage, "Payor Coverage is required."); payorCoverage.RevisePayorCache(this); _payorCoverages.Add(payorCoverage); NotifyItemAdded(() => PayorCoverages, payorCoverage); }
public void ExecuteRules_Duplicate_HasRuleViolations() { var payorCoverageTypeMock = new Mock<PayorCoverageCacheType>(); payorCoverageTypeMock.SetupGet(pct => pct.WellKnownName).Returns("Test"); var payorCoverageCache = new PayorCoverageCache( new Mock<Patient>().Object, new Mock<PayorCache>().Object, new DateRange(DateTime.Now, null), "12345", new PayorSubscriberCache( new Address( "Test", null, "City", new Mock<CountyArea>().Object, new Mock<StateProvince>().Object, new Mock<Country>().Object, new PostalCode("12345")), null, new Mock<AdministrativeGender>().Object, new PersonName(string.Empty, "Fred", null, "Savage", null), new Mock<PayorSubscriberRelationshipCacheType>().Object), payorCoverageTypeMock.Object); var repositoryMock = new Mock<IPayorCoverageCacheRepository>(); repositoryMock.Setup( rep => rep.AnyPayorCoverageTypeInEffectiveDateRange(It.IsAny<long>(), It.IsAny<long>(), It.IsAny<PayorCoverageCacheType>(), It.IsAny<DateRange>())).Returns( true); var ruleCollection = new PayorCoverageCacheRuleCollection(repositoryMock.Object); var ruleEngine = new RuleEngine<PayorCoverageCache>(ruleCollection); var ruleContext = new RuleEngineContext<PayorCoverageCache>(payorCoverageCache); ruleContext.WorkingMemory.AddContextObject(payorCoverageCache.PayorCoverageCacheType); ruleContext.WorkingMemory.AddContextObject(payorCoverageCache.EffectiveDateRange); var results = ruleEngine.ExecuteRules(ruleContext); Assert.IsTrue(results.HasRuleViolation); }
/// <summary> /// Creates the payor coverage. /// </summary> /// <param name="patient">The patient.</param> /// <param name="payorCache">The payor cache.</param> /// <param name="effectiveDateRange">The effective date range.</param> /// <param name="memberNumber">The member number.</param> /// <param name="payorSubscriberCache">The payor subscriber cache.</param> /// <param name="payorCoverageCacheType">Type of the payor coverage cache.</param> /// <returns>A Payor coverage cache.</returns> public PayorCoverageCache CreatePayorCoverage( Patient patient, PayorCache payorCache, DateRange effectiveDateRange, string memberNumber, PayorSubscriberCache payorSubscriberCache, PayorCoverageCacheType payorCoverageCacheType ) { var payorCoverage = new PayorCoverageCache ( patient, payorCache, effectiveDateRange, memberNumber, payorSubscriberCache, payorCoverageCacheType ); PayorCoverageCache createdPayorCoverage = null; DomainRuleEngine.CreateRuleEngine(payorCoverage, "CreatePayorCoverageRuleSet") .WithContext ( payorCoverage.PayorCoverageCacheType ) .WithContext ( payorCoverage.EffectiveDateRange ) .Execute(() => { createdPayorCoverage = payorCoverage; _payorCoverageCacheRepository.MakePersistent(payorCoverage); }); return createdPayorCoverage; }
/// <summary> /// Creates the payor coverage. /// </summary> /// <param name="patient">The patient.</param> /// <param name="payorCache">The payor cache.</param> /// <param name="effectiveDateRange">The effective date range.</param> /// <param name="memberNumber">The member number.</param> /// <param name="payorSubscriberCache">The payor subscriber cache.</param> /// <param name="payorCoverageCacheType">Type of the payor coverage cache.</param> /// <returns>A Payor coverage cache.</returns> public PayorCoverageCache CreatePayorCoverage( Patient patient, PayorCache payorCache, DateRange effectiveDateRange, string memberNumber, PayorSubscriberCache payorSubscriberCache, PayorCoverageCacheType payorCoverageCacheType) { var payorCoverage = new PayorCoverageCache(patient, payorCache, effectiveDateRange, memberNumber, payorSubscriberCache, payorCoverageCacheType); PayorCoverageCache createdPayorCoverage = null; DomainRuleEngine.CreateRuleEngine(payorCoverage, "CreatePayorCoverageRuleSet") .WithContext(payorCoverage.PayorCoverageCacheType) .WithContext(payorCoverage.EffectiveDateRange) .Execute(() => { createdPayorCoverage = payorCoverage; _payorCoverageCacheRepository.MakePersistent(payorCoverage); }); return(createdPayorCoverage); }
/// <summary> /// Removes the payor coverage. /// </summary> /// <param name="payorCoverage"> /// The payor coverage. /// </param> public virtual void RemovePayorCoverage(PayorCoverageCache payorCoverage) { _payorCoverages.Delete(payorCoverage); NotifyItemRemoved(() => PayorCoverages, payorCoverage); }
/// <summary> /// Destroys the payor coverage. /// </summary> /// <param name="payorCoverageCache"> /// The payor coverage cache. /// </param> public void DestroyPayorCoverage( PayorCoverageCache payorCoverageCache ) { _payorCoverageCacheRepository.MakeTransient ( payorCoverageCache ); }
/// <summary> /// Removes the payor coverage. /// </summary> /// <param name="payorCoverage"> /// The payor coverage. /// </param> public virtual void RemovePayorCoverage( PayorCoverageCache payorCoverage ) { _payorCoverages.Delete ( payorCoverage ); NotifyItemRemoved ( () => PayorCoverages, payorCoverage ); }
/// <summary> /// Adds the payor coverage. /// </summary> /// <param name="payorCoverage"> /// The payor coverage. /// </param> public virtual void AddPayorCoverage( PayorCoverageCache payorCoverage ) { Check.IsNotNull ( payorCoverage, "Payor Coverage is required." ); payorCoverage.RevisePayorCache ( this ); _payorCoverages.Add ( payorCoverage ); NotifyItemAdded ( () => PayorCoverages, payorCoverage ); }
/// <summary> /// Destroys the payor coverage. /// </summary> /// <param name="payorCoverageCache"> /// The payor coverage cache. /// </param> public void DestroyPayorCoverage(PayorCoverageCache payorCoverageCache) { _payorCoverageCacheRepository.MakeTransient(payorCoverageCache); }