Calculation type
Reduces the allowed amount of surgical charges whose schedule rollup equals a fixed qualifying code ("T" in the base class, "Y" in the Medicare subclass), applying a rank-ordered percentage schedule per unit across all affected charges combined.
affected = charges (i=1..NumCharges-1) not IgnoreCharge'd whose rollup Code (via IMultipleSurgeryScheduleRepo) == adjustment.QualifyingCode; sorted via calculationEngine.GetChargeOrder(affected, SortBy) (per-unit descending). adjustedIndex starts at 0, percentage starts at 1.0; for each affected charge: units = Math.Max(charge.Units, 1); unitAmount = detail.Amount/units; for i in 0..units-1: if adjustedIndex < Percentages.Count, percentage = Percentages[adjustedIndex]/100 (else the last-set percentage carries over); chargeAmount += MoneyMath.Multiply(unitAmount, percentage); adjustedIndex++ (unconditional, unlike MultipleProcedureAdjustment). detail.Adjust(chargeAmount, adjustment) if chargeAmount != detail.Amount.
| Key | Meaning |
|---|---|
| ScheduleType | Fee/rollup schedule used to look up each charge's rollup code via IMultipleSurgeryScheduleRepo.GetCodeScheduleRecords. |
| SortBy | SortChargesBy enum (default AmountAllowed) ranking affected charges by per-unit amount before percentage assignment. |
| Percentages | Ordered percentage list (default [100, 50]) applied by a running unit-rank index shared across ALL affected charges combined, not reset per charge; index beyond list length reuses the last-set percentage. |
| QualifyingCode | Virtual string, hardcoded "T" in the base class; overridden to "Y" in the Medicare subtype so the qualifying rollup code differs by variant. |
Gotchas
1) CalculationType.MedicareMultipleSurgeryAdjustment DOES exist as a real subclass at Backend/PricingEngine/Adjustments/MedicareMultipleSurgeryAdjustment.cs:9 (`public override string QualifyingCode => "Y";`, ScheduleType forced null in its constructor) and has its own dispatch arm at CalculationEngine.cs:774-777 using the same MultipleSurgeryAdjustmentCalculator - a reimplementer who only reads the base class will silently mis-handle Medicare accounts. 2) The percentage-rank index is global and continuous: a charge with 3 units consumes 3 consecutive slots of the shared Percentages sequence before the next affected charge's units start consuming further slots - it is not per-charge. 3) unitAmount uses Math.Max(charge.Units,1) to avoid divide-by-zero (functionally equivalent to, but implemented differently from, the explicit `if Units==0` branch used in the sibling MultipleProcedureAdjustment). 4) MoneyMath.Multiply(unitAmount, percentage) rounds via Math.Round(double,2) on a decimal-to-double cast, not decimal/AwayFromZero rounding.
class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Adjustments/MultipleSurgeryAdjustment.cs:9
calculator · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Adjustments/Calculators/MultipleSurgeryAdjustmentCalculator.cs:10
dispatch · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:778-782
CORRECTED - the draft's formula/summary were accurate on re-read of MultipleSurgeryAdjustment.cs and MultipleSurgeryAdjustmentCalculator.cs, but its `notes` field asserted 'CalculationType.MedicareMultipleSurgeryAdjustment's own class was not located in this pass' - false; the class exists at the cited path with QualifyingCode overridden to "Y", confirmed by direct read.