Search in sources :

Example 91 with EventCRFBean

use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.

the class CrfBusinessLogicHelper method areAllCompleted.

protected boolean areAllCompleted(StudyEventBean seBean, StudyBean study) {
    EventDefinitionCRFDAO edcDao = new EventDefinitionCRFDAO(ds);
    EventCRFDAO eventCrfDao = new EventCRFDAO(ds);
    ArrayList allCRFs = eventCrfDao.findAllByStudyEvent(seBean);
    ArrayList allEDCs = (ArrayList) edcDao.findAllActiveByEventDefinitionId(study, seBean.getStudyEventDefinitionId());
    boolean eventCompleted = true;
    logger.info("found all crfs: " + allCRFs.size());
    logger.info("found all edcs: " + allEDCs.size());
    for (int i = 0; i < allCRFs.size(); i++) {
        EventCRFBean ec = (EventCRFBean) allCRFs.get(i);
        // logger.info("found a crf name from event crf bean: " +
        // ec.getCrf().getName());
        logger.info("found a event name from event crf bean: " + ec.getEventName() + " crf version id: " + ec.getCRFVersionId());
        if (!ec.getStatus().equals(Status.UNAVAILABLE) || allCRFs.size() < allEDCs.size()) {
            eventCompleted = false;
            break;
        }
    }
    logger.info("returning for are all completed: " + eventCompleted);
    return eventCompleted;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ArrayList(java.util.ArrayList) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 92 with EventCRFBean

use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.

the class EventCRFDAO method create.

public EntityBean create(EntityBean eb) {
    EventCRFBean ecb = (EventCRFBean) eb;
    HashMap variables = new HashMap();
    HashMap nullVars = new HashMap();
    variables.put(new Integer(1), new Integer(ecb.getStudyEventId()));
    variables.put(new Integer(2), new Integer(ecb.getCRFVersionId()));
    Date interviewed = ecb.getDateInterviewed();
    if (interviewed != null) {
        variables.put(new Integer(3), ecb.getDateInterviewed());
    } else {
        variables.put(new Integer(3), null);
        nullVars.put(new Integer(3), new Integer(Types.DATE));
    }
    logger.debug("created: ecb.getInterviewerName()" + ecb.getInterviewerName());
    variables.put(new Integer(4), ecb.getInterviewerName());
    variables.put(new Integer(5), new Integer(ecb.getCompletionStatusId()));
    variables.put(new Integer(6), new Integer(ecb.getStatus().getId()));
    variables.put(new Integer(7), ecb.getAnnotations());
    variables.put(new Integer(8), new Integer(ecb.getOwnerId()));
    variables.put(new Integer(9), new Integer(ecb.getStudySubjectId()));
    variables.put(new Integer(10), ecb.getValidateString());
    variables.put(new Integer(11), ecb.getValidatorAnnotations());
    variables.put(new Integer(12), new Integer(ecb.getFormLayoutId()));
    executeWithPK(digester.getQuery("create"), variables, nullVars);
    if (isQuerySuccessful()) {
        ecb.setId(getLatestPK());
    }
    return ecb;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) HashMap(java.util.HashMap) Date(java.util.Date)

Example 93 with EventCRFBean

use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.

the class ParticipantEventService method getNextParticipantEvent.

public StudyEventBean getNextParticipantEvent(StudySubjectBean studySubject) {
    List<StudyEventBean> studyEvents = (ArrayList<StudyEventBean>) getStudyEventDAO().findAllBySubjectIdOrdered(studySubject.getId());
    for (StudyEventBean studyEvent : studyEvents) {
        // Skip to next event if study event is not in the right status
        if (studyEvent.getStatus() != Status.AVAILABLE || (studyEvent.getSubjectEventStatus() != SubjectEventStatus.DATA_ENTRY_STARTED && studyEvent.getSubjectEventStatus() != SubjectEventStatus.SCHEDULED))
            continue;
        List<EventDefinitionCRFBean> eventDefCrfs = getEventDefCrfsForStudyEvent(studySubject, studyEvent);
        for (EventDefinitionCRFBean eventDefCrf : eventDefCrfs) {
            boolean participantForm = eventDefCrf.isParticipantForm();
            if (participantForm) {
                List<CRFVersionBean> crfVersions = getAllCrfVersions(eventDefCrf);
                boolean eventCrfExists = false;
                for (CRFVersionBean crfVersion : crfVersions) {
                    EventCRFBean eventCRF = getEventCRFDAO().findByEventCrfVersion(studyEvent, crfVersion);
                    if (eventCRF != null && eventCRF.getStatus() == Status.AVAILABLE)
                        return studyEvent;
                    else if (eventCRF != null)
                        eventCrfExists = true;
                }
                if (!eventCrfExists)
                    return studyEvent;
            }
        }
    }
    // Did not find a next participant event
    return null;
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ArrayList(java.util.ArrayList) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Example 94 with EventCRFBean

use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteUtil method injectParentDiscNotesIntoDisplayStudyEvents.

public void injectParentDiscNotesIntoDisplayStudyEvents(List<DisplayStudyEventBean> displayStudyBeans, Set<Integer> resolutionStatusIds, DataSource dataSource, int discNoteType) {
    if (displayStudyBeans == null) {
        return;
    }
    // booleans representing whether this method should only get
    // DiscrepancyNoteBeans with
    // certain resolution status or discrepancyNoteTypeId number.
    boolean hasResolutionStatus = this.checkResolutionStatus(resolutionStatusIds);
    boolean hasDiscNoteType = discNoteType >= 1 && discNoteType <= 4;
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    DiscrepancyNoteDAO discrepancyNoteDAO = new DiscrepancyNoteDAO(dataSource);
    StudyEventBean studyEventBean;
    List<EventCRFBean> eventCRFBeans = new ArrayList<EventCRFBean>();
    List<DiscrepancyNoteBean> foundDiscNotes = new ArrayList<DiscrepancyNoteBean>();
    for (DisplayStudyEventBean dStudyEventBean : displayStudyBeans) {
        studyEventBean = dStudyEventBean.getStudyEvent();
        // All EventCRFs for a study event
        eventCRFBeans = eventCRFDAO.findAllByStudyEvent(studyEventBean);
        for (EventCRFBean eventCrfBean : eventCRFBeans) {
            // Find ItemData type notes associated with an event crf
            foundDiscNotes = discrepancyNoteDAO.findParentItemDataDNotesFromEventCRF(eventCrfBean);
            // filter for any specified disc note type
            if (!foundDiscNotes.isEmpty() && hasDiscNoteType) {
                // only include disc notes that have the specified disc note
                // type id
                foundDiscNotes = filterforDiscNoteType(foundDiscNotes, discNoteType);
            }
            if (!foundDiscNotes.isEmpty()) {
                if (!hasResolutionStatus) {
                    studyEventBean.getDiscBeanList().addAll(foundDiscNotes);
                } else {
                    // session variable
                    for (DiscrepancyNoteBean discBean : foundDiscNotes) {
                        for (int statusId : resolutionStatusIds) {
                            if (discBean.getResolutionStatusId() == statusId) {
                                studyEventBean.getDiscBeanList().add(discBean);
                            }
                        }
                    }
                }
            }
        }
    // end for(EventCRFBean...
    }
// end for (DisplayStudyEventBean
}
Also used : DiscrepancyNoteDAO(org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) DisplayStudyEventBean(org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) DisplayStudyEventBean(org.akaza.openclinica.bean.managestudy.DisplayStudyEventBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 95 with EventCRFBean

use of org.akaza.openclinica.bean.submit.EventCRFBean in project OpenClinica by OpenClinica.

the class ExtractBean method getCRFCompletionDate.

protected String getCRFCompletionDate(int h, int i, int j) {
    StudyEventBean seb = getEvent(h, i, j);
    EventCRFBean eventCRF = null;
    if (seb.getEventCRFs().size() > 0) {
        eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
    }
    // need
    return eventCRF.getDateValidateCompleted() == null ? sdf.format(eventCRF.getDateCompleted()) : sdf.format(eventCRF.getDateValidateCompleted());
// to
// be
// fixed?
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Aggregations

EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)198 ArrayList (java.util.ArrayList)118 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)89 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)85 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)68 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)64 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)63 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)62 HashMap (java.util.HashMap)54 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)52 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)48 Date (java.util.Date)47 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)47 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)44 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)43 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)42 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)41 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)41 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)41