예제 #1
0
        /// <summary>
        /// Returns the results produced by the ISNCSCI Algorithm ir a raw values format.
        /// </summary>
        /// <param name="neurologyForm">Neurology form that has been populated with the values to be used in the algorithm calculations.</param>
        /// <returns>
        /// Totals in raw values format.  The results contain lists with every prossible value for each field.
        /// You can use the resulting object to obtained a summarized version, which uses ranges, by passing the result to the method GetTotalsSummaryFor
        /// </returns>
        public static NeurologyFormTotals GetTotalsFor(NeurologyForm neurologyForm)
        {
            var totals = new NeurologyFormTotals();

            UpdateTotalsWithLevelAt(neurologyForm, totals, neurologyForm.GetLevelWithName("C2"), false, false);

            totals.UpperMotorTotal = totals.RightUpperMotorTotal + totals.LeftUpperMotorTotal;
            totals.LowerMotorTotal = totals.RightLowerMotorTotal + totals.LeftLowerMotorTotal;
            totals.TouchTotal = totals.RightTouchTotal + totals.LeftTouchTotal;
            totals.PrickTotal = totals.RightPrickTotal + totals.LeftPrickTotal;

            var s4_5 = neurologyForm.GetLevelWithName("S4_5");

            var c1 = neurologyForm.GetLevelWithName("C2").Previous;

            if (totals.RightSensoryZppHasOnlySoftValues)
                totals.AddRightSensoryZppValue(c1);

            if (totals.LeftSensoryZppHasOnlySoftValues)
                totals.AddLeftSensoryZppValue(c1);

            if (totals.RightMotorZppHasOnlySoftValues)
                totals.AddRightMotorZppValue(c1);

            if (totals.LeftMotorZppHasOnlySoftValues)
                totals.AddLeftMotorZppValue(c1);

            if (totals.MostRostralRightLevelWithMotorFunction == null)
                totals.MostRostralRightLevelWithMotorFunction = c1;

            if (totals.MostRostralLeftLevelWithMotorFunction == null)
                totals.MostRostralLeftLevelWithMotorFunction = c1;

            if (totals.MostCaudalRightLevelWithMotorFunction == null)
                totals.MostCaudalRightLevelWithMotorFunction = c1;

            if (totals.MostCaudalLeftLevelWithMotorFunction == null)
                totals.MostCaudalLeftLevelWithMotorFunction = c1;

            // [ASIA learning center 2012-11-14] Sensory incomplete: Sacral sparing of sensory function
            var isSensoryIncomplete = neurologyForm.AnalSensation == BinaryObservation.Yes || neurologyForm.AnalSensation == BinaryObservation.NT
                || !"0".Equals(s4_5.RightTouchName) || !"0".Equals(s4_5.LeftTouchName)
                || !"0".Equals(s4_5.RightPrickName) || !"0".Equals(s4_5.LeftPrickName);

            var couldNotHaveMotorFunctionMoreThan3LevelsBelowMotorLevel = CouldNotHaveMotorFunctionMoreThan3LevelsBelowMotorLevel(neurologyForm, totals);

            var couldNotBeMotorIncomplete = (neurologyForm.AnalContraction == BinaryObservation.No || neurologyForm.AnalContraction == BinaryObservation.NT)
                && isSensoryIncomplete && couldNotHaveMotorFunctionMoreThan3LevelsBelowMotorLevel;

            if ((neurologyForm.AnalContraction == BinaryObservation.No || neurologyForm.AnalContraction == BinaryObservation.NT)
                && (neurologyForm.AnalSensation == BinaryObservation.No || neurologyForm.AnalSensation == BinaryObservation.NT)
                && s4_5.RightTouchValue == 0 && !s4_5.RightTouchImpairmentNotDueToSci
                && s4_5.RightPrickValue == 0 && !s4_5.RightPrickImpairmentNotDueToSci
                && s4_5.LeftTouchValue == 0 && !s4_5.LeftTouchImpairmentNotDueToSci
                && s4_5.LeftPrickValue == 0 && !s4_5.LeftPrickImpairmentNotDueToSci)
                totals.AddAsiaImpairmentScaleValue("A");

            if (couldNotBeMotorIncomplete && totals.MostRostralNeurologicalLevelOfInjury.Name != "S4_5")
                totals.AddAsiaImpairmentScaleValue("B");

            //// Not an ASIA E only
            //// AND not an ASIA A only
            if (totals.MostRostralNeurologicalLevelOfInjury.Name != "S4_5"
                && (isSensoryIncomplete || neurologyForm.AnalContraction == BinaryObservation.Yes || neurologyForm.AnalContraction == BinaryObservation.NT))
            {
                bool couldBeAsiaC;
                bool couldBeAsiaD;
                CouldBeAsiaCorD(neurologyForm, totals, out couldBeAsiaC, out couldBeAsiaD);

                if (couldBeAsiaC)
                    totals.AddAsiaImpairmentScaleValue("C");

                if (couldBeAsiaD)
                    totals.AddAsiaImpairmentScaleValue("D");
            }

            if (totals.RightSensoryContains("S4_5") && totals.LeftSensoryContains("S4_5")
                && totals.RightMotorContains("S4_5") && totals.LeftMotorContains("S4_5"))
                totals.AddAsiaImpairmentScaleValue("E");

            return totals;
        }