Exemplo n.º 1
1
  public static void main(String[] args) {
    TestUser user = null;
    try {
      user = new TestUser(2899, 5213);
      user.getLogger().setEnabled(false);

      DrugDescriptionMatcher matcher = new DrugDescriptionMatcher(user);

      ArrayList descriptions = getTestDescriptions(user);
      Iterator iter = descriptions.iterator();
      while (iter.hasNext()) {
        String desc = (String) iter.next();

        // ArrayList drugs = matcher.match("Amoxicillin 250 mg cap",1);
        ArrayList drugs = matcher.match(desc);

        if (Lists.isEmpty(drugs)) {
          System.out.println(desc + ":\n--> No drugs found.");
        } else {
          System.out.println(desc + ":\n--> Found " + drugs.size() + " drugs:");

          Iterator drugIter = drugs.iterator();
          while (drugIter.hasNext()) {
            Drug drug = (Drug) drugIter.next();
            System.out.println(
                "--> ID " + drug.getID() + ": " + drug.getName() + " " + drug.getFormula());
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      user.finish();
    }
  }
Exemplo n.º 2
0
  public static void main(String[] args) {
    TestUser user = null;
    try {
      user = new TestUser(2899, 5213);

      Prescription one = user.getPrescription(523436);
      Prescription two = user.getPrescription(523411);
      Duplicate dup = null;

      // one.put(DRUG_ID,198115);
      // one.put(DRUG_NAME,"Celebrex");
      // two.put(DRUG_ID,239819);
      // two.put(DRUG_NAME,"Eco-5");

      dup = Duplicate.compare(user, one, two);
      if (dup != null) {
        System.out.println("drugs duplicate, status " + dup.getStatus());
      } else {
        System.out.println("drugs do not duplicate");
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      user.finish();
    }
  }