Search in sources :

Example 6 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 7 with DiscrepancyNoteBean

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;
}
Also used : 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) DnStudyEventMap(org.akaza.openclinica.domain.datamap.DnStudyEventMap)

Example 8 with DiscrepancyNoteBean

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;
}
Also used : 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) DnItemDataMap(org.akaza.openclinica.domain.datamap.DnItemDataMap)

Example 9 with DiscrepancyNoteBean

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

Example 10 with DiscrepancyNoteBean

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);
            }
        }
    }
}
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)

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