/**
   * Verifies that certain transactions from the DLHCP are hidden in the activity feed per use case
   * 43.
   *
   * @throws Exception
   */
  public void testHiddenActivityFromDLHCP() throws Exception {
    gen.clearAllTables();
    gen.standardData();

    action = new ActivityFeedAction(TestDAOFactory.getTestInstance(), 2L);
    List<TransactionBean> accesses = action.getTransactions(new Date(), 1);

    for (TransactionBean tb : accesses)
      if (tb.getRole() != null && tb.getRole().equals("DLHCP")) {
        assertFalse(tb.getTransactionType() == TransactionType.DEMOGRAPHICS_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.DEMOGRAPHICS_EDIT);
        assertFalse(tb.getTransactionType() == TransactionType.OFFICE_VISIT_CREATE);
        assertFalse(tb.getTransactionType() == TransactionType.OFFICE_VISIT_EDIT);
        assertFalse(tb.getTransactionType() == TransactionType.OFFICE_VISIT_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.RISK_FACTOR_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.PATIENT_HEALTH_INFORMATION_EDIT);
        assertFalse(tb.getTransactionType() == TransactionType.PATIENT_HEALTH_INFORMATION_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.PRESCRIPTION_REPORT_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.COMPREHENSIVE_REPORT_ADD);
        assertFalse(tb.getTransactionType() == TransactionType.COMPREHENSIVE_REPORT_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.LAB_PROCEDURE_ADD);
        assertFalse(tb.getTransactionType() == TransactionType.LAB_PROCEDURE_EDIT);
        assertFalse(tb.getTransactionType() == TransactionType.LAB_PROCEDURE_REMOVE);
        assertFalse(tb.getTransactionType() == TransactionType.PRECONFIRM_PRESCRIPTION_RENEWAL);
        assertFalse(tb.getTransactionType() == TransactionType.PRESCRIPTION_ADD);
        assertFalse(tb.getTransactionType() == TransactionType.PRESCRIPTION_EDIT);
        assertFalse(tb.getTransactionType() == TransactionType.PATIENT_REMINDERS_VIEW);
        assertFalse(tb.getTransactionType() == TransactionType.EMERGENCY_REPORT_CREATE);
        assertFalse(tb.getTransactionType() == TransactionType.EMERGENCY_REPORT_VIEW);
      }
  }
  public void testGetFluShotDelinquents()
      throws DBException, IOException, FileNotFoundException, SQLException {
    gen.patient1();
    gen.patient2();
    gen.patient3();
    List<VisitReminderReturnForm> visRems = visRemDAO.getFluShotDelinquents(LHCP);

    assertEquals(2, visRems.size());
    VisitReminderReturnForm reminder = visRems.get(0);
    assertEquals(reminder.getLastName(), "Needs");
    assertEquals(reminder.getPatientID(), 3);
    /*
     * We need to account for "today" changing. Note that tests should NOT normally have if-statements in
     * them.
     */
    if (getCurrentMonth() >= 8 && getCurrentMonth() <= 11) // if we are in [Sep,Dec]
    assertEquals(VisitFlag.MISSING_MEDICATION, reminder.getVisitFlags()[0].getType());
    else
      // otherwise we are in [Jan,Aug]
      assertEquals(VisitFlag.MISSED_MEDICATION, reminder.getVisitFlags()[0].getType());
    assertEquals(reminder.getVisitFlags()[0].getValue(), "Flu Shot");
    reminder = visRems.get(1);
    assertEquals(reminder.getLastName(), "Person");
    assertEquals(reminder.getPatientID(), 1);
    if (getCurrentMonth() >= 8 && getCurrentMonth() <= 11) // if we are in [Sep,Dec]
    assertEquals(reminder.getVisitFlags()[0].getType(), VisitFlag.MISSING_MEDICATION);
    else
      // otherwise we are in [Jan,Aug]
      assertEquals(reminder.getVisitFlags()[0].getType(), VisitFlag.MISSED_MEDICATION);
    assertEquals(reminder.getVisitFlags()[0].getValue(), "Flu Shot");
  }
  @Override
  protected void setUp() throws Exception {
    gen = new TestDataGenerator();
    gen.clearAllTables();
    gen.standardData();

    this.factory = TestDAOFactory.getTestInstance();
    this.action = new ActivityFeedAction(factory, mid);
  }
 /**
  * testMakeEmailApp
  *
  * @throws Exception
  */
 public void testMakeEmailApp() throws Exception {
   gen.patient2();
   gen.hcp0();
   Email testEmail = action.makeEmailApp(9000000000L, "2", "You are allergic.");
   assertEquals("*****@*****.**", testEmail.getFrom());
   assertEquals("*****@*****.**", testEmail.getToListStr());
   assertEquals(
       "HCP has prescribed you a potentially dangerous medication", testEmail.getSubject());
   assertEquals(
       "Kelly Doctor has prescribed a medication that you are allergic to or that has a known interaction with a drug you are currently taking. You are allergic.",
       testEmail.getBody());
 }
 public void testGetDiagnosedVisitNeeders()
     throws DBException, IOException, FileNotFoundException, SQLException {
   gen.patient1();
   gen.patient2();
   gen.patient3();
   List<VisitReminderReturnForm> visRems = visRemDAO.getDiagnosedVisitNeeders(LHCP);
   VisitReminderReturnForm reminder = visRems.get(0);
   assertEquals(reminder.getLastName(), "Person");
   assertEquals(reminder.getPatientID(), 1);
   assertEquals(reminder.getVisitFlags()[0].getType(), VisitFlag.DIAGNOSED);
   assertEquals(reminder.getVisitFlags()[0].getValue(), "250.00");
 }
  /** Method to establish mock objects, database tables, and establish mock settings */
  @Override
  protected void setUp() throws Exception {
    gen = new TestDataGenerator();
    gen.clearAllTables();
    gen.standardData();

    request = mock(HttpServletRequest.class);
    response = mock(HttpServletResponse.class);
    session = mock(HttpSession.class);
    out = mock(PrintWriter.class);

    servlet = new LittleDelegatorServlet();
  }
  public void testGetFluShotDelinquentsEmptyList() throws Exception {
    Connection conn = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    gen.patient1();
    gen.patient2();
    gen.patient3();
    boolean thisYear = DateUtil.currentlyInMonthRange(9, 12);

    java.sql.Date september = new java.sql.Date(0l), december = new java.sql.Date(0l);
    DateUtil.setSQLMonthRange(september, 8, thisYear ? 0 : 1, december, 11, thisYear ? 0 : 1);
    try {
      conn = factory.getConnection();
      ps =
          conn.prepareStatement(
              "SELECT DISTINCT "
                  + "? as hid, ov.patientid, p.lastname, p.firstname, "
                  + "p.phone "
                  + "FROM officevisits ov, patients p "
                  + "WHERE ov.patientid=p.mid "
                  + "AND p.dateofdeath IS NULL "
                  + "AND p.dateofbirth < DATE_SUB(CURDATE(), INTERVAL 50 YEAR) "
                  + "AND patientid NOT IN "
                  + "(SELECT patientid FROM officevisits ov, ovmedication om "
                  + "WHERE ov.id=om.visitid "
                  + "AND NDCode IN (90656, 90658, 90660) "
                  + "AND ((StartDate BETWEEN ? AND ?) "
                  + "OR (EndDate BETWEEN ? AND ?))) "
                  + "ORDER BY lastname, firstname, ov.patientid");
      ps.setLong(1, this.LHCP);
      ps.setDate(2, september);
      ps.setDate(3, december);
      ps.setDate(4, september);
      ps.setDate(5, december);
      rs = ps.executeQuery();
      VisitReminderReturnFormLoader loader = new VisitReminderReturnFormLoader();
      List<VisitReminderReturnForm> patients = loader.loadList(rs);
      assertEquals(2, patients.size());
      VisitReminderReturnForm patient1 = patients.get(0);
      assertEquals(9000000003l, patient1.getHcpID());
      assertEquals(3l, patient1.getPatientID());
      assertEquals("Care", patient1.getFirstName());
      assertEquals("919-971-0000", patient1.getPhoneNumber());
    } finally {
      DBUtil.closeConnection(conn, ps);
    }
  }
  @Override
  protected void setUp() throws Exception {
    gen.clearAllTables();
    gen.hospitals();
    gen.hcp0();
    gen.patient1();
    gen.admin1();
    gen.officeVisit1();
    gen.ndCodes();
    gen.uc60();

    action = new EditOfficeVisitAction(factory, 9000000001L, "1", "1");
    actionUC60 = new EditOfficeVisitAction(factory, 9000000011L, "311", "3"); // UC60
  }
Esempio n. 9
0
 @Override
 protected void setUp() throws Exception {
   gen = new TestDataGenerator();
   gen.clearAllTables();
   gen.transactionLog();
   gen.ltData0();
   gen.ltData1();
   gen.ltData2();
   gen.hcp0();
   gen.labProcedures();
   action = new LabProcLTAction(factory);
 }
 /** Clears all of the tables */
 @Override
 protected void tearDown() throws Exception {
   gen.clearAllTables();
 }
 /**
  * Clears all of the tables, gets the standard data, and includes the data for use cases 68 and 69
  */
 @Override
 protected void setUp() throws Exception {
   gen = new TestDataGenerator();
   gen.clearAllTables();
   gen.standardData();
 }
Esempio n. 12
0
 @Override
 protected void setUp() throws Exception {
   gen.clearAllTables();
 }