org.openmrs.Obs.getConcept()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.openmrs.Obs.getConcept()方法的一些代码示例,展示了Obs.getConcept()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.getConcept()方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:getConcept

Obs.getConcept介绍

暂无

代码示例

代码示例来源:origin: openmrs/openmrs-core

/**
 * @return Returns true if this Obs is complex.
 * @since 1.5
 * @should return true if the concept is complex
 */
public boolean isComplex() {		
  if (getConcept() != null) {
    return getConcept().isComplex();
  }
  
  return false;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * Get the concept description that is tied to the concept name that was used when making this
 * observation
 * 
 * @return ConceptDescription the description used
 */
public ConceptDescription getConceptDescription() {
  // if we don't have a question for this concept,
  // then don't bother looking for a description
  if (getConcept() == null) {
    return null;
  }
  
  // ABKTOD: description in which locale?
  return concept.getDescription();
}

代码示例来源:origin: openmrs/openmrs-core

log.debug("getConcept() == " + getConcept());
if (getConcept() != null && !StringUtils.isBlank(s)) {
  String abbrev = getConcept().getDatatype().getHl7Abbreviation();
  if ("BIT".equals(abbrev)) {
    setValueBoolean(Boolean.valueOf(s));

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see org.openmrs.api.ObsService#getHandler(org.openmrs.Obs)
 */
@Override
@Transactional(readOnly = true)
public ComplexObsHandler getHandler(Obs obs) throws APIException {
  if (obs.getConcept().isComplex()) {
    // Get the ConceptComplex from the ConceptService then return its
    // handler.
    if (obs.getConcept() == null) {
      throw new APIException("Obs.error.unable.get.handler", new Object[] { obs });
    }
    
    String handlerString = Context.getConceptService().getConceptComplex(obs.getConcept().getConceptId())
        .getHandler();
    
    if (handlerString == null) {
      throw new APIException("Obs.error.unable.get.handler.and.concept", new Object[] { obs, obs.getConcept() });
    }
    
    return this.getHandler(handlerString);
  }
  
  return null;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * Returns the boolean value if the concept of this obs is of boolean datatype
 * 
 * @return true or false if value is set otherwise null
 * @should return true if value coded answer concept is true concept
 * @should return false if value coded answer concept is false concept
 */
public Boolean getValueBoolean() {
  if (getConcept() != null && valueCoded != null && getConcept().getDatatype().isBoolean()) {
    Concept trueConcept = Context.getConceptService().getTrueConcept();
    return trueConcept != null && valueCoded.getId().equals(trueConcept.getId());
  }
  
  return null;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * Sets the value of this obs to the specified valueBoolean if this obs has a boolean concept.
 * 
 * @param valueBoolean the boolean value matching the boolean coded concept to set to
 */
public void setValueBoolean(Boolean valueBoolean) {
  if (getConcept() != null && getConcept().getDatatype() != null && getConcept().getDatatype().isBoolean()) {
    if (valueBoolean != null) {
      setValueCoded(valueBoolean ? Context.getConceptService().getTrueConcept() : Context
          .getConceptService().getFalseConcept());
    } else {
      setValueCoded(null);
    }
  }
}

代码示例来源:origin: openmrs/openmrs-core

private void handleExistingObsWithComplexConcept(Obs obs) {
  ComplexData complexData = obs.getComplexData();
  Concept concept = obs.getConcept();
  if (null != concept && concept.isComplex()
      && null != complexData && null != complexData.getData()) {
    // save or update complexData object on this obs
    // this is done before the database save so that the obs.valueComplex
    // can be filled in by the handler.
    ComplexObsHandler handler = getHandler(obs);
    if (null != handler) {
      handler.saveObs(obs);
    } else {
      throw new APIException("unknown.handler", new Object[] {concept});
    }
  }
}

代码示例来源:origin: openmrs/openmrs-core

if (getConcept() != null) {
  String abbrev = getConcept().getDatatype().getHl7Abbreviation();
  if ("BIT".equals(abbrev)) {
    return getValueAsBoolean() == null ? "" : getValueAsBoolean().toString();
      return "";
    } else {
      if (getConcept() instanceof ConceptNumeric) {
        ConceptNumeric cn = (ConceptNumeric) getConcept();
        if (!cn.getAllowDecimal()) {
          double d = getValueNumeric();

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see ObsService#getObs(Integer)
 */
@Test
public void getObs_shouldGetObsMatchingGivenObsId() {
  ObsService obsService = Context.getObsService();
  
  Obs obs = obsService.getObs(7);
  
  Assert.assertEquals(5089, obs.getConcept().getId().intValue());
}

代码示例来源:origin: openmrs/openmrs-core

new Object[] { obs.getConcept().getConceptId() }, null));
Concept c = Context.getConceptService().getConcept(obs.getConcept().getConceptId());
obs.setConcept(c);
String title = null;

代码示例来源:origin: openmrs/openmrs-core

if (groupedConceptIds.contains(obs.getConcept().getConceptId())) {
  groupedObsCount += 1;
  assertEquals("All of the parent groups should match", obsGroup, obs.getObsGroup());

代码示例来源:origin: openmrs/openmrs-core

@Test
public void newInstance_shouldCopyMostFields() throws Exception {
  Obs obs = new Obs();
  obs.setStatus(Obs.Status.PRELIMINARY);
  obs.setInterpretation(Obs.Interpretation.LOW);
  obs.setConcept(new Concept());
  obs.setValueNumeric(1.2);
  
  Obs copy = Obs.newInstance(obs);
  
  // these fields are not copied
  assertThat(copy.getObsId(), nullValue());
  assertThat(copy.getUuid(), not(obs.getUuid()));
  
  // other fields are copied
  assertThat(copy.getConcept(), is(obs.getConcept()));
  assertThat(copy.getValueNumeric(), is(obs.getValueNumeric()));
  assertThat(copy.getStatus(), is(obs.getStatus()));
  assertThat(copy.getInterpretation(), is(obs.getInterpretation()));
  // TODO test that the rest of the fields are set
}

代码示例来源:origin: openmrs/openmrs-core

.getValueNumeric(), obs.getValueText(), obs);
Concept concept = obs.getConcept();
ConceptDatatype conceptDatatype;

代码示例来源:origin: openmrs/openmrs-core

@Test
  public void setValueBoolean_shouldNotSetValueForNonBooleanConcept() throws Exception {
    Obs obs = createObs(2);
    ConceptDatatype dataType = new ConceptDatatype();
    dataType.setUuid(ConceptDatatype.CODED_UUID);
    obs.getConcept().setDatatype(dataType);
    assertNotNull(obs.getValueCoded());
    obs.setValueBoolean(null);
    assertNotNull(obs.getValueCoded());
  }
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnFalseWhenNoChangeHasBeenMade() throws Exception {
  assertFalse(new Obs().isDirty());
  
  //Should also work if setters are called with same values as the original
  Obs obs = createObs(2);
  obs.setGroupMembers(new LinkedHashSet<>());
  obs.getConcept().setDatatype(new ConceptDatatype());
  assertFalse(obs.isDirty());
  BeanUtils.copyProperties(obs, BeanUtils.cloneBean(obs));
  assertFalse(obs.isDirty());
  obs = createObs(null);
  obs.setGroupMembers(new LinkedHashSet<>());
  obs.getConcept().setDatatype(new ConceptDatatype());
  assertFalse(obs.isDirty());
  BeanUtils.copyProperties(obs, BeanUtils.cloneBean(obs));
  assertFalse(obs.isDirty());
}

代码示例来源:origin: openmrs/openmrs-module-webservices.rest

/**
 * Display string for Obs
 * 
 * @param obs
 * @return String ConceptName = value
 */
@PropertyGetter("display")
public String getDisplayString(Obs obs) {
  if (obs.getConcept() == null)
    return "";
  
  return obs.getConcept().getName() + ": " + obs.getValueAsString(Context.getLocale());
}

代码示例来源:origin: openmrs/openmrs-module-htmlformentry

private Concept findObsCodedValue(Encounter encounter, Concept concept) {
  for (Obs candidate : encounter.getAllObs(false)) {
    if (candidate.getConcept().equals(concept)) {
      return candidate.getValueCoded();
    }
  }
  return null;
}

代码示例来源:origin: openmrs/openmrs-core

Concept c = obs.getConcept();
if (c == null) {
  errors.rejectValue("concept", "error.null");

代码示例来源:origin: openmrs/openmrs-core

assertEquals(patient, saved.getPerson());
assertEquals(comment, saved.getComment());
assertEquals(concept, saved.getConcept());
assertEquals(encounter, saved.getEncounter());
assertEquals(DateUtil.truncateToSeconds(datetime), saved.getObsDatetime());

代码示例来源:origin: openmrs/openmrs-core

Obs newObs = new Obs(obsToCopy.getPerson(), obsToCopy.getConcept(), obsToCopy.getObsDatetime(),
    obsToCopy.getLocation());

相关文章

微信公众号

最新文章

更多