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;
}
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;
}
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;
}
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;
}
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
}
Aggregations