public void RpProcNotBilledIns_GetProcsNotBilled_MedicalInsOnly()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            Patient       patient       = PatientT.CreatePatient(suffix);
            Carrier       carrier       = CarrierT.CreateCarrier(suffix);
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("T7782");
            //Create a primary medical insurance plan
            InsuranceInfo insuranceInfo = InsuranceT.AddInsurance(patient, carrier.CarrierName, ordinal: 1, isMedical: true);

            insuranceInfo.AddBenefit(BenefitT.CreatePercentForProc(insuranceInfo.MedInsPlan.PlanNum, procedureCode.CodeNum, 80));
            Procedure procedure = ProcedureT.CreateProcedure(patient, procedureCode.ProcCode, ProcStat.TP, "", 55, procDate: DateTime.Now.AddDays(-3));

            ProcedureT.ComputeEstimates(patient, insuranceInfo);
            ProcedureT.SetComplete(procedure, patient, insuranceInfo);
            //Run the procs not billed report with "includeMedProcs" set to false.
            //The patient should not be returned due to not having any dental insurance estimates.
            DataTable table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), false, DateTime.Now.AddDays(-10), DateTime.Now, false, false);

            Assert.IsNotNull(table);
            Assert.IsFalse(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
            //Run the procs not billed report with "includeMedProcs" set to true.
            //The patient should be returned due to the medical insurance estimates.
            table = RpProcNotBilledIns.GetProcsNotBilled(new List <long>(), true, DateTime.Now.AddDays(-10), DateTime.Now, false, false);
            Assert.IsNotNull(table);
            Assert.IsTrue(table.Rows.Count > 0);
            Assert.IsTrue(table.Select().Select(x => PIn.Long(x["PatNum"].ToString())).Contains(patient.PatNum));
        }
Пример #2
0
        public void ProcMultiVisitTests_CrownGroupComplete_ClaimDates()
        {
            string           suffix       = MethodBase.GetCurrentMethod().Name;
            Patient          pat          = PatientT.CreatePatient(suffix);
            InsuranceInfo    insInfo      = InsuranceT.AddInsurance(pat, suffix);
            List <Procedure> listProcs    = new List <Procedure>();
            Procedure        procBillable = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "1", 100, new DateTime(2018, 5, 1));//PFM

            listProcs.Add(procBillable);
            Procedure procDelivery = ProcedureT.CreateProcedure(pat, "N4118", ProcStat.TP, "1", 0, new DateTime(2018, 8, 20));   //Seat - usually completed several months later.

            listProcs.Add(procDelivery);
            List <ClaimProc> listClaimProcs = ProcedureT.ComputeEstimates(pat, insInfo);

            ProcMultiVisits.CreateGroup(listProcs);
            Procedure procBillableOld = procBillable.Copy();

            procBillable.ProcStatus = ProcStat.C;
            Procedures.Update(procBillable, procBillableOld);
            Procedure procDeliveryOld = procDelivery.Copy();

            procDelivery.ProcStatus = ProcStat.C;
            Procedures.Update(procDelivery, procDeliveryOld);
            Assert.AreEqual(ProcMultiVisits.IsProcInProcess(procBillable.ProcNum), false);           //Both procedures complete means the group is now complete (not In Process).
            Assert.AreEqual(ProcMultiVisits.IsProcInProcess(procDelivery.ProcNum), false);           //Both procedures complete means the group is now complete (not In Process).
            Claim claim = new Claim();

            claim.DateSent     = DateTimeOD.Today;
            claim.DateSentOrig = DateTime.MinValue;
            claim.ClaimStatus  = "W";
            //Dates of service are calculated inside AccountModules.CreateClaim().
            //The procDelivery cannot be attached to the claim in the UI, because $0 procs are blocked by UI.  Therefore, we only attach the procBilled to the claim here.
            ODTuple <bool, Claim, string> clmResult = AccountModules.CreateClaim(claim, "P", insInfo.ListPatPlans, insInfo.ListInsPlans, listClaimProcs, listProcs,
                                                                                 insInfo.ListInsSubs, pat, null, new List <Procedure> {
                procBillable
            }, "", insInfo.PriInsPlan, insInfo.PriInsSub, Relat.Self);

            Assert.AreEqual(clmResult.Item3, "");                                //Ensure no validation errors creating the claim.  This is to verify the integrity of the unit test design.
            Assert.AreEqual(clmResult.Item2.DateService, procDelivery.ProcDate); //Claim date of service must always be the greatest date in the multi visit group.
            listClaimProcs = ClaimProcs.RefreshForClaim(clmResult.Item2.ClaimNum);
            Assert.AreEqual(listClaimProcs[0].ProcDate, procDelivery.ProcDate);  //Proc date of service must always be the greatest date in the multi visit group, even if performed on a different day.
        }