Search in sources :

Example 1 with DiscrepancyNoteBean

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);
        }
    }
}
Also used : DiscrepancyNoteBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean)

Example 2 with DiscrepancyNoteBean

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);
            }
        }
    }
}
Also used : ChildNoteBean(org.akaza.openclinica.bean.odmbeans.ChildNoteBean) ElementRefBean(org.akaza.openclinica.bean.odmbeans.ElementRefBean) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DiscrepancyNoteBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Date(java.util.Date)

Example 3 with DiscrepancyNoteBean

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);
            }
        }
    }
}
Also used : ElementRefBean(org.akaza.openclinica.bean.odmbeans.ElementRefBean) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Date(java.util.Date) ChildNoteBean(org.akaza.openclinica.bean.odmbeans.ChildNoteBean) DiscrepancyNoteBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean) Iterator(java.util.Iterator)

Example 4 with DiscrepancyNoteBean

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);
            }
        }
    }
}
Also used : ElementRefBean(org.akaza.openclinica.bean.odmbeans.ElementRefBean) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Date(java.util.Date) ChildNoteBean(org.akaza.openclinica.bean.odmbeans.ChildNoteBean) DiscrepancyNoteBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean) Iterator(java.util.Iterator)

Example 5 with DiscrepancyNoteBean

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;
}
Also used : DnStudySubjectMap(org.akaza.openclinica.domain.datamap.DnStudySubjectMap) DiscrepancyNotesBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNotesBean) DiscrepancyNote(org.akaza.openclinica.domain.datamap.DiscrepancyNote) DiscrepancyNoteBean(org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean) ArrayList(java.util.ArrayList) DnSubjectMap(org.akaza.openclinica.domain.datamap.DnSubjectMap)

Aggregations

DiscrepancyNoteBean (org.akaza.openclinica.bean.odmbeans.DiscrepancyNoteBean)10 ArrayList (java.util.ArrayList)8 ChildNoteBean (org.akaza.openclinica.bean.odmbeans.ChildNoteBean)5 ElementRefBean (org.akaza.openclinica.bean.odmbeans.ElementRefBean)5 DiscrepancyNote (org.akaza.openclinica.domain.datamap.DiscrepancyNote)5 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Iterator (java.util.Iterator)4 LinkedHashMap (java.util.LinkedHashMap)4 DiscrepancyNotesBean (org.akaza.openclinica.bean.odmbeans.DiscrepancyNotesBean)4 DnEventCrfMap (org.akaza.openclinica.domain.datamap.DnEventCrfMap)1 DnItemDataMap (org.akaza.openclinica.domain.datamap.DnItemDataMap)1 DnStudyEventMap (org.akaza.openclinica.domain.datamap.DnStudyEventMap)1 DnStudySubjectMap (org.akaza.openclinica.domain.datamap.DnStudySubjectMap)1 DnSubjectMap (org.akaza.openclinica.domain.datamap.DnSubjectMap)1