use of org.akaza.openclinica.bean.odmbeans.ChildNoteBean in project OpenClinica by OpenClinica.
the class ClinicalDataReportBean method addOneDN.
protected void addOneDN(DiscrepancyNoteBean dn, String currentIndent) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
String nls = System.getProperty("line.separator");
// Boolean p = s.length()>0||i.length()>0||d.toString().length()>0||n>0 ? true : false;
xml.append(currentIndent + "<OpenClinica:DiscrepancyNote ");
if (dn.getOid() != null) {
String i = dn.getOid();
if (i.length() > 0) {
xml.append("ID=\"" + StringEscapeUtils.escapeXml(i) + "\" ");
}
}
if (dn.getStatus() != null) {
String s = dn.getStatus();
if (s.length() > 0) {
xml.append("Status=\"" + s + "\" ");
}
}
if (dn.getNoteType() != null) {
String s = dn.getNoteType();
if (s.length() > 0) {
xml.append("NoteType=\"" + s + "\" ");
}
}
if (dn.getDateUpdated() != null) {
Date d = dn.getDateUpdated();
if (d.toString().length() > 0) {
xml.append("DateUpdated=\"" + new SimpleDateFormat("yyyy-MM-dd").format(d) + "\" ");
}
}
if (dn.getEntityName() != null) {
String s = dn.getEntityName();
if (s.length() > 0) {
xml.append("EntityName=\"" + s + "\" ");
}
}
int n = dn.getNumberOfChildNotes();
if (n > 0) {
xml.append("NumberOfChildNotes=\"" + dn.getNumberOfChildNotes() + "\"");
}
xml.append(">");
xml.append(nls);
if (dn.getChildNotes() != null && dn.getChildNotes().size() > 0) {
for (ChildNoteBean cn : dn.getChildNotes()) {
xml.append(currentIndent + indent + "<OpenClinica:ChildNote ");
if (cn.getOid() != null) {
String s = cn.getOid();
if (s.length() > 0) {
xml.append("ID=\"" + s + "\" ");
}
}
if (cn.getStatus() != null) {
String s = cn.getStatus();
if (s.length() > 0) {
xml.append("Status=\"" + s + "\" ");
}
}
if (cn.getDateCreated() != null) {
Date d = cn.getDateCreated();
if (d.toString().length() > 0) {
xml.append("DateCreated=\"" + new SimpleDateFormat("yyyy-MM-dd").format(d) + "\" ");
}
}
if (cn.getOwnerUserName() != "") {
String ownerUserName = cn.getOwnerUserName();
if (ownerUserName.length() > 0) {
xml.append("UserName=\"" + ownerUserName + "\" ");
}
}
if (cn.getOwnerFirstName() != "" || cn.getOwnerLastName() != "") {
String ownerLastName = cn.getOwnerLastName();
String ownerFirstName = cn.getOwnerFirstName();
if (ownerLastName.length() > 0 || ownerFirstName.length() > 0) {
xml.append("Name=\"" + ownerFirstName + " " + ownerLastName + "\"");
}
}
xml.append(">");
xml.append(nls);
if (cn.getDescription() != null) {
String dc = cn.getDescription();
if (dc.length() > 0) {
xml.append(currentIndent + indent + indent + "<OpenClinica:Description>" + StringEscapeUtils.escapeXml(dc) + "</OpenClinica:Description>");
xml.append(nls);
}
}
if (cn.getDetailedNote() != null) {
String nt = cn.getDetailedNote();
if (nt.length() > 0) {
xml.append(currentIndent + indent + indent + "<OpenClinica:DetailedNote>" + StringEscapeUtils.escapeXml(nt) + "</OpenClinica:DetailedNote>");
xml.append(nls);
}
}
if (cn.getUserRef() != null) {
String uid = cn.getUserRef().getElementDefOID();
String userName = cn.getUserRef().getUserName();
String fullName = cn.getUserRef().getFullName();
String temp = "";
if (userName.length() > 0) {
temp += " OpenClinica:UserName=\"" + StringEscapeUtils.escapeXml(userName) + "\"";
}
if (fullName.length() > 0) {
temp += " OpenClinica:FullName=\"" + StringEscapeUtils.escapeXml(fullName) + "\"";
}
if (uid.length() > 0) {
xml.append(currentIndent + indent + indent + "<UserRef UserOID=\"" + StringEscapeUtils.escapeXml(uid) + " \"" + temp + "/>");
xml.append(nls);
}
}
xml.append(currentIndent + indent + "</OpenClinica:ChildNote>");
xml.append(nls);
}
}
xml.append(currentIndent + "</OpenClinica:DiscrepancyNote>");
xml.append(nls);
}
use of org.akaza.openclinica.bean.odmbeans.ChildNoteBean 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.ChildNoteBean 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.ChildNoteBean 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.ChildNoteBean in project OpenClinica by OpenClinica.
the class GenerateClinicalDataServiceImpl method fillDNObject.
private void fillDNObject(DiscrepancyNoteBean dnNoteBean, ArrayList<DiscrepancyNoteBean> dnNotes, boolean addDN, DiscrepancyNote dn, String columnName) {
if (dn.getParentDiscrepancyNote() != null) {
} else {
dnNoteBean = new DiscrepancyNoteBean();
dnNoteBean.setStatus(dn.getResolutionStatus().getName());
dnNoteBean.setNoteType(dn.getEntityType());
dnNoteBean.setOid("DN_" + dn.getDiscrepancyNoteId());
dnNoteBean.setNoteType(dn.getDiscrepancyNoteType().getName());
dnNoteBean.setDateUpdated(dn.getDateCreated());
dnNoteBean.setEntityName(columnName);
for (DiscrepancyNote childDN : dn.getChildDiscrepancyNotes()) {
ChildNoteBean childNoteBean = new ChildNoteBean();
childNoteBean.setOid("CDN_" + childDN.getDiscrepancyNoteId());
ElementRefBean userRef = new ElementRefBean();
childNoteBean.setDescription(childDN.getDescription());
childNoteBean.setStatus(childDN.getResolutionStatus().getName());
childNoteBean.setDetailedNote(childDN.getDetailedNotes());
childNoteBean.setDateCreated(childDN.getDateCreated());
if (childDN.getUserAccountByOwnerId() != null) {
childNoteBean.setOwnerUserName(childDN.getUserAccountByOwnerId().getUserName());
childNoteBean.setOwnerFirstName(childDN.getUserAccountByOwnerId().getFirstName());
childNoteBean.setOwnerLastName(childDN.getUserAccountByOwnerId().getLastName());
}
if (childDN.getUserAccount() != null) {
userRef.setElementDefOID("USR_" + childDN.getUserAccount().getUserId());
userRef.setUserName(childDN.getUserAccount().getUserName());
userRef.setFullName(childDN.getUserAccount().getFirstName() + " " + childDN.getUserAccount().getLastName());
} else {
userRef.setElementDefOID("");
userRef.setUserName("");
userRef.setFullName("");
}
childNoteBean.setUserRef(userRef);
dnNoteBean.getChildNotes().add(childNoteBean);
}
dnNoteBean.setNumberOfChildNotes(dnNoteBean.getChildNotes().size());
if (!dnNotes.contains(dnNoteBean)) {
dnNotes.add(dnNoteBean);
}
}
}
Aggregations