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

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

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

Obs.isVoided介绍

暂无

代码示例

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

/**
 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#delete(java.lang.Object,
 *      java.lang.String, org.openmrs.module.webservices.rest.web.RequestContext)
 */
@Override
protected void delete(Obs delegate, String reason, RequestContext context) throws ResponseException {
  if (delegate.isVoided()) {
    // DELETE is idempotent, so we return success here
    return;
  }
  Context.getObsService().voidObs(delegate, reason);
}

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

/**
 * Returns (and removes) the Obs from the current {@see ObsGroup} with the specified concept and answer concept
 * 
 * @param concept the concept associated with the Obs we are looking for
 * @param answerConcept the concept associated with the coded value of the Obs we are looking for (may be null)
 * @return the Obs from the current {@see ObsGroup} with the specified concept and answer concept
 */
public Obs getObsFromCurrentGroup(Concept concept, Concept answerConcept) {
  if (currentObsGroupMembers == null)
    return null;
  for (Iterator<Obs> iter = currentObsGroupMembers.iterator(); iter.hasNext(); ) {
    Obs obs = iter.next();
    if (!obs.isVoided() && (concept == null || concept.getConceptId().equals(obs.getConcept().getConceptId())) &&
        (answerConcept == null || equalConcepts(answerConcept, obs.getValueCoded()))) {
      iter.remove();
      return obs;
    }
  }
  return null;
}

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

/**
 * Returns true if group is an obs group that has no unvoided members.
 *
 * @param group
 * @return
 */
private void voidObsGroupIfAllChildObsVoided(Obs group) {
  if (group != null) {
    // probably should be able to just tet if group.getGroupMembers() == 0 since
    // getGroupMembers only returns non-voided members?
    boolean allObsVoided = true;
    for (Obs member : group.getGroupMembers()) {
      allObsVoided = allObsVoided && member.isVoided();
    }
    if (allObsVoided) {
      Context.getObsService().voidObs(group, "htmlformentry");
    }
    voidObsGroupIfAllChildObsVoided(group.getObsGroup());
  }
}

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

@Override
public void testEditedResults(SubmissionResults results) {
  results.assertNoErrors();
  Encounter encounter = results.getEncounterCreated();
  assertThat(encounter.getAllObs(false).size(), is(1));   // should be one non-voided obs of value 1003
  assertThat(encounter.getAllObs(true).size(), is(3));   // should be three obs included the voided obs for 1001 and 1002
  Set<Integer> valueCoded = new HashSet<Integer>();
  for (Obs obs : encounter.getAllObs(true)) {
    if (!obs.isVoided()) {
      assertThat(obs.getValueCoded().getId(), is(1003));
    }
    else {
      valueCoded.add(obs.getValueCoded().getId());
    }
  }
  assertTrue(valueCoded.contains(1002));
  assertTrue(valueCoded.contains(1001));
}

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

@Override
public void testEditedResults(SubmissionResults results) {
  results.assertNoErrors();
  Encounter encounter = results.getEncounterCreated();
  assertThat(encounter.getAllObs(false).size(), is(2));   // should be two non-voided obs of value 1002 & 1003
  assertThat(encounter.getAllObs(true).size(), is(3));   // should be three obs included the voided obs for 1001
  Set<Integer> valueCoded = new HashSet<Integer>();
  for (Obs obs : encounter.getAllObs(true)) {
    if (obs.isVoided()) {
      assertThat(obs.getValueCoded().getId(), is(1001));
    }
    else {
      valueCoded.add(obs.getValueCoded().getId());
    }
  }
  assertTrue(valueCoded.contains(1002));
  assertTrue(valueCoded.contains(1003));
}

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

for (Obs o : e.getAllObs(true)) {
  if (o.getConcept().getConceptId().equals(2474))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(3017))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(3032))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(1))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(2))
    Assert.assertTrue(!o.isVoided()); //not matched
  if (o.getConcept().getConceptId().equals(3))
    Assert.assertTrue(!o.isVoided());//not matched
  if (o.getConcept().getConceptId().equals(6))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(1004))
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(1005))
    Assert.assertTrue(o.isVoided());
    Assert.assertTrue(o.isVoided());
  if (o.getConcept().getConceptId().equals(7) && !o.isObsGrouping())
    Assert.assertTrue(!o.isVoided());//not matched
  if (o.getConcept().getConceptId().equals(1000) && o.isObsGrouping())
    Assert.assertTrue(!o.isVoided());//not matched
  if (o.getConcept().getConceptId().equals(1000) && !o.isObsGrouping())
    Assert.assertTrue(o.isVoided());

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

private void assertObsExists(boolean lookForVoided, int conceptId, Object value) {
  // quick checks
  Assert.assertNotNull(encounterCreated);
  Collection<Obs> temp = encounterCreated.getAllObs(lookForVoided);
  Assert.assertNotNull(temp);
  String valueAsString = null;
  if(value instanceof Date){
    valueAsString = formatObsValueDate((Date)value);
  }else{
    valueAsString = TestUtil.valueAsStringHelper(value);
  }
  for (Obs obs : temp) {
    if (lookForVoided && !obs.isVoided())
      continue;
    if (obs.getConcept().getConceptId() == conceptId) {
      if (valueAsString == null)
        return;
      if (valueAsString.equals(obs.getValueAsString(Context.getLocale())))
        return;
    }
  }
  Assert.fail("Could not find obs with conceptId " + conceptId + " and value " + valueAsString);
}

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

Assert.assertTrue(!o.isVoided());

相关文章