Search in sources :

Example 1 with EventDefinitionCrf

use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.

the class OdmImportServiceImpl method updateEventDefinitionCrf.

private EventDefinitionCrf updateEventDefinitionCrf(EventDefinitionCrfDTO edcObj) {
    EventDefinitionCrf eventDefinitionCrf = edcObj.getEventDefinitionCrf();
    eventDefinitionCrf = populateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj));
    eventDefinitionCrf.setUpdateId(edcObj.getUserAccount().getUserId());
    eventDefinitionCrf.setDateUpdated(new Date());
    return eventDefinitionCrf;
}
Also used : EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf) Date(java.util.Date)

Example 2 with EventDefinitionCrf

use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.

the class OdmImportServiceImpl method saveOrUpdateEventDefnCrf.

private EventDefinitionCrf saveOrUpdateEventDefnCrf(EventDefinitionCrfDTO edcObj) {
    EventDefinitionCrf eventDefinitionCrf = edcObj.getEventDefinitionCrf();
    if (eventDefinitionCrf == null) {
        eventDefinitionCrf = new EventDefinitionCrf();
        edcObj.setEventDefinitionCrf(eventDefinitionCrf);
        eventDefinitionCrf = getEventDefinitionCrfDao().saveOrUpdate(populateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj)));
    } else {
        eventDefinitionCrf = getEventDefinitionCrfDao().saveOrUpdate(updateEventDefinitionCrf(new EventDefinitionCrfDTO(edcObj)));
    }
    return eventDefinitionCrf;
}
Also used : EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf)

Example 3 with EventDefinitionCrf

use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.

the class EventDefinitionCrfDao method findByStudyEventDefinitionIdAndCRFIdAndStudyId.

@SuppressWarnings("unchecked")
public EventDefinitionCrf findByStudyEventDefinitionIdAndCRFIdAndStudyId(Integer studyEventDefinitionId, Integer crfId, Integer studyId) {
    String query = "from " + getDomainClassName() + " do where do.studyEventDefinition.studyEventDefinitionId = :studyeventdefid " + " and do.study.studyId = :studyid and do.crf.crfId = :crfid";
    Query q = getCurrentSession().createQuery(query);
    q.setInteger("studyeventdefid", studyEventDefinitionId);
    q.setInteger("studyid", studyId);
    q.setInteger("crfid", crfId);
    return (EventDefinitionCrf) q.uniqueResult();
}
Also used : Query(org.hibernate.Query) EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf)

Example 4 with EventDefinitionCrf

use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.

the class StudyEventController method completeData.

@Transactional
private void completeData(StudyEvent studyEvent, List<EventDefinitionCrf> eventDefCrfs, List<EventCrf> eventCrfs) throws Exception {
    boolean completeStudyEvent = true;
    // Loop thru event CRFs and complete all that are participant events.
    for (EventDefinitionCrf eventDefCrf : eventDefCrfs) {
        boolean foundEventCrfMatch = false;
        for (EventCrf eventCrf : eventCrfs) {
            if (eventDefCrf.getCrf().getCrfId() == eventCrf.getCrfVersion().getCrf().getCrfId()) {
                foundEventCrfMatch = true;
                if (eventDefCrf.getParicipantForm()) {
                    eventCrf.setStatusId(Status.UNAVAILABLE.getCode());
                    eventCrfDao.saveOrUpdate(eventCrf);
                } else if (eventCrf.getStatusId() != Status.UNAVAILABLE.getCode())
                    completeStudyEvent = false;
            }
        }
        if (!foundEventCrfMatch && !eventDefCrf.getParicipantForm())
            completeStudyEvent = false;
    }
    // Complete study event only if there are no uncompleted, non-participant forms.
    if (completeStudyEvent) {
        studyEvent.setSubjectEventStatusId(4);
        StudyEventChangeDetails changeDetails = new StudyEventChangeDetails(true, false);
        StudyEventContainer container = new StudyEventContainer(studyEvent, changeDetails);
        studyEventDao.saveOrUpdateTransactional(container);
    }
}
Also used : EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) StudyEventChangeDetails(org.akaza.openclinica.patterns.ocobserver.StudyEventChangeDetails) EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf) StudyEventContainer(org.akaza.openclinica.patterns.ocobserver.StudyEventContainer) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with EventDefinitionCrf

use of org.akaza.openclinica.domain.datamap.EventDefinitionCrf in project OpenClinica by OpenClinica.

the class GenerateClinicalDataServiceImpl method getFormDataForClinicalStudy.

private ArrayList<ExportFormDataBean> getFormDataForClinicalStudy(StudySubject ss, StudyEvent se, String formVersionOID) {
    List<ExportFormDataBean> formDataBean = new ArrayList<ExportFormDataBean>();
    boolean formCheck = true;
    if (formVersionOID != null)
        formCheck = false;
    boolean hiddenCrfCheckPassed = true;
    List<CrfBean> hiddenCrfs = new ArrayList<CrfBean>();
    for (EventCrf ecrf : se.getEventCrfs()) {
        List<EventDefinitionCrf> edcs = se.getStudyEventDefinition().getEventDefinitionCrfs();
        hiddenCrfCheckPassed = true;
        int siteId = 0;
        int parentStudyId = 0;
        Study study = ss.getStudy();
        if (study.getStudy() != null && isActiveRoleAtSite) {
            // it is site subject
            siteId = study.getStudyId();
            parentStudyId = study.getStudy().getStudyId();
            hiddenCrfs = listOfHiddenCrfs(siteId, parentStudyId, edcs, ecrf);
            if (hiddenCrfs.contains(ecrf.getCrfVersion().getCrf())) {
                hiddenCrfCheckPassed = false;
            }
        }
        // This logic is to use the same method for both S_OID/SS_OID/*/* and full path
        if (hiddenCrfCheckPassed) {
            if (!formCheck) {
                if (ecrf.getCrfVersion().getOcOid().equals(formVersionOID))
                    formCheck = true;
                else
                    formCheck = false;
            }
            if (formCheck) {
                ExportFormDataBean dataBean = new ExportFormDataBean();
                dataBean.setItemGroupData(fetchItemData(ecrf.getCrfVersion().getItemGroupMetadatas(), ecrf.getEventCrfId(), ecrf.getCrfVersion().getVersioningMaps(), ecrf));
                dataBean.setFormOID(ecrf.getCrfVersion().getOcOid());
                if (ecrf.getDateInterviewed() != null)
                    dataBean.setInterviewDate(ecrf.getDateInterviewed() + "");
                if (ecrf.getInterviewerName() != null)
                    dataBean.setInterviewerName(ecrf.getInterviewerName());
                // dataBean.setStatus(EventCRFStatus.getByCode(Integer.valueOf(ecrf.getStatus().getCode())).getI18nDescription(getLocale()));
                dataBean.setStatus(fetchEventCRFStatus(ecrf));
                if (ecrf.getCrfVersion().getName() != null)
                    dataBean.setCrfVersion(ecrf.getCrfVersion().getName());
                if (collectAudits)
                    dataBean.setAuditLogs(fetchAuditLogs(ecrf.getEventCrfId(), "event_crf", ecrf.getCrfVersion().getOcOid(), null));
                if (collectDns)
                    dataBean.setDiscrepancyNotes(fetchDiscrepancyNotes(ecrf));
                formDataBean.add(dataBean);
                if (formVersionOID != null)
                    formCheck = false;
            }
        }
    }
    return (ArrayList<ExportFormDataBean>) formDataBean;
}
Also used : ExportFormDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean) EventCrf(org.akaza.openclinica.domain.datamap.EventCrf) CrfBean(org.akaza.openclinica.domain.datamap.CrfBean) Study(org.akaza.openclinica.domain.datamap.Study) ArrayList(java.util.ArrayList) EventDefinitionCrf(org.akaza.openclinica.domain.datamap.EventDefinitionCrf)

Aggregations

EventDefinitionCrf (org.akaza.openclinica.domain.datamap.EventDefinitionCrf)9 EventCrf (org.akaza.openclinica.domain.datamap.EventCrf)4 Study (org.akaza.openclinica.domain.datamap.Study)4 ArrayList (java.util.ArrayList)3 CrfBean (org.akaza.openclinica.domain.datamap.CrfBean)3 StudyEventDefinition (org.akaza.openclinica.domain.datamap.StudyEventDefinition)3 Date (java.util.Date)2 FormLayout (org.akaza.openclinica.domain.datamap.FormLayout)2 StudyEvent (org.akaza.openclinica.domain.datamap.StudyEvent)2 StudySubject (org.akaza.openclinica.domain.datamap.StudySubject)2 UserAccount (org.akaza.openclinica.domain.user.UserAccount)2 Transactional (org.springframework.transaction.annotation.Transactional)2 HashMap (java.util.HashMap)1 ExportFormDataBean (org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean)1 CrfVersion (org.akaza.openclinica.domain.datamap.CrfVersion)1 Item (org.akaza.openclinica.domain.datamap.Item)1 StudyParameterValue (org.akaza.openclinica.domain.datamap.StudyParameterValue)1 StudyUserRole (org.akaza.openclinica.domain.datamap.StudyUserRole)1 StudyUserRoleId (org.akaza.openclinica.domain.datamap.StudyUserRoleId)1 StudyEventChangeDetails (org.akaza.openclinica.patterns.ocobserver.StudyEventChangeDetails)1