public CalcPatientNumber(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target) : base(site, forecast, periodinfo, target) { _calcPatientNos = new Dictionary <int, CalculatedSitePatientNumber>(); if (site.NTTPercentOfChildren > 0) { ArtPedTargetOnMonth0 = site.GetNTTMonthValue(0) * (site.NTTPercentOfChildren / 100d); ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber(); calcPatientNo.Month = i; calcPatientNo.ArtPedMonthlyTarget = site.GetNTTMonthValue(i) * (site.NTTPercentOfChildren / 100d); calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget; _calcPatientNos.Add(i, calcPatientNo); } } else { ArtPedTargetOnMonth0 = periodinfo.DefultMonthValue[0]; ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber(); calcPatientNo.Month = i; calcPatientNo.ArtPedMonthlyTarget = periodinfo.DefultMonthValue[i]; calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget; _calcPatientNos.Add(i, calcPatientNo); } } //Pre-ART Target Breakdown (as entered by the user) if (site.NTPTPercentOfChildren > 0) { PreArtPedTargetOnMonth0 = site.GetNTPTMonthValue(0) * (site.NTPTPercentOfChildren / 100d); PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { _calcPatientNos[i].PreArtPedMonthlyTarget = site.GetNTPTMonthValue(i) * (site.NTPTPercentOfChildren / 100d); _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget; } } else { PreArtPedTargetOnMonth0 = periodinfo.DefultMonthValue[0]; PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { _calcPatientNos[i].PreArtPedMonthlyTarget = periodinfo.DefultMonthValue[i]; _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget; } } AdultsMonthlyAttritionRateInTreatment = Math.Round(1d - (Math.Pow(1d - (site.AITAnnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultsMonthlyAttritionRateInPreART = Math.Round(1d - (Math.Pow(1d - (site.AIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultMonthlyMigrationtoTreatment = Math.Round(1d - (Math.Pow(1d - (site.AIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultCombinedMonthlyRate = AdultsMonthlyAttritionRateInPreART + AdultMonthlyMigrationtoTreatment; PediatricsMonthlyAttritionRateinTreatment = Math.Round(1d - Math.Pow((1d - (site.PITAnnualPatientAttrition / 100d)), (1d / 12d)), 4, MidpointRounding.ToEven); PediatricsMonthlyAttritionRateinPreART = Math.Round(1 - (Math.Pow(1d - (site.PIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); PedMonthlyMigrationtoTreatment = Math.Round(1 - (Math.Pow(1d - (site.PIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); PedCombinedMonthlyRate = PediatricsMonthlyAttritionRateinPreART + PedMonthlyMigrationtoTreatment; //CurrentPatientsAtSiteInTreatment = site.TimeZeroPatientOnTreatment; //CurrentPatientsAtSiteInPreArt = site.TimeZeroPatientOnPreTreatment; CurrentAdultinTreatment = site.TimeZeroPatientOnTreatment * (1d - (site.NTTPercentOfChildren / 100d)); CurrentPediatricinTreatment = site.TimeZeroPatientOnTreatment * (site.NTTPercentOfChildren / 100d); CurrentAdultinPreArt = site.TimeZeroPatientOnPreTreatment * (1d - (site.NTPTPercentOfChildren / 100d)); CurrentPediatricinPreArt = site.TimeZeroPatientOnPreTreatment * (site.NTPTPercentOfChildren / 100d); TestingEfficiency = Math.Round((site.AdultTestingEfficiency / 100d), 4, MidpointRounding.ToEven); UseTestingE = forecast.PreTreatmentPatinetTargetEnum == Core.Util.OptPreTreatmentPatinetTargetEnum.TestingEfficiency; }
public CalcPatientNumber(ARTSite site, MorbidityForecast forecast, BudgetPeriodInfo periodinfo, int target) : base(site, forecast, periodinfo, target) { _calcPatientNos = new Dictionary<int, CalculatedSitePatientNumber>(); if (site.NTTPercentOfChildren > 0) { ArtPedTargetOnMonth0 = site.GetNTTMonthValue(0) * (site.NTTPercentOfChildren / 100d); ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber(); calcPatientNo.Month = i; calcPatientNo.ArtPedMonthlyTarget = site.GetNTTMonthValue(i) * (site.NTTPercentOfChildren / 100d); calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget; _calcPatientNos.Add(i, calcPatientNo); } } else { ArtPedTargetOnMonth0 = periodinfo.DefultMonthValue[0]; ArtAdulTargetOnMonth0 = site.GetNTTMonthValue(0) - ArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { CalculatedSitePatientNumber calcPatientNo = new CalculatedSitePatientNumber(); calcPatientNo.Month = i; calcPatientNo.ArtPedMonthlyTarget =periodinfo.DefultMonthValue[i]; calcPatientNo.ArtAdultMonthlyTarget = site.GetNTTMonthValue(i) - calcPatientNo.ArtPedMonthlyTarget; _calcPatientNos.Add(i, calcPatientNo); } } //Pre-ART Target Breakdown (as entered by the user) if (site.NTPTPercentOfChildren > 0) { PreArtPedTargetOnMonth0 = site.GetNTPTMonthValue(0) * (site.NTPTPercentOfChildren / 100d); PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { _calcPatientNos[i].PreArtPedMonthlyTarget = site.GetNTPTMonthValue(i) * (site.NTPTPercentOfChildren / 100d); _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget; } } else { PreArtPedTargetOnMonth0 =periodinfo.DefultMonthValue[0]; PreArtAdulTargetOnMonth0 = site.GetNTPTMonthValue(0) - PreArtPedTargetOnMonth0; for (int i = 1; i <= 12; i++) { _calcPatientNos[i].PreArtPedMonthlyTarget = periodinfo.DefultMonthValue[i]; _calcPatientNos[i].PreArtAdultMonthlyTarget = site.GetNTPTMonthValue(i) - _calcPatientNos[i].PreArtPedMonthlyTarget; } } AdultsMonthlyAttritionRateInTreatment = Math.Round(1d - (Math.Pow(1d - (site.AITAnnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultsMonthlyAttritionRateInPreART = Math.Round(1d - (Math.Pow(1d - (site.AIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultMonthlyMigrationtoTreatment = Math.Round(1d - (Math.Pow(1d - (site.AIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); AdultCombinedMonthlyRate = AdultsMonthlyAttritionRateInPreART + AdultMonthlyMigrationtoTreatment; PediatricsMonthlyAttritionRateinTreatment = Math.Round(1d - Math.Pow((1d - (site.PITAnnualPatientAttrition / 100d)), (1d / 12d)), 4, MidpointRounding.ToEven); PediatricsMonthlyAttritionRateinPreART =Math.Round( 1 - (Math.Pow(1d - (site.PIPAnualPatientAttrition / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); PedMonthlyMigrationtoTreatment = Math.Round(1 - (Math.Pow(1d - (site.PIPAnnualMigration / 100d), 1d / 12d)), 4, MidpointRounding.ToEven); PedCombinedMonthlyRate = PediatricsMonthlyAttritionRateinPreART + PedMonthlyMigrationtoTreatment; //CurrentPatientsAtSiteInTreatment = site.TimeZeroPatientOnTreatment; //CurrentPatientsAtSiteInPreArt = site.TimeZeroPatientOnPreTreatment; CurrentAdultinTreatment = site.TimeZeroPatientOnTreatment * (1d - (site.NTTPercentOfChildren / 100d)); CurrentPediatricinTreatment = site.TimeZeroPatientOnTreatment * (site.NTTPercentOfChildren / 100d); CurrentAdultinPreArt = site.TimeZeroPatientOnPreTreatment * (1d - (site.NTPTPercentOfChildren / 100d)); CurrentPediatricinPreArt = site.TimeZeroPatientOnPreTreatment * (site.NTPTPercentOfChildren / 100d); TestingEfficiency = Math.Round((site.AdultTestingEfficiency / 100d), 4, MidpointRounding.ToEven); UseTestingE = forecast.PreTreatmentPatinetTargetEnum == Core.Util.OptPreTreatmentPatinetTargetEnum.TestingEfficiency; }