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

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

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

Obs.setValueText介绍

暂无

代码示例

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

setValueDatetime(datetimeFormat.parse(s));
} else if ("ST".equals(abbrev)) {
  setValueText(s);
} else {
  throw new RuntimeException("Don't know how to handle " + abbrev);

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

obsDeath.setValueText(otherReason);
} else {
  log.debug("New concept is NOT the OTHER concept, so setting to blank");
  obsDeath.setValueText("");
obsDeath.setValueText("");

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

@Test
public void saveEncounter_shouldUpdateValueOfLeafObsAndNotDuplicateAtEncounterLevel() {
  executeDataSet(ENC_OBS_HIERARCHY_DATA_XML);
  Encounter encounter = Context.getEncounterService().getEncounter(100);
  assertEquals(1, encounter.getObsAtTopLevel(true).size());
  Obs topLevelObs = encounter.getObsAtTopLevel(true).iterator().next();
  topLevelObs.getGroupMembers().iterator().next().setValueText("editing first obs");
  encounter.addObs(topLevelObs);
  Encounter savedEncounter = Context.getEncounterService().saveEncounter(encounter);
  assertEquals(1, savedEncounter.getObsAtTopLevel(true).size());
}

代码示例来源:origin: org.motechproject/motech-server-core

@Override
public Obs setValue(Obs obs, Object value) {
  obs.setValueText((String) value);
  return obs;
}};

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

/**
 * @see Encounter#getObsAtTopLevel(boolean)
 */
@Test
public void getObsAtTopLevel_shouldGetObsInTheSameOrderObsIsAddedToTheEncounter() {
  Encounter encounter = new Encounter();
  Obs obs1= new Obs();
  obs1.setValueText("first obs");
  encounter.addObs(obs1);
  Obs obs2= new Obs();
  obs2.setValueText("second obs");
  encounter.addObs(obs2);
  Obs obs3= new Obs();
  obs3.setValueText("third obs");
  encounter.addObs(obs3);
  Set<Obs> obsAtTopLevel = encounter.getObsAtTopLevel(true);
  assertNotNull(obsAtTopLevel);
  assertEquals(3, obsAtTopLevel.size());
  Iterator<Obs> obsIterator = obsAtTopLevel.iterator();
  assertEquals("first obs", obsIterator.next().getValueText());
  assertEquals("second obs", obsIterator.next().getValueText());
  assertEquals("third obs", obsIterator.next().getValueText());
}

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

/**
 * @see Encounter#getObs()
 */
@Test
public void getObs_shouldGetObsInTheSameOrderObsIsAddedToTheEncounter() {
  Encounter encounter = new Encounter();
  Obs obs1= new Obs();
  obs1.setValueText("first obs");
  encounter.addObs(obs1);
  Obs obs2= new Obs();
  obs2.setValueText("second obs");
  encounter.addObs(obs2);
  Obs obs3= new Obs();
  obs3.setValueText("third obs");
  encounter.addObs(obs3);
  Set<Obs> obs = encounter.getObs();
  assertNotNull(obs);
  assertEquals(3, obs.size());
  Iterator<Obs> obsIterator = obs.iterator();
  assertEquals("first obs", obsIterator.next().getValueText());
  assertEquals("second obs", obsIterator.next().getValueText());
  assertEquals("third obs", obsIterator.next().getValueText());
}

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

/**
 * @see Encounter#getAllObs(null)
 */
@Test
public void getAllObs_shouldGetObsInTheSameOrderObsIsAddedToTheEncounter() {
  Encounter encounter = new Encounter();
  Obs obs1= new Obs();
  obs1.setValueText("first obs");
  encounter.addObs(obs1);
  Obs obs2= new Obs();
  obs2.setValueText("second obs");
  encounter.addObs(obs2);
  Obs obs3= new Obs();
  obs3.setValueText("third obs");
  encounter.addObs(obs3);
  Set<Obs> allObs = encounter.getAllObs(true);
  assertNotNull(allObs);
  assertEquals(3, allObs.size());
  Iterator<Obs> obsIterator = allObs.iterator();
  assertEquals("first obs", obsIterator.next().getValueText());
  assertEquals("second obs", obsIterator.next().getValueText());
  assertEquals("third obs", obsIterator.next().getValueText());
}

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

return null;
  obs.setValueText(value.getValue());
} else if ("ED".equals(hl7Datatype)) {
  ED value = (ED) obx5;

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

/**
 * @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
 */
@Test
public void validate_shouldFailValidationIfValueTextIsGreaterThanTheMaximumLength() {
  Obs obs = new Obs();
  obs.setPerson(Context.getPersonService().getPerson(2));
  obs.setConcept(Context.getConceptService().getConcept(19));
  obs.setObsDatetime(new Date());
  
  // Generate 65535+ characters length text.
  StringBuilder valueText = new StringBuilder();
  for (int i = 0; i < 730; i++) {
    valueText
        .append("This text should not exceed 65535 characters. Below code will generate a text more than 65535");
  }
  
  obs.setValueText(valueText.toString());
  
  Errors errors = new BindException(obs, "obs");
  obsValidator.validate(obs, errors);
  
  assertFalse(errors.hasFieldErrors("person"));
  assertFalse(errors.hasFieldErrors("concept"));
  assertFalse(errors.hasFieldErrors("obsDatetime"));
  assertTrue(errors.hasFieldErrors("valueText"));
}

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

/**
   * @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
   */
  @Test
  public void validate_shouldPassValidationIfValueTextIsLessThanTheMaximumLength() {
    Obs obs = new Obs();
    obs.setPerson(Context.getPersonService().getPerson(2));
    obs.setConcept(Context.getConceptService().getConcept(19));
    obs.setObsDatetime(new Date());

    // Generate 2700+ characters length text.
    StringBuilder valueText = new StringBuilder();
    for (int i = 0; i < 30; i++) {
      valueText
          .append("This text should not exceed 65535 characters. Below code will generate a text Less than 65535");
    }

    obs.setValueText(valueText.toString());

    Errors errors = new BindException(obs, "obs");
    new ObsValidator().validate(obs, errors);

    Assert.assertFalse(errors.hasFieldErrors("person"));
    Assert.assertFalse(errors.hasFieldErrors("concept"));
    Assert.assertFalse(errors.hasFieldErrors("obsDatetime"));
    Assert.assertFalse(errors.hasFieldErrors("valueText"));
  }
}

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

o.setObsDatetime(new Date());
o.setPerson(new Patient(2));
o.setValueText("childObs");
oSibling.setLocation(new Location(1));
oSibling.setObsDatetime(new Date());
oSibling.setValueText("childObs2");
oSibling.setPerson(new Patient(2));
oParent.setLocation(new Location(1));
oParent.setObsDatetime(new Date());
oSibling.setValueText("parentObs");
oParent.setPerson(new Patient(2));
oGrandparent.setObsDatetime(new Date());
oGrandparent.setPerson(new Patient(2));
oSibling.setValueText("grandParentObs");
o2.setObsDatetime(new Date());
o2.setPerson(new Patient(2));
o2.setValueText("grandparentLeafObs");
oGGP.setObsDatetime(new Date());
oGGP.setPerson(new Patient(2));
oGGP.setValueText("grandParentObs");
oGGP.addGroupMember(oGrandparent);
oGGPleaf.setObsDatetime(new Date());
oGGPleaf.setPerson(new Patient(2));

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

o1.setLocation(new Location(1));
o1.setObsDatetime(newDate);
o1.setValueText("NewObs Value");
o1.setPerson(new Patient(2));
child.addGroupMember(o1);

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

@Test
public void saveEncounter_shouldUpdateExistingEncounterWhenNewObsIsAddedToParentObs() {
  executeDataSet(ENC_OBS_HIERARCHY_DATA_XML);
  ConceptService cs = Context.getConceptService();
  EncounterService es = Context.getEncounterService();
  ObsService os = Context.getObsService();
  Encounter enc = es.getEncounter(100);
  Obs o3 = new Obs();
  o3.setConcept(cs.getConcept(3));
  o3.setDateCreated(new Date());
  o3.setCreator(Context.getAuthenticatedUser());
  o3.setLocation(new Location(1));
  o3.setObsDatetime(new Date());
  o3.setPerson(Context.getPersonService().getPerson(3));
  o3.setValueText("third obs value text");
  o3.setEncounter(enc);
  Obs oParent = os.getObs(100);
  oParent.addGroupMember(o3);
  es.saveEncounter(enc);
  Context.flushSession();
  Context.clearSession();
  enc = es.getEncounter(100);
  Set<Obs> obsAtTopLevelUpdated = enc.getObsAtTopLevel(true);
  assertEquals(1,obsAtTopLevelUpdated.size());
  assertEquals(3, obsAtTopLevelUpdated.iterator().next().getGroupMembers(true).size());
  oParent = os.getObs(100);
  assertTrue(oParent.getGroupMembers(true).contains(os.getObs(101)));
  assertTrue(oParent.getGroupMembers(true).contains(os.getObs(102)));
  assertTrue(oParent.getGroupMembers(true).contains(os.getObs(o3.getObsId())));
}

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

@Test
public void saveEncounter_shouldUpdateExistingEncounterWhenAChildObsIsEdited() {
  executeDataSet(ENC_OBS_HIERARCHY_DATA_XML);
  EncounterService es = Context.getEncounterService();
  ObsService os = Context.getObsService();
  Encounter enc = es.getEncounter(100);
  Obs o = os.getObs(101);
  o.setValueText("Obs value updated");
  es.saveEncounter(enc);
  Context.flushSession();
  Context.clearSession();
  updateSearchIndex();
  enc = es.getEncounter(100);
  Set<Obs> obsAtTopLevelUpdated = enc.getObsAtTopLevel(true);
  Obs oParent = os.getObs(100);
  final Obs editedObs = os.getObs(101);
  Obs o2 = os.getObs(102);
  Obs o3 = getNewVersionOfEditedObs(oParent,editedObs);
  assertEquals(1,obsAtTopLevelUpdated.size());
  assertEquals(3, oParent.getGroupMembers(true).size());
  assertTrue(editedObs.getVoided());
  assertFalse(oParent.getVoided());
  assertFalse(o2.getVoided());
  assertNotNull(o3);
  assertFalse(o3.getVoided());
  assertEquals("Obs value updated", o3.getValueText());
}

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

assertNull(unVoidedObs.getVoidReason());
alreadyVoidedObs.setValueText(newValueText);
toBeVoidedObs.setValueText(newValueText);
unVoidedObsToUpdate.setValueText(newValueText);
toBeVoidedObs.setVoided(true);
encounter.setEncounterDatetime(new Date());

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

obs.setValueModifier("test");
obs.setValueNumeric(1212.0);
obs.setValueText("test");

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

o.setObsDatetime(new Date());
o.setPerson(new Patient(2));
o.setValueText("original obs value text");
o2.setLocation(new Location(1));
o2.setObsDatetime(new Date());
o2.setValueText("second obs value text");
o2.setPerson(new Patient(2));
o3.setLocation(new Location(1));
o3.setObsDatetime(new Date());
o3.setValueText("leaf obs value text");
o3.setPerson(new Patient(2));
          child.setValueText("testingUpdate");
oVoidTest.setObsDatetime(new Date());
oVoidTest.setPerson(new Patient(2));
oVoidTest.setValueText("value text of soon-to-be-voided obs");

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

obs.setValueNumeric(valueNumeric);
obs.setValueModifier(valueModifier);
obs.setValueText(valueText);
obs.setComment(comment);

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

newObs.setValueNumeric(obsToCopy.getValueNumeric());
newObs.setValueModifier(obsToCopy.getValueModifier());
newObs.setValueText(obsToCopy.getValueText());
newObs.setComment(obsToCopy.getComment());
newObs.setEncounter(obsToCopy.getEncounter());

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

private void clearAndSetValue(Obs obs, ObsType type, Object value) {
  obs.setValueCoded(type.equals(ObsType.CODED) ? (Concept) value : null);
  obs.setValueComplex(type.equals(ObsType.COMPLEX) ? (String) value : null);
  obs.setValueDatetime(type.equals(ObsType.DATETIME) ? (Date) value : null);
  obs.setValueDrug(type.equals(ObsType.DRUG) ? (Drug) value : null);
  obs.setValueNumeric(type.equals(ObsType.NUMERIC) ? (Double) value : null);
  obs.setValueText(type.equals(ObsType.TEXT) ? (String) value : null);
}

相关文章