コード例 #1
0
  public List<HealthcareSite> getRegisteredSitesForSubject(Participant participant) {
    List<HealthcareSite> registeredSites = new ArrayList<HealthcareSite>();

    for (StudySubjectDemographics studySubjectDemographics :
        participant.getStudySubjectDemographics()) {
      for (StudySubject registration : studySubjectDemographics.getRegistrations()) {
        registeredSites.add(registration.getStudySite().getHealthcareSite());
      }
    }
    return registeredSites;
  }
コード例 #2
0
  public String getTable(
      Map<String, List> parameterMap, String[] params, HttpServletRequest request) {

    List<StudySubject> studySubjectResults;
    Participant participant;
    SystemAssignedIdentifier id;

    Study study = new LocalStudy(true);
    if (!StringUtils.isEmpty(params[0].toString())) {
      study.setShortTitleText(params[0].toString());
    }
    if (!StringUtils.isEmpty(params[1].toString())) {
      id = new SystemAssignedIdentifier();
      id.setValue(params[1].toString());
      study.addIdentifier(id);
    }

    List<Study> studyList = new ArrayList<Study>();

    // this if -else ensures that participant is null if no data relevant to
    // participant is
    // entered and the studyDao is called.
    if (StringUtils.isEmpty(params[2].toString())
        && StringUtils.isEmpty(params[3].toString())
        && StringUtils.isEmpty(params[4].toString())) {
      participant = null;
      // call the studyDao if participant is null.
      studyList = studyDao.searchByExample(study, true, 0);
    } else {
      participant = new Participant();
      id = new SystemAssignedIdentifier();
      if (!StringUtils.isEmpty(params[2].toString())) {
        id.setValue(params[2].toString());
        participant.addIdentifier(id);
      }

      if (!StringUtils.isEmpty(params[3].toString())) {
        participant.setFirstName(params[3].toString());
      }
      if (!StringUtils.isEmpty(params[4].toString())) {
        participant.setLastName(params[4].toString());
      }

      StudySite studySite = new StudySite();
      study.addStudySite(studySite);

      StudySubject studySubject = new StudySubject();
      studySubject.setStudySite(studySite);
      studySubject.setParticipant(participant);

      // else call the studySubjectDao
      studySubjectResults = studySubjectDao.advancedStudySearch(studySubject);
      Iterator iter = studySubjectResults.iterator();
      while (iter.hasNext()) {
        studyList.add(((StudySubject) iter.next()).getStudySite().getStudy());
      }
    }

    Context context = new HttpServletRequestContext(request, parameterMap);

    TableModel model = new TableModelImpl(context);
    try {
      return build(model, studyList).toString();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }