Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        ///<summary>Tries to import the 834. Will return false if the user cancelled out of importing.</summary>
        private bool TryImport834()
        {
            if (checkDropExistingIns.Checked &&
                !MsgBox.Show(MsgBoxButtons.YesNo, "Insurance plans for patients will be automatically replaced with the new plans. Continue?"))
            {
                return(false);
            }
            if (!MsgBox.Show(this, true, "Importing insurance plans is a database intensive operation and can take 10 minutes or more to run.  "
                             + "It is best to import insurance plans after hours or during another time period when database usage is otherwise low.\r\n"
                             + "Click OK to import insurance plans now, or click Cancel."))
            {
                return(false);
            }
            checkIsPatientCreate.Enabled = false;
            checkDropExistingIns.Enabled = false;
            gridInsPlans.Enabled         = false;
            butOK.Enabled     = false;
            butCancel.Enabled = false;
            Cursor            = Cursors.WaitCursor;
            Prefs.UpdateBool(PrefName.Ins834DropExistingPatPlans, checkDropExistingIns.Checked);
            Prefs.UpdateBool(PrefName.Ins834IsPatientCreate, checkIsPatientCreate.Checked);
            //Create all of our count variables.
            int createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount,
                updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount;
            StringBuilder sbErrorMessages;

            EtransL.ImportInsurancePlans(_x834, _listPatients, checkIsPatientCreate.Checked, checkDropExistingIns.Checked, out createdPatsCount,
                                         out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount,
                                         out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages, (rowIndex, pat) => {
                ShowStatus("Progress " + (rowIndex).ToString().PadLeft(6) + "/" + gridInsPlans.ListGridRows.Count.ToString().PadLeft(6)
                           + "  Importing plans for patient " + pat.GetNameLF());
            });
            Cursor = Cursors.Default;
            #region summary output
            string msg = Lan.g(this, "Done.");
            if (createdPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients created:") + " " + createdPatsCount;
            }
            if (updatedPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients updated:") + " " + updatedPatsCount;
            }
            if (skippedPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients skipped:") + " " + skippedPatsCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdCarrierCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of carriers created:") + " " + createdCarrierCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdInsPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance plans created:") + " " + createdInsPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedInsPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance plan updates:") + " " + updatedInsPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdInsSubCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance subscriptions created:") + " " + createdInsSubCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedInsSubCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance subscriptions updated:") + " " + updatedInsSubCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients added to insurance:") + " " + createdPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (droppedPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients dropped from insurance:") + " " + droppedPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients insurance information updated:") + " " + updatedPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            #endregion summary output
            MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(msg);
            msgBox.ShowDialog();
            return(true);
        }