Exemplo n.º 1
0
  static void setPatient(RcopiaUser user, RequestParameters params) throws IOException {
    long patientID = params.getInt(PATIENT_ID);
    Patient patient = null;

    if (patientID != 0) {
      // patient = user.getPatient(patientID);
      patient = Patient.create(user, user.getDb(PATIENT).getByID(patientID));
      if (patient == null)
        throw new PatientNotFoundException("Patient " + patientID + " is not in your list.");

      user.getCache().put(patient);
    } else {
      patient = getExternalPatient(user, params);
    }

    user.setPatient(patient);

    if (patient == null) {
      if (patientID == 0) {
        String externalID = params.getString(EXTERNAL_PATIENT_ID);
        throw new PatientNotFoundException("Patient " + externalID + " is not in your list.");
      } else {
        throw new PatientNotFoundException("Patient " + patientID + " is not in your list.");
      }
    }

    long linkedID = patient.getInt(LINKED_ID);
    if (linkedID != 0) {
      Patient alias = user.getPatient(linkedID);
      if (alias != null) user.setPatient(alias);
    }
  }
Exemplo n.º 2
0
 public ArrayList gerDrugHistories(Patient patient) throws IOException {
   user.loadRxHubRequestConfig(patient.getPracticeID(), SERVICE);
   EligibilityProcessor eligibilityProcessor = new EligibilityProcessor(patient, user, SERVICE);
   ArrayList<EligibilityCheck> checks = eligibilityProcessor.getEligibility();
   ArrayList<DrugHistoryResult> results = getDrugHistoryForACMedHx(patient, checks);
   return results;
 }
Exemplo n.º 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);
  }
Exemplo n.º 4
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.º 5
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;
  }