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(StudyEvent studyEvent) {
List<DnStudyEventMap> dnMaps = studyEvent.getDnStudyEventMaps();
DiscrepancyNotesBean dnNotesBean = new DiscrepancyNotesBean();
dnNotesBean.setEntityID(studyEvent.getStudyEventDefinition().getOc_oid());
DiscrepancyNoteBean dnNoteBean = new DiscrepancyNoteBean();
ArrayList<DiscrepancyNoteBean> dnNotes = new ArrayList<DiscrepancyNoteBean>();
boolean addDN = true;
for (DnStudyEventMap dnMap : dnMaps) {
DiscrepancyNote dn = dnMap.getDiscrepancyNote();
addDN = true;
fillDNObject(dnNoteBean, dnNotes, addDN, dn, dnMap.getDnStudyEventMapId().getColumnName());
}
dnNotesBean.setDiscrepancyNotes(dnNotes);
return dnNotesBean;
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class GenerateClinicalDataServiceImpl method fetchDiscrepancyNotes.
private DiscrepancyNotesBean fetchDiscrepancyNotes(ItemData itemData) {
List<DnItemDataMap> dnItemDataMaps = itemData.getDnItemDataMaps();
DiscrepancyNotesBean dnNotesBean = new DiscrepancyNotesBean();
dnNotesBean.setEntityID(itemData.getItem().getOcOid());
if (isCollectDns()) {
DiscrepancyNoteBean dnNoteBean = new DiscrepancyNoteBean();
ArrayList<DiscrepancyNoteBean> dnNotes = new ArrayList<DiscrepancyNoteBean>();
boolean addDN = true;
for (DnItemDataMap dnItemDataMap : dnItemDataMaps) {
DiscrepancyNote dn = dnItemDataMap.getDiscrepancyNote();
addDN = true;
fillDNObject(dnNoteBean, dnNotes, addDN, dn, null);
}
dnNotesBean.setDiscrepancyNotes(dnNotes);
}
return dnNotesBean;
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean 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);
}
}
}
use of org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setOCItemDataDNs.
protected void setOCItemDataDNs(OdmClinicalDataBean data, String idataIds, HashMap<Integer, String> idataOidPoses) {
this.setOCItemDataDNsTypesExpected();
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 GetOCItemDataDNsSql");
logger.debug("getOCItemDataDNsSql= " + this.getOCItemDataDNsSql(idataIds));
ArrayList rows = select(this.getOCItemDataDNsSql(idataIds));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
Integer idataId = (Integer) row.get("item_data_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 = idataId + "-" + 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 = idataId + "-" + 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 (idataOidPoses.containsKey(idataId)) {
String[] poses = idataOidPoses.get(idataId).split("---");
int p0 = Integer.parseInt(poses[0]);
int p1 = Integer.parseInt(poses[1]);
int p2 = Integer.parseInt(poses[2]);
int p3 = Integer.parseInt(poses[3]);
int p4 = Integer.parseInt(poses[4]);
String entityID = data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getItemOID();
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getDiscrepancyNotes().setEntityID(entityID);
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
}
}
}
}
Aggregations