///<summary>Fills the missing data field on the queueItem that was passed in. This contains all missing data on this claim. Claim will not be allowed to be sent electronically unless this string comes back empty.</summary> public static void GetMissingData(ClaimSendQueueItem queueItem) //, out string warnings){ { queueItem.Warnings = ""; queueItem.MissingData = ""; Clearinghouse clearhouse = ClearinghouseL.GetClearinghouse(queueItem.ClearinghouseNum, true); //Suppress error message in case no default medical clearinghouse set. //this is usually just the default clearinghouse or the clearinghouse for the PayorID. if (clearhouse == null) { if (queueItem.MedType == EnumClaimMedType.Dental) { queueItem.MissingData += "No default dental clearinghouse set."; } else { queueItem.MissingData += "No default medical/institutional clearinghouse set."; } return; } if (clearhouse.Eformat == ElectronicClaimFormat.x837D_4010) { X837_4010.Validate(queueItem); //,out warnings); //return; } else if (clearhouse.Eformat == ElectronicClaimFormat.x837D_5010_dental || clearhouse.Eformat == ElectronicClaimFormat.x837_5010_med_inst) { X837_5010.Validate(queueItem); //,out warnings); //return; } else if (clearhouse.Eformat == ElectronicClaimFormat.Renaissance) { queueItem.MissingData = Renaissance.GetMissingData(queueItem); //return; } else if (clearhouse.Eformat == ElectronicClaimFormat.Canadian) { queueItem.MissingData = Canadian.GetMissingData(queueItem); //return; } else if (clearhouse.Eformat == ElectronicClaimFormat.Dutch) { Dutch.GetMissingData(queueItem); //,out warnings); //return; } //return ""; }
///<summary>Called once for each claim to be created. For claims with a lot of procedures, this may actually create multiple claims. Normally returns empty string unless something went wrong.</summary> public static bool CreateClaim(ClaimSendQueueItem queueItem, int batchNum) { StringBuilder strb = new StringBuilder(); string t = "\t"; strb.Append("110\t111\t112\t118\t203/403\tF108/204/404\t205/405\t206\t207\t208\t209\t210\t211\t212\t215\t217\t219\t406\t408\t409\t410\t411\t413\t414\t415\t416\t418\t419\t420\t421\t422\t423\t424\t425\t426\t428\t429\t430\t432\t433\r\n"); Clearinghouse clearhouse = ClearinghouseL.GetClearinghouse(queueItem.ClearinghouseNum); Claim claim = Claims.GetClaim(queueItem.ClaimNum); Provider provBill = Providers.GetProv(claim.ProvBill); Patient pat = Patients.GetPat(claim.PatNum); InsPlan insplan = InsPlans.GetPlan(claim.PlanNum, new List <InsPlan>()); InsSub insSub = InsSubs.GetSub(claim.InsSubNum, new List <InsSub>()); Carrier carrier = Carriers.GetCarrier(insplan.CarrierNum); List <ClaimProc> claimProcList = ClaimProcs.Refresh(pat.PatNum); List <ClaimProc> claimProcsForClaim = ClaimProcs.GetForSendClaim(claimProcList, claim.ClaimNum); List <Procedure> procList = Procedures.Refresh(claim.PatNum); Procedure proc; ProcedureCode procCode; //ProcedureCode procCode; for (int i = 0; i < claimProcsForClaim.Count; i++) { proc = Procedures.GetProcFromList(procList, claimProcsForClaim[i].ProcNum); //procCode=Pro strb.Append(provBill.SSN + t); //110 strb.Append(provBill.MedicaidID + t); //111 strb.Append(t); //112 strb.Append(t); //118 strb.Append(pat.SSN + t); //203/403 strb.Append(carrier.CarrierName + t); //carrier name? strb.Append(insSub.SubscriberID + t); strb.Append(pat.PatNum.ToString() + t); strb.Append(pat.Birthdate.ToString("dd-MM-yyyy") + t); if (pat.Gender == PatientGender.Female) { strb.Append("2" + t); //"V"+t); } else { strb.Append("1" + t); //M"+t); } strb.Append("1" + t); strb.Append(DutchLName(pat.LName) + t); //last name without prefix strb.Append(DutchLNamePrefix(pat.LName) + t); //prefix strb.Append("2" + t); strb.Append(DutchInitials(pat) + t); //215. initials strb.Append(pat.Zip + t); strb.Append(DutchAddressNumber(pat.Address) + t); //219 house number. Already validated. strb.Append(t); strb.Append(proc.ProcDate.ToString("dd-MM-yyyy") + t); //procDate procCode = ProcedureCodes.GetProcCode(proc.CodeNum); string strProcCode = procCode.ProcCode; if (strProcCode.EndsWith("00")) //ending with 00 indicates it's a lab code. { strb.Append("02" + t); } else { strb.Append("01" + t); //409. Procedure code (01) or lab costs (02) } strb.Append(t); strb.Append(t); strb.Append(strProcCode + t); strb.Append(GetUL(proc, procCode) + t); //414. U/L. strb.Append(Tooth.ToInternat(proc.ToothNum) + t); strb.Append(Tooth.SurfTidyForClaims(proc.Surf, proc.ToothNum) + t); //needs validation strb.Append(t); if (claim.AccidentRelated == "") //not accident { strb.Append("N" + t); } else { strb.Append("J" + t); } strb.Append(pat.SSN + t); strb.Append(t); strb.Append(t); strb.Append(t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append("1" + t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append(t); strb.Append(t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append(t); strb.Append(t); strb.Append("\r\n"); } string saveFolder = clearhouse.ExportPath; if (!Directory.Exists(saveFolder)) { MessageBox.Show(saveFolder + " " + Lan.g("Dutch", "not found.")); return(false); } string saveFile = ODFileUtils.CombinePaths(saveFolder, "claims" + claim.ClaimNum.ToString() + ".txt"); File.WriteAllText(saveFile, strb.ToString()); //MessageBox.Show(strb.ToString()); return(true); }