Search in sources :

Example 21 with DiscrepancyNoteBean

use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteDAO method findAllEventCRFByStudy.

public ArrayList findAllEventCRFByStudy(StudyBean study) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    // ss.label
    this.setTypeExpected(12, TypeNames.STRING);
    // date_start
    this.setTypeExpected(13, TypeNames.DATE);
    // sed_name
    this.setTypeExpected(14, TypeNames.STRING);
    // crf_name
    this.setTypeExpected(15, TypeNames.STRING);
    // column_name
    this.setTypeExpected(16, TypeNames.STRING);
    // event_crf_id
    this.setTypeExpected(17, TypeNames.INT);
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(study.getId()));
    variables.put(Integer.valueOf(2), Integer.valueOf(study.getId()));
    alist = this.select(digester.getQuery("findAllEventCRFByStudy"), variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
        eb.setCrfName((String) hm.get("crf_name"));
        eb.setSubjectName((String) hm.get("label"));
        eb.setColumn((String) hm.get("column_name"));
        eb.setEntityId(((Integer) hm.get("event_crf_id")).intValue());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 22 with DiscrepancyNoteBean

use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteDAO method findAllTopNotesByEventCRF.

public ArrayList<DiscrepancyNoteBean> findAllTopNotesByEventCRF(int eventCRFId) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(eventCRFId));
    alist = this.select(digester.getQuery("findAllTopNotesByEventCRF"), variables);
    ArrayList<DiscrepancyNoteBean> al = new ArrayList<DiscrepancyNoteBean>();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 23 with DiscrepancyNoteBean

use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteDAO method findParentNotesForToolTip.

public ArrayList findParentNotesForToolTip(int itemDataId) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(itemDataId));
    variables.put(Integer.valueOf(2), Integer.valueOf(itemDataId));
    alist = this.select(digester.getQuery("findParentNotesForToolTip"), variables);
    ArrayList<DiscrepancyNoteBean> al = new ArrayList<DiscrepancyNoteBean>();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 24 with DiscrepancyNoteBean

use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteDAO method findAllSubjectByStudiesAndSubjectId.

public ArrayList<DiscrepancyNoteBean> findAllSubjectByStudiesAndSubjectId(StudyBean currentStudy, StudyBean subjectStudy, int studySubjectId) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    // ss.label
    this.setTypeExpected(12, TypeNames.STRING);
    // column_name
    this.setTypeExpected(13, TypeNames.STRING);
    // subject_id
    this.setTypeExpected(14, TypeNames.INT);
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(currentStudy.getId()));
    variables.put(Integer.valueOf(2), Integer.valueOf(subjectStudy.getId()));
    variables.put(Integer.valueOf(3), Integer.valueOf(subjectStudy.getId()));
    variables.put(Integer.valueOf(4), Integer.valueOf(currentStudy.getId()));
    variables.put(Integer.valueOf(5), Integer.valueOf(subjectStudy.getId()));
    variables.put(Integer.valueOf(6), Integer.valueOf(studySubjectId));
    alist = this.select(digester.getQuery("findAllSubjectByStudiesAndSubjectId"), variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
        eb.setSubjectName((String) hm.get("label"));
        eb.setColumn((String) hm.get("column_name"));
        eb.setEntityId(((Integer) hm.get("subject_id")).intValue());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 25 with DiscrepancyNoteBean

use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.

the class DiscrepancyNoteUtil method injectDiscNotesIntoDisplayStudyEvents.

/**
     * This method is an overloaded version of the previous method, with the
     * only difference being the resolutionStatusIds parameter in this method.
     * This method adds the associated discrepancy notes to the appropriate
     * StudyEventBean (contained by DisplayStudyBeans).
     *
     * @param displayStudyBeans
     *            A List of DisplayStudyEventBeans.
     * @param resolutionStatusIds
     *            A HashSet object consisting of resolution status ids (i.e.,
     *            1,2,3).
     * @param dataSource
     *            A DataSource object, for use with the DAO methods.
     * @param discNoteType
     *            An int discrepancy note type, for filtering the discrepancy
     *            notes that
     * @param discrepancyNoteThreads
     *            A List of DiscrepancyNoteThreads
     */
public void injectDiscNotesIntoDisplayStudyEvents(List<DisplayStudyEventBean> displayStudyBeans, Set<Integer> resolutionStatusIds, DataSource dataSource, int discNoteType, List<DiscrepancyNoteThread> discrepancyNoteThreads) {
    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.findItemDataDNotesFromEventCRF(eventCrfBean);
            // return only parent beans
            foundDiscNotes = filterDiscNotesForOnlyParents(foundDiscNotes, discrepancyNoteThreads);
            // update the resolution status of these parent discrepancy
            // notes
            updateStatusUsingThread(foundDiscNotes, discrepancyNoteThreads);
            // 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);
                            }
                        }
                    }
                }
            }
        // 3014: Not for now; Find EventCRF type notes
        /*
                 * foundDiscNotes =
                 * discrepancyNoteDAO.findEventCRFDNotesFromEventCRF(eventCrfBean);
                 * //filter for any specified disc note type if((!
                 * foundDiscNotes.isEmpty()) && hasDiscNoteType){ foundDiscNotes =
                 * filterforDiscNoteType(foundDiscNotes,discNoteType); }
                 *
                 * if(! foundDiscNotes.isEmpty()){ if(! hasResolutionStatus) {
                 * studyEventBean.getDiscBeanList().addAll(foundDiscNotes); }
                 * else { //Only include disc notes with a particular resolution
                 * status, specified by //the parameter passed to the servlet
                 * for(DiscrepancyNoteBean discBean : foundDiscNotes) { for(int
                 * statusId : resolutionStatusIds){
                 * if(discBean.getResolutionStatusId() == statusId){
                 * studyEventBean.getDiscBeanList().add(discBean); } } } } }
                 */
        // end if(! foundDiscNotes.isEmpty()){
        }
    // 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)

Aggregations

DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)122 ArrayList (java.util.ArrayList)81 HashMap (java.util.HashMap)62 Iterator (java.util.Iterator)44 DiscrepancyNoteDAO (org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO)34 Date (java.util.Date)20 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)20 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)20 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)20 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)18 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)18 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)15 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)14 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)14 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)13 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)11 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)11 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)11 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)10 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)10