@Test public void parseConcepts_shouldParseListCorrectly() { List<Concept> concepts = EmrUtils.parseConcepts(""); Assert.assertEquals(0, concepts.size()); concepts = EmrUtils.parseConcepts("5497,730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,5356"); Assert.assertEquals(3, concepts.size()); Assert.assertEquals(Dictionary.getConcept("5497AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(0)); Assert.assertEquals(Dictionary.getConcept("730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(1)); Assert.assertEquals(Dictionary.getConcept("5356AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(2)); concepts = EmrUtils.parseConcepts(" 5497, 730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\t , 5356 \t"); Assert.assertEquals(3, concepts.size()); Assert.assertEquals(Dictionary.getConcept("5497AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(0)); Assert.assertEquals(Dictionary.getConcept("730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(1)); Assert.assertEquals(Dictionary.getConcept("5356AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), concepts.get(2)); }
public static List<Concept> parseConcepts(String csv) { List<String> identifiers = parseCsv(csv); List<Concept> concepts = new ArrayList<Concept>(); for (String identifier : identifiers) { if (StringUtils.isNumeric(identifier)) { concepts.add(Context.getConceptService().getConcept(Integer.valueOf(identifier))); } else { concepts.add(Dictionary.getConcept(identifier)); } } return concepts; }
EmrUtils { public static List<Concept> parseConcepts(String csv) { List<String> identifiers = parseCsv(csv); List<Concept> concepts = new ArrayList<Concept>(); for (String identifier : identifiers) { if (StringUtils.isNumeric(identifier)) { concepts.add(Context.getConceptService().getConcept(Integer.valueOf(identifier))); } else { concepts.add(Dictionary.getConcept(identifier)); } } return concepts; } }
EmrUtils { public static List<Concept> parseConcepts(String csv) { List<String> identifiers = parseCsv(csv); List<Concept> concepts = new ArrayList<Concept>(); for (String identifier : identifiers) { if (StringUtils.isNumeric(identifier)) { concepts.add(Context.getConceptService().getConcept(Integer.valueOf(identifier))); } else { concepts.add(Dictionary.getConcept(identifier)); } } return concepts; }  }
EmrUtils { public static List<Concept> parseConcepts(String csv) { List<String> identifiers = parseCsv(csv); List<Concept> concepts = new ArrayList<Concept>(); for (String identifier : identifiers) { if (StringUtils.isNumeric(identifier)) { concepts.add(Context.getConceptService().getConcept(Integer.valueOf(identifier))); } else { concepts.add(Dictionary.getConcept(identifier)); } } return concepts; }  static boolean dateHasTime(Date date); static boolean isToday(Date date); static Integer whoStage(Concept c); static List<String> parseCsv(String csv); static List<Concept> parseConcepts(String csv); static Provider getProvider(User user); }
EmrUtils { public static List<Concept> parseConcepts(String csv) { List<String> identifiers = parseCsv(csv); List<Concept> concepts = new ArrayList<Concept>(); for (String identifier : identifiers) { if (StringUtils.isNumeric(identifier)) { concepts.add(Context.getConceptService().getConcept(Integer.valueOf(identifier))); } else { concepts.add(Dictionary.getConcept(identifier)); } } return concepts; }  static boolean dateHasTime(Date date); static boolean isToday(Date date); static Integer whoStage(Concept c); static List<String> parseCsv(String csv); static List<Concept> parseConcepts(String csv); static Provider getProvider(User user);  }