Changeset 2178
- Timestamp:
- Dec 12, 2013, 11:42:30 AM (10 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/reports/samplereportgenerator.jsp
r2159 r2178 477 477 else if ('overviewreport' == reportType) 478 478 { 479 var spacer0 = document.createElement('text'); 480 spacer0.innerHTML = "<BR>"; 481 cellElement.appendChild(spacer0); 479 482 var spacer = document.createElement('text'); 480 483 spacer.innerHTML = "<BR>"; 484 cellElement.appendChild(spacer); 485 // Table with patients having at least one item of different sample types 486 cellElement.appendChild(spacer); 487 var patientWithSampleTable = createOverviewPatientWithSampleTable(report); 488 cellElement.appendChild(patientWithSampleTable); 489 // Table with patients having different combinations of sample types 481 490 cellElement.appendChild(spacer); 482 491 var patientDetailedTable = createOverviewPatientDetailedTable(report); … … 1092 1101 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1093 1102 data = getJSONData(sitesCombined, 'consentMissing'); 1103 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1104 } 1105 reportTable.appendChild(sitesCombinedRow); 1106 1107 return reportTable; 1108 } 1109 1110 function createOverviewPatientWithSampleTable(report) 1111 { 1112 var reportTable = getReportTable(); 1113 var bloodSampleFilter = report.bloodSampleFilter; 1114 var sdString = report.beginDate; 1115 var edString = report.endDate; 1116 var ldString = report.latestDate; 1117 var startDate = dateStrToDate(sdString); 1118 var endDate = dateStrToDate(edString); 1119 var latestDate = dateStrToDate(ldString); 1120 1121 var headerRow = document.createElement('tr'); 1122 var subHeaderRow = document.createElement('tr'); 1123 var subHeader2Row = document.createElement('tr'); 1124 var columnHeaderRow = document.createElement('tr'); 1125 1126 var numCols = 7; 1127 var numDecimals = 0; 1128 var headerText = 'Patients having a sample type item'; 1129 if (bloodSampleFilter != null && bloodSampleFilter != 'none') 1130 { 1131 bloodSampleFilterDisplayText = getBloodSampleFilterDisplayText(bloodSampleFilter); 1132 headerText += ', blood sample type = \'' + bloodSampleFilterDisplayText + '\''; 1133 } 1134 var startDateStr = addHyphensToDateString(sdString); 1135 var endDateStr = addHyphensToDateString(edString); 1136 var latestDateStr = addHyphensToDateString(ldString); 1137 headerText += ' (betweeen ' + startDateStr + ' and ' + endDateStr + ')'; 1138 headerText += '\nColumn entries are non-exclusive, i.e. a patient may be represented in several columns'; 1139 headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+3))); 1140 1141 // Subheader 1142 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader', 3)); 1143 1144 subHeaderRow.appendChild(getTableCellElement('Patients', 'reportsubheader')); 1145 subHeaderRow.appendChild(getTableCellElement('with', 'reportsubheader')); 1146 subHeaderRow.appendChild(getTableCellElement('with', 'reportsubheader')); 1147 subHeaderRow.appendChild(getTableCellElement('with', 'reportsubheader')); 1148 subHeaderRow.appendChild(getTableCellElement('with', 'reportsubheader')); 1149 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1150 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1151 1152 // Subheader 2 1153 subHeader2Row.appendChild(getTableCellElement('', 'reportsubheader', 3)); 1154 1155 subHeader2Row.appendChild(getTableCellElement('total', 'reportsubheader')); 1156 subHeader2Row.appendChild(getTableCellElement('blood', 'reportsubheader')); 1157 subHeader2Row.appendChild(getTableCellElement('follow-up', 'reportsubheader')); 1158 subHeader2Row.appendChild(getTableCellElement('specimen(s)', 'reportsubheader')); 1159 subHeader2Row.appendChild(getTableCellElement('no specimen(s)', 'reportsubheader')); 1160 subHeader2Row.appendChild(getTableCellElement('', 'reportsubheader')); 1161 subHeader2Row.appendChild(getTableCellElement('', 'reportsubheader')); 1162 1163 // Columnsheader 1164 var siteHeader = getTableCellElement('Site', 'reportsubheader'); 1165 var startDateHeader = getTableCellElement('Start date','reportsubheader'); 1166 var latestDateHeader = getTableCellElement('Latest date','reportsubheader'); 1167 columnHeaderRow.appendChild(siteHeader); 1168 columnHeaderRow.appendChild(startDateHeader); 1169 columnHeaderRow.appendChild(latestDateHeader); 1170 1171 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1172 columnHeaderRow.appendChild(getTableCellElement('sample(s)', 'reportsubheader')); 1173 columnHeaderRow.appendChild(getTableCellElement('blood s.', 'reportsubheader')); 1174 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1175 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1176 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1177 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 1178 1179 // Build table 1180 reportTable.appendChild(headerRow); 1181 reportTable.appendChild(subHeaderRow); 1182 reportTable.appendChild(subHeader2Row); 1183 reportTable.appendChild(columnHeaderRow); 1184 1185 // Data rows 1186 addDataRowsToOverviewPatientWithSampleTable(report, reportTable); 1187 1188 // Add a row with the combined numbers for all sites for each period 1189 var sitesCombinedRow = document.createElement('tr'); 1190 sitesCombinedRow.appendChild(getTableCellElement('Sites combined', 'colsummary')); 1191 sitesCombinedRow.appendChild(getTableCellElement('', 'colsummary', 2)); 1192 // Get combined numbers for all sites for each period 1193 var noDateKey = 'noDate'; 1194 var sumKey = 'sumKey'; 1195 var statistics = report.statistics; 1196 // Get values for use in summary section 1197 numPatientsNoSamples = statistics.patientNoSamples; 1198 var sitesCombined = statistics.sitesCombinedKey; 1199 if (sitesCombined != null) 1200 { 1201 data = getJSONData(sitesCombined, 'patient'); 1202 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1203 data = getJSONData(sitesCombined, 'patientWithBloodSample'); 1204 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1205 data = getJSONData(sitesCombined, 'patientWithFollowUpBloodSample'); 1206 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1207 data = getJSONData(sitesCombined, 'patientWithSpecimen'); 1208 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1209 data = getJSONData(sitesCombined, 'patientWithNoSpecimen'); 1094 1210 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 1095 1211 } … … 1668 1784 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1669 1785 data = getJSONData(siteData, 'consentMissing'); 1786 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1787 } 1788 reportTable.appendChild(tableRow); 1789 } 1790 } 1791 1792 function addDataRowsToOverviewPatientWithSampleTable(report, reportTable) 1793 { 1794 var sites = report.sites; 1795 var statistics = report.statistics; 1796 unknownCreation = statistics.noDate; 1797 unknownSite = statistics.unknownSite; 1798 var siteOrderList = report.siteOrderListKey; 1799 for (var siteOrderIndex in siteOrderList) 1800 { 1801 var namePrefix = siteOrderList[siteOrderIndex]; 1802 if (!sites.hasOwnProperty(namePrefix)) continue; 1803 var site = sites[namePrefix]; 1804 var siteName = site.name; 1805 var siteStartDate = dateStrToDate(site.startDate); 1806 var siteStartDateStr = addHyphensToDateString(site.startDate); 1807 1808 var siteData = statistics[namePrefix]; 1809 var siteLatestDate = siteData['latestDateKey']; 1810 var siteLatestDateStr = addHyphensToDateString(siteLatestDate); 1811 var tableRow = document.createElement('tr'); 1812 var tableCol = getTableCellElement(siteName, 'rowtitle'); 1813 tableRow.appendChild(tableCol); 1814 tableRow.appendChild(getTableCellElement(siteStartDateStr, 'reportdata')); 1815 tableRow.appendChild(getTableCellElement(siteLatestDateStr, 'reportdata')); 1816 var noDateKey = 'noDate'; 1817 var sumKey = 'sumKey'; 1818 var totalKey = 'totalKey'; 1819 if (siteData != null) 1820 { 1821 data = getJSONData(siteData, 'patient'); 1822 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1823 data = getJSONData(siteData, 'patientWithBloodSample'); 1824 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1825 data = getJSONData(siteData, 'patientWithFollowUpBloodSample'); 1826 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1827 data = getJSONData(siteData, 'patientWithSpecimen'); 1828 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1829 data = getJSONData(siteData, 'patientWithNoSpecimen'); 1670 1830 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1671 1831 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java
r2160 r2178 976 976 String specimenKey = "specimen"; 977 977 String noSpecimenKey = "noSpecimen"; 978 String patientWithSpecimenKey = "patientWithSpecimen"; 979 String patientWithNoSpecimenKey = "patientWithNoSpecimen"; 980 String patientWithBloodSampleKey = "patientWithBloodSample"; 981 String patientWithFollowUpBloodSampleKey = "patientWithFollowUpBloodSample"; 978 982 String patientBloodSampleOnlyKey = "patientBloodSampleOnly"; 979 983 String patientSpecimenOnlyKey = "patientSpecimenOnly"; … … 997 1001 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, specimenKey); 998 1002 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noSpecimenKey); 1003 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientWithSpecimenKey); 1004 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientWithNoSpecimenKey); 1005 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientWithBloodSampleKey); 1006 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientWithFollowUpBloodSampleKey); 999 1007 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientBloodSampleOnlyKey); 1000 1008 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientSpecimenOnlyKey); … … 1014 1022 jsonSitesCombined.put(specimenKey, 0); 1015 1023 jsonSitesCombined.put(noSpecimenKey, 0); 1024 jsonSitesCombined.put(patientWithSpecimenKey, 0); 1025 jsonSitesCombined.put(patientWithNoSpecimenKey, 0); 1026 jsonSitesCombined.put(patientWithBloodSampleKey, 0); 1027 jsonSitesCombined.put(patientWithFollowUpBloodSampleKey, 0); 1016 1028 jsonSitesCombined.put(patientBloodSampleOnlyKey, 0); 1017 1029 jsonSitesCombined.put(patientSpecimenOnlyKey, 0); … … 1035 1047 // Set of patient id's for patients with blood samples 1036 1048 Set<String> patientsWithBloodSamplesSet = new HashSet<String>(); 1049 // Set of patient id's for patients with follow-up blood samples 1050 Set<String> patientsWithFollowUpBloodSamplesSet = new HashSet<String>(); 1037 1051 // Set of patient id's for patients with specimens 1038 1052 Set<String> patientsWithSpecimensSet = new HashSet<String>(); … … 1191 1205 // Add patient to patients with blood samples set 1192 1206 patientsWithBloodSamplesSet.add(patientId); 1207 // Get blood sample annotation 1208 String bloodSampleType = (String) Annotationtype.BLOOD_SAMPLE.getAnnotationValue(dc, manager, s); 1209 if (bloodSampleType != null && 1210 (bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_06) 1211 || bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_12) 1212 || bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_36)) 1213 ) 1214 { 1215 patientsWithFollowUpBloodSamplesSet.add(patientId); 1216 } 1193 1217 } 1194 1218 } … … 1323 1347 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, patientKey); 1324 1348 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, patientKey); 1349 // Update data for patients having different kinds of samples 1350 if (patientsWithSpecimensSet.contains(patId)) 1351 { 1352 // Patient with at least one specimen 1353 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, patientWithSpecimenKey); 1354 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, patientWithSpecimenKey); 1355 } 1356 if (patientsWithNoSpecimensSet.contains(patId)) 1357 { 1358 // Patient with at least one no specimen 1359 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, patientWithNoSpecimenKey); 1360 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, patientWithNoSpecimenKey); 1361 } 1362 if (patientsWithBloodSamplesSet.contains(patId)) 1363 { 1364 // Patient with at least one blood sample 1365 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, patientWithBloodSampleKey); 1366 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, patientWithBloodSampleKey); 1367 } 1368 if (patientsWithFollowUpBloodSamplesSet.contains(patId)) 1369 { 1370 // Patient with at least one follow-up blood sample 1371 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, patientWithFollowUpBloodSampleKey); 1372 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, patientWithFollowUpBloodSampleKey); 1373 } 1374 // Update data for patient records of different kinds 1325 1375 if (patientsWithSpecimensSet.contains(patId)) 1326 1376 {
Note: See TracChangeset
for help on using the changeset viewer.