コード例 #1
0
 /* Returns the whole list of evaluations for a patient */
 private List<Evaluation> getEvaluationsForSync(
     String patientUUID, String evaluatorCC, String patientCC) {
   List<Evaluation> evaluations = new ArrayList<Evaluation>();
   SQLiteDatabase db = this.getReadableDatabase();
   Cursor cursor =
       db.query(
           TABLE_EVALUATIONS,
           new String[] {
             KEY_EVALUATION_UUID,
             KEY_EVALUATION_ULCERAS,
             KEY_EVALUATION_AGRUPADAS,
             KEY_EVALUATION_LESIONES_H,
             KEY_EVALUATION_LESIONES_B,
             KEY_EVALUATION_LESIONES_LA,
             KEY_EVALUATION_LESIONES_RA,
             KEY_EVALUATION_LESIONES_LL,
             KEY_EVALUATION_LESIONES_RL,
             KEY_EVALUATION_ACTIVIDADES,
             KEY_EVALUATION_ANTECEDENTES,
             KEY_EVALUATION_MANTA,
             KEY_EVALUATION_DATE,
             KEY_EVALUATION_THRESHOLD,
             KEY_EVALUATION_SCORE
           },
           FK_PATIENT + "=?",
           new String[] {patientUUID},
           null,
           null,
           null,
           null);
   if (cursor != null && cursor.moveToFirst()) {
     do {
       Evaluation evaluation =
           new Evaluation(
               cursor.getString(0),
               cursor.getInt(1) == 1 ? true : false,
               cursor.getInt(2) == 1 ? true : false,
               cursor.getInt(3) == 1 ? true : false,
               cursor.getInt(4) == 1 ? true : false,
               cursor.getInt(5) == 1 ? true : false,
               cursor.getInt(6) == 1 ? true : false,
               cursor.getInt(7) == 1 ? true : false,
               cursor.getInt(8) == 1 ? true : false,
               cursor.getInt(9) == 1 ? true : false,
               cursor.getInt(10) == 1 ? true : false,
               cursor.getInt(11) == 1 ? true : false,
               cursor.getString(12),
               cursor.getInt(13),
               cursor.getInt(14));
       evaluation.setEvaluadorId(evaluatorCC);
       evaluation.setPacienteId(patientCC);
       evaluations.add(evaluation);
     } while (cursor.moveToNext());
   }
   db.close();
   return evaluations;
 }
コード例 #2
0
 /* Returns the latest evaluation for a patient, only with the date and the final score */
 public Evaluation getMinimizedLatestEvaluation(String patientUUID) {
   SQLiteDatabase db = this.getReadableDatabase();
   Cursor cursor =
       db.query(
           TABLE_EVALUATIONS,
           new String[] {KEY_EVALUATION_DATE, KEY_EVALUATION_SCORE},
           FK_PATIENT + "=?",
           new String[] {patientUUID},
           null,
           null,
           null,
           null);
   Evaluation evaluation = null;
   if (cursor != null && cursor.moveToLast()) {
     evaluation = new Evaluation();
     evaluation.setDate(cursor.getString(0));
     evaluation.setScore(cursor.getInt(1));
   }
   db.close();
   return evaluation;
 }
コード例 #3
0
  /* Adds an item to the evaluations table */
  public int addEvaluation(Evaluation evaluation, String patientUUID) {
    Calendar cal = Calendar.getInstance();
    // TODO: Fix date to add hh:mm:ss.ssss
    String date =
        cal.get(Calendar.DAY_OF_MONTH)
            + "-"
            + (cal.get(Calendar.MONTH) + 1) // Sumo 1, ya que empieza en 0
            + "-"
            + cal.get(Calendar.YEAR)
            + " "
            + cal.get(Calendar.HOUR_OF_DAY)
            + "-"
            + cal.get(Calendar.MINUTE)
            // Descomentar si se desea que la fehca tambien use los milisegundos
            + "-"
            + cal.get(Calendar.SECOND); // + "-" + cal.get(Calendar.MILLISECOND);

    ContentValues values = new ContentValues();
    values.put(KEY_EVALUATION_UUID, evaluation.getUUIDNumber());
    values.put(KEY_EVALUATION_ULCERAS, evaluation.isUlceras());
    values.put(KEY_EVALUATION_AGRUPADAS, evaluation.isAgrupadas());
    values.put(KEY_EVALUATION_LESIONES_H, evaluation.isLesionesH());
    values.put(KEY_EVALUATION_LESIONES_B, evaluation.isLesionesB());
    values.put(KEY_EVALUATION_LESIONES_LA, evaluation.isLesionesLA());
    values.put(KEY_EVALUATION_LESIONES_RA, evaluation.isLesionesRA());
    values.put(KEY_EVALUATION_LESIONES_LL, evaluation.isLesionesLL());
    values.put(KEY_EVALUATION_LESIONES_RL, evaluation.isLesionesRL());
    values.put(KEY_EVALUATION_ACTIVIDADES, evaluation.isActividades());
    values.put(KEY_EVALUATION_ANTECEDENTES, evaluation.isAntecedentes());
    values.put(KEY_EVALUATION_MANTA, evaluation.isManta());
    values.put(KEY_EVALUATION_DATE, date);
    values.put(KEY_EVALUATION_THRESHOLD, evaluation.getUmbral());
    values.put(KEY_EVALUATION_SCORE, evaluation.getScore());
    values.put(FK_PATIENT, patientUUID);
    return add(TABLE_EVALUATIONS, values);
  }