예제 #1
0
  public RcopiaDb getDb(String type) {
    String requestor = "rcopia.acmedhx.processors.DrugHistoryProcessor";

    RcopiaDb db = DatabaseFactory.instance().get(type, new com.drfirst.util.Logger(), false);
    db.setSource(requestor);
    return db;
  }
예제 #2
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);
  }
예제 #3
0
  private long getPracticePreferenceInt(String field) throws IOException {
    RcopiaDb db = getDb(PRACTICE_PREFERENCES);
    String query =
        "SELECT "
            + field
            + " FROM "
            + db.getName()
            + " WHERE "
            + PRACTICE_ID
            + "="
            + user.getPracticeID();

    long groupID = user.getGroupID();
    if (groupID != 0) query += " AND " + PROVIDER_GROUP_ID + "=" + groupID;

    return db.getInt(query);
  }
예제 #4
0
  private static synchronized void doLoad() {
    if (loaded) return;

    try {
      Display.masterLog("Loading Manufacturers...");
      RcopiaDb manufacturerDb =
          DatabaseFactory.instance().get(MANUFACTURER, Display.getMasterLogger());

      manufacturers = manufacturerDb.getAll();
      createMap();
    } catch (Exception e) {
      e.printStackTrace();
      ErrorMailServer.instance().mail("Cannot load manufacturer list: " + e.getMessage());
      throw new RuntimeException("Cannot load manufacturer list: " + e.getMessage());
    }

    loaded = true;
  }
예제 #5
0
  private void doLoad() {
    if (logger == null) logger = new Logger();

    if (loaded) return;

    try {
      logger.log("Loading State Prescription Variances...");
      RcopiaDb db = DatabaseFactory.instance().get(STATE_PHARMACY_VARIANCES, logger);

      ArrayList variances = db.getAll();
      createMap(variances);
    } catch (Exception e) {
      logger.log(e);
      ErrorMailServer.instance()
          .mail("Cannot load State Prescription Variances: " + e.getMessage());
      throw new SystemErrorException(
          "Cannot load  State Prescription Variances: " + e.getMessage());
    }

    loaded = true;
  }
예제 #6
0
  private static ArrayList getTestDescriptions(RcopiaUser user) throws IOException {
    RcopiaDb db = user.getDb(DRUG_HISTORY_ITEM);
    String cond = CREATEDDATE + "> sysdate-7";
    db.setResultMax(100);

    ArrayList list = db.getByConditions(cond);
    ArrayList descriptions = new ArrayList();
    if (list == null) return descriptions;

    Iterator iter = list.iterator();
    while (iter.hasNext()) {
      RcopiaInfo info = (RcopiaInfo) iter.next();
      String desc =
          info.getString(DRUG_NAME)
              + " "
              + info.getString("drug_strength_num")
              + " "
              + info.getString("drug_strength_unit_code");
      descriptions.add(desc);
    }

    return descriptions;
  }
예제 #7
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);
    }
  }