Ignore:
Timestamp:
Mar 4, 2011, 11:33:52 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #291: Personal information registration

Allow laterality=unknown option since that is not always known at the time of registration. On the other hand, if a laterality has been selected but the associated specimen tubes doesn't have that information the specimen tubes will be updated with the selected laterality.

File:
1 edited

Legend:

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

    r1306 r1307  
    179179 
    180180  var laterality = selectedLaterality.value;
    181   if (laterality != 'LEFT' && laterality != 'RIGHT')
     181  if (laterality.match(/\d+/))
    182182  {
    183183    // It is the ID of an existing case
     
    192192    }
    193193  }
    194  
    195   if (!laterality) return;
    196  
    197   // No specimen tubes
     194  else  if (laterality == '')
     195  {
     196    laterality = null;
     197  }
     198   
     199  // No specimen tubes?
    198200  if (!caseInfo.specimen || caseInfo.specimen.length == 0) return;
     201 
    199202  for (var i = 0; i < caseInfo.specimen.length; i++)
    200203  {
    201204    var specimen = caseInfo.specimen[i];
    202     if (specimen.laterality && specimen.laterality != laterality)
    203     {
    204       setInputStatus('laterality', 'Not same laterality as specimen tubes', 'warning');
     205    if (specimen.laterality != laterality)
     206    {
     207      if (specimen.laterality == null)
     208      {
     209        setInputStatus('laterality', 'Specimen tubes are updated to: ' + laterality, 'valid')
     210      }
     211      else
     212      {
     213        setInputStatus('laterality', 'Not same laterality as specimen tubes', 'warning');
     214      }
    205215      return;
    206216    }
     
    294304 
    295305  // Generate list of specimen tubes
    296   var thisCaseLaterality;
     306  var hasLeftSpecimen = false;
     307  var hasRightSpecimen = false;
     308  var hasUnknownSpecimen = false;
     309  var thisCaseLaterality = null;
    297310  if (caseInfo.specimen && caseInfo.specimen.length > 0)
    298311  {
     
    302315    {
    303316      var specimen = caseInfo.specimen[i];
    304       specimenTubes += specimen.name ;
     317      specimenTubes += specimen.name;
    305318      if (specimen.laterality)
    306319      {
    307320        specimenTubes += ' ('+specimen.laterality + ')';
    308321        Forms.checkRadio(frm.laterality, specimen.laterality);
    309        
    310         if (thisCaseLaterality && thisCaseLaterality != specimen.laterality)
    311         {
    312           setInputStatus('specimenTubes', 'Specimen tubes with different laterality', 'warning');
    313         }
     322        if (specimen.laterality == 'LEFT') hasLeftSpecimen = true;
     323        if (specimen.laterality == 'RIGHT') hasRightSpecimen = true;
    314324        thisCaseLaterality = specimen.laterality;
    315325      }
    316326      else
    317327      {
     328        hasUnknownSpecimen = true;
    318329        specimenTubes += ' (<i>unknown laterality</i>)';
    319330      }
     
    321332    }
    322333    setInnerHTML('specimenTubes', specimenTubes);
    323   }
    324 
    325  
     334   
     335    // Check that all specimen tubes have the same laterality
     336    var numLateralities = 0;
     337    if (hasLeftSpecimen) numLateralities++;
     338    if (hasRightSpecimen) numLateralities++;
     339    if (hasUnknownSpecimen) numLateralities++;
     340    if (numLateralities > 1)
     341    {
     342      setInputStatus('specimenTubes', 'Specimen tubes with different laterality', 'warning');
     343      thisCaseLaterality = null;
     344    }
     345  }
     346
    326347  Main.show('caseSection');
    327348 
     
    329350  var hasLeftCase = false;
    330351  var hasRightCase = false;
     352  var hasUnknownCase = false;
    331353  if (patientInfo.cases && patientInfo.cases.length > 0)
    332354  {
     
    338360      if (cc.laterality == 'LEFT')
    339361      {
    340         if (hasLeftCase) setInputStatus('laterality', 'Two cases with LEFT', 'warning');
     362        if (hasLeftCase) setInputStatus('laterality', 'Two cases with laterality=LEFT', 'warning');
    341363        hasLeftCase = true;
    342364      }
    343       if (cc.laterality == 'RIGHT')
    344       {
    345         if (hasRightCase) setInputStatus('laterality', 'Two cases with RIGHT', 'warning');
     365      else if (cc.laterality == 'RIGHT')
     366      {
     367        if (hasRightCase) setInputStatus('laterality', 'Two cases with laterality=RIGHT', 'warning');
    346368        hasRightCase = true;
     369      }
     370      else
     371      {
     372        hasUnknownCase = true; 
    347373      }
    348374      if (cc.laterality == thisCaseLaterality) cases += ' checked';
     
    372398        cases += ' onclick="lateralityOnChange()"><i>new case</i> (RIGHT)<br>';
    373399      }
     400      cases += '<input type="radio" name="laterality" value=""';
     401      if (thisCaseLaterality == null) cases += ' checked';
     402      cases += ' onclick="lateralityOnChange()"><i>new case</i> (<i>unknown laterality</i>)<br>';
    374403    }
    375404   
     
    727756        <td class="prompt" id="laterality.prompt">Laterality</td>
    728757        <td class="input" id="laterality.input">
    729           <input type="radio" name="laterality" value="LEFT" onclick="lateralityOnChange()">LEFT
    730           <input type="radio" name="laterality" value="RIGHT" onclick="lateralityOnChange()">RIGHT
     758          <input type="radio" name="laterality" value="LEFT" onclick="lateralityOnChange()">LEFT<br>
     759          <input type="radio" name="laterality" value="RIGHT" onclick="lateralityOnChange()">RIGHT<br>
     760          <input type="radio" name="laterality" value="" checked onclick="lateralityOnChange()"><i>unknown</i>
    731761        </td>
    732762        <td class="status" id="laterality.status"></td>
Note: See TracChangeset for help on using the changeset viewer.