Exemplo n.º 1
0
  public void testViewTestingProcedures() throws Exception {
    LabProcedureBean lp = new LabProcedureBean();
    lp.setLoinc("10763-1");
    lp.setCommentary("");
    lp.setOvID(902L);
    lp.setPid(2L);
    lp.setResults("");
    lp.allow();
    lp.statusTesting();
    lp.setLTID(5000000005L);
    long id = lpDAO.addLabProcedure(lp);
    lp.setProcedureID(id);

    LabProcedureBean procedures = lpDAO.getLabProcedure(id);

    List<LabProcedureBean> beans = action.viewTestingProcedures(5000000005L);
    assertEquals(1, beans.size());
    LabProcedureBean lpBean = beans.get(0);

    assertEquals(procedures.getLoinc(), lpBean.getLoinc());
    assertEquals(procedures.getOvID(), lpBean.getOvID());
    assertEquals(procedures.getLoinc(), lpBean.getLoinc());
    assertEquals("Testing", lpBean.getStatus());
    assertEquals(procedures.getProcedureID(), lpBean.getProcedureID());
  }
Exemplo n.º 2
0
 /**
  * Inserts a lab procedure into the database.
  *
  * @param b The LabProcedureBean to be inserted.
  * @return A long containing the ID of the newly inserted lab procedure bean.
  * @throws DBException
  */
 public long addLabProcedure(LabProcedureBean b) throws DBException {
   Connection conn = null;
   PreparedStatement ps = null;
   try {
     if (b.getPid() == 0L) throw new SQLException("PatientMID cannot be null");
     conn = factory.getConnection();
     ps =
         conn.prepareStatement(
             "INSERT INTO LabProcedure (PatientMID, LaboratoryProcedureCode, Status, Commentary, Results, OfficeVisitID, Rights) VALUES (?,?,?,?,?,?,?)");
     ps.setLong(1, b.getPid());
     ps.setString(2, b.getLoinc());
     ps.setString(3, b.getStatus());
     ps.setString(4, b.getCommentary());
     ps.setString(5, b.getResults());
     ps.setLong(6, b.getOvID());
     ps.setString(7, b.getRights());
     ps.executeUpdate();
     return DBUtil.getLastInsert(conn);
   } catch (SQLException e) {
     e.printStackTrace();
     throw new DBException(e);
   } finally {
     DBUtil.closeConnection(conn, ps);
   }
 }
Exemplo n.º 3
0
  /**
   * Sends an e-mail informing the patient that their procedure has been updated
   *
   * @param b the procedure that was updated
   * @return an e-mail to the patient with the notice
   * @throws DBException
   */
  private Email makeEmail(LabProcedureBean b) throws DBException {

    PatientBean p = new PatientDAO(factory).getPatient(b.getPid());

    Email email = new Email();
    email.setFrom("*****@*****.**");
    email.setToList(Arrays.asList(p.getEmail()));
    email.setSubject("A Lab Procedure Was Updated");
    email.setBody(
        String.format(
            "Dear %s, \n Your Lab Procedure (%s) has a new updated status of %s. Log on to iTrust to view.",
            p.getFullName(), b.getLoinc(), b.getStatus()));
    return email;
  }
Exemplo n.º 4
0
  /**
   * testGetLabProc
   *
   * @throws Exception
   */
  public void testGetLabProc() throws Exception {
    LabProcedureBean lp = new LabProcedureBean();
    lp.setPid(2L);
    lp.setLoinc("10763-1");
    lp.setCommentary("This is a test");
    lp.setOvID(902L);
    lp.setResults("Test Result");
    lp.allow();
    lp.statusReceived();
    lp.setLTID(5000000005L);
    long id = lpDAO.addLabProcedure(lp);
    lp.setProcedureID(id);

    assertEquals(lp.getCommentary(), action.getLabProcedure(id).getCommentary());
    assertEquals(lp.getPid(), action.getLabProcedure(id).getPid());
    assertEquals(lp.getLoinc(), action.getLabProcedure(id).getLoinc());
    assertEquals(lp.getOvID(), action.getLabProcedure(id).getOvID());
    assertEquals(lp.getResults(), action.getLabProcedure(id).getResults());
    assertEquals(lp.getLTID(), action.getLabProcedure(id).getLTID());
    assertEquals(lp.getStatus(), action.getLabProcedure(id).getStatus());
    assertEquals(lp.getRights(), action.getLabProcedure(id).getRights());
  }