/// <summary> /// Builds a query that searches for patient items. /// </summary> /// <param name="args"></param> /// <returns></returns> private HqlProjectionQuery BuildPatientSearchQuery(QueryBuilderArgs args) { var query = new HqlProjectionQuery(); _patientQueryBuilder.AddRootQuery(query, null); _patientQueryBuilder.AddCriteria(query, args); if (args.CountQuery) { _patientQueryBuilder.AddCountProjection(query, args); } else { _patientQueryBuilder.AddItemProjection(query, args); } return(query); }