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()); }
/** * 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); } }
public void testGetLabProcedure() 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 proc = lpDAO.getLabProcedure(id); assertEquals(lp.getOvID(), proc.getOvID()); }
/** * 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()); }