Ejemplo n.º 1
0
 ///<summary>We pass in the benefit list so that we know whether to include family.  We are getting a simplified list of claimprocs.  History of payments and pending payments.  If the patient has multiple insurance, then this info will be for all of their insurance plans.  It runs a separate query for each plan because that's the only way to handle family history.  For some plans, the benefits will indicate entire family, but not for other plans.  And the date ranges can be different as well.   When this list is processed later, it is again filtered, but it can't have missing information.  Use excludeClaimNum=-1 to not exclude a claim.  A claim is excluded if editing from inside that claim.</summary>
 public static List<ClaimProcHist> GetHistList(long patNum,List<Benefit> benList,List<PatPlan> patPlanList,List<InsPlan> planList,long excludeClaimNum,DateTime procDate,List<InsSub> subList)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         return Meth.GetObject<List<ClaimProcHist>>(MethodBase.GetCurrentMethod(),patNum,benList,patPlanList,planList,excludeClaimNum,procDate,subList);
     }
     List<ClaimProcHist> retVal=new List<ClaimProcHist>();
     InsSub sub;
     InsPlan plan;
     bool isFam;
     bool isLife;
     DateTime dateStart;
     DataTable table;
     ClaimProcHist cph;
     for(int p=0;p<patPlanList.Count;p++) {//loop through each plan that this patient is covered by
         sub=InsSubs.GetSub(patPlanList[p].InsSubNum,subList);
         //get the plan for the given patPlan
         plan=InsPlans.GetPlan(sub.PlanNum,planList);
         //test benefits for fam and life
         isFam=false;
         isLife=false;
         for(int i=0;i<benList.Count;i++) {
             if(benList[i].PlanNum==0 && benList[i].PatPlanNum!=patPlanList[p].PatPlanNum) {
                 continue;
             }
             if(benList[i].PatPlanNum==0 && benList[i].PlanNum!=plan.PlanNum) {
                 continue;
             }
             else if(benList[i].TimePeriod==BenefitTimePeriod.Lifetime) {
                 isLife=true;
             }
             if(benList[i].CoverageLevel==BenefitCoverageLevel.Family) {
                 isFam=true;
             }
         }
         if(isLife) {
             dateStart=new DateTime(1880,1,1);
         }
         else {
             //unsure what date to use to start.  DateTime.Today?  That might miss procs from late last year when doing secondary claim, InsPaidOther.
             //If we use the proc date, then it will indeed get an accurate history.  And future procedures just don't matter when calculating things.
             dateStart=BenefitLogic.ComputeRenewDate(procDate,plan.MonthRenew);
         }
         string command="SELECT claimproc.ProcDate,CodeNum,InsPayEst,InsPayAmt,DedApplied,claimproc.PatNum,Status,ClaimNum,claimproc.InsSubNum,claimproc.ProcNum  "
             +"FROM claimproc "
             +"LEFT JOIN procedurelog on claimproc.ProcNum=procedurelog.ProcNum "//to get the codenum
             +"WHERE "//claimproc.PlanNum="+POut.Long(plan.PlanNum)
             +"claimproc.InsSubNum="+POut.Long(patPlanList[p].InsSubNum)
             +" AND claimproc.ProcDate >= "+POut.Date(dateStart)//no upper limit on date.
             +" AND claimproc.Status IN("
             +POut.Long((int)ClaimProcStatus.NotReceived)+","
             +POut.Long((int)ClaimProcStatus.Adjustment)+","//insPayAmt and DedApplied
             +POut.Long((int)ClaimProcStatus.Received)+","
             +POut.Long((int)ClaimProcStatus.Supplemental)+")";
         if(!isFam) {
             //we include patnum because this one query can get results for multiple patients that all have this one subsriber.
             command+=" AND claimproc.PatNum="+POut.Long(patNum);
         }
         if(excludeClaimNum != -1) {
             command+=" AND claimproc.ClaimNum != "+POut.Long(excludeClaimNum);
         }
         table=Db.GetTable(command);
         for(int i=0;i<table.Rows.Count;i++) {
             cph=new ClaimProcHist();
             cph.ProcDate   = PIn.Date (table.Rows[i]["ProcDate"].ToString());
             cph.StrProcCode= ProcedureCodes.GetStringProcCode(PIn.Long(table.Rows[i]["CodeNum"].ToString()));
             cph.Status=(ClaimProcStatus)PIn.Long(table.Rows[i]["Status"].ToString());
             if(cph.Status==ClaimProcStatus.NotReceived) {
                 cph.Amount   = PIn.Double(table.Rows[i]["InsPayEst"].ToString());
             }
             else {
                 cph.Amount   = PIn.Double(table.Rows[i]["InsPayAmt"].ToString());
             }
             cph.Deduct     = PIn.Double(table.Rows[i]["DedApplied"].ToString());
             cph.PatNum     = PIn.Long   (table.Rows[i]["PatNum"].ToString());
             cph.ClaimNum   = PIn.Long   (table.Rows[i]["ClaimNum"].ToString());
             cph.InsSubNum  = PIn.Long   (table.Rows[i]["InsSubNum"].ToString());
             cph.ProcNum    = PIn.Long   (table.Rows[i]["ProcNum"].ToString());
             cph.PlanNum=plan.PlanNum;
             retVal.Add(cph);
         }
     }
     return retVal;
 }
Ejemplo n.º 2
0
Archivo: Benefits.cs Proyecto: mnisl/OD
		private static bool TighterLimitExists(List<Benefit> listShort,Benefit benefit,ClaimProcHist claimProcHist){
			if(claimProcHist.StrProcCode=="") {//If this was a 'total' payment that was not attached to a procedure
				//there won't be anything more restrictive.
				return false;
			}
			//The list is not in order by restrictive/broad, so tests will need to be done.
			if(benefit.CodeNum!=0) {//The benefit is already restrictive.  There isn't currently a way to have a more restrictive benefit, although in the future when code ranges are supported, a tighter code range would be more restrictive.
				return false;
			}
			for(int b=0;b<listShort.Count;b++) {
				if(listShort[b].BenefitNum==benefit.BenefitNum) {
					continue;//skip self.
				}
				if(listShort[b].QuantityQualifier!=BenefitQuantity.None) {
					continue;//it must be some other kind of limitation other than an amount limit.  For example, BW frequency.
				}
				if(listShort[b].CodeNum != 0) {
					if(listShort[b].CodeNum==ProcedureCodes.GetCodeNum(claimProcHist.StrProcCode)) {//Enhance later for code ranges when supported by program
						return true;//a tighter limitation benefit exists for this specific procedure code.
					}
				}
				else if(listShort[b].CovCatNum!=0) {//specific category
					if(benefit.CovCatNum!=0) {//If benefit is a category limitation,
						//then we can only consider categories that are more restrictive (further down on list).
						//either of these could be -1 if isHidden
						int orderBenefit=CovCats.GetOrderShort(benefit.CovCatNum);
						int orderTest=CovCats.GetOrderShort(listShort[b].CovCatNum);
						if(orderBenefit==-1) {
							//nothing to do here.  Treat it like a general limitation 
						}
						else if(orderTest<orderBenefit) {//the CovCat of listShort is further up in the list and less restrictive, so should not be considered.
							//this handles orderTest=-1, skipping the hidden category
							continue;
						}
					}
					else {//But if this is a general limitation,
						//then we don't need to do the above check because any match can be considered more restrictive.
					}
					//see if the claimProcHist is in this more restrictive category
					CovSpan[] spansForCat=CovSpans.GetForCat(listShort[b].CovCatNum);//get the spans 
					//This must be a payment that was attached to a proc, so test the proc to be in the coderange of this annual max benefit
					for(int j=0;j<spansForCat.Length;j++) {
						if(String.Compare(claimProcHist.StrProcCode,spansForCat[j].FromCode)>=0 
							&& String.Compare(claimProcHist.StrProcCode,spansForCat[j].ToCode)<=0) 
						{
							return true;
						}
					}
				}
			}
			return false;
		}
Ejemplo n.º 3
0
 /// <summary>Used in creation of the loopList.  Used in TP list estimation and in claim creation.  Some of the items in the claimProcList passed in will not have been saved to the database yet.</summary>
 public static List<ClaimProcHist> GetHistForProc(List<ClaimProc> claimProcList,long procNum,long codeNum)
 {
     List<ClaimProcHist> retVal=new List<ClaimProcHist>();
     ClaimProcHist cph;
     for(int i=0;i<claimProcList.Count;i++) {
         if(claimProcList[i].ProcNum != procNum) {
             continue;
         }
         cph=new ClaimProcHist();
         cph.Amount=ClaimProcs.GetInsEstTotal(claimProcList[i]);
         cph.ClaimNum=0;
         if(claimProcList[i].DedEstOverride != -1) {
             cph.Deduct=claimProcList[i].DedEstOverride;
         }
         else {
             cph.Deduct=claimProcList[i].DedEst;
         }
         cph.PatNum=claimProcList[i].PatNum;
         cph.PlanNum=claimProcList[i].PlanNum;
         cph.InsSubNum=claimProcList[i].InsSubNum;
         cph.ProcDate=DateTime.Today;
         cph.Status=ClaimProcStatus.Estimate;
         cph.StrProcCode=ProcedureCodes.GetStringProcCode(codeNum);
         retVal.Add(cph);
     }
     return retVal;
 }