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

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

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

Obs.getObsDatetime介绍

暂无

代码示例

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

if (o.getObsDatetime() == null) {
  o.setObsDatetime(getEncounterDatetime());

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

Obs obsWithDifferentDateBefore = null;
for (Obs o : enc.getAllObs(false)) {
  if (enc.getEncounterDatetime().equals(o.getObsDatetime())) {
    obsWithSameDateBefore.add(o);
  } else if (obsWithDifferentDateBefore == null) {
Obs obsWithDifferentDateAfter = null;
for (Obs o : enc.getAllObs(false)) {
  if (enc.getEncounterDatetime().equals(o.getObsDatetime())) {
    obsWithSameDateAfter.add(o);
    assertTrue(obsWithSameDateBefore.contains(o.getPreviousVersion()));

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

this(obs.getObsDatetime(), null, obs.getValueAsBoolean(), obs.getValueCoded(), obs.getValueDatetime(), obs
    .getValueNumeric(), obs.getValueText(), obs);

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

Assert.assertEquals(newObs.getObsDatetime().toString(), newDate.toString());
  Assert.assertEquals(member.getObsDatetime().toString(), newDate.toString());
  if(member.getGroupMembers()!= null) {
      Assert.assertEquals(memberChild.getObsDatetime().toString(), newDate.toString());
      if (memberChild.getValueText()!= null && memberChild.getValueText().equals("NewObs Value")) {
        count++;

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

/**
 * @see Encounter#addObs(Obs)
 */
@Test
public void addObs_shouldAddEncounterAttrsToObsIfAttributesAreNull() {
  /// an encounter that will hav the date/location/patient on it
  Encounter encounter = new Encounter();
  
  Date date = new Date();
  encounter.setEncounterDatetime(date);
  
  Location location = new Location(1);
  encounter.setLocation(location);
  
  Patient patient = new Patient(1);
  encounter.setPatient(patient);
  
  // add an obs that doesn't have date/location/patient set on it.
  Obs obs = new Obs(123);
  encounter.addObs(obs);
  
  // make sure it was added
  assertEquals(1, encounter.getAllObs(true).size());
  
  // check the values of the obs attrs to see if they were added
  assertTrue(obs.getObsDatetime().equals(date));
  assertTrue(obs.getLocation().equals(location));
  assertTrue(obs.getPerson().equals(patient));
}

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

&& OpenmrsUtil.compare(obs.getObsDatetime(), originalDate) == 0) {

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

assertTrue(childObs.getObsDatetime().equals(date));
assertTrue(childObs.getLocation().equals(location));
assertTrue(childObs.getPerson().equals(patient));
assertTrue(childObs2.getObsDatetime().equals(date));
assertTrue(childObs2.getLocation().equals(location));
assertTrue(childObs2.getPerson().equals(patient));

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

/**
 * You should be able to add an obs without an obsDatetime to an encounter, save the encounter,
 * and have the obs automatically persisted with the same date as the encounter. Added to test
 * bug reported in {@link Ticket#827}
 *
 * @see EncounterService#saveEncounter(Encounter)
 */
@Test
public void saveEncounter_shouldCascadeEncounterDatetimeToObs() {
  EncounterService es = Context.getEncounterService();
  
  // get an encounter from the database
  Encounter encounter = es.getEncounter(1);
  assertNotNull(encounter.getEncounterDatetime());
  
  // Now add an obs to it and do NOT set the obs datetime
  Obs obs = new Obs();
  obs.setConcept(Context.getConceptService().getConcept(1));
  obs.setValueNumeric(50d);
  encounter.addObs(obs);
  
  es.saveEncounter(encounter);
  
  assertTrue(encounter.getEncounterDatetime().equals(obs.getObsDatetime()));
}

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

assertEquals("encounter time propogated", groupObs.getObsDatetime(), enc.getEncounterDatetime());
assertNotNull("obs save succeeds", childObs.getObsId());
assertEquals("encounter id propogated", childObs.getEncounter().getId(), enc.getId());
assertEquals("encounter time propogated", childObs.getObsDatetime(), enc.getEncounterDatetime());

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

errors.rejectValue("person", "error.null");
if (obs.getObsDatetime() == null) {
  errors.rejectValue("obsDatetime", "error.null");

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

@Test
public void earliestObs_shouldReturnTheFirstObsGivenThePassedConcepUuid() throws Exception {
  VelocityFunctions functions = setupFunctionsForPatient(7);
  DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  Obs earliestWeight = functions.earliestObs("c607c80f-1ea9-4da3-bb88-6276ce8868dd");
  Assert.assertEquals(50, earliestWeight.getValueNumeric().intValue());
  // this is a bit of a hack because for some reason the obsDatetime set for this obs in the standard test dataset changed between 1.7 and 1.8
  Assert.assertTrue("Obs datetime not correct", (StringUtils.equals("2008-08-01", df.format(earliestWeight.getObsDatetime()))
      || StringUtils.equals("2008-07-01", df.format(earliestWeight.getObsDatetime()))));
}

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

/**
 * @see VelocityFunctions#earliestObs(Integer)
 * @verifies return the first obs given the passed conceptId
 */
@Test
public void earliestObs_shouldReturnTheFirstObsGivenThePassedConceptId() throws Exception {
  VelocityFunctions functions = setupFunctionsForPatient(7);
  DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  
  Obs earliestWeight = functions.earliestObs(5089);
  Assert.assertEquals(50, earliestWeight.getValueNumeric().intValue());
  // this is a bit of a hack because for some reason the obsDatetime set for this obs in the standard test dataset changed between 1.7 and 1.8 
  Assert.assertTrue("Obs datetime not correct", (StringUtils.equals("2008-08-01", df.format(earliestWeight.getObsDatetime()))
          || StringUtils.equals("2008-07-01", df.format(earliestWeight.getObsDatetime()))));
 }

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

/**
 * @see VelocityFunctions#latestObs(Integer)
 * @verifies return the most recent obs given the passed conceptId
 */
@Test
public void latestObs_shouldReturnTheMostRecentObsGivenThePassedConceptId() throws Exception {
  VelocityFunctions functions = setupFunctionsForPatient(7);
  DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  
  Obs earliestWeight = functions.latestObs(5089);
  Assert.assertEquals(61, earliestWeight.getValueNumeric().intValue());
  Assert.assertEquals("2008-08-19", df.format(earliestWeight.getObsDatetime()));
}

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

@Test
public void latestObs_shouldReturnTheMostRecentObsGivenThePassedConceptUuid() throws Exception {
  VelocityFunctions functions = setupFunctionsForPatient(7);
  DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  Obs earliestWeight = functions.latestObs("c607c80f-1ea9-4da3-bb88-6276ce8868dd");
  Assert.assertEquals(61, earliestWeight.getValueNumeric().intValue());
  Assert.assertEquals("2008-08-19", df.format(earliestWeight.getObsDatetime()));
}

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

assertEquals(concept, saved.getConcept());
assertEquals(encounter, saved.getEncounter());
assertEquals(DateUtil.truncateToSeconds(datetime), saved.getObsDatetime());
assertEquals(location, saved.getLocation());
assertEquals(valueGroupId, saved.getValueGroupId());

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

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

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

@Override
public void testResults(SubmissionResults results) {
  results.assertNoErrors();
  List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200"));
  Assert.assertEquals(obsList.size(),1);
  Assert.assertEquals("RECOVERED",obsList.get(0).getValueCoded().getDisplayString());
  Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime()));
}

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

@Override
public void testResults(SubmissionResults results) {
  results.assertNoErrors();
  List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200"));
  List<Obs> obsDeathList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4300"));
  Assert.assertEquals(obsList.size(),1);
  Assert.assertEquals(obsDeathList.size(),1);
  Assert.assertEquals("PATIENT DIED",obsList.get(0).getValueCoded().getDisplayString());
  Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime()));
  Assert.assertEquals("OTHER NON-CODED",obsDeathList.get(0).getValueCoded().getDisplayString());
  Assert.assertEquals("Died from cancer",obsDeathList.get(0).getValueText());
}

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

@Override
public void testResults(SubmissionResults results) {
  results.assertNoErrors();
  List<Obs> obsList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4200"));
  List<Obs> obsDeathList = os.getObservationsByPersonAndConcept(results.getPatient(), cs.getConcept("4300"));
  Assert.assertEquals(obsList.size(),1);
  Assert.assertEquals(obsDeathList.size(),1);
  Assert.assertEquals("PATIENT DIED",obsList.get(0).getValueCoded().getDisplayString());
  Assert.assertEquals(dateAsString(date),dateAsString(obsList.get(0).getObsDatetime()));
  Assert.assertEquals("STROKE",obsDeathList.get(0).getValueCoded().getDisplayString());
  Assert.assertEquals(null,obsList.get(0).getValueText());
}

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

@Override
public void validateDefaultRepresentation() throws Exception {
  super.validateDefaultRepresentation();
  assertPropPresent("person");
  assertPropPresent("concept");
  assertPropPresent("value");
  assertPropEquals("obsDatetime", getObject().getObsDatetime());
  assertPropEquals("accessionNumber", getObject().getAccessionNumber());
  assertPropEquals("obsGroup", getObject().getObsGroup());
  assertPropPresent("groupMembers");
  assertPropEquals("comment", getObject().getComment());
  assertPropPresent("location");
  assertPropPresent("order");
  assertPropPresent("encounter");
  assertPropEquals("voided", getObject().getVoided());
}

相关文章