diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/DiagnosesDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/DiagnosesDAO.java index 854f6e7b9233b19b9d5899e8157294daa670244d..d58b52c286db99d535c5bfa47a36ad3e606b9d68 100644 --- a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/DiagnosesDAO.java +++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/DiagnosesDAO.java @@ -133,45 +133,6 @@ public class DiagnosesDAO { } - public ArrayList<DiagnosisStatisticsBean> getWeeklyCounts(String icdCode, String zipCode, java.util.Date lower, java.util.Date upper) throws DBException { - return getWeeklyCounts(icdCode, zipCode, lower, upper, 3); - } - - - /** - * Gets a weekly local zip code count and regional count of a specified diagnosis code over a time period - * - * @param icdCode The diagnosis code - * @param zipCode The zip code to evaluate - * @param lower The starting date - * @param upper The ending date - * @return A list of beans containing the local and regional count for each week in the time period - * @throws DBException - */ - public ArrayList<DiagnosisStatisticsBean> getWeeklyCounts(String icdCode, String zipCode, java.util.Date lower, java.util.Date upper, int zipSFs) throws DBException { - Calendar cal = Calendar.getInstance(); - cal.setTime(lower); - cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); - Date lowerDate = cal.getTime(); - cal.add(Calendar.HOUR, 24*6); - Date upperDate = cal.getTime(); - - ArrayList<DiagnosisStatisticsBean> weekStats = new ArrayList<DiagnosisStatisticsBean>(); - - do { - DiagnosisStatisticsBean db = getDiagnosisCounts(icdCode, zipCode, lowerDate, upperDate, zipSFs); - weekStats.add(db); - - cal.setTime(upperDate); - cal.add(Calendar.HOUR, 24); - lowerDate = cal.getTime(); - cal.add(Calendar.HOUR, 24*6); - upperDate = cal.getTime(); - } while (lowerDate.before(upper)); - - return weekStats; - } - public DiagnosisStatisticsBean getCountForWeekBefore(String icdCode, String zipCode, java.util.Date next) throws DBException { return getCountForWeekBefore(icdCode, zipCode, next, 3); } diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java index 3e87e10f137526ea3aada1c16e2879362b1a6ed4..94d05e3dd12077f686f783acf77847237ca8f7ac 100644 --- a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java +++ b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/officevisit/OVDiagnosesTest.java @@ -92,28 +92,6 @@ public class OVDiagnosesTest extends TestCase { assertEquals(3, dsBean.getZipStats()); assertEquals(5, dsBean.getRegionStats()); } - - /** - * testGetWeeklyStatisticsValid - * @throws Exception - */ - public void testGetWeeklyStatisticsValid() throws Exception { - Date lower = new SimpleDateFormat("MM/dd/yyyy").parse("06/28/2011"); - Date upper = new SimpleDateFormat("MM/dd/yyyy").parse("09/28/2011"); - List<DiagnosisStatisticsBean> db = diagDAO.getWeeklyCounts("487.00", "27607", lower, upper); - - assertEquals(new SimpleDateFormat("MM/dd/yyyy").parse("06/27/2011"), db.get(0).getStartDate()); - assertEquals(new SimpleDateFormat("MM/dd/yyyy").parse("07/03/2011"), db.get(0).getEndDate()); - assertEquals(new SimpleDateFormat("MM/dd/yyyy").parse("09/26/2011"), db.get(db.size()-1).getStartDate()); - - long totalRegion = 0; - for (DiagnosisStatisticsBean d : db) { - totalRegion += d.getRegionStats(); - } - //If previous test fails, this test may fail - long totalRegionNonsplit = diagDAO.getDiagnosisCounts("487.00", "27607", lower, upper).getRegionStats(); - assertEquals(totalRegionNonsplit, totalRegion); - } public void testZipSFs() throws Exception { TestDataGenerator gen = new TestDataGenerator();