public Date initialScreeningDate(Long clientId) { List resultList = null; Date returnDate = null; String hql = "Select min(c.performedDate)from RsdiFormColorectalCancer c " + "where c.rsdiFormClientSnapshot.clientId = :clientId "; Query q = getEntityManager().createQuery(hql); q.setParameter("clientId", String.valueOf(clientId)); resultList = q.getResultList(); if (resultList.size() >= 1) { returnDate = (Date) resultList.get(0); } return returnDate; }
public Date nextFollowupDate(Long clientId) { List resultList = null; Date returnDate = null; String hql = "Select c.recommendedFollowupDate from RsdiFormColorectalCancer c " + "where c.rsdiFormClientSnapshot.clientId = :clientId " + "and c.performedDate IN( " + "select max(c2.performedDate) from RsdiFormColorectalCancer c2 " + "where c2.rsdiFormClientSnapshot.clientId = :clientId ) "; Query q = getEntityManager().createQuery(hql); q.setParameter("clientId", String.valueOf(clientId)); resultList = q.getResultList(); if (resultList.size() >= 1) { returnDate = (Date) resultList.get(0); } return returnDate; }