Exemplo n.º 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);
  }
Exemplo n.º 2
0
  private static void createMap() throws IOException {
    if (manufacturers == null) return;

    Iterator iter = manufacturers.iterator();
    while (iter.hasNext()) {
      RcopiaInfo item = (RcopiaInfo) iter.next();
      map.put(item.getID(), item);
    }
  }
Exemplo n.º 3
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);
    }
  }
Exemplo n.º 4
0
  protected static synchronized void doLoad() {
    if (loaded) return;

    doseMap.clear();

    try {
      Display.masterLog("Loading dose check information...");
      loadDoses();
      Display.masterLog("Loaded dose check information.");
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("Cannot load dose check information");
    }
    loaded = true;
  }
Exemplo n.º 5
0
 public static RcopiaInfo get(long id) {
   load();
   return (RcopiaInfo) map.get(id);
 }