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

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

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

Obs.setComment介绍

暂无

代码示例

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

obsGrouper.setComment(comments.toString());

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldReturnADifferentObjectWhenUpdatingAnObs() {
  ObsService obsService = Context.getObsService();
  
  Obs obs = obsService.getObs(7);
  
  // change something on the obs and save it again
  obs.setComment("A new comment");
  Obs obsSaved = obsService.saveObs(obs, "Testing that a new obs is returned");
  
  assertFalse(obsSaved.getObsId().equals(obs.getObsId()));
}

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

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnTrueWhenAnImmutableFieldIsChangedFromANonNullToANullValueForEditedObs() throws Exception {
  Obs obs = createObs(2);
  assertNotNull(obs.getComment());
  obs.setComment(null);
  assertTrue(obs.isDirty());
}

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

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnFalsWhenAnImmutableFieldIsChangedFromANonNullToANullValueForNewObs() throws Exception {
  Obs obs = createObs(null);
  assertNotNull(obs.getComment());
  obs.setComment(null);
  assertFalse(obs.isDirty());
}

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

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnFalseWhenAnImmutableFieldIsChangedFromANullToANonNullValueInNewObs() throws Exception {
  Obs obs = new Obs();
  assertNull(obs.getComment());
  obs.setComment("some non null value");
  assertFalse(obs.isDirty());
}

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

/**
 * @see Obs#isDirty()
 */
@Test
public void isDirty_shouldReturnTrueWhenAnImmutableFieldIsChangedFromANullToANonNullValueInExistingObs() throws Exception {
  Obs obs = new Obs(5);
  assertNull(obs.getComment());
  obs.setComment("some non null value");
  assertTrue(obs.isDirty());
}

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

obs.setComment(comments.toString());

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldSetVoidReasonMessageToChangeMessage() {
  
  // Set changeMessage arg to saveObs() method - should equal void reason on new Obs
  String changeMessage = "Testing TRUNK-3701";
  
  int obsId = 7;
  ObsService obsService = Context.getObsService();
  Obs obs = obsService.getObs(obsId);
  
  // change something on the obs and save it again
  obs.setComment("Comment to make sure obs changes");
  
  obsService.saveObs(obs, changeMessage);
  obs = obsService.getObs(obsId); //refetch original (now voided) obs
  
  // check
  assertEquals(changeMessage, obs.getVoidReason());
}

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldLinkOriginalAndUpdatedObs() {
  // build
  int obsId = 7;
  ObsService obsService = Context.getObsService();
  Obs obs = obsService.getObs(obsId);
  
  // operate
  // change something on the obs and save it again
  obs.setComment("A new comment");
  Obs obsSaved = obsService.saveObs(obs, "Testing linkage");
  obs = obsService.getObs(obsId);
  
  // check
  assertNotNull(obsSaved);
  assertNotNull(obs);
  assertEquals(obs, obsSaved.getPreviousVersion());
}

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

/**
 * @see PatientService#mergePatients(Patient,Patient)
 */
@Test
public void mergePatients_shouldAuditMovedIndependentObservations() throws Exception {
  //retrieve patients
  Patient preferred = patientService.getPatient(999);
  Patient notPreferred = patientService.getPatient(7);
  voidOrders(Collections.singleton(notPreferred));
  
  //get an observation for notPreferred and make it independent from any encounter
  Obs obs = Context.getObsService().getObs(7);
  obs.setEncounter(null);
  obs.setComment("this observation is for testing the merge");
  Context.getObsService().saveObs(obs, "Reason cannot be blank");
  
  //merge the two patients and retrieve the audit object
  PersonMergeLog audit = mergeAndRetrieveAudit(preferred, notPreferred);
  String uuid = null;
  List<Obs> observations = Context.getObsService().getObservationsByPerson(preferred);
  for (Obs o : observations) {
    if (obs.getComment().equals(o.getComment())) {
      uuid = o.getUuid();
    }
  }
  Assert.assertTrue("moving of independent observation was not audited",
    isValueInList(uuid, audit.getPersonMergeLogData().getMovedIndependentObservations()));
}

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

/**
 * @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
 */
@Test
public void validate_shouldPassValidationIfFieldLengthsAreCorrect() {
  Obs obs = new Obs();
  obs.setPerson(Context.getPersonService().getPerson(2));
  obs.setConcept(Context.getConceptService().getConcept(5089));
  obs.setObsDatetime(new Date());
  obs.setValueNumeric(1.0);
  
  obs.setAccessionNumber("AccessionNumber");
  obs.setValueModifier("m");
  obs.setValueComplex("ValueComplex");
  obs.setVoidReason("VoidReason");
  obs.setComment("comment");
  
  Errors errors = new BindException(obs, "obs");
  obsValidator.validate(obs, errors);
  
  assertFalse(errors.hasErrors());
}

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

/**
 * @see ObsValidator#validate(java.lang.Object, org.springframework.validation.Errors)
 */
@Test
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() {
  Obs obs = new Obs();
  obs.setPerson(Context.getPersonService().getPerson(2));
  obs.setConcept(Context.getConceptService().getConcept(5089));
  obs.setObsDatetime(new Date());
  obs.setValueNumeric(1.0);
  
  obs.setAccessionNumber("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
  obs.setValueModifier("too long text");
  obs.setValueComplex("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
  obs.setVoidReason("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
  obs.setComment("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
  
  Errors errors = new BindException(obs, "obs");
  obsValidator.validate(obs, errors);
  
  assertTrue(errors.hasFieldErrors("accessionNumber"));
  assertTrue(errors.hasFieldErrors("valueModifier"));
  assertTrue(errors.hasFieldErrors("valueComplex"));
  assertTrue(errors.hasFieldErrors("comment"));
  assertTrue(errors.hasFieldErrors("voidReason"));
}

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

obs.setComment(comment);

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

} else {
  if(existingObs != null && StringUtils.isNotBlank(comment))
    existingObs.setComment(comment);

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

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

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

newObs.setValueModifier(obsToCopy.getValueModifier());
newObs.setValueText(obsToCopy.getValueText());
newObs.setComment(obsToCopy.getComment());
newObs.setEncounter(obsToCopy.getEncounter());
newObs.setCreator(obsToCopy.getCreator());

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

Obs obs8 = new Obs();
obs8.setValueText("34");
obs8.setComment("org.openmrs.Location");
field8.setExistingObs(obs8);
section1.addField(field8);

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

@Test
public void asRepresentation_shouldReturnProperlyEncodedValues() throws Exception {
  Obs obs = getObject();
  obs.setComment(null); // to test that we don't get a NPE when no comment (specifically with the Location example)
  obs.setComment("org.openmrs.Location");
  rep = getResource().asRepresentation(getObject(), Representation.DEFAULT);
  Assert.assertTrue(rep.keySet().contains("value"));
  obs.setComment("org.openmrs.Location");
  rep = getResource().asRepresentation(getObject(), Representation.DEFAULT);
  Assert.assertTrue(rep.keySet().contains("value"));
  obs.setComment("org.openmrs.Location");
  rep = getResource().asRepresentation(getObject(), Representation.DEFAULT);
  Assert.assertNull(rep.get("value"));

相关文章