Changeset 1926
- Timestamp:
- Apr 12, 2013, 9:14:18 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
r1923 r1926 292 292 if ('consentcount' == reportType) 293 293 { 294 var spacer0 = document.createElement('text'); 295 spacer0.innerHTML = "<BR>"; 296 cellElement.appendChild(spacer0); 294 297 var spacer = document.createElement('text'); 295 298 spacer.innerHTML = "<BR>"; 299 cellElement.appendChild(spacer); 300 // Table with consents in different categories with date, as well as consents with unknown date 301 cellElement.appendChild(spacer); 302 var hasDateTable = createConsentCountHasDateTable(report); 303 cellElement.appendChild(hasDateTable); 304 // Table with consents in different categories with unknown date, as well as missing consents 296 305 cellElement.appendChild(spacer); 297 306 var unknownDateTable = createConsentCountUnknownDateTable(report); … … 561 570 headerText += '\nLast registration ' + latestDateStr; 562 571 } 563 headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+5))); 572 headerText += '\nConsents without date treated as if belonging to selected time period'; 573 headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+3))); 564 574 565 575 // Subheader 566 576 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader', 3)); 567 577 568 subHeaderRow.appendChild(getTableCellElement('Yes', 'reportsubheader'));569 578 subHeaderRow.appendChild(getTableCellElement('Yes', 'reportsubheader')); 570 579 subHeaderRow.appendChild(getTableCellElement('No', 'reportsubheader')); 571 580 subHeaderRow.appendChild(getTableCellElement('Not asked', 'reportsubheader')); 572 subHeaderRow.appendChild(getTableCellElement('Unknown date', 'reportsubheader'));573 581 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader', 2)); 574 582 … … 581 589 columnHeaderRow.appendChild(latestDateHeader); 582 590 583 columnHeaderRow.appendChild(getTableCellElement('(has PAT#)', 'reportsubheader')); 584 columnHeaderRow.appendChild(getTableCellElement('(no PAT#)', 'reportsubheader')); 585 columnHeaderRow.appendChild(getTableCellElement('(has date)', 'reportsubheader')); 586 columnHeaderRow.appendChild(getTableCellElement('(has date)', 'reportsubheader')); 591 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 592 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 587 593 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 588 594 columnHeaderRow.appendChild(getTableCellElement('Sum', 'reportsubheader')); … … 603 609 // Get combined numbers for all sites for each period 604 610 var noDateKey = 'noDate'; 611 var sumDateIgnoredKey = 'sumDateIgnoredKey'; 612 var statistics = report.statistics; 613 var sitesCombined = statistics.sitesCombinedKey; 614 if (sitesCombined != null) 615 { 616 data = getJSONDataWithPercent(sitesCombined, 'yes', sumDateIgnoredKey, numDecimals); 617 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 618 data = getJSONDataWithPercent(sitesCombined, 'no', sumDateIgnoredKey, numDecimals); 619 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 620 data = getJSONDataWithPercent(sitesCombined, 'notAsked', sumDateIgnoredKey, numDecimals); 621 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 622 } 623 // Add entry with total number of consents with chosen restrictions 624 data = getJSONData(sitesCombined, sumDateIgnoredKey, 0); 625 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 626 // Add entry with total number of consents, regardless of restrictions 627 var totalKey = 'totalKey'; 628 data = getJSONData(sitesCombined, totalKey, 0); 629 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 630 reportTable.appendChild(sitesCombinedRow); 631 632 return reportTable; 633 } 634 635 function createConsentCountHasDateTable(report) 636 { 637 var reportTable = getReportTable(); 638 var sdString = report.beginDate; 639 var edString = report.endDate; 640 var ldString = report.latestDate; 641 var startDate = dateStrToDate(sdString); 642 var endDate = dateStrToDate(edString); 643 var latestDate = dateStrToDate(ldString); 644 645 var headerRow = document.createElement('tr'); 646 var subHeaderRow = document.createElement('tr'); 647 var columnHeaderRow = document.createElement('tr'); 648 649 var numCols = 5; 650 var numDecimals = 0; 651 var headerText = '# Consent forms of different types for cases and blood samples'; 652 var startDateStr = addHyphensToDateString(sdString); 653 var endDateStr = addHyphensToDateString(edString); 654 var latestDateStr = addHyphensToDateString(ldString); 655 headerText += ' (betweeen ' + startDateStr + ' and ' + endDateStr + ')'; 656 if (latestDate != null) 657 { 658 headerText += '\nLast registration ' + latestDateStr; 659 } 660 headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+5))); 661 662 // Subheader 663 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader', 3)); 664 665 subHeaderRow.appendChild(getTableCellElement('Yes', 'reportsubheader')); 666 subHeaderRow.appendChild(getTableCellElement('Yes', 'reportsubheader')); 667 subHeaderRow.appendChild(getTableCellElement('No', 'reportsubheader')); 668 subHeaderRow.appendChild(getTableCellElement('Not asked', 'reportsubheader')); 669 subHeaderRow.appendChild(getTableCellElement('Unknown date', 'reportsubheader')); 670 subHeaderRow.appendChild(getTableCellElement('', 'reportsubheader', 2)); 671 672 // Columnsheader 673 var siteHeader = getTableCellElement('Site', 'reportsubheader'); 674 var startDateHeader = getTableCellElement('Start date','reportsubheader'); 675 var latestDateHeader = getTableCellElement('Latest date','reportsubheader'); 676 columnHeaderRow.appendChild(siteHeader); 677 columnHeaderRow.appendChild(startDateHeader); 678 columnHeaderRow.appendChild(latestDateHeader); 679 680 columnHeaderRow.appendChild(getTableCellElement('(has PAT#)', 'reportsubheader')); 681 columnHeaderRow.appendChild(getTableCellElement('(no PAT#)', 'reportsubheader')); 682 columnHeaderRow.appendChild(getTableCellElement('(has date)', 'reportsubheader')); 683 columnHeaderRow.appendChild(getTableCellElement('(has date)', 'reportsubheader')); 684 columnHeaderRow.appendChild(getTableCellElement('', 'reportsubheader')); 685 columnHeaderRow.appendChild(getTableCellElement('Sum', 'reportsubheader')); 686 columnHeaderRow.appendChild(getTableCellElement('Total', 'reportsubheader')); 687 688 // Build table 689 reportTable.appendChild(headerRow); 690 reportTable.appendChild(subHeaderRow); 691 reportTable.appendChild(columnHeaderRow); 692 693 // Data rows 694 addDataRowsToConsentTableHasDate(report, reportTable); 695 696 // Add a row with the combined numbers for all sites for each period 697 var sitesCombinedRow = document.createElement('tr'); 698 sitesCombinedRow.appendChild(getTableCellElement('Sites combined', 'colsummary')); 699 sitesCombinedRow.appendChild(getTableCellElement('', 'colsummary', 2)); 700 // Get combined numbers for all sites for each period 701 var noDateKey = 'noDate'; 605 702 var sumKey = 'sumKey'; 606 703 var statistics = report.statistics; … … 608 705 if (sitesCombined != null) 609 706 { 610 data = getJSONDataWithPercent(sitesCombined, 'yesPatient ', sumKey, numDecimals);611 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 612 data = getJSONDataWithPercent(sitesCombined, 'yes NoPatient', sumKey, numDecimals);613 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 614 data = getJSONDataWithPercent(sitesCombined, 'no ', sumKey, numDecimals);615 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 616 data = getJSONDataWithPercent(sitesCombined, 'notAsked ', sumKey, numDecimals);707 data = getJSONDataWithPercent(sitesCombined, 'yesPatientExistsDateExists', sumKey, numDecimals); 708 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 709 data = getJSONDataWithPercent(sitesCombined, 'yesPatientUnknownDateExists', sumKey, numDecimals); 710 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 711 data = getJSONDataWithPercent(sitesCombined, 'noDateExists', sumKey, numDecimals); 712 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 713 data = getJSONDataWithPercent(sitesCombined, 'notAskedDateExists', sumKey, numDecimals); 617 714 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 618 715 data = getJSONDataWithPercent(sitesCombined, noDateKey, sumKey, numDecimals); … … 686 783 if (sitesCombined != null) 687 784 { 688 data = getJSONDataWithPercent(sitesCombined, 'yes NoDate', noDateOrMissingKey, numDecimals);689 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 690 data = getJSONDataWithPercent(sitesCombined, 'no NoDate', noDateOrMissingKey, numDecimals);691 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 692 data = getJSONDataWithPercent(sitesCombined, 'notAsked NoDate', noDateOrMissingKey, numDecimals);785 data = getJSONDataWithPercent(sitesCombined, 'yesDateUnknown', noDateOrMissingKey, numDecimals); 786 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 787 data = getJSONDataWithPercent(sitesCombined, 'noDateUnknown', noDateOrMissingKey, numDecimals); 788 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 789 data = getJSONDataWithPercent(sitesCombined, 'notAskedDateUnknown', noDateOrMissingKey, numDecimals); 693 790 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); 694 791 data = getJSONDataWithPercent(sitesCombined, 'missing', noDateOrMissingKey, numDecimals); … … 1179 1276 tableRow.appendChild(getTableCellElement(siteLatestDateStr, 'reportdata')); 1180 1277 var noDateKey = 'noDate'; 1278 var sumDateIgnoredKey = 'sumDateIgnoredKey'; 1279 var totalKey = 'totalKey'; 1280 if (siteData != null) 1281 { 1282 data = getJSONDataWithPercent(siteData, 'yes', sumDateIgnoredKey, numDecimals); 1283 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1284 data = getJSONDataWithPercent(siteData, 'no', sumDateIgnoredKey, numDecimals); 1285 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1286 data = getJSONDataWithPercent(siteData, 'notAsked', sumDateIgnoredKey, numDecimals); 1287 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1288 // Add column with summed values for site 1289 var siteSum = getJSONData(siteData, sumDateIgnoredKey, 0); 1290 tableRow.appendChild(getTableCellElement(siteSum, 'rowsummary')); 1291 } 1292 // Add column with total number of samples for site, regardless of creation date 1293 var siteTotal = getJSONData(siteData, totalKey, 0); 1294 tableRow.appendChild(getTableCellElement(siteTotal, 'rowsummary')); 1295 reportTable.appendChild(tableRow); 1296 } 1297 } 1298 1299 function addDataRowsToConsentTableHasDate(report, reportTable, numDecimals) 1300 { 1301 var sites = report.sites; 1302 var statistics = report.statistics; 1303 unknownCreation = statistics.noDate; 1304 unknownSite = statistics.unknownSite; 1305 var siteOrderList = report.siteOrderListKey; 1306 for (var siteOrderIndex in siteOrderList) 1307 { 1308 var namePrefix = siteOrderList[siteOrderIndex]; 1309 if (!sites.hasOwnProperty(namePrefix)) continue; 1310 var site = sites[namePrefix]; 1311 var siteName = site.name; 1312 var siteStartDate = dateStrToDate(site.startDate); 1313 var siteStartDateStr = addHyphensToDateString(site.startDate); 1314 1315 var siteData = statistics[namePrefix]; 1316 var siteLatestDate = siteData['latestDateKey']; 1317 var siteLatestDateStr = addHyphensToDateString(siteLatestDate); 1318 var tableRow = document.createElement('tr'); 1319 var tableCol = getTableCellElement(siteName, 'rowtitle'); 1320 tableRow.appendChild(tableCol); 1321 tableRow.appendChild(getTableCellElement(siteStartDateStr, 'reportdata')); 1322 tableRow.appendChild(getTableCellElement(siteLatestDateStr, 'reportdata')); 1323 var noDateKey = 'noDate'; 1181 1324 var sumKey = 'sumKey'; 1182 1325 var totalKey = 'totalKey'; 1183 1326 if (siteData != null) 1184 1327 { 1185 data = getJSONDataWithPercent(siteData, 'yesPatient ', sumKey, numDecimals);1186 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1187 data = getJSONDataWithPercent(siteData, 'yes NoPatient', sumKey, numDecimals);1188 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1189 data = getJSONDataWithPercent(siteData, 'no ', sumKey, numDecimals);1190 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1191 data = getJSONDataWithPercent(siteData, 'notAsked ', sumKey, numDecimals);1328 data = getJSONDataWithPercent(siteData, 'yesPatientExistsDateExists', sumKey, numDecimals); 1329 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1330 data = getJSONDataWithPercent(siteData, 'yesPatientUnknownDateExists', sumKey, numDecimals); 1331 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1332 data = getJSONDataWithPercent(siteData, 'noDateExists', sumKey, numDecimals); 1333 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1334 data = getJSONDataWithPercent(siteData, 'notAskedDateExists', sumKey, numDecimals); 1192 1335 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1193 1336 data = getJSONDataWithPercent(siteData, noDateKey, sumKey, numDecimals); … … 1234 1377 if (siteData != null) 1235 1378 { 1236 data = getJSONDataWithPercent(siteData, 'yes NoDate', noDateOrMissingKey, numDecimals);1237 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1238 data = getJSONDataWithPercent(siteData, 'no NoDate', noDateOrMissingKey, numDecimals);1239 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1240 data = getJSONDataWithPercent(siteData, 'notAsked NoDate', noDateOrMissingKey, numDecimals);1379 data = getJSONDataWithPercent(siteData, 'yesDateUnknown', noDateOrMissingKey, numDecimals); 1380 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1381 data = getJSONDataWithPercent(siteData, 'noDateUnknown', noDateOrMissingKey, numDecimals); 1382 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1383 data = getJSONDataWithPercent(siteData, 'notAskedDateUnknown', noDateOrMissingKey, numDecimals); 1241 1384 tableRow.appendChild(getTableCellElement(data, 'reportdata')); 1242 1385 data = getJSONDataWithPercent(siteData, 'missing', noDateOrMissingKey, numDecimals); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java
r1923 r1926 462 462 JSONObject jsonSitesCombined = new JSONObject(); 463 463 String yesKey = "yes"; 464 String yesPatientExistsKey = "yesPatientExists"; 465 String yesPatientUnknownKey = "yesPatientUnkown"; 466 String yesPatientExistsDateExistsKey = "yesPatientExistsDateExists"; 467 String yesPatientExistsDateUnknownKey = "yesPatientExistsDateUnknown"; 468 String yesPatientUnknownDateExistsKey = "yesPatientUnknownDateExists"; 469 String yesPatientUnknownDateUnknownKey = "yesPatientUnknownDateUnknown"; 470 String yesDateUnknownKey = "yesDateUnknown"; 464 471 String noKey = "no"; 465 String noNoDateKey = "noNoDate"; 472 String noDateExistsKey = "noDateExists"; 473 String noDateUnknownKey = "noDateUnknown"; 466 474 String notAskedKey = "notAsked"; 467 String notAskedNoDateKey = "notAskedNoDate"; 468 String yesPatientKey = "yesPatient"; 469 String yesNoPatientKey = "yesNoPatient"; 470 String yesNoDateKey = "yesNoDate"; 475 String notAskedDateExistsKey = "notAskedDateExists"; 476 String notAskedDateUnknownKey = "notAskedDateUnknown"; 471 477 String otherKey = "other"; 472 478 String missingKey = "missing"; 473 479 String sitesCombinedKey = "sitesCombinedKey"; 474 String sumKey = "sumKey";475 String totalKey = "totalKey";476 480 String latestDateKey = "latestDateKey"; 477 481 String noDateKey = "noDate"; 478 482 String noDateOrMissingKey = "noDateOrMissing"; 483 String sumKey = "sumKey"; 484 String sumDateIgnoredKey = "sumDateIgnoredKey"; 485 String totalKey = "totalKey"; 479 486 String duplicateKey = "duplicateKey"; 480 487 jsonStatistics.put(sitesCombinedKey, jsonSitesCombined); 481 488 // Initialize site data to 0 for the different keys 482 489 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesKey); 490 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientExistsKey); 491 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientUnknownKey); 492 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientExistsDateExistsKey); 493 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientExistsDateUnknownKey); 494 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientUnknownDateExistsKey); 495 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientUnknownDateUnknownKey); 496 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesDateUnknownKey); 483 497 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noKey); 484 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noNoDateKey); 498 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noDateExistsKey); 499 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noDateUnknownKey); 485 500 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, notAskedKey); 486 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, notAskedNoDateKey); 487 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesPatientKey); 488 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesNoPatientKey); 489 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, yesNoDateKey); 501 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, notAskedDateExistsKey); 502 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, notAskedDateUnknownKey); 490 503 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, otherKey); 491 504 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, missingKey); … … 493 506 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noDateOrMissingKey); 494 507 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, sumKey); 508 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, sumDateIgnoredKey); 495 509 jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, totalKey); 496 510 // Initialize combined data to 0 for the different keys 497 511 jsonSitesCombined.put(yesKey, 0); 512 jsonSitesCombined.put(yesPatientExistsKey, 0); 513 jsonSitesCombined.put(yesPatientUnknownKey, 0); 514 jsonSitesCombined.put(yesPatientExistsDateExistsKey, 0); 515 jsonSitesCombined.put(yesPatientExistsDateUnknownKey, 0); 516 jsonSitesCombined.put(yesPatientUnknownDateExistsKey, 0); 517 jsonSitesCombined.put(yesPatientUnknownDateUnknownKey, 0); 518 jsonSitesCombined.put(yesDateUnknownKey, 0); 498 519 jsonSitesCombined.put(noKey, 0); 499 jsonSitesCombined.put(noNoDateKey, 0); 520 jsonSitesCombined.put(noDateExistsKey, 0); 521 jsonSitesCombined.put(noDateUnknownKey, 0); 500 522 jsonSitesCombined.put(notAskedKey, 0); 501 jsonSitesCombined.put(notAskedNoDateKey, 0); 502 jsonSitesCombined.put(yesPatientKey, 0); 503 jsonSitesCombined.put(yesNoPatientKey, 0); 504 jsonSitesCombined.put(yesNoDateKey, 0); 523 jsonSitesCombined.put(notAskedDateExistsKey, 0); 524 jsonSitesCombined.put(notAskedDateUnknownKey, 0); 505 525 jsonSitesCombined.put(otherKey, 0); 506 526 jsonSitesCombined.put(missingKey, 0); … … 508 528 jsonSitesCombined.put(noDateOrMissingKey, 0); 509 529 jsonSitesCombined.put(sumKey, 0); 530 jsonSitesCombined.put(sumDateIgnoredKey, 0); 510 531 jsonSitesCombined.put(totalKey, 0); 511 532 // Initialize other data to 0 for different keys … … 546 567 // Get consent date 547 568 Date consentDate = (Date) Annotationtype.CONSENT_DATE.getAnnotationValue(dc, manager, s); 548 String key = null; 569 // Several key may be of interest, so a list is used to collect them 570 List<String> keyList = new ArrayList<String>(); 549 571 Boolean duplicate = false; 550 572 if (consent != null) … … 574 596 if (consent.equals("Yes")) 575 597 { 576 key = yesKey;598 keyList.add(yesKey); 577 599 if (patient != null) 578 600 { 579 key = yesPatientKey; 601 keyList.add(yesPatientExistsKey); 602 keyList.add(yesPatientExistsDateExistsKey); 580 603 } 581 604 else 582 605 { 583 key = yesNoPatientKey; 606 keyList.add(yesPatientUnknownKey); 607 keyList.add(yesPatientUnknownDateExistsKey); 584 608 } 585 609 } 586 610 else if (consent.equals("No")) 587 611 { 588 key = noKey; 612 keyList.add(noKey); 613 keyList.add(noDateExistsKey); 589 614 } 590 615 else if (consent.equals("Not asked")) 591 616 { 592 key = notAskedKey; 617 keyList.add(notAskedKey); 618 keyList.add(notAskedDateExistsKey); 593 619 } 594 620 else 595 621 { 596 key = otherKey;622 keyList.add(otherKey); 597 623 } 598 624 // Find out if current consent date is the latest so far. … … 605 631 else 606 632 { 633 // The parent is the 'Patient' 634 BioMaterial patient = s.getParent(); 607 635 if (consent.equals("Yes")) 608 636 { 609 key = yesNoDateKey; 637 keyList.add(yesKey); 638 keyList.add(yesDateUnknownKey); 639 if (patient != null) 640 { 641 keyList.add(yesPatientExistsKey); 642 keyList.add(yesPatientExistsDateUnknownKey); 643 } 644 else 645 { 646 keyList.add(yesPatientUnknownKey); 647 keyList.add(yesPatientUnknownDateUnknownKey); 648 } 610 649 } 611 650 else if (consent.equals("No")) 612 651 { 613 key = noNoDateKey; 652 keyList.add(noKey); 653 keyList.add(noDateUnknownKey); 614 654 } 615 655 else if (consent.equals("Not asked")) 616 656 { 617 key = notAskedNoDateKey; 657 keyList.add(notAskedKey); 658 keyList.add(notAskedDateUnknownKey); 618 659 } 619 660 else 620 661 { 621 key = otherKey;662 keyList.add(otherKey); 622 663 } 623 664 } … … 634 675 else 635 676 { 636 key = missingKey;677 keyList.add(missingKey); 637 678 } 638 679 // Note that items with duplicate == false include missing consent items 639 680 if (!duplicate) 640 681 { 641 if (key != null) 642 { 643 // Update consent counters 644 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, key); 645 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, key); 682 if (keyList != null && keyList.size() > 0) 683 { 684 for (String key: keyList) 685 { 686 // Update consent counters 687 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, key); 688 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, key); 689 } 646 690 // Include all consents except missing in summed count 647 691 if (consent != null) … … 649 693 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, sumKey); 650 694 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, sumKey); 695 jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, sumDateIgnoredKey); 696 jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, sumDateIgnoredKey); 651 697 } 652 698 }
Note: See TracChangeset
for help on using the changeset viewer.