Search in sources :

Example 1 with SubjectGroupMap

use of org.akaza.openclinica.domain.datamap.SubjectGroupMap in project OpenClinica by OpenClinica.

the class GenerateClinicalDataServiceImpl method setExportSubjectDataBean.

@SuppressWarnings("unchecked")
private ExportSubjectDataBean setExportSubjectDataBean(StudySubject studySubj, Study study, List<StudyEvent> studyEvents, String formVersionOID) {
    ExportSubjectDataBean exportSubjectDataBean = new ExportSubjectDataBean();
    if (subjectBelongsToStudy(study, studySubj)) {
        // exportSubjectDataBean.setAuditLogs(studySubj.getA)
        if (studySubj.getSubject().getDateOfBirth() != null)
            exportSubjectDataBean.setDateOfBirth(studySubj.getSubject().getDateOfBirth() + "");
        exportSubjectDataBean.setSubjectGender(studySubj.getSubject().getGender() + "");
        for (SubjectGroupMap subjGrpMap : studySubj.getSubjectGroupMaps()) {
            SubjectGroupDataBean subjGrpDataBean = new SubjectGroupDataBean();
            subjGrpDataBean.setStudyGroupClassId("SGC_" + subjGrpMap.getStudyGroupClass().getStudyGroupClassId());
            subjGrpDataBean.setStudyGroupClassName(subjGrpMap.getStudyGroup().getStudyGroupClass().getName());
            subjGrpDataBean.setStudyGroupName(subjGrpMap.getStudyGroup().getName());
            exportSubjectDataBean.getSubjectGroupData().add(subjGrpDataBean);
        }
        exportSubjectDataBean.setStudySubjectId(studySubj.getLabel());
        if (studySubj.getSubject().getUniqueIdentifier() != null)
            exportSubjectDataBean.setUniqueIdentifier(studySubj.getSubject().getUniqueIdentifier());
        exportSubjectDataBean.setSecondaryId(studySubj.getSecondaryLabel());
        exportSubjectDataBean.setStatus(studySubj.getStatus().toString());
        if (isCollectAudits())
            exportSubjectDataBean.setAuditLogs(fetchAuditLogs(studySubj.getStudySubjectId(), "study_subject", studySubj.getOcOid(), null));
        AuditLogsBean subjectGroupMapLogs = fetchAuditLogs(studySubj.getStudySubjectId(), "subject_group_map", studySubj.getOcOid(), null);
        AuditLogsBean subjectLogs = fetchAuditLogs(studySubj.getSubject().getSubjectId(), "subject", studySubj.getOcOid(), null);
        exportSubjectDataBean.getAuditLogs().getAuditLogs().addAll(subjectGroupMapLogs.getAuditLogs());
        exportSubjectDataBean.getAuditLogs().getAuditLogs().addAll(subjectLogs.getAuditLogs());
        Collections.sort(exportSubjectDataBean.getAuditLogs().getAuditLogs());
        if (isCollectDns())
            exportSubjectDataBean.setDiscrepancyNotes(fetchDiscrepancyNotes(studySubj));
        exportSubjectDataBean.setExportStudyEventData(setExportStudyEventDataBean(studySubj, studyEvents, formVersionOID));
        exportSubjectDataBean.setSubjectOID(studySubj.getOcOid());
        exportSubjectDataBean.setEnrollmentDate(studySubj.getEnrollmentDate() + "");
    }
    return exportSubjectDataBean;
}
Also used : SubjectGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean) SubjectGroupMap(org.akaza.openclinica.domain.datamap.SubjectGroupMap) AuditLogsBean(org.akaza.openclinica.bean.odmbeans.AuditLogsBean) ExportSubjectDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)

Aggregations

AuditLogsBean (org.akaza.openclinica.bean.odmbeans.AuditLogsBean)1 ExportSubjectDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)1 SubjectGroupDataBean (org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean)1 SubjectGroupMap (org.akaza.openclinica.domain.datamap.SubjectGroupMap)1