Ejemplo n.º 1
0
 public static Map<String, String> typesMap() {
   Map<String, String> theMap = new HashMap<String, String>();
   for (IdentityDocType type : all()) {
     theMap.put(type.id.toString(), type.identityDocTypeName);
   }
   return theMap;
 }
Ejemplo n.º 2
0
  // SELECT DOCTOR .id as id, concat(surname, ' ', name, ' ', patronymic) as fio, doctor_type_name
  // as type FROM DOCTOR LEFT JOIN DOCTOR_TYPE ON DOCTOR_TYPE.ID = DOCTOR.DOCTOR_TYPE_ID
  public static Map<String, String> fioMapByType(Long doctorTypeNameId) {
    // TODO: check this statement at latest version of PostgreSQL
    Map<String, String> theMap = new HashMap<String, String>();
    String sql =
        "SELECT DOCTOR.id as id, concat(surname, ' ', name, ' ', patronymic) as fio FROM DOCTOR LEFT JOIN DOCTOR_TYPE ON DOCTOR_TYPE.ID = DOCTOR.DOCTOR_TYPE_ID WHERE doctor_type.id=:type_id";
    SqlQuery sqlQuery = Ebean.createSqlQuery(sql).setParameter("type_id", doctorTypeNameId);
    List<SqlRow> rows = sqlQuery.findList();
    for (SqlRow row : rows) {
      theMap.put(row.getString("id"), row.getString("fio"));
    }

    return theMap;
  }