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

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

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

Obs.setLocation介绍

暂无

代码示例

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

o.setLocation(getLocation());

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

obsExit.setLocation(loc);
} else {
  log.error("Could not find a suitable location for which to create this new Obs");

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

Location location = Context.getLocationService().getDefaultLocation();
if (location != null) {
  obsDeath.setLocation(location);
} else {
  log.error("Could not find a suitable location for which to create this new Obs");

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

private Obs buildObs() {
  Obs newObs = new Obs();
  newObs.setConcept(Context.getConceptService().getConcept(1));
  newObs.setValueNumeric(50d);
  newObs.setLocation(new Location(2));
  return newObs;
}

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

ob.setDateCreated(new Date());
ob.setObsDatetime(cp.getEncounter().getEncounterDatetime());
ob.setLocation(cp.getEncounter().getLocation());
ob.setPerson(cp.getEncounter().getPatient());
if (ob.getUuid() == null) {

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

o.setEncounter(new Encounter(3));
o.setObsDatetime(new Date());
o.setLocation(new Location(1));
ConceptName cn1 = new ConceptName(1847);
o.setValueCodedName(cn1);
o2.setEncounter(new Encounter(3));
o2.setObsDatetime(new Date());
o2.setLocation(new Location(1));
ConceptName cn2 = new ConceptName(2453);
o2.setValueCodedName(cn2);

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

o.setEncounter(new Encounter(3));
o.setObsDatetime(new Date());
o.setLocation(new Location(1));
ConceptName cn1 = new ConceptName(1847);
o.setValueCodedName(cn1);
o2.setEncounter(new Encounter(3));
o2.setObsDatetime(new Date());
o2.setLocation(new Location(1));
ConceptName cn2 = new ConceptName(2453);
o2.setValueCodedName(cn2);

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

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

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldCreateVeryBasicObsAndAddNewObsId() {
  Obs o = new Obs();
  o.setConcept(Context.getConceptService().getConcept(3));
  o.setPerson(new Patient(2));
  o.setEncounter(new Encounter(3));
  o.setObsDatetime(new Date());
  o.setLocation(new Location(1));
  o.setValueNumeric(50d);
  
  Obs oSaved = Context.getObsService().saveObs(o, null);
  
  // make sure the returned Obs and the passed in obs
  // now both have primary key obsIds
  assertTrue(oSaved.getObsId().equals(o.getObsId()));
}

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

obs.setLocation(newLocation);

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

o1.setDateCreated(newDate);
o1.setCreator(Context.getAuthenticatedUser());
o1.setLocation(new Location(1));
o1.setObsDatetime(newDate);
o1.setValueText("NewObs Value");

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldCascadeSaveToChildObsGroups() {
  ObsService obsService = Context.getObsService();
  
  Obs parentObs = new Obs();
  parentObs.setConcept(Context.getConceptService().getConcept(3));
  parentObs.setObsDatetime(new Date());
  parentObs.setPerson(new Patient(2));
  parentObs.setLocation(new Location(1));
  
  Obs groupMember = new Obs();
  groupMember.setConcept(Context.getConceptService().getConcept(3));
  groupMember.setValueNumeric(1.0);
  groupMember.setObsDatetime(new Date());
  groupMember.setPerson(new Patient(2));
  groupMember.setLocation(new Location(1));
  parentObs.addGroupMember(groupMember);
  
  obsService.saveObs(parentObs, null);
  
  // make sure the child obs was saved
  Assert.assertNotNull(groupMember.getObsId());
}

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

groupMember.setObsDatetime(new Date());
groupMember.setPerson(new Patient(2));
groupMember.setLocation(new Location(2));
groupMember.setValueNumeric(50d);
origParentObs.addGroupMember(groupMember);

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

@Test
public void saveEncounter_shouldSaveEncounterWithComplexObs() {
  executeDataSet(ENC_OBS_HIERARCHY_DATA_XML);
  EncounterService es = Context.getEncounterService();
  Encounter encounter = es.getEncounter(101);
  Obs observation = buildObs();
  observation.setLocation(encounter.getLocation());
  observation.setPerson(encounter.getPatient());
  encounter.addObs(observation);
  es.saveEncounter(encounter);
  Context.flushSession();
  Context.clearSession();
  encounter = es.getEncounter(101);
  assertEquals(2, encounter.getObsAtTopLevel(true).size());
}

代码示例来源: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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldSetCreatorAndDateCreatedOnNewObs() {
  Obs o = new Obs();
  o.setConcept(Context.getConceptService().getConcept(3));
  o.setPerson(new Patient(2));
  o.setEncounter(new Encounter(3));
  o.setObsDatetime(new Date());
  o.setLocation(new Location(1));
  o.setValueNumeric(50d);
  
  Context.getObsService().saveObs(o, null);
  assertNotNull(o.getDateCreated());
  assertNotNull(o.getCreator());
}

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

/**
 * @see ConceptService#purgeConcept(Concept)
 */
@Test(expected = ConceptNameInUseException.class)
public void purgeConcept_shouldFailIfAnyOfTheConceptNamesOfTheConceptIsBeingUsedByAnObs() {
  Obs o = new Obs();
  o.setConcept(Context.getConceptService().getConcept(3));
  o.setPerson(new Patient(2));
  o.setEncounter(new Encounter(3));
  o.setObsDatetime(new Date());
  o.setLocation(new Location(1));
  ConceptName conceptName = new ConceptName(1847);
  o.setValueCodedName(conceptName);
  Context.getObsService().saveObs(o, null);
  //ensure that the association between the conceptName and the obs has been established
  Assert.assertEquals(true, conceptService.hasAnyObservation(conceptName));
  
  Concept concept = conceptService.getConceptByName("cd4 count");
  //make sure the name concept name exists
  Assert.assertNotNull(concept);
  conceptService.purgeConcept(concept);
}

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

/**
 * When you save the encounter with a changed location, the location change should be cascaded
 * to all the obs associated with the encounter that had the same location as the encounter.
 *
 * @see EncounterService#saveEncounter(Encounter)
 */
@Test
public void saveEncounter_shouldCascadeChangeOfLocationInEncounterToContainedObs() {
  EncounterService es = Context.getEncounterService();
  Encounter enc = buildEncounter();
  
  es.saveEncounter(enc);
  
  // Now add an obs to it
  Obs newObs = new Obs();
  newObs.setConcept(Context.getConceptService().getConcept(1));
  newObs.setValueNumeric(50d);
  Location location = new Location(1);
  newObs.setLocation(location);
  
  enc.addObs(newObs);
  es.saveEncounter(enc);
  
  enc.setLocation(location);
  es.saveEncounter(enc);
  assertEquals(enc.getLocation(), newObs.getLocation());
}

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

o.setDateCreated(new Date());
o.setCreator(Context.getAuthenticatedUser());
o.setLocation(new Location(1));
o.setObsDatetime(new Date());
o.setPerson(new Patient(2));
o2.setDateCreated(new Date());
o2.setCreator(Context.getAuthenticatedUser());
o2.setLocation(new Location(1));
o2.setObsDatetime(new Date());
o2.setValueText("second obs value text");
oParent.setDateCreated(new Date());
oParent.setCreator(Context.getAuthenticatedUser());
oParent.setLocation(new Location(1));
oParent.setObsDatetime(new Date());
oParent.setPerson(new Patient(2));
oGP.setDateCreated(new Date());
oGP.setCreator(Context.getAuthenticatedUser());
oGP.setLocation(new Location(1));
oGP.setObsDatetime(new Date());
oGP.setPerson(new Patient(2));
o3.setDateCreated(new Date());
o3.setCreator(Context.getAuthenticatedUser());
o3.setLocation(new Location(1));
o3.setObsDatetime(new Date());
o3.setValueText("leaf obs value text");

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

obs.setEncounter(encounter);
obs.setObsDatetime(datetime);
obs.setLocation(location);
obs.setValueGroupId(valueGroupId);
obs.setValueDatetime(valueDatetime);

相关文章