/// <summary> /// sample referral /// </summary> /// <param name="result"></param> public void SetTestsReceivedFromReferringSites(ClassOfChemistryTests[] result) { //ChemistryTestNameEnum[] chemTests = LqtUtil.EnumToArray<ChemistryTestNameEnum>(); for (int i = 1; i <= 12; i++) { //for (int x = 0; x < chemTests.Length; x++) foreach (Test t in _testingArea.Tests) { ChemistrySymptomDirectedTest csdt = _chemMonthlyOutputs[i].GetChemSymptomDirectedTestById(t.Id); if ((i + 1) >= PeriodInfo.FirstMonth && (i + 1) <= PeriodInfo.LastMonth) { csdt.TestsonInstrumentForecastPeriodFromReferringSites = result[i - 1].GetChemTestValue(t.Id); } if ((i + 1) > PeriodInfo.LastMonth) { csdt.TestsonInstrumentBufferStockFromReferringSites = result[i - 1].GetChemTestValue(t.Id); } } if ((i + 1) >= PeriodInfo.FirstMonth && (i + 1) <= PeriodInfo.LastMonth) { _chemMonthlyOutputs[i].TotalSampleForecastPeriodRecivedFromReferrSites = result[i - 1].TotalSamples; } if ((i + 1) > PeriodInfo.LastMonth) { _chemMonthlyOutputs[i].TotalSampleBufferStockRecivedFromReferrSites = result[i - 1].TotalSamples; } } _testsReceivedFromReferringSitesBeyondForecast = result[12]; }
public IList <ChemandOtherNumberofTest> GetChemistryTestNumber() { _chemtestNumber = new List <ChemandOtherNumberofTest>(); if (ArtSite.ForecastChemistry) { foreach (PSymptomDirectedTest sdt in ChemTestProtocol.SymptomDirectedTests) { ChemandOtherNumberofTest ct = new ChemandOtherNumberofTest(); ct.ForecastId = Forecast.Id; ct.SiteId = ArtSite.Site.Id; ct.Platform = (int)ClassOfMorbidityTestEnum.Chemistry; ct.TestId = sdt.Test.Id; //ct.TestName = sdt.ChemTestName; for (int i = 1; i <= 12; i++) { ChemistrySymptomDirectedTest csdt = _chemMonthlyOutputs[i].GetChemSymptomDirectedTestById(sdt.Test.Id); ct.InvalidTestandWastage += csdt.AdditionalTestsdueToWastage; ct.RepeatedDuetoClinicalReq += csdt.RepeatedDuetoClinicianRequest(); ct.SymptomDirectedTests += csdt.TotalSymptomDirectTest(); ct.TestBasedOnProtocols += _chemMonthlyOutputs[i].GetSumOfChemTest(sdt.Test.Id); //ct.TestBasedOnProtocols += csdt.TestBasedonProtocol; } foreach (ChemistryPlatformTests ptc in _chemPlatformTests) { if (ct.TestBasedOnProtocols > 0) { ct.ReagentstoRunControls += ptc.TotalControlsFP() + ptc.SampleReferredTotalControlsFP(); ct.BufferStock += ptc.TotalControlsBP() + ptc.SampleReferredTotalControlsBP(); } else { ct.ReagentstoRunControls = 0; ct.BufferStock += ptc.TotalControlsBP(); } } _chemtestNumber.Add(ct); } } return(_chemtestNumber); }
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; } } }
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; } }