Changeset 2023


Ignore:
Timestamp:
Sep 19, 2013, 4:36:31 PM (8 years ago)
Author:
olle
Message:

Refs #449. Refs #505. First version of wizard for registration/update of data for follow-up blood samples.

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

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/META-INF/servlets.xml

    r2020 r2023  
    1212    <servlet-name>BloodRegistration</servlet-name>
    1313    <servlet-class>net.sf.basedb.reggie.servlet.BloodRegistrationServlet</servlet-class>
     14  </servlet>
     15  <servlet>
     16    <servlet-name>BloodFollowUpRegistration</servlet-name>
     17    <servlet-class>net.sf.basedb.reggie.servlet.BloodFollowUpRegistrationServlet</servlet-class>
    1418  </servlet>
    1519  <servlet>
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r2020 r2023  
    553553          <dt>
    554554            <base:icon image="<%=home + "/images/blood.png" %>"/>
    555             <a href="personal/bloodform.jsp?ID=<%=ID%>">Blood referral form registration</a>
    556           </dt>
    557           <dd>
    558             <ul>
    559             <li>Register new blood referral forms and patients.
    560             <li>Update information for existing blood referral forms.
     555            Blood referral form registration
     556          </dt>
     557          <dd>
     558            <ul>
     559            <li><a href="personal/bloodform.jsp?ID=<%=ID%>">Register new/updated blood referral forms and patients</a>
     560            <li><a href="personal/bloodfollowupform.jsp?ID=<%=ID%>">Register new/updated follow-up blood referral forms</a>
    561561            </ul>
    562562          </dd>
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r2021 r2023  
    124124    The "BloodSample" annotation, used for samples (Blood). It
    125125    is an enumerated string annotation with options:
    126     PreNeo, PreOp
     126    PreNeo, PreOp, FollowUp06, FollowUp12, FollowUp36
    127127  */
    128128  public static final Annotationtype BLOOD_SAMPLE =
    129129    new Annotationtype("BloodSample", Type.STRING, Item.SAMPLE);
    130130 
     131  /**
     132    The "BloodRccidNumber" annotation, used for follow-up samples (Blood). It
     133    is a string annotation.
     134   */
     135  public static final Annotationtype BLOOD_RCCIDNUMBER =
     136    new Annotationtype("BloodRccidNumber", Type.STRING, Item.SAMPLE);
     137
    131138  /**
    132139    The "ReasonIfNoSpecimen" annotation type, used
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Blood.java

    r1831 r2023  
    113113  }
    114114
    115  
    116115  /**
    117116    Find all blood information linked with a patient. A patient can have any
     
    133132  }
    134133 
     134  /**
     135    Find blood information by RCCID number. This method will check for
     136    {@link Subtype#BLOOD} samples annotated with BloodRccidNumber=name.
     137    <p>
     138    If exactly one match is found this is the search for blood sample. More than one
     139    match is an error condition. No match indicates an RCCID number that has not yet been
     140    registered (null is returned).
     141   
     142    @param dc DbControl The DbControl to use to connect to the database.
     143    @param name String The RCCID number to find a blood sample for.
     144    @return Blood A blood item with the input RCCID number, or null if not found.
     145    @since 2.13
     146   */
     147  public static Blood findByRccidNumber(DbControl dc, String name)
     148  {
     149    Blood blood = null;
     150
     151    // Only follow-up blood samples have non-blank RCCID numbers.
     152    // Return null if input RCCID number is null or empty string.
     153    if (name == null || name.equals(""))
     154    {
     155      return null;
     156    }
     157
     158    // Look for a blood sample with annotation BloodRccidNumber=name
     159    ItemQuery<Sample> bloodQuery = Sample.getQuery();
     160    Subtype.BLOOD.addFilter(dc, bloodQuery);
     161    bloodQuery.restrict(Annotations.eq(null, Annotationtype.BLOOD_RCCIDNUMBER.load(dc), name, false));
     162   
     163    List<Sample> bloodSamples = bloodQuery.list(dc);
     164 
     165    // ...if more than one is found, something is incorrectly registered... abort
     166    if (bloodSamples.size() > 1)
     167    {
     168      throw new InvalidDataException(
     169          "Found " + bloodSamples.size() + " blood samples with same RCCID number (" + name +
     170          "). This wizard can't be used until that is corrected.");
     171    }
     172 
     173    if (bloodSamples.size() == 1)
     174    {
     175      blood = new Blood(bloodSamples.get(0));
     176    }
     177 
     178    return blood;
     179  }
     180
     181  /**
     182    Find all blood information by base RCCID number, i.e. the RCCID number disregarding the suffix
     183    letter 'B', 'C', or 'D'. This method will check for {@link Subtype#BLOOD} samples annotated
     184    with BloodRccidNumber=rccidNumber, where rccidNumber is input name string with suffix letter
     185    exchanged for 'B', 'C', and 'D'.
     186    <p>
     187    No match indicates an RCCID number that has not yet been registered (null is returned).
     188   
     189    @param dc DbControl The DbControl to use to connect to the database.
     190    @param name String The RCCID number to find a blood sample for.
     191    @return Blood A blood item with the input RCCID number, or null if not found.
     192    @since 2.13
     193   */
     194  public static List<Blood> findAllByBaseRccidNumber(DbControl dc, String name)
     195  {
     196    // Only follow-up blood samples have non-blank RCCID numbers.
     197    // Return null if input RCCID number is null or empty string.
     198    if (name == null || name.equals(""))
     199    {
     200      return null;
     201    }
     202
     203    // Get base RCCID number (RCCID number without suffix letter 'B', 'C', or 'D')
     204    String baseRccidNumber = name;
     205    if (name.endsWith("B") || name.endsWith("C") || name.endsWith("D"))
     206    {
     207      // Set base RCCID number as name with last character removed
     208      baseRccidNumber = name.substring(0, name.length() - 1);
     209    }
     210    // Check for blood samples with base RCCID number
     211    List<Blood> bloodSampleList = new ArrayList<Blood>();
     212    String rccidNumber = "";
     213    for (int i = 0; i < 3; i++)
     214    {
     215      String suffix = "B";
     216      if (i == 1)
     217      {
     218        suffix = "C";
     219      }
     220      else if (i == 2)
     221      {
     222        suffix = "D";
     223      }
     224      rccidNumber = baseRccidNumber + suffix;
     225      // Look for a blood sample with annotation BloodRccidNumber=rccidNumber
     226      ItemQuery<Sample> bloodQuery = Sample.getQuery();
     227      Subtype.BLOOD.addFilter(dc, bloodQuery);
     228      bloodQuery.restrict(Annotations.eq(null, Annotationtype.BLOOD_RCCIDNUMBER.load(dc), rccidNumber, false));
     229     
     230      List<Sample> bloodSamples = bloodQuery.list(dc);
     231      if (bloodSamples.size() == 1)
     232      {
     233        Blood blood = new Blood(bloodSamples.get(0));
     234        bloodSampleList.add(blood);
     235      }
     236    }
     237    // Return null if no blood samples were found with input base RCCID number
     238    if (bloodSampleList.size() == 0)
     239    {
     240      bloodSampleList = null;
     241    }
     242
     243    return bloodSampleList;
     244  }
     245
    135246  /**
    136247    Generate the next auto-generated blood name. This method will search all blood
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2022 r2023  
    201201        jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_FREEZER_DATETIME, 1, null, effectiveOptions, createIfMissing));
    202202        jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_SERUM, 1, new ValueOptions("Yes", "No"), effectiveOptions, createIfMissing));
    203         jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_SAMPLE, 1, new ValueOptions("PreNeo", "PreOp"), effectiveOptions, createIfMissing));
     203        jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_SAMPLE, 1, new ValueOptions("PreNeo", "PreOp", "FollowUp06", "FollowUp12", "FollowUp36"), effectiveOptions, createIfMissing));
     204        jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_RCCIDNUMBER, 1, null, effectiveOptions, createIfMissing));
    204205
    205206        jsonChecks.add(checkAnnotationType(dc, Annotationtype.SAMPLING_DATETIME, 1, null, effectiveOptions, createIfMissing));
Note: See TracChangeset for help on using the changeset viewer.