public void X834_ImportInsurancePlans_ReplacePatPlan() { Patient pat = Createx834Patient(); string suffix = MethodBase.GetCurrentMethod().Name; //Create old insurance plan and associate it to them. InsuranceInfo insuranceOld = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix); //Create x834 X834 x834 = new X834(new X12object(Properties.Resources.x834Test)); int createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount, updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount; StringBuilder sbErrorMessages; //Pass in true for dropExistingInsurance EtransL.ImportInsurancePlans(x834, new List <Patient> { pat }, true, true, out createdPatsCount, out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount, out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages); //Get the pat plans for this patient from the database. List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum); Assert.AreEqual(1, listPatPlans.Count); Assert.AreEqual(1, droppedPatPlanCount); InsSub subForPatPlan = InsSubs.GetOne(listPatPlans[0].InsSubNum); //These should be different as a new plan was created and the old plan was dropped. Assert.AreNotEqual(insuranceOld.PriInsPlan.PlanNum, subForPatPlan.PlanNum); }
public void X834_ImportInsurancePlans_ReplaceSecondaryPatPlan() { Patient pat = Createx834Patient(); string suffix = MethodBase.GetCurrentMethod().Name; //Create primary insurance plan that appears in the 834. InsuranceInfo insurancePrimary = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix, subscriberID: "CG00000B"); //Create secondary insurance that does not appear in the 834. InsuranceInfo insuranceSecondary = InsuranceT.AddInsurance(pat, "Secondary Carrier" + suffix); //Get the pat plans for this patient from the database. List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum); Assert.AreEqual(2, listPatPlans.Count); //Create x834 X834 x834 = new X834(new X12object(Properties.Resources.x834Test)); int createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount, updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount; StringBuilder sbErrorMessages; //Pass in true for dropExistingInsurance EtransL.ImportInsurancePlans(x834, new List <Patient> { pat }, true, true, out createdPatsCount, out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount, out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages); //Get the pat plans for this patient from the database. listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum); Assert.AreEqual(1, listPatPlans.Count); Assert.AreEqual(1, droppedPatPlanCount); //These should be different as a new plan was created and the old plan was dropped. Assert.AreEqual(insurancePrimary.ListPatPlans[0].PatPlanNum, listPatPlans[0].PatPlanNum); }
public void X834_ImportInsurancePlans_DoNotReplacePatPlan() { Patient pat = Createx834Patient(); string suffix = MethodBase.GetCurrentMethod().Name; //Create old insurance plan and associate it to them. InsuranceInfo insuranceOld = InsuranceT.AddInsurance(pat, "Old Carrier" + suffix); //Create x834 X834 x834 = new X834(new X12object(Properties.Resources.x834Test)); int createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount, updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount; StringBuilder sbErrorMessages; EtransL.ImportInsurancePlans(x834, new List <Patient> { pat }, true, false, out createdPatsCount, out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount, out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages); //Get the pat plans for this patient from the database. List <PatPlan> listPatPlans = PatPlans.GetPatPlansForPat(pat.PatNum); //No patient was created. Should have matched the one we created. Assert.AreEqual(0, createdPatsCount); //There should be two now as the old was kept. Assert.AreEqual(2, listPatPlans.Count); Assert.AreEqual(1, createdPatPlanCount); }
private void Load834_Unsafe() { Cursor = Cursors.WaitCursor; ShowStatus("Loading..."); Application.DoEvents(); const int previewLimitCount = 40; int selectedIndex = -1; _x834selected = null; for (int i = 0; i < gridInsPlanFiles.ListGridRows.Count; i++) { UI.GridRow row = gridInsPlanFiles.ListGridRows[i]; if (i < previewLimitCount) { gridInsPlanFiles.BeginUpdate(); } string filePath = (string)row.Tag; ShowStatus(Lan.g(this, "Parsing file") + " " + Path.GetFileName(filePath)); string messageText = File.ReadAllText(filePath); X12object xobj = X12object.ToX12object(messageText); if (xobj == null) { row.Cells[_colErrorIndex].Text = "Is not in X12 format."; continue; } try { if (!X834.Is834(xobj)) { row.Cells[_colErrorIndex].Text = "Is in X12 format, but is not an 834 document."; continue; } xobj.FilePath = filePath; row.Cells[_colDateIndex].Text = xobj.DateInterchange.ToString(); int memberCount = xobj.GetSegmentCountById("INS"); int planCount = xobj.GetSegmentCountById("HD"); row.Cells[_colPatCountIndex].Text = memberCount.ToString(); row.Cells[_colPlanCountIndex].Text = planCount.ToString(); row.Cells[_colErrorIndex].Text = ""; if (_x834selected == null || _x834selected.DateInterchange > xobj.DateInterchange) { selectedIndex = i; _x834selected = xobj; } } catch (ApplicationException aex) { row.Cells[_colErrorIndex].Text = aex.Message; } catch (Exception ex) { row.Cells[_colErrorIndex].Text = ex.ToString(); } if (i < previewLimitCount) { gridInsPlanFiles.EndUpdate(); //Also invalidates grid. Update required in case there was large error text. Application.DoEvents(); } } //These 834 files are large and take a lot of memory when parsed into objects. //Run garbage collection to prevent OD from taking up too much memory at one time. GC.Collect(); gridInsPlanFiles.BeginUpdate(); if (selectedIndex >= 0) { gridInsPlanFiles.ListGridRows[selectedIndex].ColorBackG = Color.LightYellow; } gridInsPlanFiles.EndUpdate(); //Also invalidates grid. Update required in case there was large error text. ShowStatus(""); Cursor = Cursors.Default; Application.DoEvents(); }
public FormEtrans834Preview(X834 x834) { InitializeComponent(); Lan.F(this); _x834 = x834; }