/**
   * Method used to find experts of specified specialty from hospitals that are in range
   *
   * @param hospitals The hospitals within the proximity of the user
   * @param specialty The expertise specified
   * @return A relationship between the hospitals within proximity and the personnel with the
   *     specified expertise within them.
   */
  public List<PersonnelBean> findExpertsForLocalHospitals(
      List<HospitalBean> hospitals, String specialty) {
    // HashMap<HospitalBean, List<PersonnelBean>> experts = new HashMap<HospitalBean,
    // List<PersonnelBean>>();
    List<PersonnelBean> beans = new ArrayList<PersonnelBean>();
    if (specialty.equalsIgnoreCase("all")) {}

    try {
      // Go through all nearby hospitals
      for (HospitalBean hospital : hospitals) {
        // Put the specified experts into a hashmap with the hospital
        // experts.put(hospital, personnelDAO.getPersonnelFromHospital(hospital.getHospitalID(),
        // specialty));
        List<PersonnelBean> personnelBeans =
            personnelDAO.getPersonnelFromHospital(hospital.getHospitalID(), specialty);
        for (PersonnelBean personnelBean : personnelBeans) {
          beans.add(personnelBean);
        }
      }
    } catch (DBException e) {
      e.printStackTrace();
    }
    Collections.sort(beans, new CustomComparator());
    return beans;
  }
 public void testFailGetLabProcedures() throws Exception {
   try {
     lpDAO.getAllLabProceduresDate(0L);
     fail("Exception should have been thrown");
   } catch (DBException e) {
     assertEquals("PatientMID cannot be null", e.getExtendedMessage());
   }
 }
Esempio n. 3
0
  public boolean isDependent() {
    boolean isDependent = false;
    try {
      return authDAO.isDependent(pid);
    } catch (DBException e) {
      // If a DBException occurs print a stack trace and return false
      e.printStackTrace();
    }

    return isDependent;
  }
 @Test
 public void testApproveClaim() {
   subject.approveClaim();
   try {
     b1 = init.getBillId(b1.getBillID());
   } catch (DBException e) {
     e.printStackTrace();
     fail();
   }
   assertEquals(BillingBean.APPROVED, b1.getStatus());
 }
Esempio n. 5
0
  public boolean setDependent(boolean dependency) {
    try {
      authDAO.setDependent(pid, dependency);
      if (dependency) patientDAO.removeAllRepresented(pid);
    } catch (DBException e) {
      // If a DBException occurs print a stack trace and return false
      e.printStackTrace();
      return false;
    }

    return true;
  }
 /** testEvilDatabase */
 public void testEvilDatabase() {
   try {
     action = new EditOfficeVisitAction(EvilDAOFactory.getEvilInstance(), 0L, "1", "1");
     fail("exception should have been thrown");
   } catch (ITrustException e) {
     assertEquals(
         "A database exception has occurred. Please see the log in the console for stacktrace",
         e.getMessage());
     DBException dbe = (DBException) e;
     assertEquals(EvilDAOFactory.MESSAGE, dbe.getSQLException().getMessage());
   }
 }