/** * get admission recod fo a context */ public OnAdmissionSummaryVo get(ClinicalContactRefVo clinicalContactRefVo, ClinicalNoteType noteType, HcpDisType disciplineType, CareContextRefVo careContextRefVo) { if(careContextRefVo == null) throw new DomainRuntimeException("Cannot get OnAdmissionSummaryVo for null CareContextRefVo "); ArrayList<Serializable> values = new ArrayList<Serializable>(); ArrayList<String> params = new ArrayList<String>(); StringBuffer hql = new StringBuffer(); hql.append("from OnAdmissionSummary oas"); String clause = " where "; if(clinicalContactRefVo != null) { hql.append(clause); hql.append("oas.clinicalContact.id = :clinicalContactId"); params.add("clinicalContactId"); values.add(clinicalContactRefVo.getID_ClinicalContact()); clause = " and "; } hql.append(clause); hql.append("oas.careContext.id = :careContextId"); params.add("careContextId"); values.add(careContextRefVo.getID_CareContext()); clause = " and "; if(noteType != null) { hql.append(clause); hql.append("oas.admissionNotes.noteType = :noteType"); params.add("noteType"); values.add(getDomLookup(noteType)); clause = " and "; } if(disciplineType != null) { hql.append(clause); hql.append("oas.admissionNotes.discipline = :discType"); params.add("discType"); values.add(getDomLookup(disciplineType)); clause = " and "; } DomainFactory factory = getDomainFactory(); java.util.List assSumList = factory.find(hql.toString(), params, values); if ((assSumList != null) && (assSumList.size()>0)) { //wdev-7165 - assSumList contains records RIE, but col will not. OnAdmissionSummaryVoCollection col = OnAdmissionSummaryVoAssembler.createOnAdmissionSummaryVoCollectionFromOnAdmissionSummary(assSumList); return col.size() > 0 ? col.get(0) : null; } else return null; }