use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findAllDiscrepancyNotesDataByStudy.
public ArrayList<DiscrepancyNoteBean> findAllDiscrepancyNotesDataByStudy(StudyBean currentStudy) {
ArrayList<DiscrepancyNoteBean> discNotes = new ArrayList<DiscrepancyNoteBean>();
setTypesExpected();
this.setTypeExpected(12, TypeNames.STRING);
this.setTypeExpected(13, TypeNames.INT);
this.setTypeExpected(14, TypeNames.INT);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), currentStudy.getId());
variables.put(Integer.valueOf(2), currentStudy.getId());
variables.put(Integer.valueOf(3), currentStudy.getId());
variables.put(Integer.valueOf(4), currentStudy.getId());
variables.put(Integer.valueOf(5), currentStudy.getId());
variables.put(Integer.valueOf(6), currentStudy.getId());
variables.put(Integer.valueOf(7), currentStudy.getId());
variables.put(Integer.valueOf(8), currentStudy.getId());
variables.put(Integer.valueOf(9), currentStudy.getId());
variables.put(Integer.valueOf(10), currentStudy.getId());
String sql = digester.getQuery("findAllSubjectDNByStudy");
sql += " UNION ";
sql += digester.getQuery("findAllStudySubjectDNByStudy");
sql += " UNION ";
sql += digester.getQuery("findAllStudyEventDNByStudy");
sql += " UNION ";
sql += digester.getQuery("findAllEventCrfDNByStudy");
if (currentStudy.isSite(currentStudy.getParentStudyId())) {
sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
}
sql += " UNION ";
sql += digester.getQuery("findAllItemDataDNByStudy");
if (currentStudy.isSite(currentStudy.getParentStudyId())) {
sql += " and ec.event_crf_id not in ( " + this.findSiteHiddenEventCrfIdsString(currentStudy) + " ) ";
}
ArrayList rows = select(sql, variables);
Iterator it = rows.iterator();
while (it.hasNext()) {
DiscrepancyNoteBean discBean = (DiscrepancyNoteBean) this.getEntityFromHashMap((HashMap) it.next());
discBean = findSingleMapping(discBean);
discNotes.add(discBean);
}
return discNotes;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findAllDNotesByItemNameAndEventCRF.
public ArrayList<DiscrepancyNoteBean> findAllDNotesByItemNameAndEventCRF(EventCRFBean eventCRFBean, String itemName) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(eventCRFBean.getId()));
variables.put(Integer.valueOf(2), itemName);
ArrayList dNotelist = new ArrayList();
dNotelist = this.select(digester.getQuery("findAllDNotesByItemNameAndEventCRF"), variables);
ArrayList<DiscrepancyNoteBean> returnedNotelist = new ArrayList<DiscrepancyNoteBean>();
Iterator it = dNotelist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
// eb.setColumn((String) hm.get("column_name"));
// eb.setEventCRFId(eventCRFBean.getId());
returnedNotelist.add(eb);
}
return returnedNotelist;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findEventCRFDNotesFromEventCRF.
public ArrayList<DiscrepancyNoteBean> findEventCRFDNotesFromEventCRF(EventCRFBean eventCRFBean) {
this.setTypesExpected();
this.setTypeExpected(12, TypeNames.STRING);
ArrayList dNotelist = new ArrayList();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(eventCRFBean.getId()));
dNotelist = this.select(digester.getQuery("findEventCRFDNotesFromEventCRF"), variables);
ArrayList<DiscrepancyNoteBean> returnedNotelist = new ArrayList<DiscrepancyNoteBean>();
Iterator it = dNotelist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
eb.setColumn((String) hm.get("column_name"));
eb.setEventCRFId(eventCRFBean.getId());
returnedNotelist.add(eb);
}
return returnedNotelist;
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method getStudyEventDNCountWithFilter.
public Integer getStudyEventDNCountWithFilter(ListNotesFilter filter, Integer currentStudyId) {
DiscrepancyNoteBean discrepancyNoteBean = new DiscrepancyNoteBean();
setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), currentStudyId);
variables.put(Integer.valueOf(2), currentStudyId);
String sql = digester.getQuery("getStudyEventDNCountWithFilter");
sql += filter.execute("");
ArrayList rows = this.select(sql, variables);
Iterator it = rows.iterator();
if (it.hasNext()) {
Integer count = (Integer) ((HashMap) it.next()).get("count");
return count;
} else {
return null;
}
}
use of org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class DiscrepancyNoteDAO method findAllEntityByPK.
public ArrayList findAllEntityByPK(String entityName, int noteId) {
this.setTypesExpected();
ArrayList alist = new ArrayList();
// ss.label
this.setTypeExpected(12, TypeNames.STRING);
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(noteId));
variables.put(Integer.valueOf(2), Integer.valueOf(noteId));
if ("subject".equalsIgnoreCase(entityName)) {
// column_name
this.setTypeExpected(13, TypeNames.STRING);
alist = this.select(digester.getQuery("findAllSubjectByPK"), variables);
} else if ("studySub".equalsIgnoreCase(entityName)) {
// column_name
this.setTypeExpected(13, TypeNames.STRING);
alist = this.select(digester.getQuery("findAllStudySubjectByPK"), variables);
} else if ("eventCrf".equalsIgnoreCase(entityName)) {
// 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);
alist = this.select(digester.getQuery("findAllEventCRFByPK"), variables);
} else if ("studyEvent".equalsIgnoreCase(entityName)) {
// date_start
this.setTypeExpected(13, TypeNames.DATE);
// sed_name
this.setTypeExpected(14, TypeNames.STRING);
// column_name
this.setTypeExpected(15, TypeNames.STRING);
alist = this.select(digester.getQuery("findAllStudyEventByPK"), variables);
} else if ("itemData".equalsIgnoreCase(entityName)) {
// date_start
this.setTypeExpected(13, TypeNames.DATE);
// sed_name
this.setTypeExpected(14, TypeNames.STRING);
// crf_name
this.setTypeExpected(15, TypeNames.STRING);
// item_name
this.setTypeExpected(16, TypeNames.STRING);
// value
this.setTypeExpected(17, TypeNames.STRING);
// YW <<
// item_data_id
this.setTypeExpected(18, TypeNames.INT);
// item_id
this.setTypeExpected(19, TypeNames.INT);
// YW >>
alist = this.select(digester.getQuery("findAllItemDataByPK"), variables);
}
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
HashMap hm = (HashMap) it.next();
DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
if ("subject".equalsIgnoreCase(entityName) || "studySub".equalsIgnoreCase(entityName)) {
eb.setSubjectName((String) hm.get("label"));
eb.setColumn((String) hm.get("column_name"));
} else if ("eventCrf".equalsIgnoreCase(entityName)) {
eb.setSubjectName((String) hm.get("label"));
eb.setEventName((String) hm.get("sed_name"));
eb.setEventStart((Date) hm.get("date_start"));
eb.setCrfName((String) hm.get("crf_name"));
eb.setColumn((String) hm.get("column_name"));
} else if ("itemData".equalsIgnoreCase(entityName)) {
eb.setSubjectName((String) hm.get("label"));
eb.setEventName((String) hm.get("sed_name"));
eb.setEventStart((Date) hm.get("date_start"));
eb.setCrfName((String) hm.get("crf_name"));
eb.setEntityName((String) hm.get("item_name"));
eb.setEntityValue((String) hm.get("value"));
// YW <<
eb.setEntityId(((Integer) hm.get("item_data_id")).intValue());
eb.setItemId(((Integer) hm.get("item_id")).intValue());
// YW >>
} else if ("studyEvent".equalsIgnoreCase(entityName)) {
eb.setSubjectName((String) hm.get("label"));
eb.setEventName((String) hm.get("sed_name"));
eb.setEventStart((Date) hm.get("date_start"));
eb.setColumn((String) hm.get("column_name"));
}
if (fetchMapping) {
eb = findSingleMapping(eb);
}
al.add(eb);
}
return al;
}
Aggregations