class HibernateDiagnosisDAO implements DiagnosisDAO {

	@Override
	public List<Diagnosis> getPrimaryDiagnoses(Encounter encounter) {
		Query query = sessionFactory.getCurrentSession().createQuery(
			"from Diagnosis d where d.encounter.encounterId = :encounterId and d.rank = :rankId order by dateCreated desc");
		query.setInteger("encounterId", encounter.getId());
		query.setInteger("rankId", PRIMARY_RANK);
		return query.list();
	}

}