示例#1
0
        public IList <ChemandOtherNumberofTest> GetOtherTestNumber()
        {
            _othtestNumber = new List <ChemandOtherNumberofTest>();
            if (ArtSite.ForecastOtherTest)
            {
                foreach (PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests)
                {
                    ChemandOtherNumberofTest ct = new ChemandOtherNumberofTest();
                    ct.ForecastId = Forecast.Id;
                    ct.SiteId     = ArtSite.Site.Id;
                    ct.Platform   = (int)ClassOfMorbidityTestEnum.OtherTest;
                    //ct.TestId = sdt.Test.Id;
                    ct.TestName = sdt.OtherTestName;

                    for (int i = 1; i <= 12; i++)
                    {
                        OtherSymptomDirectedTest csdt = _othMonthlyOutputs[i].GetOtherSymptomDirectedTestById(sdt.OtherTestNameToEnum);
                        ct.InvalidTestandWastage += csdt.AdditionalTestsdueToWastage;

                        if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        {
                            ct.TestBasedOnProtocols     += csdt.TestConducted; //_othMonthlyOutputs[i].GetSumOfOtherTest(sdt.OtherTestNameToEnum);
                            ct.SymptomDirectedTests     += csdt.TotalSymptomDirectTest();
                            ct.RepeatedDuetoClinicalReq += (csdt.TestConducted + csdt.TotalSymptomDirectTest()) * _othrRepeatsduetoClinicianRequest;
                        }

                        ct.BufferStock += csdt.SubtotalOfTestForBufferStock;
                    }

                    _othtestNumber.Add(ct);
                }
            }
            return(_othtestNumber);
        }
示例#2
0
        private void CalculateOtherTest()
        {
            _othrRepeatsduetoClinicianRequest = (OtherTestProtocol.TestReapeated / 100d);
            _othAdditionalTestsDuetoWastage   = (InvAssumption.OtherTests / 100d);

            for (int i = 1; i <= 12; i++)
            {
                MOutputOtherTest otherOut = new MOutputOtherTest();
                otherOut.Month = i;

                foreach (PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests)
                {
                    OtherSymptomDirectedTest csdt = new OtherSymptomDirectedTest();
                    csdt.TestName = sdt.OtherTestNameToEnum;
                    csdt.AdultSymptomDirectTest       = (CurrentAdultinTreatment * (sdt.AdultInTreatmeant / 100d)) / 12d;
                    csdt.PedSymptomDirectTest         = (CurrentPediatricinTreatment * (sdt.PediatricInTreatmeant / 100d)) / 12d;
                    csdt.PreArtAdultSymptomDirectTest = (CurrentAdultinPreArt * (sdt.AdultPreART / 100d)) / 12d;
                    csdt.PreArtPedSymptomDirectTest   = (CurrentPediatricinPreArt * (sdt.PediatricPreART / 100d)) / 12d;
                    csdt.RepeatPercent = _othrRepeatsduetoClinicianRequest;

                    otherOut.OtherSymptomDirectedTest.Add(csdt);
                }

                foreach (ProtocolPanel panel in OtherTestProtocol.ProtocolPanels)
                {
                    OtherTestByPannel othpanel = new OtherTestByPannel();

                    othpanel.ExistingAdultPatientsinTreatment = CalculatedPatientNos[i].ArtAdultPreExistingPatients * panel.AdultInTreatmentDistribution;
                    othpanel.ExistingPedPatientsinTreatment   = CalculatedPatientNos[i].ArtPediatricPreExistingPatients * panel.PediatricInTreatmentDistribution;
                    othpanel.ExistingAdultPatientsinPreArt    = CalculatedPatientNos[i].PreArtAdultPreExistingPatients * panel.AdultPreARTDistribution;
                    othpanel.ExistingPedPatientsinPreArt      = CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * panel.PediatricPreARTDistribution;

                    for (int x = 1, y = i; x <= i; x++, y--)
                    {
                        othpanel.NewAdultPatientstoTreatment += CalculatedPatientNos[i].GetArtAdultPatientsEntering(x) * panel.AdultArtTestGivenInMonth(y) * (panel.AITNewPatient / 100d);
                        othpanel.NewPedPatientstoTreatment   += CalculatedPatientNos[i].GetArtPediatricPatientsEntering(x) * panel.AdultPreArtTestGivenInMonth(y) * (panel.PITNewPatient / 100d);
                        othpanel.NewAdultPatientstoPreArt    += CalculatedPatientNos[i].GetPreArtAdultPatientsEntering(x) * panel.PediatricArtTestGivenInMonth(y) * (panel.APARTNewPatient / 100d);
                        othpanel.NewPedPatientstoPreArt      += CalculatedPatientNos[i].GetPreArtPediatricPatientsEntering(x) * panel.PediatricPreArtTestGivenInMonth(y) * (panel.PPARTNewPatient / 100d);
                    }

                    OtherTestNameEnum[] othtest = LqtUtil.EnumToArray <OtherTestNameEnum>();

                    for (int x = 0; x < othtest.Length; x++) //PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests
                    {
                        double tconducted = 0d;
                        if (panel.IsOtherTestSelected(othtest[x]))
                        {
                            tconducted = othpanel.TotalTestsForRegimen();
                        }
                        othpanel.SetOtherTestValue(othtest[x], tconducted);
                        otherOut.GetOtherSymptomDirectedTestById(othtest[x]).TestConducted += tconducted;
                    }
                    otherOut.OtherTestByPanel.Add(othpanel);
                }

                _othMonthlyOutputs.Add(i, otherOut);
            }

            double adultPatientEnterPerMonth    = 0d;
            double pedPatientEnterPerMonth      = 0d;
            double preAdultPatientEnterPerMonth = 0d;
            double prePedPatientEnterPerMonth   = 0d;

            foreach (PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests)
            {
                for (int i = 1; i <= 12; i++)
                {
                    OtherSymptomDirectedTest csdt = _othMonthlyOutputs[i].GetOtherSymptomDirectedTestById(sdt.OtherTestNameToEnum);
                    adultPatientEnterPerMonth    = (CalculatedPatientNos[i].GetArtAdultPatientsEntering(i) * (sdt.AdultInTreatmeant / 100d)) / 12d;
                    csdt.AdultSymptomDirectTest += adultPatientEnterPerMonth;
                    pedPatientEnterPerMonth      = (CalculatedPatientNos[i].GetArtPediatricPatientsEntering(i) * (sdt.PediatricInTreatmeant / 100d)) / 12d;
                    csdt.PedSymptomDirectTest   += pedPatientEnterPerMonth;

                    preAdultPatientEnterPerMonth       = (CalculatedPatientNos[i].GetPreArtAdultPatientsEntering(i) * (sdt.AdultPreART / 100d)) / 12d;
                    csdt.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                    prePedPatientEnterPerMonth         = (CalculatedPatientNos[i].GetPreArtPediatricPatientsEntering(i) * (sdt.PediatricPreART / 100d)) / 12d;
                    csdt.PreArtPedSymptomDirectTest   += prePedPatientEnterPerMonth;

                    for (int x = i + 1; x <= 12; x++)
                    {
                        OtherSymptomDirectedTest ct = _othMonthlyOutputs[x].GetOtherSymptomDirectedTestById(sdt.OtherTestNameToEnum);
                        ct.AdultSymptomDirectTest       += adultPatientEnterPerMonth;
                        ct.PedSymptomDirectTest         += pedPatientEnterPerMonth;
                        ct.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                        ct.PreArtPedSymptomDirectTest   += prePedPatientEnterPerMonth;
                    }

                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    {
                        csdt.TotalTest = csdt.GetCalculatedTotalTest();
                    }
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    {
                        csdt.TestsforBufferStock = csdt.GetCalculatedTotalTest();
                    }

                    csdt.AdditionalTestsdueToWastage = csdt.TotalTest * _othAdditionalTestsDuetoWastage;
                    csdt.AdditionalTestsdueToWastageBeyondForecast = csdt.TestsforBufferStock * _othAdditionalTestsDuetoWastage;
                }
            }

            for (int i = 1; i <= 12; i++)
            {
                if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                {
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinForecastPeriod = _othMonthlyOutputs[i].GetSumOfTotalOtherSamples();
                }
                else
                {
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinForecastPeriod = 0d;
                }
                if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                {
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinBufferStock = _othMonthlyOutputs[i].GetSumOfTotalOtherSamples();
                }
                else
                {
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinBufferStock = 0d;
                }
            }
        }
示例#3
0
        private void CalculateOtherTest()
        {
            _othrRepeatsduetoClinicianRequest = (OtherTestProtocol.TestReapeated / 100d);
            _othAdditionalTestsDuetoWastage = (InvAssumption.OtherTests / 100d);

            for (int i = 1; i <= 12; i++)
            {
                MOutputOtherTest otherOut = new MOutputOtherTest();
                otherOut.Month = i;

                foreach (PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests)
                {
                    OtherSymptomDirectedTest csdt = new OtherSymptomDirectedTest();
                    csdt.TestName = sdt.OtherTestNameToEnum;
                    csdt.AdultSymptomDirectTest = (CurrentAdultinTreatment * (sdt.AdultInTreatmeant/100d)) / 12d;
                    csdt.PedSymptomDirectTest = (CurrentPediatricinTreatment * (sdt.PediatricInTreatmeant/100d)) / 12d;
                    csdt.PreArtAdultSymptomDirectTest = (CurrentAdultinPreArt * (sdt.AdultPreART/100d)) / 12d;
                    csdt.PreArtPedSymptomDirectTest = (CurrentPediatricinPreArt * (sdt.PediatricPreART / 100d)) / 12d;
                    csdt.RepeatPercent = _othrRepeatsduetoClinicianRequest;

                    otherOut.OtherSymptomDirectedTest.Add(csdt);
                }

                foreach (ProtocolPanel panel in OtherTestProtocol.ProtocolPanels)
                {
                    OtherTestByPannel othpanel = new OtherTestByPannel();

                    othpanel.ExistingAdultPatientsinTreatment = CalculatedPatientNos[i].ArtAdultPreExistingPatients * panel.AdultInTreatmentDistribution;
                    othpanel.ExistingPedPatientsinTreatment = CalculatedPatientNos[i].ArtPediatricPreExistingPatients * panel.PediatricInTreatmentDistribution;
                    othpanel.ExistingAdultPatientsinPreArt = CalculatedPatientNos[i].PreArtAdultPreExistingPatients * panel.AdultPreARTDistribution;
                    othpanel.ExistingPedPatientsinPreArt = CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * panel.PediatricPreARTDistribution;

                    for (int x = 1, y = i; x <= i; x++, y--)
                    {
                        othpanel.NewAdultPatientstoTreatment += CalculatedPatientNos[i].GetArtAdultPatientsEntering(x) * panel.AdultArtTestGivenInMonth(y) * (panel.AITNewPatient/100d);
                        othpanel.NewPedPatientstoTreatment += CalculatedPatientNos[i].GetArtPediatricPatientsEntering(x) * panel.AdultPreArtTestGivenInMonth(y) * (panel.PITNewPatient/100d);
                        othpanel.NewAdultPatientstoPreArt += CalculatedPatientNos[i].GetPreArtAdultPatientsEntering(x) * panel.PediatricArtTestGivenInMonth(y) * (panel.APARTNewPatient/100d);
                        othpanel.NewPedPatientstoPreArt += CalculatedPatientNos[i].GetPreArtPediatricPatientsEntering(x) * panel.PediatricPreArtTestGivenInMonth(y) * (panel.PPARTNewPatient / 100d);
                    }

                    OtherTestNameEnum[] othtest = LqtUtil.EnumToArray<OtherTestNameEnum>();

                    for (int x = 0; x < othtest.Length;x++ ) //PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests
                    {
                        double tconducted = 0d;
                        if (panel.IsOtherTestSelected(othtest[x]))
                        {
                            tconducted = othpanel.TotalTestsForRegimen();
                        }
                        othpanel.SetOtherTestValue(othtest[x], tconducted);
                        otherOut.GetOtherSymptomDirectedTestById(othtest[x]).TestConducted += tconducted;
                    }
                    otherOut.OtherTestByPanel.Add(othpanel);
                }

                _othMonthlyOutputs.Add(i, otherOut);
            }

            double adultPatientEnterPerMonth = 0d;
            double pedPatientEnterPerMonth = 0d;
            double preAdultPatientEnterPerMonth = 0d;
            double prePedPatientEnterPerMonth = 0d;

            foreach (PSymptomDirectedTest sdt in OtherTestProtocol.SymptomDirectedTests)
            {
                for (int i = 1; i <= 12; i++)
                {
                    OtherSymptomDirectedTest csdt = _othMonthlyOutputs[i].GetOtherSymptomDirectedTestById(sdt.OtherTestNameToEnum);
                    adultPatientEnterPerMonth = (CalculatedPatientNos[i].GetArtAdultPatientsEntering(i) * (sdt.AdultInTreatmeant / 100d)) / 12d;
                    csdt.AdultSymptomDirectTest += adultPatientEnterPerMonth;
                    pedPatientEnterPerMonth = (CalculatedPatientNos[i].GetArtPediatricPatientsEntering(i) * (sdt.PediatricInTreatmeant / 100d)) / 12d;
                    csdt.PedSymptomDirectTest += pedPatientEnterPerMonth;

                    preAdultPatientEnterPerMonth = (CalculatedPatientNos[i].GetPreArtAdultPatientsEntering(i) * (sdt.AdultPreART / 100d)) / 12d;
                    csdt.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                    prePedPatientEnterPerMonth = (CalculatedPatientNos[i].GetPreArtPediatricPatientsEntering(i) * (sdt.PediatricPreART / 100d)) / 12d;
                    csdt.PreArtPedSymptomDirectTest += prePedPatientEnterPerMonth;

                    for (int x = i + 1; x <= 12; x++)
                    {
                        OtherSymptomDirectedTest ct = _othMonthlyOutputs[x].GetOtherSymptomDirectedTestById(sdt.OtherTestNameToEnum);
                        ct.AdultSymptomDirectTest += adultPatientEnterPerMonth;
                        ct.PedSymptomDirectTest += pedPatientEnterPerMonth;
                        ct.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                        ct.PreArtPedSymptomDirectTest += prePedPatientEnterPerMonth;
                    }

                    if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                        csdt.TotalTest = csdt.GetCalculatedTotalTest();
                    if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                        csdt.TestsforBufferStock = csdt.GetCalculatedTotalTest();

                    csdt.AdditionalTestsdueToWastage = csdt.TotalTest * _othAdditionalTestsDuetoWastage;
                    csdt.AdditionalTestsdueToWastageBeyondForecast = csdt.TestsforBufferStock * _othAdditionalTestsDuetoWastage;
                }
            }

            for (int i = 1; i <= 12; i++)
            {
                if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinForecastPeriod = _othMonthlyOutputs[i].GetSumOfTotalOtherSamples();
                else
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinForecastPeriod = 0d;
                if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinBufferStock = _othMonthlyOutputs[i].GetSumOfTotalOtherSamples();
                else
                    _othMonthlyOutputs[i].TotalOtherSamplesWithinBufferStock = 0d;
            }
        }