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

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

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

Obs.getPersonId介绍

[英]The person id of the person on this object. This should be the same as #getPerson().getPersonId(). It is duplicated here for speed and simplicity reasons
[中]

代码示例

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

private void updateImmutableFieldsAndAssert(Obs obs, boolean assertion) throws Exception {
  //Set all fields to some random values via reflection
  List<Field> fields = Reflect.getAllFields(Obs.class);
  final Integer originalPersonId = obs.getPersonId();
  //call each setter and check that dirty has been set to true for each
  for (Field field : fields) {
    String fieldName = field.getName();
    if (IGNORED_FIELDS.contains(fieldName)) {
      continue;
    }
    if ("personId".equals(fieldName)) {
      //call setPersonId because it is protected so BeanUtils.setProperty won't work
      obs.setPersonId((Integer) generateValue(field, true));
    } else {
      BeanUtils.setProperty(obs, fieldName, generateValue(field, true));
    }
    assertEquals("Obs was not marked as dirty after changing: " + fieldName, obs.isDirty(), assertion);
    if ("person".equals(fieldName)) {
      //Because setPerson updates the personId we need to reset personId to its original value 
      //that matches that of person otherwise the test will fail for the personId field
      obs.setPersonId(originalPersonId);
    }
    
    //reset for next field
    resetObs(obs);
  }
}

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

public Patient[] dueDatesToWebServicePatients(List<Obs> dueDates) {
  List<Patient> wsPatients = new ArrayList<Patient>();
  for (Obs dueDate : dueDates) {
    Integer patientId = dueDate.getPersonId();
    org.openmrs.Patient patient = registrarBean.getPatientById(patientId);
    if (patient != null) {
      Patient wsPatient = patientToWebService(patient, true);
      wsPatient.setEstimateDueDate(dueDate.getValueDatetime());
      wsPatients.add(wsPatient);
    }
  }
  return wsPatients.toArray(new Patient[wsPatients.size()]);
}

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

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

相关文章

微信公众号

最新文章

更多