/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }