Changeset 1721


Ignore:
Timestamp:
Sep 24, 2012, 1:16:11 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #416: Check consent before exporting "monthly operation list"

This is now implemented as an extra column in the exported list. The HTML preview parses the export and automatically display a warning icon to cases that doesn't have an explicit 'YES'.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/export_monthly_oplist.jsp

    r1676 r1721  
    7171    else
    7272    {
    73       var numLines = request.responseText.split('\n').length - 1;
     73      var allLines = request.responseText.split('\n');
     74      var numLines = allLines.length - 1;
     75     
     76      // Check last column for the 'Consent' value. All should be 'YES' for the export to be ok.
     77      var numNoConsent = 0;
     78      var numMissingConsent = 0;
     79      for (var i = 0 ; i < numLines; i++)
     80      {
     81        var line = allLines[i];
     82        var lastColIdx = line.lastIndexOf('\t');
     83        var lastCol = line.substr(lastColIdx+1);
     84       
     85        if (lastCol != 'YES')
     86        {
     87          if (lastCol == 'MISSING')
     88          {
     89            numMissingConsent++;
     90          }
     91          else
     92          {
     93            numNoConsent++;
     94          }
     95          allLines[i] = '<span class="consent-warning">'+line+'</span>';
     96        }
     97      }
     98     
     99      if (numMissingConsent > 0 || numNoConsent > 0)
     100      {
     101        var previewWarning = document.getElementById('previewWarning');
     102        var warning = '<img src="images/warning.png" alt="!">';
     103        warning += ' Found ' + (numNoConsent+numMissingConsent) + ' case(s) with denied or missing consent!';
     104        previewWarning.innerHTML = warning;
     105      }
     106     
    74107      previewTitle.innerHTML = 'Operation dates - ' + frm.time[frm.time.selectedIndex].text + ' (' + numLines + ')';
    75       previewList.innerHTML = request.responseText;
     108      previewList.innerHTML = allLines.join('\n');
    76109      Main.show('previewWrapper');
    77110    }
     
    98131  bottom: 1em;
    99132  left: 20px;
    100   width: 850px;
     133  width: 950px;
    101134  overflow: visible;
    102135}
     
    109142  width: 950px;
    110143  overflow: auto;
    111  
    112144  white-space: pre;
    113145  font-family: monospace;
     
    121153{
    122154  font-weight: bold;
     155}
     156
     157.consent-warning
     158{
     159  font-weight: bold;
     160  color: #A00000;
     161  background-color: #F8F8E8;
     162}
     163
     164.consent-warning:after
     165{
     166  content: url('images/warning_small.png');
     167  vertical-align: middle;
    123168}
    124169
     
    212257 
    213258  <div id="previewWrapper" style="display: none;">
    214     <div id="previewTitle">Preview</div>
     259    <div>
     260      <span id="previewTitle">Preview</span>
     261      <span id="previewWarning"></span>
     262    </div>
    215263    <div id="previewList"></div>
    216264  </div>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ExportServlet.java

    r1680 r1721  
    133133                // Get the personal number of the patient
    134134                String pnr = (String)Annotationtype.PERSONAL_NUMBER.getAnnotationValue(dc, manager, patient);
     135
    135136                if (pnr != null)
    136137                {
     
    138139                  Site site = Site.findByCaseName(s.getName());
    139140                  String laterality = (String)Annotationtype.LATERALITY.getAnnotationValue(dc, manager, theCase);
     141                  String consent = (String)Annotationtype.CONSENT.getAnnotationValue(dc, manager, theCase);
    140142                  String opDate = dateFormat.format(s.getCreationEvent().getEventDate());
    141143                  String subtype = exportSubtype ? s.getItemSubtype().getName() : null;
    142144                  String caseName = caseNamePattern.matcher(s.getName()).replaceFirst("");
    143                   opDates.add(new PersonalOpDate(pnr, opDate, site, laterality, subtype, caseName));
     145                  opDates.add(new PersonalOpDate(pnr, opDate, site, laterality, subtype, caseName, consent));
    144146                }
    145147              }
     
    185187    private final String subtype;
    186188    private final String caseName;
    187    
    188     PersonalOpDate(String pnr, String opDate, Site site, String laterality, String subtype, String caseName)
     189    private final String consent;
     190   
     191    PersonalOpDate(String pnr, String opDate, Site site, String laterality, String subtype, String caseName, String consent)
    189192    {
    190193      this.pnr = pnr;
     
    194197      this.subtype = subtype;
    195198      this.caseName = caseName;
     199      this.consent = consent;
    196200    }
    197201   
     
    202206          (laterality == null ? "" : laterality) + "\t" +
    203207          site.getName() +
    204           (subtype==null ? "" : "\t" + subtype);
     208          (subtype==null ? "" : "\t" + subtype) + "\t" +
     209          (consent == null ? "MISSING" : consent.toUpperCase());
    205210    }
    206211
Note: See TracChangeset for help on using the changeset viewer.