コード例 #1
0
 private void InitTotalValues()
 {
     if (ArtSite.Site.ChemistryRefSite == 0)
     {
         foreach (ChemistryPlatformTests cpt in _chemPlatformTests)
         {
             TotalPatientSamples += cpt.TotalSmaples();
             TotalControls       += cpt.TotalControls();
         }
     }
     else
     {
         for (int i = 1; i <= 12; i++)
         {
             MOutputChemistryTest moc = _chemMonthlyOutputs[i];
             TotalPatientSamples += moc.TotalChemistrySamplesWithinForecastPeriod + moc.TotalChemistrySamplesWithinBufferStock;
         }
     }
 }
コード例 #2
0
        private double GetTotalValues(int testid)
        {
            double totalv = 0d;

            if (ArtSite.Site.ChemistryRefSite == 0)
            {
                foreach (ChemistryPlatformTests cpt in _chemPlatformTests)
                {
                    if (ParameterIncluded(testid))
                    {
                        totalv += cpt.TotalTestsOnInstrument(testid);
                    }
                }
            }
            else
            {
                for (int i = 1; i <= 12; i++)
                {
                    MOutputChemistryTest moc = _chemMonthlyOutputs[i];
                    totalv += moc.GetChemSymptomDirectedTestById(testid).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(testid).TestsforBufferStock;
                }
            }
            return(totalv);
        }
コード例 #3
0
        private void InitTotalValues()
        {
            if (ArtSite.Site.ChemistryRefSite == 0)
            {
                foreach (ChemistryPlatformTests cpt in _chemPlatformTests)
                {
                    TotalPatientSamples += cpt.TotalSmaples();
                    TotalControls       += cpt.TotalControls();

                    if (ParameterIncluded(ChemistryTestNameEnum.ALT))
                    {
                        TotalALT += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.ALT);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.AST))
                    {
                        TotalAST += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.AST);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.CHO))
                    {
                        TotalCHO += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.CHO);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.GLC))
                    {
                        TotalGLC += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.GLC);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.CRE))
                    {
                        TotalCRE += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.CRE);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.TG))
                    {
                        TotalTG += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.TG);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.GGT))
                    {
                        TotalGGT += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.GGT);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.ALP))
                    {
                        TotalALP += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.ALP);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.AMY))
                    {
                        TotalAMY += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.AMY);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.CO2))
                    {
                        TotalCO2 += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.CO2);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.Electrolyte_Panel))
                    {
                        TotalElectrolyte += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.Electrolyte_Panel);
                    }
                    if (ParameterIncluded(ChemistryTestNameEnum.Urea))
                    {
                        TotalUrea += cpt.TotalTestsOnInstrument(ChemistryTestNameEnum.Urea);
                    }
                }
            }
            else
            {
                for (int i = 1; i <= 12; i++)
                {
                    MOutputChemistryTest moc = _chemMonthlyOutputs[i];
                    TotalPatientSamples += moc.TotalChemistrySamplesWithinForecastPeriod + moc.TotalChemistrySamplesWithinBufferStock;
                    TotalALT            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.ALT).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.ALT).TestsforBufferStock;
                    TotalAST            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.AST).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.AST).TestsforBufferStock;
                    TotalCHO            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CHO).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CHO).TestsforBufferStock;
                    TotalGLC            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.GLC).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.GLC).TestsforBufferStock;
                    TotalCRE            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CRE).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CRE).TestsforBufferStock;
                    TotalTG             += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.TG).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.TG).TestsforBufferStock;
                    TotalGGT            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.GGT).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.GGT).TestsforBufferStock;
                    TotalALP            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.ALP).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.ALP).TestsforBufferStock;
                    TotalAMY            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.AMY).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.AMY).TestsforBufferStock;
                    TotalCO2            += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CO2).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.CO2).TestsforBufferStock;
                    TotalElectrolyte    += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.Electrolyte_Panel).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.Electrolyte_Panel).TestsforBufferStock;
                    TotalUrea           += moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.Urea).TestBasedonProtocol + moc.GetChemSymptomDirectedTestById(ChemistryTestNameEnum.Urea).TestsforBufferStock;
                }
            }
        }
コード例 #4
0
        private void CalculateChemistryTestConducted()
        {
            _chemRepeatsduetoClinicianRequest = (ChemTestProtocol.TestReapeated / 100d);
            _chemAdditionalTestsDuetoWastage  = (InvAssumption.Chemistry / 100d);

            for (int i = 1; i <= 12; i++)
            {
                MOutputChemistryTest chemOut = new MOutputChemistryTest();
                chemOut.Month = i;

                foreach (PSymptomDirectedTest sdt in ChemTestProtocol.SymptomDirectedTests)
                {
                    ChemistrySymptomDirectedTest csdt = new ChemistrySymptomDirectedTest();
                    csdt.TestId = sdt.Test.Id;
                    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 = _chemRepeatsduetoClinicianRequest;

                    chemOut.ChemSymptomDirectedTest.Add(csdt);
                }

                foreach (ProtocolPanel panel in ChemTestProtocol.ProtocolPanels)
                {
                    ChemistryTestByPannel chemp = new ChemistryTestByPannel();

                    chemp.ExistingAdultPatientsinTreatment = CalculatedPatientNos[i].ArtAdultPreExistingPatients * panel.AdultInTreatmentDistribution;
                    chemp.ExistingPedPatientsinTreatment   = CalculatedPatientNos[i].ArtPediatricPreExistingPatients * panel.PediatricInTreatmentDistribution; // ((pediatricsinTreatment / 12d) * preExistingPatientsonPanel);
                    chemp.ExistingAdultPatientsinPreArt    = CalculatedPatientNos[i].PreArtAdultPreExistingPatients * panel.AdultPreARTDistribution;
                    chemp.ExistingPedPatientsinPreArt      = CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * panel.PediatricPreARTDistribution;

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

                    //ChemistryTestNameEnum[] chemtest = LqtUtil.EnumToArray<ChemistryTestNameEnum>();

                    //for (int z = 0; z < chemtest.Length; z++)
                    foreach (Test t in _testingArea.Tests)
                    {
                        double tconducted = 0d;
                        if (panel.IsTestSelected(t.Id))
                        {
                            tconducted = chemp.TotalTestsForRegimen();
                        }
                        chemp.SetChemTestValue(t.Id, tconducted);
                        if (chemOut.GetChemSymptomDirectedTestById(t.Id) != null)
                        {
                            chemOut.GetChemSymptomDirectedTestById(t.Id).TestConducted += tconducted;
                        }
                    }
                    chemOut.ChemTestByPanel.Add(chemp);
                }

                _chemMonthlyOutputs.Add(i, chemOut);
            }

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

            foreach (PSymptomDirectedTest sdt in ChemTestProtocol.SymptomDirectedTests)
            {
                for (int i = 1; i <= 12; i++)
                {
                    ChemistrySymptomDirectedTest csdt = _chemMonthlyOutputs[i].GetChemSymptomDirectedTestById(sdt.Test.Id);
                    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++)
                    {
                        ChemistrySymptomDirectedTest ct = _chemMonthlyOutputs[x].GetChemSymptomDirectedTestById(sdt.Test.Id);
                        ct.AdultSymptomDirectTest       += adultPatientEnterPerMonth;
                        ct.PedSymptomDirectTest         += pedPatientEnterPerMonth;
                        ct.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                        ct.PreArtPedSymptomDirectTest   += prePedPatientEnterPerMonth;
                    }

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

                    csdt.AdditionalTestsdueToWastage = csdt.TestBasedonProtocol * _chemAdditionalTestsDuetoWastage;
                    csdt.AdditionalTestsdueToWastageBeyondForecast = csdt.TestsforBufferStock * _chemAdditionalTestsDuetoWastage;
                }
            }

            for (int i = 2; i <= 13; i++)
            {
                if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                {
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinForecastPeriod = _chemMonthlyOutputs[i - 1].GetSumOfTotalChemistrySamples();
                }
                else
                {
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinForecastPeriod = 0d;
                }
                if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                {
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinBufferStock = _chemMonthlyOutputs[i - 1].GetSumOfTotalChemistrySamples();
                }
                else
                {
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinBufferStock = 0d;
                }
            }
        }
コード例 #5
0
        private void CalculateChemistryTestConducted()
        {
            _chemRepeatsduetoClinicianRequest = (ChemTestProtocol.TestReapeated / 100d);
            _chemAdditionalTestsDuetoWastage = (InvAssumption.Chemistry / 100d);

            for (int i = 1; i <= 12; i++)
            {
                MOutputChemistryTest chemOut = new MOutputChemistryTest();
                chemOut.Month = i;

                foreach (PSymptomDirectedTest sdt in ChemTestProtocol.SymptomDirectedTests)
                {
                    ChemistrySymptomDirectedTest csdt = new ChemistrySymptomDirectedTest();
                    csdt.TestName = sdt.ChemTestNameToEnum;
                    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 = _chemRepeatsduetoClinicianRequest;

                    chemOut.ChemSymptomDirectedTest.Add(csdt);
                }

                foreach (ProtocolPanel panel in ChemTestProtocol.ProtocolPanels)
                {
                    ChemistryTestByPannel chemp = new ChemistryTestByPannel();

                    chemp.ExistingAdultPatientsinTreatment = CalculatedPatientNos[i].ArtAdultPreExistingPatients * panel.AdultInTreatmentDistribution;
                    chemp.ExistingPedPatientsinTreatment = CalculatedPatientNos[i].ArtPediatricPreExistingPatients * panel.PediatricInTreatmentDistribution; // ((pediatricsinTreatment / 12d) * preExistingPatientsonPanel);
                    chemp.ExistingAdultPatientsinPreArt = CalculatedPatientNos[i].PreArtAdultPreExistingPatients * panel.AdultPreARTDistribution;
                    chemp.ExistingPedPatientsinPreArt = CalculatedPatientNos[i].PreArtPediatricPreExistingPatients * panel.PediatricPreARTDistribution;

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

                    ChemistryTestNameEnum[] chemtest = LqtUtil.EnumToArray<ChemistryTestNameEnum>();

                    for (int z = 0; z < chemtest.Length; z++)
                    {
                        double tconducted = 0d;
                        if (panel.IsChemTestSelected(chemtest[z]))
                        {
                            tconducted = chemp.TotalTestsForRegimen();
                        }
                        chemp.SetChemTestValue(chemtest[z], tconducted);
                        if (chemOut.GetChemSymptomDirectedTestById(chemtest[z]) != null)
                            chemOut.GetChemSymptomDirectedTestById(chemtest[z]).TestConducted += tconducted;
                    }
                    chemOut.ChemTestByPanel.Add(chemp);
                }

                _chemMonthlyOutputs.Add(i, chemOut);
            }

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

            foreach (PSymptomDirectedTest sdt in ChemTestProtocol.SymptomDirectedTests)
            {
                for (int i = 1; i <= 12; i++)
                {
                    ChemistrySymptomDirectedTest csdt = _chemMonthlyOutputs[i].GetChemSymptomDirectedTestById(sdt.ChemTestNameToEnum);
                    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++)
                    {
                        ChemistrySymptomDirectedTest ct = _chemMonthlyOutputs[x].GetChemSymptomDirectedTestById(sdt.ChemTestNameToEnum);
                        ct.AdultSymptomDirectTest += adultPatientEnterPerMonth;
                        ct.PedSymptomDirectTest += pedPatientEnterPerMonth;
                        ct.PreArtAdultSymptomDirectTest += preAdultPatientEnterPerMonth;
                        ct.PreArtPedSymptomDirectTest += prePedPatientEnterPerMonth;
                    }

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

                    csdt.AdditionalTestsdueToWastage = csdt.TestBasedonProtocol * _chemAdditionalTestsDuetoWastage;
                    csdt.AdditionalTestsdueToWastageBeyondForecast = csdt.TestsforBufferStock * _chemAdditionalTestsDuetoWastage;
                }
            }

            for (int i = 2; i <= 13; i++)
            {
                if (i >= PeriodInfo.FirstMonth && i <= PeriodInfo.LastMonth)
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinForecastPeriod = _chemMonthlyOutputs[i - 1].GetSumOfTotalChemistrySamples();
                else
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinForecastPeriod = 0d;
                if (i >= PeriodInfo.BeginsOnmonth && i <= PeriodInfo.EndOnMonth)
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinBufferStock = _chemMonthlyOutputs[i - 1].GetSumOfTotalChemistrySamples();
                else
                    _chemMonthlyOutputs[i - 1].TotalChemistrySamplesWithinBufferStock = 0d;
            }
        }