Пример #1
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;
  }
Пример #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);
    }
  }