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

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

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

Obs.getId介绍

暂无

代码示例

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

complexData = new ComplexData(originalFilename, fileInputStream);
} else {
  log.error("Unable to find file associated with complex obs " + obs.getId());

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

private Obs saveObsNotDirty(Obs obs, String changeMessage) {
  if(!obs.isObsGrouping()){
    return obs;
  }
  ObsService os = Context.getObsService();
  boolean refreshNeeded = false;
  for (Obs o : obs.getGroupMembers(true)) {
    if (o.getId() == null) {
      os.saveObs(o, null);
    } else {
      Obs newObs = os.saveObs(o, changeMessage);
      refreshNeeded = !newObs.equals(o) || refreshNeeded;
    }
  }
  if(refreshNeeded) {
    Context.refreshEntity(obs);
  }
  return obs;
}

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

/**
 * This method gets the revision obs for voided obs
 *
 * @see ObsService#getRevisionObs(Obs)
 */
@Test
public void shouldGetRevisedObs() {
  executeDataSet(INITIAL_OBS_XML);
  executeDataSet(REVISION_OBS_XML);
  ObsService os = Context.getObsService();
  Obs initialObs = os.getObsByUuid("uuid14");
  Obs revisedObs = os.getRevisionObs(initialObs);
  assertEquals(17, revisedObs.getId().intValue());
  assertEquals(2, revisedObs.getGroupMembers(true).size());
}

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

/**
 * @see org.openmrs.api.ObsService#saveObs(org.openmrs.Obs, String)
 */
@Override
public Obs saveObs(Obs obs, String changeMessage) throws APIException {
  if(obs == null){
    throw new APIException("Obs.error.cannot.be.null", (Object[]) null);
  }
  if(obs.getId() != null && changeMessage == null){
    throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null);
  }
  handleExistingObsWithComplexConcept(obs);
  ensureRequirePrivilege(obs);
  //Should allow updating a voided Obs, it seems to be pointless to restrict it,
  //otherwise operations like merge patients won't be possible when to moving voided obs
  if (obs.getObsId() == null || obs.getVoided()) {
    return saveNewOrVoidedObs(obs,changeMessage);
  } else if(!obs.isDirty()){
    setPersonFromEncounter(obs);
    return saveObsNotDirty(obs, changeMessage);
  } else {
    setPersonFromEncounter(obs);
    return saveExistingObs(obs,changeMessage);
  }
}

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

List<Obs> obsToAdd = new ArrayList<>();
for (Obs o : encounter.getObsAtTopLevel(true)) {
  if (o.getId() == null) {
    os.saveObs(o, null);
  } else {
    obsToAdd.add(os.getObs(o.getId()));
    obsToAdd.add(newObs);

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

/**
 * @see ObsService#saveObs(Obs,String)
 */
@Test
public void saveObs_shouldNotVoidAnObsWithNoChanges() {
  executeDataSet(ENCOUNTER_OBS_XML);
  ObsService os = Context.getObsService();
  Obs obs = os.getObs(14);
  assertFalse(obs.getGroupMembers(true).isEmpty());
  assertFalse(obs.getGroupMembers(false).isEmpty());
  assertFalse(obs.isDirty());
  Set<Obs> originalMembers = new HashSet<>(obs.getGroupMembers());
  for (Obs o : originalMembers) {
    assertFalse(o.isDirty());
  }
  Obs saveObs = os.saveObs(obs, "no change");
  assertEquals(obs, saveObs);
  assertFalse(saveObs.getVoided());
  Set<Obs> savedMembers = new HashSet<>(saveObs.getGroupMembers());
  assertFalse(saveObs.isDirty());
  for (Obs o : savedMembers) {
    assertFalse("obs"+o.getId(), o.isDirty());
  }
}

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

for(Obs member : obs.getGroupMembers()) {
  member.setObsDatetime(newDate);
  if(member.getId() == 17) {
    child = member;

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

encounter = es.getEncounter(encounter.getEncounterId());
int newObsId = encounter.getAllObs().iterator().next().getId();

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

throw new IllegalRequestException("It is not a complex obs, thus have no data.");
obs = obsService.getComplexObs(obs.getId(), view);
ComplexData complexData = obs.getComplexData();

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

/**
 * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#save(java.lang.Object)
 */
@Override
public Obs save(Obs delegate) {
  Obs savedObs = Context.getObsService().saveObs(delegate, "REST web service");
  return Context.getObsService().getObs(savedObs.getId());
}

代码示例来源:origin: org.motechproject/motech-openmrs-api

private MRSObservation createMRSObservation(Obs obs, Object value) {
  final OpenMRSObservation mrsObservation = new OpenMRSObservation(Integer.toString(obs.getId()), obs.getObsDatetime(),
      obs.getConcept().getName().getName(), value);
  if (obs.getPatient() != null) {
    List<PatientIdentifier> patientIdentifiers = obs.getPatient().getActiveIdentifiers();
    if (patientIdentifiers != null) {
      for (PatientIdentifier patientId : patientIdentifiers) {
        if (IdentifierType.IDENTIFIER_MOTECH_ID.getName().equals(patientId.getIdentifierType().getName())) {
          mrsObservation.setPatientId(patientId.getIdentifier());
        }
      }
    }
  }
  if (obs.hasGroupMembers()) {
    for (Obs observation : obs.getGroupMembers()) {
      mrsObservation.addDependantObservation(convertOpenMRSToMRSObservation(observation));
    }
  }
  eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_OBSERVATION_SUBJECT, EventHelper.observationParameters(mrsObservation)));
  return mrsObservation;
}

相关文章