/** * List all the Reports that are active */ public TemplateForPatientDocumentVoCollection listReports(String templateName, TemplateBoRefVoCollection notThisOnes, DocumentCategory cat) { String hql = "select tem from TemplateBo as tem left join tem.report as rep where (tem.name like :name and tem.isActive = 1 and rep.isActive = 1 and tem.isRIE is null "; ArrayList<String> paramNames = new ArrayList<String>(); paramNames.add("name"); ArrayList<Object> paramValues = new ArrayList<Object>(); paramValues.add(templateName != null ? "%" + templateName + "%" : "%"); if (notThisOnes != null && notThisOnes.size() > 0) { hql += " and tem.id not in ("; for (int i = 0; i < notThisOnes.size(); i++) { hql += notThisOnes.get(i).getID_TemplateBo(); if (i < (notThisOnes.size() - 1)) { hql += ","; } } hql += " )"; } // Only not configured or configured for this category if (cat != null) { hql += " and tem.id not in " + "(select dtem.id from DocumentCategoryConfig as dcc left join dcc.template as dtem " + "where (dcc.category.id <> :cat)) "; paramNames.add("cat"); paramValues.add(cat.getId()); } hql += ") order by upper(rep.reportName) asc, upper(tem.name) asc";// WDEV-13654 List<?> dOs = getDomainFactory().find(hql, paramNames, paramValues); if (dOs == null || dOs.size() == 0) return null; return TemplateForPatientDocumentVoAssembler.createTemplateForPatientDocumentVoCollectionFromTemplateBo(dOs); }
public TemplateForPatientDocumentVoCollection searchReports(String templateName, String listOfMandatorySeeds, DocumentCategory documentType, Specialty specialty) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String subHql = ""; if(listOfMandatorySeeds != null && listOfMandatorySeeds.length() > 0) { subHql = " and r21.bOName not in (" + listOfMandatorySeeds + ")"; } String mainHql = "select t from DocumentCategoryConfig as d left join d.template as t left join t.report as r"; String whereHql = " where t.id not in (select t11.id from TemplateBo as t11 left join t11.report as r11 left join r11.seeds as r21 where (r21.canBeNull = 0" + subHql + ")) and r.reportXml is not null and t.templateXml is not null and r.isActive = 1 and t.isActive = 1";//WDEV-13547 if(templateName != null && templateName.length() > 0) { whereHql += " and upper(t.name) like :templateName";//WDEV-13750 markers.add("templateName"); values.add(templateName.toUpperCase() + "%");//WDEV-13750 } if(documentType != null) { whereHql += " and d.category.id = :catId"; markers.add("catId"); values.add(documentType.getID()); } if(specialty != null) { mainHql += " left join d.specialty as s left join s.instance as i"; whereHql += " and i.id = :specialtyId"; markers.add("specialtyId"); values.add(specialty.getID()); } String hql = mainHql + whereHql + " order by upper(r.reportName) asc, upper(t.name) asc";//WDEV-13547 List<?> list = factory.find(hql, markers, values); return TemplateForPatientDocumentVoAssembler.createTemplateForPatientDocumentVoCollectionFromTemplateBo(list);//WDEV-13547 }