Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        private void gridMain_DoubleClick(object sender, EventArgs e)
        {
            int index = gridMain.GetSelectedIndex();

            if (index == -1)           //Clicked in empty space.
            {
                return;
            }
            //Mimics FormClaimsSend.gridHistory_CellDoubleClick(...)
            Cursor = Cursors.WaitCursor;
            Etrans et = (Etrans)gridMain.ListGridRows[index].Tag;

            //Sadly this is needed due to FormEtrans835Edit calling Etranss.Update .
            //See Etranss.RefreshHistory(...), this query does not select all etrans columns.
            //Mimics FormClaimsSend.gridHistory_CellDoubleClick(...)
            et = Etranss.GetEtrans(et.EtransNum);
            if (et == null)
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "ERA could not be found, it was most likely deleted.");
                RefreshAndFillGrid();
                return;
            }
            EtransL.ViewFormForEra(et, this);
            Cursor = Cursors.Default;
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public void X835_GetStatus_Finalized()
        {
            //Finalized => Some or all ERA claims are attached and have financial payment entered with claim payment.
            //Other claims must be manually detached.
            _x835.ListClaimsPaid[0].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[0].ClaimNum          = _claimPrimaryJustinSmith.ClaimNum;
            _x835.ListClaimsPaid[1].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[1].ClaimNum          = _claimPrimaryJacobJones.ClaimNum;
            _x835.ListClaimsPaid[2].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[2].ClaimNum          = _claimPrimaryStephanieMayer.ClaimNum;
            //TryEnterPayment returns if claim is recieved or payment already entered (no supplemental).
            TryEnterPayment(_x835, _eraJustinSmithClaim, _claimPrimaryJustinSmith, true);
            TryEnterPayment(_x835, _eraJacobJonesClaim, _claimPrimaryJacobJones, true);
            TryEnterPayment(_x835, _eraStephanieMayerClaim, _claimPrimaryStephanieMayer, true);
            X835Status status;

            if (!EtransL.TryFinalizeBatchPayment(_x835, true, true))
            {
                status = X835Status.None;
            }
            else
            {
                List <Claim> listClaims = new List <Claim>()
                {
                    _claimPrimaryJustinSmith, _claimPrimaryJacobJones, _claimPrimaryStephanieMayer
                };
                List <long> listPatNums = new List <long>()
                {
                    _claimPrimaryJustinSmith.PatNum, _claimPrimaryJacobJones.PatNum, _claimPrimaryStephanieMayer.PatNum
                };
                status = _x835.GetStatus(listClaims, ClaimProcs.Refresh(listPatNums), _listEtrans835Attaches);
            }
            Assert.AreEqual(X835Status.Finalized, status);
        }
Ejemplo n.º 6
0
        public void X835_GetStatus_FinalizedSomeDetached()
        {
            //FinalizedSomeDetached => Some ERA claims has financial information entered and claim payment.
            //Others are manually detached.
            _x835.ListClaimsPaid[0].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[0].ClaimNum          = _eraJustinSmithClaim.ClaimNum;
            _x835.ListClaimsPaid[1].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[1].ClaimNum          = 0;
            _x835.ListClaimsPaid[2].IsAttachedToClaim = true;
            _x835.ListClaimsPaid[2].ClaimNum          = 0;
            //Returns if claim is recieved or payment already entered (no supplemental).
            TryEnterPayment(_x835, _eraJustinSmithClaim, _claimPrimaryJustinSmith, true);
            EtransL.TryFinalizeBatchPayment(_x835, true, true);
            //jsalmon - No, you should not situationally return out of a unit test without an explanation.
            //if(!EtransL.TryFinalizeBatchPayment(_x835,true,true)) {
            //	return;
            //}
            List <Claim> listClaims = new List <Claim>()
            {
                _claimPrimaryJustinSmith, new Claim(), new Claim()
            };                                                                                                        //Spoof manually detached claims.
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(_claimPrimaryJustinSmith.PatNum);
            X835Status       status         = _x835.GetStatus(listClaims, listClaimProcs, _listEtrans835Attaches);

            Assert.AreEqual(X835Status.FinalizedSomeDetached, status);
        }
Ejemplo n.º 7
0
 private void FormEtrans835Edit_Shown(object sender, EventArgs e)
 {
     if (_hasPrintPreviewOnLoad)
     {
         //This way the form will fully load visually before showing the print preview.
         EtransL.PrintPreview835(_x835, _preLoadedPrintPreviewClaimNum);
     }
 }
Ejemplo n.º 8
0
 ///<summary>Returns if given claim is already recieved. Currently ERA test do not consider supplemental.</summary>
 public static void TryEnterPayment(X835 x835, Hx835_Claim claimPaid, Claim claim, bool isAutomatic)
 {
     if (claim.ClaimStatus == "R")           //Currently we do not have test for supplemental payments.
     {
         return;
     }
     EtransL.ImportEraClaimData(x835, claimPaid, claim, isAutomatic);
 }
Ejemplo n.º 9
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (!EtransL.TryDeleteEra(_x835, _x835.RefreshClaims(), _listClaimProcs, _listAttaches))
     {
         return;
     }
     DialogResult = DialogResult.OK;
     Close();
 }
Ejemplo n.º 10
0
        ///<summary>Since ERAs are only used in the United States, we do not need to translate any text shown to the user.</summary>
        private void butBatch_Click(object sender, EventArgs e)
        {
            if (gridClaimDetails.ListGridRows.Count == 0)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            if (!EtransL.TryFinalizeBatchPayment(_x835))
            {
                Cursor = Cursors.Default;
                return;
            }

            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
            Close();
        }
Ejemplo n.º 11
0
        private void gridClaimDetails_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Hx835_Claim claimPaid      = (Hx835_Claim)gridClaimDetails.ListGridRows[e.Row].Tag;
            Claim       claim          = claimPaid.GetClaimFromDb();
            bool        isAttachNeeded = (!claimPaid.IsAttachedToClaim);

            if (claim == null)           //Not found in db.
            {
                claim = ClaimSelectionHelper(claimPaid);
                if (claim != null)               //A claim was selected.
                {
                    isAttachNeeded = true;       //Hard attach selected claim to db claim, since user manually picked matching claim.
                }
            }
            if (claim == null)           //Claim not found and user did not select one.
            {
                return;
            }
            //From this point on claim is not null.
            bool isReadOnly = true;

            CreateAttachForClaim(claimPaid, claim.ClaimNum, isAttachNeeded);
            if (claimPaid.IsSplitClaim)
            {
                //Sync ClaimNum for all split claims in the same group, based on user selection.
                claimPaid.GetOtherNotDetachedSplitClaims()
                .ForEach(x => CreateAttachForClaim(x, claim.ClaimNum, isAttachNeeded));
            }
            if (claimPaid.IsProcessed(_listClaimProcs, _listAttaches))
            {
                //If the claim is already received, then we do not allow the user to enter payments.
                //The user can edit the claim to change the status from received if they wish to enter the payments again.
                if (Security.IsAuthorized(Permissions.ClaimView))
                {
                    Patient       pat    = Patients.GetPat(claim.PatNum);
                    Family        fam    = Patients.GetFamily(claim.PatNum);
                    FormClaimEdit formCE = new FormClaimEdit(claim, pat, fam);
                    formCE.ShowDialog();                    //Modal, because the user could edit information in this window.
                }
                isReadOnly = false;
            }
            else if (Security.IsAuthorized(Permissions.InsPayCreate))             //Claim found and is not received.  Date not checked here, but it will be checked when actually creating the check.
            {
                EtransL.ImportEraClaimData(_x835, claimPaid, claim, false);
                RefreshFromDb();                //ClaimProcs could have been split, need to refresh both claimProc list and attaches.
                isReadOnly = false;
            }
            if (isReadOnly)
            {
                FormEtrans835ClaimEdit formC = new FormEtrans835ClaimEdit(_x835, claimPaid);
                formC.Show(this);                //This window is just used to display information.
            }
            if (!gridClaimDetails.IsDisposed)    //Not sure how the grid is sometimes disposed, perhaps because of it being non-modal.
            //Refresh the claim detail row in case something changed above.
            {
                gridClaimDetails.BeginUpdate();
                List <GridRow> listRows = new List <GridRow>()
                {
                    gridClaimDetails.ListGridRows[e.Row]
                };                                          //Row associated to claimPaid
                if (claimPaid.IsSplitClaim)                 //Need to update multiple rows.
                {
                    List <Hx835_Claim> listOtherSplitClaims = claimPaid.GetOtherNotDetachedSplitClaims();
                    List <GridRow>     listAdditionalRows   = gridClaimDetails.ListGridRows
                                                              .Where(x =>
                                                                     x != gridClaimDetails.ListGridRows[e.Row] &&
                                                                     listOtherSplitClaims.Contains((Hx835_Claim)x.Tag)
                                                                     ).ToList();
                    listRows.AddRange(listAdditionalRows);
                }
                SetClaimDetailRows(listRows, listRows.Select(x => (Hx835_Claim)x.Tag).ToList(), true);
                gridClaimDetails.EndUpdate();
            }
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
 private void gridEras_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
 {
     EtransL.ViewFormForEra(_listEtrans[gridEras.SelectedIndices[0]], this, _specificClaimNum);
 }