Skip to content

Commit

Permalink
REPORT-823: Improved the preview pages of query definitions.
Browse files Browse the repository at this point in the history
* Cohort Queries
  * Previously, the preview page for cohort query definitions did not display enough
information; only the size of the cohort was shown.
  * Now, the preview page for cohort query definitions shows a pageable list of patient IDs in
the cohort.
* Person Queries
  * Previously, the preview page for person query definitions displayed too much information;
the table was often too long and required scrolling to see all of the entries.
  * Now, the preview page for person query definitions shows a pageable list of patient IDs.

* The preview pages for both cohort and person query definitions now share the same style to
create a consistent look among the two.
  • Loading branch information
sstream17 committed May 4, 2019
1 parent 5a7f860 commit e286876
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -360,7 +361,7 @@ private void printCohortDimensionResult(StringBuilder sb, CohortDimensionResult
* @param cohort
*/
private void printCohort(StringBuilder sb, Cohort cohort) {
sb.append(cohort.size() + " patients");
printCollection(sb, cohort.getMemberIds());
}

private void printObsValue(StringBuilder sb, Obs obsValue) {
Expand Down Expand Up @@ -402,14 +403,14 @@ private void printMap(StringBuilder sb, Map<?, ?> m) {

private void printCollection(StringBuilder sb, Collection<?> c){
if(c != null){
sb.append("<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">");
sb.append("<tr><th align=\"left\">" + Context.getMessageSourceService().getMessage("reporting.ids") + "</th></tr>");
sb.append("<table id=\"collectionTable\" cellspacing=\"0\" cellpadding=\"2\" border=\"1\"></table>");
Collection<Object> tableData = new ArrayList<Object>();
for (Object item : c) {
sb.append("<tr><td align=\"left\">");
printObject(sb, item);
sb.append("</td></tr>");
Collection<Object> tableRow = new ArrayList<Object>();
tableRow.add(item);
tableData.add(tableRow);
}
sb.append("</table>");
sb.append("<script>$j('#collectionTable').dataTable({\"aaData\":" + tableData + ", \"bPaginate\":true, \"bLengthChange\":false, \"bFilter\":false, \"bSort\":false, \"bInfo\":true, \"bAutoWidth\":false, \"aoColumns\":[{\"sTitle\": \"" + Context.getMessageSourceService().getMessage("reporting.ids") + "\"}]});</script>");
}
}

Expand Down Expand Up @@ -567,4 +568,4 @@ public void setDate(Date date) {
this.date = date;
}

}
}

0 comments on commit e286876

Please sign in to comment.