Пример #1
0
        public void ProcedureCodes_GetSubstituteCodeNum_Posterior()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level.
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2740");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2750");

            originalProcCode.SubstitutionCode = "D2750";
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Posterior;
            ProcedureCodeT.Update(originalProcCode);
            //Posterior Procedure= ToothNum 4
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //Finally, use one or more asserts to verify the results.
            Assert.AreEqual(downgradeProcCode.CodeNum, subCodeNum);
        }
Пример #2
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideAlways()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level.
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2330");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140");

            originalProcCode.SubstitutionCode = "D2140";
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Always;
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Always, plan.PlanNum);
            //Next, perform the thing you're trying to test.
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //Finally, use one or more asserts to verify the results.
            Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum);
        }
Пример #3
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverrideNever()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Add a substitution code on the procedure level that has SubstitutionCondition.Never.
            ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2330");

            //clear out any substitution codes on this procedure
            originalProcCode.SubstitutionCode = "";
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode to never substitute
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2150");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Never, plan.PlanNum);
            //Next, perform the thing you're trying to test.
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "9", 100);//Tooth 9
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //The procedure level and ins override is set SubstitutionCondition.Never so it should use originalProcCode.CodeNum
            Assert.AreEqual(originalProcCode.CodeNum, subCodeNum);
        }
Пример #4
0
        public void ProcedureCodes_GetSubstituteCodeNum_InsPlanOverridePosterior()
        {
            //First, setup the test scenario.
            string  suffix  = MethodBase.GetCurrentMethod().Name;
            Patient pat     = PatientT.CreatePatient(suffix);
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            //Procedure code does not have a substitution code
            ProcedureCode originalProcCode = ProcedureCodes.GetProcCode("D2740");

            //clear out any substitution codes on this procedure
            originalProcCode.SubstitutionCode = "";
            ProcedureCodeT.Update(originalProcCode);
            //Add an override for the inplan above for the originalProcCode to substitute if posterior
            ProcedureCode downgradeProcCodeForIns = ProcedureCodes.GetProcCode("D2750");

            SubstitutionLinkT.CreateSubstitutionLink(originalProcCode.CodeNum, downgradeProcCodeForIns.ProcCode, SubstitutionCondition.Posterior, plan.PlanNum);
            //Posterior procedure
            Procedure proc       = ProcedureT.CreateProcedure(pat, originalProcCode.ProcCode, ProcStat.C, "4", 100);//Tooth 4
            long      subCodeNum = ProcedureCodes.GetSubstituteCodeNum(originalProcCode.ProcCode, proc.ToothNum, plan.PlanNum);

            //The ins override is set to substitute only if posterior.
            Assert.AreEqual(downgradeProcCodeForIns.CodeNum, subCodeNum);
        }
Пример #5
0
        public void InsPlan_PpoNoSubWriteoffsNoSub()
        {
            string        suffix         = MethodBase.GetCurrentMethod().Name;
            Patient       pat            = PatientT.CreatePatient(suffix);
            long          ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR Fees" + suffix);
            long          ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);
            InsuranceInfo ins            = InsuranceT.AddInsurance(pat, suffix, planType: "p", feeSchedNum: ppoFeeSchedNum);

            ins.PriInsPlan.HasPpoSubstWriteoffs = false;
            InsPlans.Update(ins.PriInsPlan);
            BenefitT.CreateCategoryPercent(ins.PriInsPlan.PlanNum, EbenefitCategory.Restorative, 50);
            ProcedureCode originalProcCode  = ProcedureCodes.GetProcCode("D2330");
            ProcedureCode downgradeProcCode = ProcedureCodes.GetProcCode("D2140");

            originalProcCode.SubstitutionCode = "";          //NOT substituting
            originalProcCode.SubstOnlyIf      = SubstitutionCondition.Always;
            ProcedureCodeT.Update(originalProcCode);
            FeeT.CreateFee(ucrFeeSchedNum, originalProcCode.CodeNum, 100);
            FeeT.CreateFee(ucrFeeSchedNum, downgradeProcCode.CodeNum, 80);
            FeeT.CreateFee(ppoFeeSchedNum, originalProcCode.CodeNum, 60);
            FeeT.CreateFee(ppoFeeSchedNum, downgradeProcCode.CodeNum, 50);
            Procedure        proc           = ProcedureT.CreateProcedure(pat, "D2330", ProcStat.C, "9", 100);//Tooth 9
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);
            List <Procedure> listProcs      = Procedures.Refresh(pat.PatNum);

            ins.RefreshBenefits();
            Claim     claim  = ClaimT.CreateClaim("P", ins.ListPatPlans, ins.ListInsPlans, listClaimProcs, listProcs, pat, listProcs, ins.ListBenefits, ins.ListInsSubs);
            ClaimProc clProc = ClaimProcs.Refresh(pat.PatNum)[0];          //Should only be one

            Assert.AreEqual(50, clProc.Percentage);
            Assert.AreEqual(30, clProc.BaseEst);
            Assert.AreEqual(30, clProc.InsPayEst);
            Assert.AreEqual(40, clProc.WriteOffEst);
        }
Пример #6
0
        private void butEncCdt_Click(object sender, EventArgs e)
        {
            FormProcCodes FormP = new FormProcCodes();

            if (!Security.IsAuthorized(Permissions.SecurityAdmin, false))
            {
                FormP.IsSelectionMode = false;
            }
            else
            {
                FormP.IsSelectionMode = true;
            }
            FormP.ShowDialog();
            if (FormP.DialogResult == DialogResult.OK)
            {
                NewEncCodeSystem            = "CDT";
                comboEncCodes.SelectedIndex = -1;
                ProcedureCode procCur = ProcedureCodes.GetProcCode(FormP.SelectedCodeNum);
                textEncCodeValue.Text    = procCur.ProcCode;
                textEncCodeDescript.Text = procCur.Descript;
                //We might implement a CodeSystem column on the ProcCode table since it may have ICD9 and ICD10 codes in it.  If so, we can set the NewEncCodeSystem to the value in that new column.
                //NewEncCodeSystem=procCur.CodeSystem;
                labelEncWarning.Visible = true;
            }
        }
        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));
        }
Пример #8
0
        public void InsPlans_GetAllowed_NoFeeSched()
        {
            Carrier carrier = CarrierT.CreateCarrier(MethodBase.GetCurrentMethod().Name);
            InsPlan plan    = new InsPlan();

            plan.CarrierNum = carrier.CarrierNum;
            plan.PlanType   = "";
            plan.CobRule    = EnumCobRule.Basic;
            plan.PlanNum    = InsPlans.Insert(plan);
            ProcedureCode procCode = _listProcCodes[13];

            procCode.SubstitutionCode = _listProcCodes[14].ProcCode;
            ProcedureCodes.Update(procCode);
            ProcedureCodes.RefreshCache();
            Provider prov         = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
            long     provFeeSched = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name);

            prov.FeeSched = provFeeSched;
            Providers.Update(prov);
            Providers.RefreshCache();
            Fee defaultFee = FeeT.GetNewFee(Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)).FeeSched,
                                            ProcedureCodes.GetSubstituteCodeNum(procCode.ProcCode, "", plan.PlanNum), 80);
            double amt = InsPlans.GetAllowed(procCode.ProcCode, plan.FeeSched, plan.AllowedFeeSched, plan.CodeSubstNone, plan.PlanType, "", 0, 0, plan.PlanNum);

            Assert.AreEqual(defaultFee.Amount, amt);
        }
Пример #9
0
 ///<summary>The procedure code must have already been insterted into the database.</summary>
 public FormProcCodeEdit(ProcedureCode procCode)
 {
     InitializeComponent();            // Required for Windows Form Designer support
     tbTime.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbTime_CellClicked);
     Lan.F(this);
     ProcCode = procCode;
 }
Пример #10
0
        public override T Convert <T, U>(U entity)
        {
            ProcedureCode procedureCode = entity as ProcedureCode;

            if (procedureCode == null)
            {
                return(default(T));
            }

            BO.ProcedureCode procedureCodeBO = new BO.ProcedureCode();

            procedureCodeBO.ID = procedureCode.Id;
            procedureCodeBO.ProcedureCodeText = procedureCode.ProcedureCodeText;
            procedureCodeBO.ProcedureCodeDesc = procedureCode.ProcedureCodeDesc;
            procedureCodeBO.Amount            = procedureCode.Amount;
            procedureCodeBO.CompanyId         = procedureCode.CompanyId;
            procedureCodeBO.SpecialityId      = procedureCode.SpecialityId;
            procedureCodeBO.RoomTestId        = procedureCode.RoomTestId;

            if (procedureCode.IsDeleted.HasValue)
            {
                procedureCodeBO.IsDeleted = procedureCode.IsDeleted.Value;
            }
            if (procedureCode.UpdateByUserID.HasValue)
            {
                procedureCodeBO.UpdateByUserID = procedureCode.UpdateByUserID.Value;
            }

            return((T)(object)procedureCodeBO);
        }
Пример #11
0
        public void Fees_GetListFromObjects_DiscountPlan()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Create a discount plan and associate it to the fee schedule that was just created.
            DiscountPlan discountPlan = DiscountPlanT.CreateDiscountPlan(suffix, feeSchedNum: fee.FeeSched);
            //Act like a discount plan has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          null,
                                                          null,
                                                          discountPlan.DiscountPlanNum);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #12
0
 ///<summary>Inserts one ProcedureCode into the database.  Returns the new priKey.</summary>
 internal static long Insert(ProcedureCode procedureCode)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         procedureCode.CodeNum=DbHelper.GetNextOracleKey("procedurecode","CodeNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(procedureCode,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     procedureCode.CodeNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(procedureCode,false);
     }
 }
Пример #13
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 17, Configuration.FieldSeparator),
                       Id,
                       SetIdPr1.HasValue ? SetIdPr1.Value.ToString(culture) : null,
                       ProcedureCodingMethod,
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureDescription,
                       ProcedureDateTime.HasValue ? ProcedureDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ProcedureFunctionalType,
                       ProcedureMinutes.HasValue ? ProcedureMinutes.Value.ToString(Consts.NumericFormat, culture) : null,
                       Anesthesiologist != null ? string.Join(Configuration.FieldRepeatSeparator, Anesthesiologist.Select(x => x.ToDelimitedString())) : null,
                       AnesthesiaCode,
                       AnesthesiaMinutes.HasValue ? AnesthesiaMinutes.Value.ToString(Consts.NumericFormat, culture) : null,
                       Surgeon != null ? string.Join(Configuration.FieldRepeatSeparator, Surgeon.Select(x => x.ToDelimitedString())) : null,
                       ProcedurePractitioner != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedurePractitioner.Select(x => x.ToDelimitedString())) : null,
                       ConsentCode?.ToDelimitedString(),
                       ProcedurePriority,
                       AssociatedDiagnosisCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Пример #14
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       SetIdPr1.HasValue ? SetIdPr1.Value.ToString(culture) : null,
                       ProcedureCodingMethod,
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureDescription,
                       ProcedureDateTime.HasValue ? ProcedureDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ProcedureFunctionalType?.ToDelimitedString(),
                       ProcedureMinutes.HasValue ? ProcedureMinutes.Value.ToString(Consts.NumericFormat, culture) : null,
                       Anesthesiologist?.ToDelimitedString(),
                       AnesthesiaCode?.ToDelimitedString(),
                       AnesthesiaMinutes.HasValue ? AnesthesiaMinutes.Value.ToString(Consts.NumericFormat, culture) : null,
                       Surgeon?.ToDelimitedString(),
                       ProcedurePractitioner?.ToDelimitedString(),
                       ConsentCode?.ToDelimitedString(),
                       ProcedurePriority,
                       AssociatedDiagnosisCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null,
                       ProcedureDrgType?.ToDelimitedString(),
                       TissueTypeCode != null ? string.Join(Configuration.FieldRepeatSeparator, TissueTypeCode.Select(x => x.ToDelimitedString())) : null,
                       ProcedureIdentifier?.ToDelimitedString(),
                       ProcedureActionCode,
                       DrgProcedureDeterminationStatus?.ToDelimitedString(),
                       DrgProcedureRelevance?.ToDelimitedString(),
                       TreatingOrganizationalUnit != null ? string.Join(Configuration.FieldRepeatSeparator, TreatingOrganizationalUnit.Select(x => x.ToDelimitedString())) : null,
                       RespiratoryWithinSurgery,
                       ParentProcedureId?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Пример #15
0
        ///<summary>Creates a procedure and computes estimates for a patient where the secondary insurance has a COB rule of Medicaid.</summary>
        private void ComputeEstimatesMedicaidCOB(string suffix, double procFee, double priAllowed, double secAllowed, int priPercentCovered,
                                                 int secPercentCovered, Action <ClaimProc /*Primary*/, ClaimProc /*Secondary*/, Procedure> assertAct)
        {
            Patient pat            = PatientT.CreatePatient(suffix);
            long    ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum);
            long medicaidFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", medicaidFeeSchedNum, 2, cobRule: EnumCobRule.SecondaryMedicaid);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            InsPlan        priPlan      = InsPlanT.GetPlanForPriSecMed(PriSecMed.Primary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(priPlan.PlanNum, EbenefitCategory.Diagnostic, priPercentCovered);
            InsPlan secPlan = InsPlanT.GetPlanForPriSecMed(PriSecMed.Secondary, listPatPlans, listPlans, listSubs);

            BenefitT.CreateCategoryPercent(secPlan.PlanNum, EbenefitCategory.Diagnostic, secPercentCovered);
            List <Benefit> listBens = Benefits.Refresh(listPatPlans, listSubs);
            string         procStr  = "D0150";
            Procedure      proc     = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ProcedureCode  procCode = ProcedureCodes.GetProcCode(procStr);

            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, priAllowed);
            FeeT.CreateFee(medicaidFeeSchedNum, procCode.CodeNum, secAllowed);
            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), false, listPlans, listPatPlans, listBens, pat.Age, listSubs);
            List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(pat.PatNum);

            assertAct(listClaimProcs.FirstOrDefault(x => x.PlanNum == priPlan.PlanNum), listClaimProcs.FirstOrDefault(x => x.PlanNum == secPlan.PlanNum), proc);
        }
 public XDocument Serialize()
 {
     return(new XDocument(new XElement(EspdNames.Qarq + nameof(QualificationApplicationRequest),
                                       new XAttribute(XNamespace.Xmlns + "cbc", UblNames.Cbc),
                                       new XAttribute(XNamespace.Xmlns + "cac", UblNames.Cac),
                                       UBLVersionID.Serialize(nameof(UBLVersionID)),
                                       CustomizationID.Serialize(nameof(CustomizationID)),
                                       ProfileID.Serialize(nameof(ProfileID)),
                                       ProfileExecutionID.Serialize(nameof(ProfileExecutionID)),
                                       ID?.Serialize(nameof(ID)),
                                       CopyIndicator.Serialize(nameof(CopyIndicator)),
                                       UUID.Serialize(nameof(UUID)),
                                       ContractFolderID.Serialize(nameof(ContractFolderID)),
                                       IssueDate.Serialize(nameof(IssueDate)),
                                       IssueTime.Serialize(nameof(IssueTime)),
                                       VersionID.Serialize(nameof(VersionID)),
                                       PreviousVersionID.Serialize(nameof(PreviousVersionID)),
                                       ProcedureCode.Serialize(nameof(ProcedureCode)),
                                       QualificationApplicationTypeCode.Serialize(nameof(QualificationApplicationTypeCode)),
                                       WeightScoringMethodologyNote.Serialize(nameof(WeightScoringMethodologyNote)),
                                       WeightingTypeCode.Serialize(nameof(WeightingTypeCode)),
                                       ContractingParty?.Serialize(),
                                       ProcurementProject?.Serialize(),
                                       ProcurementProjectLots?.Select(lot => lot.Serialize()),
                                       TenderingCriteria?.Select(c => c.Serialize()),
                                       AdditionalDocumentReferences?.Select(d => d.Serialize())
                                       )));
 }
Пример #17
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 16, Configuration.FieldSeparator),
                       Id,
                       PrimaryKeyValueIim?.ToDelimitedString(),
                       ServiceItemCode?.ToDelimitedString(),
                       InventoryLotNumber,
                       InventoryExpirationDate.HasValue ? InventoryExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       InventoryManufacturerName?.ToDelimitedString(),
                       InventoryLocation?.ToDelimitedString(),
                       InventoryReceivedDate.HasValue ? InventoryReceivedDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       InventoryReceivedQuantity.HasValue ? InventoryReceivedQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       InventoryReceivedQuantityUnit?.ToDelimitedString(),
                       InventoryReceivedItemCost?.ToDelimitedString(),
                       InventoryOnHandDate.HasValue ? InventoryOnHandDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       InventoryOnHandQuantity.HasValue ? InventoryOnHandQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       InventoryOnHandQuantityUnit?.ToDelimitedString(),
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Пример #18
0
        ///<summary>Updates one ProcedureCode in the database.</summary>
        internal static void Update(ProcedureCode procedureCode)
        {
            string command = "UPDATE procedurecode SET "
                             //ProcCode excluded from update
                             + "Descript          = '" + POut.String(procedureCode.Descript) + "', "
                             + "AbbrDesc          = '" + POut.String(procedureCode.AbbrDesc) + "', "
                             + "ProcTime          = '" + POut.String(procedureCode.ProcTime) + "', "
                             + "ProcCat           =  " + POut.Long(procedureCode.ProcCat) + ", "
                             + "TreatArea         =  " + POut.Int((int)procedureCode.TreatArea) + ", "
                             + "NoBillIns         =  " + POut.Bool(procedureCode.NoBillIns) + ", "
                             + "IsProsth          =  " + POut.Bool(procedureCode.IsProsth) + ", "
                             + "DefaultNote       = '" + POut.String(procedureCode.DefaultNote) + "', "
                             + "IsHygiene         =  " + POut.Bool(procedureCode.IsHygiene) + ", "
                             + "GTypeNum          =  " + POut.Int(procedureCode.GTypeNum) + ", "
                             + "AlternateCode1    = '" + POut.String(procedureCode.AlternateCode1) + "', "
                             + "MedicalCode       = '" + POut.String(procedureCode.MedicalCode) + "', "
                             + "IsTaxed           =  " + POut.Bool(procedureCode.IsTaxed) + ", "
                             + "PaintType         =  " + POut.Int((int)procedureCode.PaintType) + ", "
                             + "GraphicColor      =  " + POut.Int(procedureCode.GraphicColor.ToArgb()) + ", "
                             + "LaymanTerm        = '" + POut.String(procedureCode.LaymanTerm) + "', "
                             + "IsCanadianLab     =  " + POut.Bool(procedureCode.IsCanadianLab) + ", "
                             + "PreExisting       =  " + POut.Bool(procedureCode.PreExisting) + ", "
                             + "BaseUnits         =  " + POut.Int(procedureCode.BaseUnits) + ", "
                             + "SubstitutionCode  = '" + POut.String(procedureCode.SubstitutionCode) + "', "
                             + "SubstOnlyIf       =  " + POut.Int((int)procedureCode.SubstOnlyIf) + ", "
                             //DateTStamp can only be set by MySQL
                             + "IsMultiVisit      =  " + POut.Bool(procedureCode.IsMultiVisit) + ", "
                             + "DrugNDC           = '" + POut.String(procedureCode.DrugNDC) + "', "
                             + "RevenueCodeDefault= '" + POut.String(procedureCode.RevenueCodeDefault) + "' "
                             + "WHERE CodeNum = " + POut.Long(procedureCode.CodeNum);

            Db.NonQ(command);
        }
Пример #19
0
        ///<summary></summary>
        public static void Update(ProcedureCode code)
        {
            //MessageBox.Show("Updating");
            string command = "UPDATE procedurecode SET "
                             + "descript = '" + POut.PString(code.Descript) + "'"
                             + ",abbrdesc = '" + POut.PString(code.AbbrDesc) + "'"
                             + ",proctime = '" + POut.PString(code.ProcTime) + "'"
                             + ",proccat = '" + POut.PInt(code.ProcCat) + "'"
                             + ",treatarea = '" + POut.PInt((int)code.TreatArea) + "'"
                             //+ ",removetooth = '"   +POut.PBool  (RemoveTooth)+"'"
                             + ",setrecall = '" + POut.PBool(code.SetRecall) + "'"
                             + ",nobillins = '" + POut.PBool(code.NoBillIns) + "'"
                             + ",isprosth = '" + POut.PBool(code.IsProsth) + "'"
                             + ",defaultnote = '" + POut.PString(code.DefaultNote) + "'"
                             + ",ishygiene = '" + POut.PBool(code.IsHygiene) + "'"
                             + ",gtypenum = '" + POut.PInt(code.GTypeNum) + "'"
                             + ",alternatecode1 = '" + POut.PString(code.AlternateCode1) + "'"
                             + ",MedicalCode = '" + POut.PString(code.MedicalCode) + "'"
                             + ",IsTaxed = '" + POut.PBool(code.IsTaxed) + "'"
                             + ",PaintType = '" + POut.PInt((int)code.PaintType) + "'"
                             + ",GraphicColor = '" + POut.PInt(code.GraphicColor.ToArgb()) + "'"
                             + ",LaymanTerm = '" + POut.PString(code.LaymanTerm) + "'"
                             + ",IsCanadianLab = '" + POut.PBool(code.IsCanadianLab) + "'"
                             + " WHERE adacode = '" + POut.PString(code.ADACode) + "'";

            General.NonQ(command);
        }
Пример #20
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!_insPlan.CodeSubstNone && gridInsPlanSubstInc.Rows.Count == 0 && gridInsPlanSubstExc.Rows.Count > 0)
            {
                if (MsgBox.Show(this, MsgBoxButtons.YesNo, "You have chosen to exclude all substituion codes.  "
                                + "The checkbox option named 'Don't Substitute Codes (e.g. posterior composites)' "
                                + "in the Other Ins Info tab of the Edit Insurance Plan window can be used to exclude all substitution codes.\r\n"
                                + "Would you like to enable this option instead of excluding specific codes?"))
                {
                    _insPlan.CodeSubstNone = true;
                    DialogResult           = DialogResult.OK;
                    return;
                }
            }
            List <SubstitutionLink> listSubstLinks = new List <SubstitutionLink>();

            foreach (UI.ODGridRow row in gridInsPlanSubstExc.Rows)
            {
                ProcedureCode    procCode = (ProcedureCode)row.Tag;
                SubstitutionLink subLink  = _listDbSubstLinks.FirstOrDefault(x => x.CodeNum == procCode.CodeNum);
                if (subLink == null)
                {
                    subLink         = new SubstitutionLink();
                    subLink.PlanNum = _insPlan.PlanNum;
                    subLink.CodeNum = procCode.CodeNum;
                }
                listSubstLinks.Add(subLink);
            }
            SubstitutionLinks.Sync(listSubstLinks, _listDbSubstLinks);
            DialogResult = DialogResult.OK;
        }
Пример #21
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 51, Configuration.FieldSeparator),
                       Id,
                       SetIdObr.HasValue ? SetIdObr.Value.ToString(culture) : null,
                       PlacerOrderNumber?.ToDelimitedString(),
                       FillerOrderNumber?.ToDelimitedString(),
                       UniversalServiceIdentifier?.ToDelimitedString(),
                       Priority,
                       RequestedDateTime.HasValue ? RequestedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ObservationDateTime.HasValue ? ObservationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ObservationEndDateTime.HasValue ? ObservationEndDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       CollectionVolume?.ToDelimitedString(),
                       CollectorIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorIdentifier.Select(x => x.ToDelimitedString())) : null,
                       SpecimenActionCode,
                       DangerCode?.ToDelimitedString(),
                       RelevantClinicalInformation,
                       SpecimenReceivedDateTime.HasValue ? SpecimenReceivedDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       SpecimenSource?.ToDelimitedString(),
                       OrderingProvider != null ? string.Join(Configuration.FieldRepeatSeparator, OrderingProvider.Select(x => x.ToDelimitedString())) : null,
                       OrderCallbackPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, OrderCallbackPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       PlacerField1,
                       PlacerField2,
                       FillerField1,
                       FillerField2,
                       ResultsRptStatusChngDateTime.HasValue ? ResultsRptStatusChngDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ChargeToPractice?.ToDelimitedString(),
                       DiagnosticServSectId,
                       ResultStatus,
                       ParentResult?.ToDelimitedString(),
                       QuantityTiming != null ? string.Join(Configuration.FieldRepeatSeparator, QuantityTiming.Select(x => x.ToDelimitedString())) : null,
                       ResultCopiesTo != null ? string.Join(Configuration.FieldRepeatSeparator, ResultCopiesTo.Select(x => x.ToDelimitedString())) : null,
                       ParentResultsObservationIdentifier?.ToDelimitedString(),
                       TransportationMode,
                       ReasonForStudy != null ? string.Join(Configuration.FieldRepeatSeparator, ReasonForStudy.Select(x => x.ToDelimitedString())) : null,
                       PrincipalResultInterpreter?.ToDelimitedString(),
                       AssistantResultInterpreter != null ? string.Join(Configuration.FieldRepeatSeparator, AssistantResultInterpreter.Select(x => x.ToDelimitedString())) : null,
                       Technician != null ? string.Join(Configuration.FieldRepeatSeparator, Technician.Select(x => x.ToDelimitedString())) : null,
                       Transcriptionist != null ? string.Join(Configuration.FieldRepeatSeparator, Transcriptionist.Select(x => x.ToDelimitedString())) : null,
                       ScheduledDateTime.HasValue ? ScheduledDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       NumberOfSampleContainers.HasValue ? NumberOfSampleContainers.Value.ToString(Consts.NumericFormat, culture) : null,
                       TransportLogisticsOfCollectedSample != null ? string.Join(Configuration.FieldRepeatSeparator, TransportLogisticsOfCollectedSample.Select(x => x.ToDelimitedString())) : null,
                       CollectorsComment != null ? string.Join(Configuration.FieldRepeatSeparator, CollectorsComment.Select(x => x.ToDelimitedString())) : null,
                       TransportArrangementResponsibility?.ToDelimitedString(),
                       TransportArranged,
                       EscortRequired,
                       PlannedPatientTransportComment != null ? string.Join(Configuration.FieldRepeatSeparator, PlannedPatientTransportComment.Select(x => x.ToDelimitedString())) : null,
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null,
                       PlacerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null,
                       FillerSupplementalServiceInformation != null ? string.Join(Configuration.FieldRepeatSeparator, FillerSupplementalServiceInformation.Select(x => x.ToDelimitedString())) : null,
                       MedicallyNecessaryDuplicateProcedureReason?.ToDelimitedString(),
                       ResultHandling,
                       ParentUniversalServiceIdentifier?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Пример #22
0
        ///<summary></summary>
        public static void Insert(ProcedureCode code)
        {
            //must have already checked ADACode for nonduplicate.
            string command = "INSERT INTO procedurecode (adacode,descript,abbrdesc,"
                             + "proctime,proccat,treatarea,RemoveTooth,setrecall,"
                             + "nobillins,isprosth,defaultnote,ishygiene,gtypenum,alternatecode1,MedicalCode,IsTaxed,"
                             + "PaintType,GraphicColor,LaymanTerm,IsCanadianLab) VALUES("
                             + "'" + POut.PString(code.ADACode) + "', "
                             + "'" + POut.PString(code.Descript) + "', "
                             + "'" + POut.PString(code.AbbrDesc) + "', "
                             + "'" + POut.PString(code.ProcTime) + "', "
                             + "'" + POut.PInt(code.ProcCat) + "', "
                             + "'" + POut.PInt((int)code.TreatArea) + "', "
                             + "'0', " //No longer used, but remains part of the table so that ordinal values are not upset.
                                       //The value is set to 0 here, so that conversion to extraction paint type is not necessary.
                             + "'" + POut.PBool(code.SetRecall) + "', "
                             + "'" + POut.PBool(code.NoBillIns) + "', "
                             + "'" + POut.PBool(code.IsProsth) + "', "
                             + "'" + POut.PString(code.DefaultNote) + "', "
                             + "'" + POut.PBool(code.IsHygiene) + "', "
                             + "'" + POut.PInt(code.GTypeNum) + "', "
                             + "'" + POut.PString(code.AlternateCode1) + "', "
                             + "'" + POut.PString(code.MedicalCode) + "', "
                             + "'" + POut.PBool(code.IsTaxed) + "', "
                             + "'" + POut.PInt((int)code.PaintType) + "', "
                             + "'" + POut.PInt(code.GraphicColor.ToArgb()) + "', "
                             + "'" + POut.PString(code.LaymanTerm) + "', "
                             + "'" + POut.PBool(code.IsCanadianLab) + "')";

            General.NonQ(command);
            ProcedureCodes.Refresh();
            //Cur already set
            //MessageBox.Show(Cur.PayNum.ToString());
        }
Пример #23
0
        ///<summary>If a substitute exists for the given proc code, then it will give the CodeNum of that code.  Otherwise, it will return the codeNum for the given procCode.</summary>
        public static int GetSubstituteCodeNum(string procCode, string toothNum)
        {
            if (procCode == null || procCode == "")
            {
                return(0);
            }
            if (!HList.Contains(procCode))
            {
                return(0);
            }
            ProcedureCode proc = (ProcedureCode)HList[procCode];

            if (proc.SubstitutionCode != "" && HList.Contains(proc.SubstitutionCode))
            {
                if (proc.SubstOnlyIf == SubstitutionCondition.Always)
                {
                    return(((ProcedureCode)HList[proc.SubstitutionCode]).CodeNum);
                }
                if (proc.SubstOnlyIf == SubstitutionCondition.Molar && Tooth.IsMolar(toothNum))
                {
                    return(((ProcedureCode)HList[proc.SubstitutionCode]).CodeNum);
                }
                if (proc.SubstOnlyIf == SubstitutionCondition.SecondMolar && Tooth.IsSecondMolar(toothNum))
                {
                    return(((ProcedureCode)HList[proc.SubstitutionCode]).CodeNum);
                }
            }
            return(proc.CodeNum);
        }
Пример #24
0
        public void Fees_GetListFromObjects_InsPlanAllowedFeeSched()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Create an insurance plan and associate the allowed fee schedule to the fee schedule that was just created.
            InsPlan insPlan = InsPlanT.CreateInsPlan(0, allowedFeeSched: fee.FeeSched);
            //Act like an ins plan has our fee schedule which should return the corresponding fees by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          new List <InsPlan>()
            {
                insPlan
            },
                                                          null,
                                                          null,
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #25
0
 ///<summary>Inserts one ProcedureCode into the database.  Returns the new priKey.</summary>
 internal static long Insert(ProcedureCode procedureCode)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         procedureCode.CodeNum = DbHelper.GetNextOracleKey("procedurecode", "CodeNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(procedureCode, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     procedureCode.CodeNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(procedureCode, false));
     }
 }
 private void FormRepeatChargeEdit_Load(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         FormProcCodes FormP = new FormProcCodes();
         FormP.IsSelectionMode = true;
         FormP.ShowDialog();
         if (FormP.DialogResult != DialogResult.OK)
         {
             DialogResult = DialogResult.Cancel;
             return;
         }
         ProcedureCode procCode = ProcedureCodes.GetProcCode(FormP.SelectedADA);
         if (procCode.TreatArea != TreatmentArea.Mouth)
         {
             MsgBox.Show(this, "Procedure codes that require tooth numbers are not allowed.");
             DialogResult = DialogResult.Cancel;
             return;
         }
         RepeatCur.ADACode = FormP.SelectedADA;
     }
     textADACode.Text   = RepeatCur.ADACode;
     textDesc.Text      = ProcedureCodes.GetProcCode(RepeatCur.ADACode).Descript;
     textChargeAmt.Text = RepeatCur.ChargeAmt.ToString("F");
     if (RepeatCur.DateStart.Year > 1880)
     {
         textDateStart.Text = RepeatCur.DateStart.ToShortDateString();
     }
     if (RepeatCur.DateStop.Year > 1880)
     {
         textDateStop.Text = RepeatCur.DateStop.ToShortDateString();
     }
     textNote.Text = RepeatCur.Note;
 }
Пример #27
0
        ///<summary>Creates a procedure and returns its procedure fee.</summary>
        private double GetProcFee(string suffix, bool doUseMedicalCode)
        {
            Prefs.UpdateBool(PrefName.InsPpoAlwaysUseUcrFee, true);
            Prefs.UpdateBool(PrefName.MedicalFeeUsedForNewProcs, doUseMedicalCode);
            Patient pat            = PatientT.CreatePatient(suffix);
            long    ucrFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "UCR " + suffix);

            FeeSchedT.UpdateUCRFeeSched(pat, ucrFeeSchedNum);
            long ppoFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "PPO " + suffix);

            InsuranceT.AddInsurance(pat, suffix, "p", ppoFeeSchedNum, 1, true);
            List <InsSub>  listSubs     = InsSubT.GetInsSubs(pat);
            List <InsPlan> listPlans    = InsPlans.RefreshForSubList(listSubs);
            List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum);
            string         procStr      = "D0150";
            string         procStrMed   = "D0120";
            ProcedureCode  procCode     = ProcedureCodes.GetProcCode(procStr);
            ProcedureCode  procCodeMed  = ProcedureCodes.GetProcCode(procStrMed);

            procCode.MedicalCode = procCodeMed.ProcCode;
            FeeT.CreateFee(ucrFeeSchedNum, procCode.CodeNum, 300);
            FeeT.CreateFee(ppoFeeSchedNum, procCode.CodeNum, 120);
            FeeT.CreateFee(ucrFeeSchedNum, procCodeMed.CodeNum, 175);
            FeeT.CreateFee(ppoFeeSchedNum, procCodeMed.CodeNum, 85);
            Procedure proc = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", 300);

            return(Procedures.GetProcFee(pat, listPatPlans, listSubs, listPlans, procCode.CodeNum, proc.ProvNum, proc.ClinicNum, procCode.MedicalCode));
        }
Пример #28
0
        public void Fees_GetListFromObjects_AppointmentProviderSecondary()
        {
            string        suffix        = MethodBase.GetCurrentMethod().Name;
            ProcedureCode procedureCode = ProcedureCodeT.CreateProcCode("D1110");
            Fee           fee           = CreateSingleFee(suffix, (_defaultFeeAmt * _rand.NextDouble()), hasProv: true, codeNum: procedureCode.CodeNum);
            //Update our new provider so that they are associated to the new fee schedule that was just created.
            Provider prov = Providers.GetProv(fee.ProvNum);

            prov.FeeSched = fee.FeeSched;
            ProviderT.Update(prov);
            //Make an appointment that has the new provider set as the secondary provider.
            Appointment appt = AppointmentT.CreateAppointment(0, DateTime.Now, 0, 0, provHyg: prov.ProvNum);
            //The fees associated to the fee schedule of the appointment's secondary provider should be returned by GetListFromObjects().
            List <Fee> listFees = Fees.GetListFromObjects(new List <ProcedureCode>()
            {
                procedureCode
            },
                                                          null,
                                                          null,
                                                          0,
                                                          0,
                                                          0,
                                                          null,
                                                          null,
                                                          new List <Appointment>()
            {
                appt
            },
                                                          null,
                                                          0);

            Assert.IsTrue(listFees.Exists(x => x.FeeNum == fee.FeeNum));
        }
Пример #29
0
        public void FeeSchedTools_GlobalUpdateWriteoffEstimates_SubscriberInDifferentFamily()
        {
            string        suffix   = MethodBase.GetCurrentMethod().Name;
            string        procStr  = "D0145";
            double        procFee  = 100;
            ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr);
            //Set up clinic, prov, pat
            Clinic  clinic        = ClinicT.CreateClinic(suffix);
            long    feeSchedNum   = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix);
            long    provNum       = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee           = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat           = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            Patient patSubscriber = PatientT.CreatePatient(suffix + "_Subscriber", provNum, clinic.ClinicNum);
            //Set up insurance
            InsuranceInfo info = InsuranceT.AddInsurance(pat, suffix, "p", feeSchedNum);

            info.PriInsSub.Subscriber = patSubscriber.PatNum;
            InsSubs.Update(info.PriInsSub);
            info.ListBenefits.Add(BenefitT.CreatePercentForProc(info.PriInsPlan.PlanNum, procCode.CodeNum, 100));
            //Create the procedure and claimproc
            Procedure proc         = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", procFee);
            ClaimProc priClaimProc = ClaimProcT.CreateClaimProc(pat.PatNum, proc.ProcNum, info.PriInsPlan.PlanNum, info.PriInsSub.InsSubNum, DateTime.Today,
                                                                -1, -1, -1, ClaimProcStatus.CapEstimate);

            Procedures.ComputeEstimates(proc, pat.PatNum, new List <ClaimProc>(), true, info.ListInsPlans, info.ListPatPlans, info.ListBenefits, pat.Age,
                                        info.ListInsSubs);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ProcNum == proc.ProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
            GlobalUpdateWriteoffs(clinic.ClinicNum);
            priClaimProc = ClaimProcs.Refresh(pat.PatNum).FirstOrDefault(x => x.ClaimProcNum == priClaimProc.ClaimProcNum);
            Assert.AreEqual(procFee, priClaimProc.InsPayEst);
        }
Пример #30
0
        public void FeeSchedTools_GlobalUpdateFees()
        {
            PrefT.UpdateBool(PrefName.MedicalFeeUsedForNewProcs, false);
            string        suffix    = MethodBase.GetCurrentMethod().Name;
            string        procStr   = "D0120";
            string        procStr2  = "D0145";
            double        procFee   = 100;
            ProcedureCode procCode  = ProcedureCodes.GetProcCode(procStr);
            ProcedureCode procCode2 = ProcedureCodes.GetProcCode(procStr2);
            //Set up clinic, prov, pat
            Clinic  clinic      = ClinicT.CreateClinic(suffix);
            long    feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix, false);
            long    provNum     = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum);
            Fee     fee         = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum);
            Fee     fee2        = FeeT.GetNewFee(feeSchedNum, procCode2.CodeNum, procFee, clinic.ClinicNum, provNum);
            Patient pat         = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum);
            //Chart a procedure for this proccode/pat as well as a different proccode
            Procedure proc  = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", fee.Amount);
            Procedure proc2 = ProcedureT.CreateProcedure(pat, procStr2, ProcStat.TP, "", fee2.Amount);

            //Update the fee amount for only the D0120 code
            fee.Amount = 50;
            Fees.Update(fee);
            //Now run global update fees
            Procedures.GlobalUpdateFees(Fees.GetByClinicNum(clinic.ClinicNum), clinic.ClinicNum, clinic.Abbr);
            //Make sure we have the same number of updated fees, and fee amounts for both procs
            proc  = Procedures.GetOneProc(proc.ProcNum, false);
            proc2 = Procedures.GetOneProc(proc2.ProcNum, false);
            Assert.AreEqual(fee.Amount, proc.ProcFee);
            Assert.AreEqual(fee2.Amount, proc2.ProcFee);
        }
Пример #31
0
        public void FeeSchedTools_ImportCanada()
        {
            string canadianCodes = Properties.Resources.canadianprocedurecodes;

            //If we need to import these procedures codes, do so
            foreach (string line in canadianCodes.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
            {
                string[] properties = line.Split('\t');
                if (properties.Count() != 10)
                {
                    continue;
                }
                if (ProcedureCodes.GetCodeNum(properties[0]) != 0)
                {
                    continue;
                }
                ProcedureCode procCode = new ProcedureCode()
                {
                    ProcCode = properties[0],
                    Descript = properties[1],
                    ProcTime = properties[8],
                    AbbrDesc = properties[9],
                };
                ProcedureCodes.Insert(procCode);
            }
            //Now import the fees
            string     feeData     = Properties.Resources.BC_BCDA_2018_GPOOC;
            FeeSched   feeSched    = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name, isGlobal: false);
            List <Fee> listNewFees = FeeScheds.ImportCanadaFeeSchedule2(feeSched, feeData, 0, 0, out int numImported, out int numSkipped);

            Assert.IsTrue(DoAmountsMatch(listNewFees, feeSched.FeeSchedNum, 0, 0));
        }
Пример #32
0
 ///<summary>Inserts one ProcedureCode into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(ProcedureCode procedureCode,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         procedureCode.CodeNum=ReplicationServers.GetKey("procedurecode","CodeNum");
     }
     string command="INSERT INTO procedurecode (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="CodeNum,";
     }
     command+="ProcCode,Descript,AbbrDesc,ProcTime,ProcCat,TreatArea,NoBillIns,IsProsth,DefaultNote,IsHygiene,GTypeNum,AlternateCode1,MedicalCode,IsTaxed,PaintType,GraphicColor,LaymanTerm,IsCanadianLab,PreExisting,BaseUnits,SubstitutionCode,SubstOnlyIf,IsMultiVisit,DrugNDC,RevenueCodeDefault) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(procedureCode.CodeNum)+",";
     }
     command+=
          "'"+POut.String(procedureCode.ProcCode)+"',"
         +"'"+POut.String(procedureCode.Descript)+"',"
         +"'"+POut.String(procedureCode.AbbrDesc)+"',"
         +"'"+POut.String(procedureCode.ProcTime)+"',"
         +    POut.Long  (procedureCode.ProcCat)+","
         +    POut.Int   ((int)procedureCode.TreatArea)+","
         +    POut.Bool  (procedureCode.NoBillIns)+","
         +    POut.Bool  (procedureCode.IsProsth)+","
         +"'"+POut.String(procedureCode.DefaultNote)+"',"
         +    POut.Bool  (procedureCode.IsHygiene)+","
         +    POut.Int   (procedureCode.GTypeNum)+","
         +"'"+POut.String(procedureCode.AlternateCode1)+"',"
         +"'"+POut.String(procedureCode.MedicalCode)+"',"
         +    POut.Bool  (procedureCode.IsTaxed)+","
         +    POut.Int   ((int)procedureCode.PaintType)+","
         +    POut.Int   (procedureCode.GraphicColor.ToArgb())+","
         +"'"+POut.String(procedureCode.LaymanTerm)+"',"
         +    POut.Bool  (procedureCode.IsCanadianLab)+","
         +    POut.Bool  (procedureCode.PreExisting)+","
         +    POut.Int   (procedureCode.BaseUnits)+","
         +"'"+POut.String(procedureCode.SubstitutionCode)+"',"
         +    POut.Int   ((int)procedureCode.SubstOnlyIf)+","
         //DateTStamp can only be set by MySQL
         +    POut.Bool  (procedureCode.IsMultiVisit)+","
         +"'"+POut.String(procedureCode.DrugNDC)+"',"
         +"'"+POut.String(procedureCode.RevenueCodeDefault)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         procedureCode.CodeNum=Db.NonQ(command,true);
     }
     return procedureCode.CodeNum;
 }
Пример #33
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ProcedureCode> TableToList(DataTable table){
			List<ProcedureCode> retVal=new List<ProcedureCode>();
			ProcedureCode procedureCode;
			for(int i=0;i<table.Rows.Count;i++) {
				procedureCode=new ProcedureCode();
				procedureCode.CodeNum           = PIn.Long  (table.Rows[i]["CodeNum"].ToString());
				procedureCode.ProcCode          = PIn.String(table.Rows[i]["ProcCode"].ToString());
				procedureCode.Descript          = PIn.String(table.Rows[i]["Descript"].ToString());
				procedureCode.AbbrDesc          = PIn.String(table.Rows[i]["AbbrDesc"].ToString());
				procedureCode.ProcTime          = PIn.String(table.Rows[i]["ProcTime"].ToString());
				procedureCode.ProcCat           = PIn.Long  (table.Rows[i]["ProcCat"].ToString());
				procedureCode.TreatArea         = (OpenDentBusiness.TreatmentArea)PIn.Int(table.Rows[i]["TreatArea"].ToString());
				procedureCode.NoBillIns         = PIn.Bool  (table.Rows[i]["NoBillIns"].ToString());
				procedureCode.IsProsth          = PIn.Bool  (table.Rows[i]["IsProsth"].ToString());
				procedureCode.DefaultNote       = PIn.String(table.Rows[i]["DefaultNote"].ToString());
				procedureCode.IsHygiene         = PIn.Bool  (table.Rows[i]["IsHygiene"].ToString());
				procedureCode.GTypeNum          = PIn.Int   (table.Rows[i]["GTypeNum"].ToString());
				procedureCode.AlternateCode1    = PIn.String(table.Rows[i]["AlternateCode1"].ToString());
				procedureCode.MedicalCode       = PIn.String(table.Rows[i]["MedicalCode"].ToString());
				procedureCode.IsTaxed           = PIn.Bool  (table.Rows[i]["IsTaxed"].ToString());
				procedureCode.PaintType         = (OpenDentBusiness.ToothPaintingType)PIn.Int(table.Rows[i]["PaintType"].ToString());
				procedureCode.GraphicColor      = Color.FromArgb(PIn.Int(table.Rows[i]["GraphicColor"].ToString()));
				procedureCode.LaymanTerm        = PIn.String(table.Rows[i]["LaymanTerm"].ToString());
				procedureCode.IsCanadianLab     = PIn.Bool  (table.Rows[i]["IsCanadianLab"].ToString());
				procedureCode.PreExisting       = PIn.Bool  (table.Rows[i]["PreExisting"].ToString());
				procedureCode.BaseUnits         = PIn.Int   (table.Rows[i]["BaseUnits"].ToString());
				procedureCode.SubstitutionCode  = PIn.String(table.Rows[i]["SubstitutionCode"].ToString());
				procedureCode.SubstOnlyIf       = (OpenDentBusiness.SubstitutionCondition)PIn.Int(table.Rows[i]["SubstOnlyIf"].ToString());
				procedureCode.DateTStamp        = PIn.DateT (table.Rows[i]["DateTStamp"].ToString());
				procedureCode.IsMultiVisit      = PIn.Bool  (table.Rows[i]["IsMultiVisit"].ToString());
				procedureCode.DrugNDC           = PIn.String(table.Rows[i]["DrugNDC"].ToString());
				procedureCode.RevenueCodeDefault= PIn.String(table.Rows[i]["RevenueCodeDefault"].ToString());
				procedureCode.ProvNumDefault    = PIn.Long  (table.Rows[i]["ProvNumDefault"].ToString());
				retVal.Add(procedureCode);
			}
			return retVal;
		}
Пример #34
0
		///<summary>Updates one ProcedureCode in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(ProcedureCode procedureCode,ProcedureCode oldProcedureCode){
			string command="";
			//ProcCode excluded from update
			if(procedureCode.Descript != oldProcedureCode.Descript) {
				if(command!=""){ command+=",";}
				command+="Descript = '"+POut.String(procedureCode.Descript)+"'";
			}
			if(procedureCode.AbbrDesc != oldProcedureCode.AbbrDesc) {
				if(command!=""){ command+=",";}
				command+="AbbrDesc = '"+POut.String(procedureCode.AbbrDesc)+"'";
			}
			if(procedureCode.ProcTime != oldProcedureCode.ProcTime) {
				if(command!=""){ command+=",";}
				command+="ProcTime = '"+POut.String(procedureCode.ProcTime)+"'";
			}
			if(procedureCode.ProcCat != oldProcedureCode.ProcCat) {
				if(command!=""){ command+=",";}
				command+="ProcCat = "+POut.Long(procedureCode.ProcCat)+"";
			}
			if(procedureCode.TreatArea != oldProcedureCode.TreatArea) {
				if(command!=""){ command+=",";}
				command+="TreatArea = "+POut.Int   ((int)procedureCode.TreatArea)+"";
			}
			if(procedureCode.NoBillIns != oldProcedureCode.NoBillIns) {
				if(command!=""){ command+=",";}
				command+="NoBillIns = "+POut.Bool(procedureCode.NoBillIns)+"";
			}
			if(procedureCode.IsProsth != oldProcedureCode.IsProsth) {
				if(command!=""){ command+=",";}
				command+="IsProsth = "+POut.Bool(procedureCode.IsProsth)+"";
			}
			if(procedureCode.DefaultNote != oldProcedureCode.DefaultNote) {
				if(command!=""){ command+=",";}
				command+="DefaultNote = '"+POut.String(procedureCode.DefaultNote)+"'";
			}
			if(procedureCode.IsHygiene != oldProcedureCode.IsHygiene) {
				if(command!=""){ command+=",";}
				command+="IsHygiene = "+POut.Bool(procedureCode.IsHygiene)+"";
			}
			if(procedureCode.GTypeNum != oldProcedureCode.GTypeNum) {
				if(command!=""){ command+=",";}
				command+="GTypeNum = "+POut.Int(procedureCode.GTypeNum)+"";
			}
			if(procedureCode.AlternateCode1 != oldProcedureCode.AlternateCode1) {
				if(command!=""){ command+=",";}
				command+="AlternateCode1 = '"+POut.String(procedureCode.AlternateCode1)+"'";
			}
			if(procedureCode.MedicalCode != oldProcedureCode.MedicalCode) {
				if(command!=""){ command+=",";}
				command+="MedicalCode = '"+POut.String(procedureCode.MedicalCode)+"'";
			}
			if(procedureCode.IsTaxed != oldProcedureCode.IsTaxed) {
				if(command!=""){ command+=",";}
				command+="IsTaxed = "+POut.Bool(procedureCode.IsTaxed)+"";
			}
			if(procedureCode.PaintType != oldProcedureCode.PaintType) {
				if(command!=""){ command+=",";}
				command+="PaintType = "+POut.Int   ((int)procedureCode.PaintType)+"";
			}
			if(procedureCode.GraphicColor != oldProcedureCode.GraphicColor) {
				if(command!=""){ command+=",";}
				command+="GraphicColor = "+POut.Int(procedureCode.GraphicColor.ToArgb())+"";
			}
			if(procedureCode.LaymanTerm != oldProcedureCode.LaymanTerm) {
				if(command!=""){ command+=",";}
				command+="LaymanTerm = '"+POut.String(procedureCode.LaymanTerm)+"'";
			}
			if(procedureCode.IsCanadianLab != oldProcedureCode.IsCanadianLab) {
				if(command!=""){ command+=",";}
				command+="IsCanadianLab = "+POut.Bool(procedureCode.IsCanadianLab)+"";
			}
			if(procedureCode.PreExisting != oldProcedureCode.PreExisting) {
				if(command!=""){ command+=",";}
				command+="PreExisting = "+POut.Bool(procedureCode.PreExisting)+"";
			}
			if(procedureCode.BaseUnits != oldProcedureCode.BaseUnits) {
				if(command!=""){ command+=",";}
				command+="BaseUnits = "+POut.Int(procedureCode.BaseUnits)+"";
			}
			if(procedureCode.SubstitutionCode != oldProcedureCode.SubstitutionCode) {
				if(command!=""){ command+=",";}
				command+="SubstitutionCode = '"+POut.String(procedureCode.SubstitutionCode)+"'";
			}
			if(procedureCode.SubstOnlyIf != oldProcedureCode.SubstOnlyIf) {
				if(command!=""){ command+=",";}
				command+="SubstOnlyIf = "+POut.Int   ((int)procedureCode.SubstOnlyIf)+"";
			}
			//DateTStamp can only be set by MySQL
			if(procedureCode.IsMultiVisit != oldProcedureCode.IsMultiVisit) {
				if(command!=""){ command+=",";}
				command+="IsMultiVisit = "+POut.Bool(procedureCode.IsMultiVisit)+"";
			}
			if(procedureCode.DrugNDC != oldProcedureCode.DrugNDC) {
				if(command!=""){ command+=",";}
				command+="DrugNDC = '"+POut.String(procedureCode.DrugNDC)+"'";
			}
			if(procedureCode.RevenueCodeDefault != oldProcedureCode.RevenueCodeDefault) {
				if(command!=""){ command+=",";}
				command+="RevenueCodeDefault = '"+POut.String(procedureCode.RevenueCodeDefault)+"'";
			}
			if(procedureCode.ProvNumDefault != oldProcedureCode.ProvNumDefault) {
				if(command!=""){ command+=",";}
				command+="ProvNumDefault = "+POut.Long(procedureCode.ProvNumDefault)+"";
			}
			if(command==""){
				return false;
			}
			command="UPDATE procedurecode SET "+command
				+" WHERE CodeNum = "+POut.Long(procedureCode.CodeNum);
			Db.NonQ(command);
			return true;
		}
Пример #35
0
		///<summary>Updates one ProcedureCode in the database.</summary>
		public static void Update(ProcedureCode procedureCode){
			string command="UPDATE procedurecode SET "
				//ProcCode excluded from update
				+"Descript          = '"+POut.String(procedureCode.Descript)+"', "
				+"AbbrDesc          = '"+POut.String(procedureCode.AbbrDesc)+"', "
				+"ProcTime          = '"+POut.String(procedureCode.ProcTime)+"', "
				+"ProcCat           =  "+POut.Long  (procedureCode.ProcCat)+", "
				+"TreatArea         =  "+POut.Int   ((int)procedureCode.TreatArea)+", "
				+"NoBillIns         =  "+POut.Bool  (procedureCode.NoBillIns)+", "
				+"IsProsth          =  "+POut.Bool  (procedureCode.IsProsth)+", "
				+"DefaultNote       = '"+POut.String(procedureCode.DefaultNote)+"', "
				+"IsHygiene         =  "+POut.Bool  (procedureCode.IsHygiene)+", "
				+"GTypeNum          =  "+POut.Int   (procedureCode.GTypeNum)+", "
				+"AlternateCode1    = '"+POut.String(procedureCode.AlternateCode1)+"', "
				+"MedicalCode       = '"+POut.String(procedureCode.MedicalCode)+"', "
				+"IsTaxed           =  "+POut.Bool  (procedureCode.IsTaxed)+", "
				+"PaintType         =  "+POut.Int   ((int)procedureCode.PaintType)+", "
				+"GraphicColor      =  "+POut.Int   (procedureCode.GraphicColor.ToArgb())+", "
				+"LaymanTerm        = '"+POut.String(procedureCode.LaymanTerm)+"', "
				+"IsCanadianLab     =  "+POut.Bool  (procedureCode.IsCanadianLab)+", "
				+"PreExisting       =  "+POut.Bool  (procedureCode.PreExisting)+", "
				+"BaseUnits         =  "+POut.Int   (procedureCode.BaseUnits)+", "
				+"SubstitutionCode  = '"+POut.String(procedureCode.SubstitutionCode)+"', "
				+"SubstOnlyIf       =  "+POut.Int   ((int)procedureCode.SubstOnlyIf)+", "
				//DateTStamp can only be set by MySQL
				+"IsMultiVisit      =  "+POut.Bool  (procedureCode.IsMultiVisit)+", "
				+"DrugNDC           = '"+POut.String(procedureCode.DrugNDC)+"', "
				+"RevenueCodeDefault= '"+POut.String(procedureCode.RevenueCodeDefault)+"', "
				+"ProvNumDefault    =  "+POut.Long  (procedureCode.ProvNumDefault)+" "
				+"WHERE CodeNum = "+POut.Long(procedureCode.CodeNum);
			Db.NonQ(command);
		}