Ejemplo n.º 1
0
        protected override void SetPayerPlanPeriodId(PayerPlanPeriod[] payerPlanPeriods, DrugExposure[] drugExposures,
           ProcedureOccurrence[] procedureOccurrences)
        {
            if (!payerPlanPeriods.Any()) return;

               foreach (var de in drugExposures)
               {
               if (de.DrugCost == null) continue;
               foreach (var planPeriod in payerPlanPeriods)
               {
                   if (de.StartDate.Between(planPeriod.StartDate, planPeriod.EndDate.Value) &&
                       !string.IsNullOrEmpty(de.DrugCost.AdditionalFields["pat_planid"]) &&
                       de.DrugCost.AdditionalFields["pat_planid"] == planPeriod.PlanSourceValue)
                   {
                       de.DrugCost.PayerPlanPeriodId = planPeriod.Id;
                       break;
                   }
               }
               }

               foreach (var po in procedureOccurrences)
               {
               if (po.ProcedureCosts == null) continue;
               foreach (var planPeriod in payerPlanPeriods)
               {
                   if (po.StartDate.Between(planPeriod.StartDate, planPeriod.EndDate.Value))
                   {
                       foreach (var procedureCost in po.ProcedureCosts)
                       {
                           if (procedureCost.AdditionalFields["pat_planid"] == planPeriod.PlanSourceValue)
                           {
                               procedureCost.PayerPlanPeriodId = planPeriod.Id;
                           }
                       }
                   }
               }
               }
        }
Ejemplo n.º 2
0
 public static List<PayerPlanPeriod> GetPayerPlanPeriods(PayerPlanPeriod[] entities, Func<PayerPlanPeriod, PayerPlanPeriod, bool> canBeCombined, KeyMasterOffset keyMaster)
 {
     return GetPayerPlanPeriods(entities, 32, canBeCombined, keyMaster);
 }
Ejemplo n.º 3
0
        public static List<PayerPlanPeriod> GetPayerPlanPeriods(PayerPlanPeriod[] entities, int gap, Func<PayerPlanPeriod, PayerPlanPeriod, bool> canBeCombined, KeyMasterOffset keyMaster)
        {
            var result = new List<PayerPlanPeriod>();
            if (entities.Length == 0) return result;

            var ordered =
               entities.OrderBy(e => e.StartDate).ToList();
            var payerPlanPeriod = ordered[0];
            var list = new List<PayerPlanPeriod>();

            foreach (var entity in ordered)
            {
                if (canBeCombined(entity, payerPlanPeriod))
                {
                    list.Add(entity);
                    continue;
                }

                result.AddRange(GetEras(list, gap, -1).Select(i => new PayerPlanPeriod
                                                                             {
                                                                                 Id = keyMaster.PayerPlanPeriodId,
                                                                                 PersonId = i.PersonId,
                                                                                 StartDate = i.StartDate,
                                                                                 EndDate = i.EndDate,
                                                                                 PayerSourceValue =
                                                                                    payerPlanPeriod.PayerSourceValue,
                                                                                 FamilySourceValue =
                                                                                    payerPlanPeriod.FamilySourceValue,
                                                                                 PlanSourceValue =
                                                                                    payerPlanPeriod.PlanSourceValue
                                                                             }));

                list.Clear();
                payerPlanPeriod = entity;
                list.Add(entity);
            }

            result.AddRange(GetEras(list, gap, -1).Select(i => new PayerPlanPeriod
                                                                         {
                                                                             Id = keyMaster.PayerPlanPeriodId,
                                                                             PersonId = i.PersonId,
                                                                             StartDate = i.StartDate,
                                                                             EndDate = i.EndDate,
                                                                             PayerSourceValue =
                                                                                payerPlanPeriod.PayerSourceValue,
                                                                             FamilySourceValue =
                                                                                payerPlanPeriod.FamilySourceValue,
                                                                             PlanSourceValue =
                                                                                payerPlanPeriod.PlanSourceValue
                                                                         }));

            return result;
        }
Ejemplo n.º 4
0
        private static IEnumerable<PayerPlanPeriod> GetPayerPlanPeriods(string destination)
        {
            var dataText = File.ReadAllLines(destination);

             foreach (var line in dataText)
             {
            var pp = new PayerPlanPeriod
               {
                  StartDate = DateTime.Parse(line.Split('\t')[0]),
                  EndDate = DateTime.Parse(line.Split('\t')[1]),
                  PayerSourceValue = line.Split('\t')[2].Trim().ToLower() == "null" ? null : line.Split('\t')[2].Trim(),
                  PlanSourceValue =
                     line.Split('\t').Count() > 3 && line.Split('\t')[3].Trim().ToLower() != "null"
                        ? line.Split('\t')[3].Trim()
                        : null
               };

            pp.AdditionalFields = new Dictionary<string, string>();
            pp.AdditionalFields.Add("plantyp", pp.PayerSourceValue);
            if (line.Split('\t').Count() == 5)
               pp.AdditionalFields.Add("datatyp", line.Split('\t')[4].Trim().ToLower() == "null" ? null : line.Split('\t')[4].Trim());

            yield return pp;
             }
        }