예제 #1
0
  /**
   * Gets all lab procedures, period.
   *
   * @return A java.util.List of LabProcedureBeans.
   * @throws DBException
   */
  public List<LabProcedureBean> getAllLabProcedures() throws DBException {
    Connection conn = null;
    PreparedStatement ps = null;

    try {
      conn = factory.getConnection();
      ps = conn.prepareStatement("SELECT * FROM LabProcedure ORDER BY UpdatedDate ASC");
      ResultSet rs = ps.executeQuery();
      return labProcedureLoader.loadList(rs);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new DBException(e);
    } finally {
      DBUtil.closeConnection(conn, ps);
    }
  }
예제 #2
0
  /**
   * This gets all the procedures for a particular patient on a particular office visit
   *
   * @param mid The MID of the patient.
   * @param ovid The Office Visit ID.
   * @return A java.util.List of LabProcedureBeans
   * @throws DBException
   */
  public List<LabProcedureBean> getAllLabProceduresForDocOV(long ovid) throws DBException {
    Connection conn = null;
    PreparedStatement ps = null;

    try {
      conn = factory.getConnection();
      ps = conn.prepareStatement("SELECT * FROM LabProcedure WHERE OfficeVisitID = ? ");
      ps.setLong(1, ovid);
      ResultSet rs = ps.executeQuery();
      return labProcedureLoader.loadList(rs);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new DBException(e);
    } finally {
      DBUtil.closeConnection(conn, ps);
    }
  }
예제 #3
0
 /**
  * Gets an individual lab procedure.
  *
  * @param id The ID of the lab procedure.
  * @return A LabProcedureBean representing the procedure.
  * @throws DBException
  */
 public LabProcedureBean getLabProcedure(long id) throws DBException {
   Connection conn = null;
   PreparedStatement ps = null;
   try {
     conn = factory.getConnection();
     ps = conn.prepareStatement("SELECT * FROM LabProcedure WHERE LaboratoryProcedureID = ?");
     ps.setLong(1, id);
     ResultSet rs = ps.executeQuery();
     rs.next();
     return labProcedureLoader.loadSingle(rs);
   } catch (SQLException e) {
     e.printStackTrace();
     throw new DBException(e);
   } finally {
     DBUtil.closeConnection(conn, ps);
   }
 }
예제 #4
0
  /**
   * Gets all the lab procedures that correspond to a particular LOINC.
   *
   * @param id The LOINC in question.
   * @return A java.util.List of LabProcedureBeans.
   * @throws DBException
   */
  public List<LabProcedureBean> getAllLabProceduresLOINC(long id) throws DBException {
    Connection conn = null;
    PreparedStatement ps = null;

    try {
      if (id == 0L) throw new SQLException("PatientMID cannot be null");
      conn = factory.getConnection();
      ps =
          conn.prepareStatement(
              "SELECT * FROM LabProcedure WHERE PatientMID = ? ORDER BY LaboratoryProcedureCode ASC");
      ps.setLong(1, id);
      ResultSet rs = ps.executeQuery();
      return labProcedureLoader.loadList(rs);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new DBException(e);
    } finally {
      DBUtil.closeConnection(conn, ps);
    }
  }
예제 #5
0
 /**
  * Gets the lab procedures for a given LHCP that occur within the next month.
  *
  * @param ovid The Office Visit ID conducted by the LHCP in question.
  * @return A java.util.List of LabProcedureBeans.
  * @throws DBException
  */
 public List<LabProcedureBean> getLabProceduresForLHCPForNextMonth(long ovid) throws DBException {
   Connection conn = null;
   PreparedStatement ps = null;
   try {
     if (ovid == 0L) throw new SQLException("OfficeVisitID cannot be null");
     conn = factory.getConnection();
     ps =
         conn.prepareStatement(
             "SELECT * FROM LabProcedure WHERE OfficeVisitID = ? AND Status = ? AND (DateDiff(SYSDATE(),UpdatedDate) <= 30) ORDER BY UpdatedDate DESC");
     ps.setLong(1, ovid);
     ps.setString(2, LabProcedureBean.Completed);
     ResultSet rs = ps.executeQuery();
     return labProcedureLoader.loadList(rs);
   } catch (SQLException e) {
     e.printStackTrace();
     throw new DBException(e);
   } finally {
     DBUtil.closeConnection(conn, ps);
   }
 }
예제 #6
0
  /**
   * This gets all the procedures for a particular patient on a particular office visit
   *
   * @param mid The MID of the patient.
   * @param ovid The Office Visit ID.
   * @return A java.util.List of LabProcedureBeans.
   * @throws DBException
   */
  public List<LabProcedureBean> getAllLabProceduresForDocOV(long mid, long ovid)
      throws DBException {
    Connection conn = null;
    PreparedStatement ps = null;

    try {
      if (mid == 0L) throw new SQLException("PatientMID cannot be null");
      conn = factory.getConnection();
      ps =
          conn.prepareStatement(
              "SELECT * FROM LabProcedure WHERE PatientMID = ? AND OfficeVisitID = ? ORDER BY UpdatedDate DESC");
      ps.setLong(1, mid);
      ps.setLong(2, ovid);
      ResultSet rs = ps.executeQuery();
      return labProcedureLoader.loadList(rs);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new DBException(e);
    } finally {
      DBUtil.closeConnection(conn, ps);
    }
  }