예제 #1
0
  public ArrayList get(long drugID) throws IOException {
    load();
    if (LOAD_INTO_MEMORY) return (ArrayList) doseMap.get(drugID);

    RcopiaDb db = user.getDb(DOSE_CHECK);
    String cond = DRUG_ID + "=" + drugID + " AND " + IS_MAINTENANCE_DOSE + "=" + Str.quote(Y);

    return db.getByConditions(cond);
  }
예제 #2
0
  private static void loadDoses() throws IOException {
    RcopiaDb db = DatabaseFactory.instance().get(DOSE_CHECK, Display.getMasterLogger());

    ArrayList doses = db.getAll();

    Iterator iter = doses.iterator();
    while (iter.hasNext()) {
      RcopiaInfo info = (RcopiaInfo) iter.next();
      if (info.isDeleted()) continue;

      long drugID = info.getInt(DRUG_ID);
      if (drugID == 0) continue;

      if (!Y.equalsIgnoreCase(info.getString(IS_MAINTENANCE_DOSE))) continue;

      ArrayList list = (ArrayList) doseMap.get(drugID);
      if (list == null) {
        list = new ArrayList();
        doseMap.put(drugID, list);
      }

      list.add(info);
    }
  }
예제 #3
0
 public static RcopiaInfo get(long id) {
   load();
   return (RcopiaInfo) map.get(id);
 }