コード例 #1
0
  /**
   * 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;
  }
コード例 #2
0
 /**
  * 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 HashMap<HospitalBean, List<PersonnelBean>> findExperts(
     List<HospitalBean> hospitals, String specialty) {
   HashMap<HospitalBean, List<PersonnelBean>> experts =
       new HashMap<HospitalBean, List<PersonnelBean>>();
   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));
     }
   } catch (DBException e) {
     //
   }
   return experts;
 }