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