コード例 #1
0
        public void CalculateTestConducted()
        {
            int count =1;
            foreach (ARTSite site in _artSites)
            {
                if (UpdateCalculationEvent != null)
                    UpdateCalculationEvent(count, new PerformMorbidityCalculationArgs() { SiteName = site.Site.SiteName, ArgumentType = 1 });
                count++;
                _peridoInfo.WorkingDaysinBudgetPeriod = _peridoInfo.NumberofMonthsinBudgetPeriod * site.Site.MaxWorkingDays();

                CalcPatientNumber calcPatientNo = new CalcPatientNumber(site, _forecast, _peridoInfo, _targetSelected);
                calcPatientNo.DoCalculation();

                ArtSiteCalculated scalculated = new ArtSiteCalculated(site.Site.Id);
                scalculated.SiteName = site.Site.SiteName;
                Dictionary<int, CalculatedSitePatientNumber> pNumbers = calcPatientNo.CalculatedPatientNumbers;
                scalculated.PatientNumbers = pNumbers;

                PatientsNoofTest ptest = new PatientsNoofTest();
                ptest.SiteId = site.Site.Id;
                ptest.ForecastId = _forecast.Id;
                for (int i = 1; i <= 12; i++)
                {
                    ptest.SetArtPatinetNumber(i, pNumbers[i].TotalPatinetInTreatment());
                    ptest.SetPreArtPatinetNumber(i, pNumbers[i].TotalPatientInPreART());
                }

                scalculated.PatinetNoOfTest = ptest;
                //--------------------end patient numbers----------------------

                CalcRapidTest calcRapid = new CalcRapidTest(site, _forecast, _peridoInfo, _targetSelected, _rapidTestAlgorithm);
                calcRapid.CalculatedPatientNos = pNumbers;
                calcRapid.RapidTestPlatformQuantifyObject = _platformFactory.RapidTestPlatform;
                InitBaseCalcValue(calcPatientNo, calcRapid);
                calcRapid.DoCalculation();

                scalculated.RapidNumberofTest = calcRapid.RapidNumberofTest();
                CopySupplyForecast(calcRapid.QuantifyedReagents(), scalculated.TestReagents);

                //--------------------end rapid test----------------------

                MorbidityCalcContainer mcalcContainer = new MorbidityCalcContainer(site.Site.Id);
                //--------------------init container----------------------

                CalcCD4Test calcCd4 = new CalcCD4Test(site, _forecast, _peridoInfo, _targetSelected);
                calcCd4.CalculatedPatientNos = pNumbers;
                calcCd4.CD4PlatformQuantifyObject = _platformFactory.CD4Platform;
                calcCd4.RapidTestOutputs = calcRapid.RapidTestOutputs;
                calcCd4.CD4TestProtocol = _cd4Protocol;
                InitBaseCalcValue(calcPatientNo, calcCd4);

                calcCd4.CalculateTestConducted();
                mcalcContainer.CD4Calculation = calcCd4;
                mcalcContainer.CD4ReferedSites = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.CD4.ToString());

                //--------------------end CD4 test----------------------

                CalcHematology calcHema = new CalcHematology(site, _forecast, _peridoInfo, _targetSelected);
                calcHema.CalculatedPatientNos = pNumbers;
                calcHema.HematologyPlatformQuantifyObject = _platformFactory.HematologyPlatform;
                calcHema.HemTestProtocol = _hemProtocol;
                InitBaseCalcValue(calcPatientNo, calcHema);

                calcHema.CalculateTestConducted();
                mcalcContainer.HematologyCalculation = calcHema;
                mcalcContainer.HemaReferedSites = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.Hematology.ToString());

                //--------------------end Hema test----------------------

                CalcViralLoad calcVl = new CalcViralLoad(site, _forecast, _peridoInfo, _targetSelected);
                calcVl.CalculatedPatientNos = pNumbers;
                calcVl.VLPlatformQuantifyObject = _platformFactory.ViralloadPlatform;
                calcVl.VLTestProtocol = _vilProtocol;
                InitBaseCalcValue(calcPatientNo, calcVl);

                calcVl.CalculateTestConducted();
                mcalcContainer.ViralLoadCalculation = calcVl;
                mcalcContainer.ViraReferedSites = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.ViralLoad.ToString());

                //--------------------end VL test----------------------

                CalcChemistryTest calcChem = new CalcChemistryTest(site, _forecast, _peridoInfo, _targetSelected);
                calcChem.CalculatedPatientNos = pNumbers;
                calcChem.ChemistryPlatformQuantifyObject = _platformFactory.ChemistryPlatform;
                calcChem.ChemTestProtocol = _cheProtocol;
                InitBaseCalcValue(calcPatientNo, calcChem);

                calcChem.CalculateTestConducted();
                mcalcContainer.ChemistryCalculation = calcChem;
                mcalcContainer.ChemReferedSites = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.Chemistry.ToString());

                //--------------------end Chemistry test----------------------

                CalcConsumable calcCon = new CalcConsumable(site, _forecast, _peridoInfo, _targetSelected);
                calcCon.CalculatedPatientNos = pNumbers;
                calcCon.ConsumablePlatformQuantifyObject = _platformFactory.ConsumablePlatform;
                calcCon.CD4MonthlyOutputs = calcCd4.GetCD4TestOutputs;
                calcCon.RapidTestOutputs = calcRapid.RapidTestOutputs;

                calcCon.RapidTestCalculator = calcRapid;
                calcCon.CD4TestCalculator = calcCd4;
                calcCon.ChemistryTestCalculator = calcChem;
                calcCon.HematologyTestCalculator = calcHema;
                calcCon.ViralTestCalculator = calcVl;

                InitBaseCalcValue(calcPatientNo, calcCon);
                mcalcContainer.ConsumableCalculation = calcCon;

                //--------------------end Consumable----------------------

                CalcOtherTest calcOth = new CalcOtherTest(site, _forecast, _peridoInfo, _targetSelected);
                calcOth.CalculatedPatientNos = pNumbers;
                calcOth.OtherTestPlatformQuantifyObject = _platformFactory.OtherTestPlatform;
                calcOth.CalculatedConsumable = calcCon;
                calcOth.OtherTestProtocol = _othProtocol;

                InitBaseCalcValue(calcPatientNo, calcOth);
                mcalcContainer.OtherTestCalculation = calcOth;

                //--------------------end Other test----------------------

                _artsiteCalculated.Add(scalculated.SiteId, scalculated);
                _listOfMorbidityCalcContainers.Add(mcalcContainer.SiteId, mcalcContainer);
            }
        }
コード例 #2
0
        public void CalculateTestConducted()
        {
            int count = 1;

            foreach (ARTSite site in _artSites)
            {
                if (UpdateCalculationEvent != null)
                {
                    UpdateCalculationEvent(count, new PerformMorbidityCalculationArgs()
                    {
                        SiteName = site.Site.SiteName, ArgumentType = 1
                    });
                }
                count++;
                _peridoInfo.WorkingDaysinBudgetPeriod = _peridoInfo.NumberofMonthsinBudgetPeriod * site.Site.MaxWorkingDays();

                CalcPatientNumber calcPatientNo = new CalcPatientNumber(site, _forecast, _peridoInfo, _targetSelected);
                calcPatientNo.DoCalculation();

                ArtSiteCalculated scalculated = new ArtSiteCalculated(site.Site.Id);
                scalculated.SiteName = site.Site.SiteName;
                Dictionary <int, CalculatedSitePatientNumber> pNumbers = calcPatientNo.CalculatedPatientNumbers;
                scalculated.PatientNumbers = pNumbers;

                PatientsNoofTest ptest = new PatientsNoofTest();
                ptest.SiteId     = site.Site.Id;
                ptest.ForecastId = _forecast.Id;
                for (int i = 1; i <= 12; i++)
                {
                    ptest.SetArtPatinetNumber(i, pNumbers[i].TotalPatinetInTreatment());
                    ptest.SetPreArtPatinetNumber(i, pNumbers[i].TotalPatientInPreART());
                }

                scalculated.PatinetNoOfTest = ptest;
                //--------------------end patient numbers----------------------

                CalcRapidTest calcRapid = new CalcRapidTest(site, _forecast, _peridoInfo, _targetSelected, _rapidTestAlgorithm);
                calcRapid.CalculatedPatientNos            = pNumbers;
                calcRapid.RapidTestPlatformQuantifyObject = _platformFactory.RapidTestPlatform;
                InitBaseCalcValue(calcPatientNo, calcRapid);
                calcRapid.DoCalculation();

                scalculated.RapidNumberofTest = calcRapid.RapidNumberofTest();
                CopySupplyForecast(calcRapid.QuantifyedReagents(), scalculated.TestReagents);

                //--------------------end rapid test----------------------

                MorbidityCalcContainer mcalcContainer = new MorbidityCalcContainer(site.Site.Id);
                //--------------------init container----------------------

                CalcCD4Test calcCd4 = new CalcCD4Test(site, _forecast, _peridoInfo, _targetSelected);
                calcCd4.CalculatedPatientNos = pNumbers;
                calcCd4.TestingArea          = CD4TestingArea;
                calcCd4.RapidTestOutputs     = calcRapid.RapidTestOutputs;
                calcCd4.CD4TestProtocol      = _cd4Protocol;
                InitBaseCalcValue(calcPatientNo, calcCd4);

                calcCd4.CalculateTestConducted();
                mcalcContainer.CD4Calculation  = calcCd4;
                mcalcContainer.CD4ReferedSites = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.CD4.ToString());

                //--------------------end CD4 test----------------------

                CalcHematology calcHema = new CalcHematology(site, _forecast, _peridoInfo, _targetSelected);
                calcHema.CalculatedPatientNos = pNumbers;
                calcHema.TestingArea          = HematologyTestingArea;
                calcHema.HemTestProtocol      = _hemProtocol;
                InitBaseCalcValue(calcPatientNo, calcHema);

                calcHema.CalculateTestConducted();
                mcalcContainer.HematologyCalculation = calcHema;
                mcalcContainer.HemaReferedSites      = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.Hematology.ToString());


                //--------------------end Hema test----------------------

                CalcViralLoad calcVl = new CalcViralLoad(site, _forecast, _peridoInfo, _targetSelected);
                calcVl.CalculatedPatientNos = pNumbers;
                calcVl.TestingArea          = ViralLoadTestingArea;
                calcVl.VLTestProtocol       = _vilProtocol;
                InitBaseCalcValue(calcPatientNo, calcVl);

                calcVl.CalculateTestConducted();
                mcalcContainer.ViralLoadCalculation = calcVl;
                mcalcContainer.ViraReferedSites     = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.ViralLoad.ToString());


                //--------------------end VL test----------------------

                CalcChemistryTest calcChem = new CalcChemistryTest(site, _forecast, _peridoInfo, _targetSelected);
                calcChem.CalculatedPatientNos = pNumbers;
                calcChem.TestingArea          = ChemistryTestingArea;
                calcChem.ChemTestProtocol     = _cheProtocol;
                InitBaseCalcValue(calcPatientNo, calcChem);

                calcChem.CalculateTestConducted();
                mcalcContainer.ChemistryCalculation = calcChem;
                mcalcContainer.ChemReferedSites     = DataRepository.GetListOfReferedSites(scalculated.SiteId, ClassOfMorbidityTestEnum.Chemistry.ToString());


                //--------------------end Chemistry test----------------------

                CalcConsumable calcCon = new CalcConsumable(site, _forecast, _peridoInfo, _targetSelected);
                calcCon.CalculatedPatientNos             = pNumbers;
                calcCon.ConsumablePlatformQuantifyObject = _platformFactory.ConsumablePlatform;
                calcCon.CD4MonthlyOutputs = calcCd4.GetCD4TestOutputs;
                calcCon.RapidTestOutputs  = calcRapid.RapidTestOutputs;

                calcCon.RapidTestCalculator      = calcRapid;
                calcCon.CD4TestCalculator        = calcCd4;
                calcCon.ChemistryTestCalculator  = calcChem;
                calcCon.HematologyTestCalculator = calcHema;
                calcCon.ViralTestCalculator      = calcVl;

                InitBaseCalcValue(calcPatientNo, calcCon);
                mcalcContainer.ConsumableCalculation = calcCon;

                //--------------------end Consumable----------------------

                CalcOtherTest calcOth = new CalcOtherTest(site, _forecast, _peridoInfo, _targetSelected);
                calcOth.CalculatedPatientNos = pNumbers;
                calcOth.TestingArea          = OtherTestTestingArea;
                calcOth.CalculatedConsumable = calcCon;
                calcOth.OtherTestProtocol    = _othProtocol;

                InitBaseCalcValue(calcPatientNo, calcOth);
                mcalcContainer.OtherTestCalculation = calcOth;

                //--------------------end Other test----------------------

                _artsiteCalculated.Add(scalculated.SiteId, scalculated);
                _listOfMorbidityCalcContainers.Add(mcalcContainer.SiteId, mcalcContainer);
            }
        }