Search in sources :

Example 6 with ExportSubjectDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean 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

ExportSubjectDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)6 ArrayList (java.util.ArrayList)4 SimpleDateFormat (java.text.SimpleDateFormat)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ExportFormDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean)3 ExportStudyEventDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportStudyEventDataBean)3 SubjectGroupDataBean (org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean)3 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)2 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)2 AuditLogsBean (org.akaza.openclinica.bean.odmbeans.AuditLogsBean)2 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)2 ImportItemDataBean (org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean)2 ImportItemGroupDataBean (org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean)2 Calendar (java.util.Calendar)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 AuditLogBean (org.akaza.openclinica.bean.odmbeans.AuditLogBean)1