private Obs getObsGroup() {
    ConceptDatatype datatype = new ConceptDatatype();
    datatype.setUuid(ConceptDatatype.CODED_UUID);
    datatype.setHl7Abbreviation(ConceptDatatype.CODED);

    Concept concept = new Concept(1);
    concept.setDatatype(datatype);
    concept.addName(new ConceptName("MedSet", Locale.ENGLISH));

    ConceptSource source = new ConceptSource();
    source.setName("LOCAL");

    ConceptMap map = new ConceptMap();
    map.setSourceCode("100");
    map.setSource(source);

    concept.addConceptMapping(map);

    Date dateCreated = new Date(213231421890234L);

    Obs obs = new Obs(1);
    obs.setConcept(concept);
    obs.setDateCreated(dateCreated);

    return obs;
  }
 private Concept newConcept(ConceptDatatype conceptDatatype, String conceptUuid) {
   Concept concept = new Concept();
   concept.setDatatype(conceptDatatype);
   concept.setUuid(conceptUuid);
   when(conceptService.getConceptByUuid(conceptUuid)).thenReturn(concept);
   return concept;
 }
Esempio n. 3
0
 /** Gets or creates a Concept with a given UUID and name. */
 public static Concept getConcept(String name, String uuid, String typeUuid) {
   ConceptService conceptService = Context.getConceptService();
   Concept concept = conceptService.getConceptByUuid(uuid);
   if (concept == null) {
     concept = new Concept();
     concept.setUuid(uuid);
     concept.setShortName(new ConceptName(name, new Locale("en")));
     concept.setDatatype(conceptService.getConceptDatatypeByUuid(typeUuid));
     concept.setConceptClass(conceptService.getConceptClassByUuid(ConceptClass.MISC_UUID));
     conceptService.saveConcept(concept);
   }
   return concept;
 }
  @Test
  @Verifies(
      value = "shouldSetTheValueComplexOfObsIfConceptIsComplex",
      method = "createObs(Concept concept, Object value, Date datetime, String accessionNumber)")
  public void createObs_shouldSetTheValueComplexOfObsIfConceptIsComplex() {

    ComplexData complexData = new ComplexData("test", null);
    Concept c = new Concept();
    ConceptDatatype cd = new ConceptDatatype();
    cd.setUuid(HtmlFormEntryConstants.COMPLEX_UUID);
    c.setDatatype(cd);
    Obs o = HtmlFormEntryUtil.createObs(c, complexData, null, null);
    Assert.assertEquals(o.getValueComplex(), complexData.getTitle());
  }
Esempio n. 5
0
  /**
   * @see FormatTag#printConcept(StringBuilder,Concept)
   * @verifies print the name with the correct name, and type
   */
  @Test
  public void printConcept_shouldPrintTheNameWithTheCorrectLocaleNameAndType() throws Exception {
    ConceptService service = Context.getConceptService();
    Locale locale = Context.getLocale();
    ConceptNameTag tag = service.getConceptNameTag(5);
    ConceptNameTag anotherTag = service.getConceptNameTag(6);
    Context.flushSession();

    Concept c = new Concept();
    c.addName(
        buildName("English fully specified", locale, true, ConceptNameType.FULLY_SPECIFIED, null));
    c.addName(buildName("English synonym", locale, false, null, null));
    c.addName(buildName("English tag", locale, false, null, tag));
    c.addName(buildName("English another tag", locale, false, null, anotherTag));
    c.setDatatype(service.getConceptDatatype(1));
    c.setConceptClass(service.getConceptClass(1));

    Context.getConceptService().saveConcept(c);

    assertPrintConcept("English fully specified", c, null, null);
    assertPrintConcept(
        "English fully specified", c, ConceptNameType.FULLY_SPECIFIED.toString(), null);
    assertPrintConcept("English tag", c, null, tag.getTag());
  }