use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class ClinicalDataReportBean method addDiscrepancyNotes.
protected void addDiscrepancyNotes(DiscrepancyNotesBean DNs, String currentIndent) {
if (DNs != null) {
ArrayList<DiscrepancyNoteBean> dns = DNs.getDiscrepancyNotes();
if (dns != null && dns.size() > 0) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
String nls = System.getProperty("line.separator");
xml.append(currentIndent + "<OpenClinica:DiscrepancyNotes EntityID=\"" + DNs.getEntityID() + "\">");
xml.append(nls);
for (DiscrepancyNoteBean dn : dns) {
this.addOneDN(dn, currentIndent + indent);
}
xml.append(currentIndent + "</OpenClinica:DiscrepancyNotes>");
xml.append(nls);
}
}
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setOCSubjectDataDNs.
protected void setOCSubjectDataDNs(OdmClinicalDataBean data, String studySubjectOids, HashMap<String, String> subOidPoses) {
this.setOCSubjectDataDNsTypesExpected();
HashMap<String, ArrayList<ChildNoteBean>> pDNs = new HashMap<String, ArrayList<ChildNoteBean>>();
// HashMap<String, ArrayList<DiscrepancyNoteBean>> sDNs = new HashMap<String, ArrayList<DiscrepancyNoteBean>>();
logger.debug("Begin to execute GetOCSubjectDataDNsSql");
logger.debug("getOCSubjectDataDNsSql= " + this.getOCSubjectDataDNsSql(studySubjectOids));
ArrayList rows = select(this.getOCSubjectDataDNsSql(studySubjectOids));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
String studySubjectLabel = (String) row.get("study_subject_oid");
Integer pdnId = (Integer) row.get("parent_dn_id");
Integer dnId = (Integer) row.get("dn_id");
String description = (String) row.get("description");
String detailedNote = (String) row.get("detailed_notes");
Integer ownerId = (Integer) row.get("owner_id");
Date dateCreated = (Date) row.get("date_created");
String status = (String) row.get("status");
String noteType = (String) row.get("name");
if (pdnId != null && pdnId > 0) {
String key = studySubjectLabel + "-" + pdnId;
ChildNoteBean cn = new ChildNoteBean();
cn.setDateCreated(dateCreated);
cn.setDescription(description);
cn.setDetailedNote(detailedNote);
cn.setStatus(status);
cn.setOid("CDN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
cn.setUserRef(userRef);
ArrayList<ChildNoteBean> cns = pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
cns.add(cn);
pDNs.put(key, cns);
} else {
DiscrepancyNoteBean dn = new DiscrepancyNoteBean();
String k = studySubjectLabel + "-" + dnId;
if (pDNs != null && pDNs.containsKey(k)) {
dn.setChildNotes(pDNs.get(k));
dn.setNumberOfChildNotes(dn.getChildNotes().size());
}
dn.setDateUpdated(dateCreated);
dn.setNoteType(noteType);
dn.setStatus(status);
dn.setOid("DN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
if (subOidPoses.containsKey(studySubjectLabel)) {
int i = Integer.parseInt(subOidPoses.get(studySubjectLabel));
String entityID = data.getExportSubjectData().get(i).getSubjectOID();
data.getExportSubjectData().get(i).getDiscrepancyNotes().setEntityID(entityID);
data.getExportSubjectData().get(i).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
}
}
}
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setOCEventDataDNs.
protected void setOCEventDataDNs(OdmClinicalDataBean data, String definitionOids, String studySubjectOids, HashMap<String, String> evnOidPoses) {
this.setOCEventDataDNsTypesExpected();
HashMap<String, ArrayList<ChildNoteBean>> pDNs = new HashMap<String, ArrayList<ChildNoteBean>>();
// HashMap<String, ArrayList<DiscrepancyNoteBean>> sDNs = new HashMap<String, ArrayList<DiscrepancyNoteBean>>();
logger.debug("Begin to execute GetOCEventDataDNsSql");
logger.debug("getOCEventDataDNsSql= " + this.getOCEventDataDNsSql(definitionOids, studySubjectOids));
ArrayList rows = select(this.getOCEventDataDNsSql(definitionOids, studySubjectOids));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
String studySubjectLabel = (String) row.get("study_subject_oid");
String defOid = (String) row.get("definition_oid");
Integer pdnId = (Integer) row.get("parent_dn_id");
Integer dnId = (Integer) row.get("dn_id");
String description = (String) row.get("description");
String detailedNote = (String) row.get("detailed_notes");
Integer ownerId = (Integer) row.get("owner_id");
Date dateCreated = (Date) row.get("date_created");
String status = (String) row.get("status");
String noteType = (String) row.get("name");
String oidKey = studySubjectLabel + defOid;
if (pdnId != null && pdnId > 0) {
String key = oidKey + pdnId;
ChildNoteBean cn = new ChildNoteBean();
cn.setDateCreated(dateCreated);
cn.setDescription(description);
cn.setDetailedNote(detailedNote);
cn.setStatus(status);
cn.setOid("CDN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
cn.setUserRef(userRef);
ArrayList<ChildNoteBean> cns = pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
cns.add(cn);
pDNs.put(key, cns);
} else {
DiscrepancyNoteBean dn = new DiscrepancyNoteBean();
String k = oidKey + dnId;
if (pDNs != null && pDNs.containsKey(k)) {
dn.setChildNotes(pDNs.get(k));
dn.setNumberOfChildNotes(dn.getChildNotes().size());
}
dn.setDateUpdated(dateCreated);
dn.setNoteType(noteType);
dn.setStatus(status);
dn.setOid("DN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
if (evnOidPoses.containsKey(oidKey)) {
String[] poses = evnOidPoses.get(oidKey).split("---");
int p0 = Integer.parseInt(poses[0]);
int p1 = Integer.parseInt(poses[1]);
String entityID = data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getStudyEventOID();
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getDiscrepancyNotes().setEntityID(entityID);
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
}
}
}
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setOCFormDataDNs.
protected void setOCFormDataDNs(OdmClinicalDataBean data, String ecIds, HashMap<Integer, String> formOidPoses) {
this.setOCFormDataDNsTypesExpected();
HashMap<String, ArrayList<ChildNoteBean>> pDNs = new HashMap<String, ArrayList<ChildNoteBean>>();
// HashMap<String, ArrayList<DiscrepancyNoteBean>> sDNs = new HashMap<String, ArrayList<DiscrepancyNoteBean>>();
logger.debug("Begin to execute GetOCEventDataDNsSql");
logger.debug("getOCFormDataDNsSql= " + this.getOCFormDataDNsSql(ecIds));
ArrayList rows = select(this.getOCFormDataDNsSql(ecIds));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
Integer ecId = (Integer) row.get("event_crf_id");
Integer pdnId = (Integer) row.get("parent_dn_id");
Integer dnId = (Integer) row.get("dn_id");
String description = (String) row.get("description");
String detailedNote = (String) row.get("detailed_notes");
Integer ownerId = (Integer) row.get("owner_id");
Date dateCreated = (Date) row.get("date_created");
String status = (String) row.get("status");
String noteType = (String) row.get("name");
if (pdnId != null && pdnId > 0) {
String key = ecId + "-" + pdnId;
ChildNoteBean cn = new ChildNoteBean();
cn.setDateCreated(dateCreated);
cn.setDescription(description);
cn.setDetailedNote(detailedNote);
cn.setStatus(status);
cn.setOid("CDN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
cn.setUserRef(userRef);
ArrayList<ChildNoteBean> cns = pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
cns.add(cn);
pDNs.put(key, cns);
} else {
DiscrepancyNoteBean dn = new DiscrepancyNoteBean();
String k = ecId + "-" + dnId;
if (pDNs != null && pDNs.containsKey(k)) {
dn.setChildNotes(pDNs.get(k));
dn.setNumberOfChildNotes(dn.getChildNotes().size());
}
dn.setDateUpdated(dateCreated);
dn.setNoteType(noteType);
dn.setStatus(status);
dn.setOid("DN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
if (formOidPoses.containsKey(ecId)) {
String[] poses = formOidPoses.get(ecId).split("---");
int p0 = Integer.parseInt(poses[0]);
int p1 = Integer.parseInt(poses[1]);
int p2 = Integer.parseInt(poses[2]);
String entityID = data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getFormOID();
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().setEntityID(entityID);
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
}
}
}
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class GenerateClinicalDataServiceImpl method fetchDiscrepancyNotes.
private DiscrepancyNotesBean fetchDiscrepancyNotes(StudySubject studySubj) {
List<DnStudySubjectMap> dnMaps = studySubj.getDnStudySubjectMaps();
DiscrepancyNotesBean dnNotesBean = new DiscrepancyNotesBean();
dnNotesBean.setEntityID(studySubj.getOcOid());
DiscrepancyNoteBean dnNoteBean = new DiscrepancyNoteBean();
DiscrepancyNoteBean dnSubjBean = new DiscrepancyNoteBean();
ArrayList<DiscrepancyNoteBean> dnNotes = new ArrayList<DiscrepancyNoteBean>();
boolean addDN = true;
for (DnStudySubjectMap dnMap : dnMaps) {
DiscrepancyNote dn = dnMap.getDiscrepancyNote();
addDN = true;
fillDNObject(dnNoteBean, dnNotes, addDN, dn, dnMap.getDnStudySubjectMapId().getColumnName());
}
dnNotesBean.setDiscrepancyNotes(dnNotes);
List<DnSubjectMap> dnSubjMaps = studySubj.getSubject().getDnSubjectMaps();
ArrayList<DiscrepancyNoteBean> dnSubjs = new ArrayList<DiscrepancyNoteBean>();
for (DnSubjectMap dnMap : dnSubjMaps) {
DiscrepancyNote dn = dnMap.getDiscrepancyNote();
addDN = true;
fillDNObject(dnSubjBean, dnSubjs, addDN, dn, dnMap.getDnSubjectMapId().getColumnName());
}
for (DiscrepancyNoteBean dnSubjMap : dnSubjs) dnNotesBean.getDiscrepancyNotes().add(dnSubjMap);
return dnNotesBean;
}
Aggregations