function DisplayStudy($id, $audit, $fix, $search_pipelineid, $search_name, $search_compare, $search_value, $search_type, $search_swversion, $imgperline) { $id = mysql_real_escape_string($id); $sqlstring = "select a.*, c.uid, d.project_costcenter, d.project_id, c.subject_id from studies a left join enrollment b on a.enrollment_id = b.enrollment_id left join subjects c on b.subject_id = c.subject_id left join projects d on b.project_id = d.project_id where a.study_id = '$id'"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $study_id = $row['study_id']; $enrollmentid = $row['enrollment_id']; //$equipmentid = $row['equipment_id']; $study_num = $row['study_num']; $study_alternateid = $row['study_alternateid']; $study_modality = $row['study_modality']; $study_datetime = $row['study_datetime']; $study_ageatscan = $row['study_ageatscan']; $study_height = $row['study_height']; $study_weight = $row['study_weight']; $study_type = $row['study_type']; $study_operator = $row['study_operator']; $study_physician = $row['study_performingphysician']; $study_site = $row['study_site']; $study_notes = $row['study_notes']; $study_doradread = $row['study_doradread']; $study_radreaddate = $row['study_radreaddate']; $study_radreadfindings = $row['study_radreadfindings']; $study_etsnellenchart = $row['study_etsnellenchart']; $study_etvergence = $row['study_etvergence']; $study_ettracking = $row['study_ettracking']; $study_snpchip = $row['study_snpchip']; $study_status = $row['study_status']; $study_alternateid = $row['study_alternateid']; $study_experimenter = $row['study_experimenter']; $study_desc = $row['study_desc']; $study_createdby = $row['study_createdby']; $uid = $row['uid']; $subjectid = $row['subject_id']; $costcenter = $row['project_costcenter']; $projectid = $row['project_id']; $ft1 = floor($study_height/0.3048); $ft2 = (($study_height/0.3048)-$ft1)*12; $in = number_format($ft2,1); if (($study_height == 0) || ($study_weight == 0)) { $bmi = 0; } else { $bmi = $study_weight / ( $study_height * $study_height); } $study_heightft = "$ft1' $in\""; } else { ?> Study [<?php echo $id; ?> ] does not exist <? return; } if ($study_modality == "") { $study_modality = "Missing modality"; $class="missing"; } else { $class = "value"; } $study_datetime = date("F j, Y g:ia",strtotime($study_datetime)); $study_radreaddate = date("F j, Y g:ia",strtotime($study_radreaddate)); /* get privacy information */ $username = $_SESSION['username']; $sqlstring = "select user_id from users where username = '******'"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); $row = mysql_fetch_array($result, MYSQL_ASSOC); $userid = $row['user_id']; $sqlstring = "select b.* from user_project a left join projects b on a.project_id = b.project_id where a.project_id = $projectid and a.view_data = 1 and a.user_id = '$userid'"; //PrintSQL($sqlstring); $result = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $projectname = $row['project_name']; $projectcostcenter = $row['project_costcenter']; $dataprojectlist[] = "$projectname ($projectcostcenter)"; } $dataaccess = 1; } else { $dataaccess = 0; } $urllist['Subject List'] = "subjects.php"; $urllist[$uid] = "subjects.php?action=display&id=$subjectid"; $urllist["Study " . $study_num] = "studies.php?id=$id"; NavigationBar("Studies", $urllist, 1, null, $dataaccess, null, $dataprojectlist); if (!$dataaccess) { echo "You do not have data access to this project. Consult your NiDB administrator"; return; } /* update the mostrecent table */ UpdateMostRecent($userid, '', $id); ?> <div align="center"> <span class="uid"><?php echo FormatUID($uid); ?> </span> </div> <br> <style> #preview{ position:absolute; border:1px solid #ccc; background:gray; padding:0px; display:none; color:#fff; } </style> <script type="text/javascript"> $(document).ready(function() { //$('a.basic').cluetip({width: 275}); //$('a.wide').cluetip({width: 800, clickThrough:true}); //$('a.iframe').fancybox({width:1100, height: 1000, transitionIn: 'none', transitionOut: 'none', speedIn: 0, speedOut: 0, type: 'iframe'}); }); </script> <table class="bluerounded"> <tr> <td class="title"><span style="margin-left:15px">Study Information</span> </td> </tr> <tr> <td class="body"> <table class="reviewtable" width="100%"> <tr> <td colspan="2" align="center"> </td> </tr> <tr> <td class="label">Study number</td> <td class="value"><?php echo $study_num; ?> </td> </tr> <tr> <td class="label">Study ID</td> <td class="value"><tt><?php echo $uid; echo $study_num; ?> </tt></td> </tr> <tr> <td class="label">Alternate Study ID</td> <td class="value"><tt><?php echo $study_alternateid; ?> </tt></td> </tr> <tr> <td class="label">Modality</td> <td class="<?php echo $class; ?> "><?php echo $study_modality; ?> </td> </tr> <tr> <td class="label">Date/time</td> <td class="value"><?php echo $study_datetime; ?> </td> </tr> <tr> <td class="label">Age at scan</td> <td class="value"><?php echo number_format($study_ageatscan, 1); ?> y</td> </tr> <tr> <td class="label">Height</td> <td class="value"><?php echo number_format($study_height, 2); ?> m <span class="tiny">(<?php echo $study_heightft; ?> )</span></td> </tr> <tr> <td class="label">Weight</td> <td class="value"><?php echo number_format($study_weight, 1); ?> kg <span class="tiny">(<?php echo number_format($study_weight * 2.20462, 1); ?> lbs)</span></td> </tr> <tr> <td class="label">BMI</td> <td class="value"><?php echo number_format($bmi, 1); ?> <span class="tiny">kg/m<sup>2</sup></span></td> </tr> <tr> <td class="label">Visit type</td> <td class="value"><?php echo $study_type; ?> </td> </tr> <tr> <td class="label">Description</td> <td class="value"><?php echo $study_desc; ?> </td> </tr> <tr> <td class="label">Operator</td> <td class="value"><?php echo $study_operator; ?> </td> </tr> <tr> <td class="label">Performing physician</td> <td class="value"><?php echo $study_physician; ?> </td> </tr> <tr> <td class="label">Site</td> <td class="value"><?php echo $study_site; ?> </td> </tr> <tr> <td class="label">Notes</td> <td class="value"><?php echo $study_notes; ?> </td> </tr> <? if (strtolower($study_modality) == "mr") { ?> <tr> <td class="label">Radiological read?</td> <td class="value"><? if ($study_doradread) { echo "Yes"; } else { echo "No"; } ?></td> </tr> <tr> <td class="label">Rad. read date</td> <td class="value"><?php echo $study_radreaddate; ?> </td> </tr> <tr> <td class="label">Rad. read findings</td> <td class="value"><?php echo $study_radreadfindings; ?> </td> </tr> <? } elseif (strtolower($study_modality) == "et") { ?> <tr> <td class="label">Snellen chart</td> <td class="value"><?php echo $study_etsnellenchart; ?> </td> </tr> <tr> <td class="label">Vergence</td> <td class="value"><?php echo $study_etvergence; ?> </td> </tr> <tr> <td class="label">Tracking</td> <td class="value"><?php echo $study_ettracking; ?> </td> </tr> <? } elseif (strtolower($study_modality) == "snp") { ?> <tr> <td class="label">SNP chip</td> <td class="value"><?php echo $study_snpchip; ?> </td> </tr> <? } ?> <tr> <td class="label">Status</td> <td class="value"><?php echo $study_status; ?> </td> </tr> <tr> <td class="label">Created by</td> <td class="value"><?php echo $study_createdby; ?> </td> </tr> <tr> <td class="label">Experimenter</td> <td class="value"><?php echo $study_experimenter; ?> </td> </tr> <tr> <td colspan="2" align="center"> <br> <a href="studies.php?action=editform&id=<?php echo $id; ?> ">Edit</a> </td> </tr> </table> <? if ($GLOBALS['isadmin']) { ?> <details> <summary style="color:darkred" class="tiny">Admin Functions</summary> <br><br> <span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Delete this study:</span> <a href="studies.php?action=deleteconfirm&id=<?php echo $id; ?> "><span class="adminbutton" style="padding: 3px; margin; 3px;">X</span></a> <script> $(function() { $( "#newuid" ).autocomplete({ source: "subjectlist.php", minLength: 2, autoFocus: true }); }); </script> <style> .ui-autocomplete { max-height: 100px; overflow-y: auto; /* prevent horizontal scrollbar */ overflow-x: hidden; /* add padding to account for vertical scrollbar */ padding-right: 20px; } /* IE 6 doesn't support max-height * we use height instead, but this forces the menu to always be this tall */ * html .ui-autocomplete { height: 100px; } </style> <form action="studies.php" method="post"> <input type="hidden" name="studyid" value="<?php echo $study_id; ?> "> <input type="hidden" name="action" value="movestudytosubject"> <input type="hidden" name="enrollmentid" value="<?php echo $enrollmentid; ?> "> <br> <span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Move study to subject:</span> <input type="text" size="10" name="newuid" id="newuid"/> <input type="submit" value="Move"> </form> <form action="studies.php" method="post"> <input type="hidden" name="studyid" value="<?php echo $study_id; ?> "> <input type="hidden" name="action" value="movestudytoproject"> <input type="hidden" name="enrollmentid" value="<?php echo $enrollmentid; ?> "> <input type="hidden" name="subjectid" value="<?php echo $subjectid; ?> "> <br> <span align="center" style="background-color: darkred; color: white; padding: 1px 5px; border-radius:2px; font-weight: bold; font-size: 11pt">Move study to project:</span> <select name="newprojectid"> <? $sqlstringB = "select a.project_id, b.project_name, b.project_costcenter from enrollment a left join projects b on a.project_id = b.project_id where a.subject_id = $subjectid"; echo $sqlstringB; $resultB = MySQLQuery($sqlstringB, __FILE__, __LINE__); while ($rowB = mysql_fetch_array($resultB, MYSQL_ASSOC)) { $project_id = $rowB['project_id']; $project_name = $rowB['project_name']; $project_costcenter = $rowB['project_costcenter']; ?> <option value="<?php echo $project_id; ?> "><?php echo $project_name; ?> (<?php echo $project_costcenter; ?> )</option> <? } ?> </select> <input type="submit" value="Move"> </form> <br> <? if (!$audit) { ?> <a href="studies.php?id=<?php echo $id; ?> &audit=1">Perform file audit</a> - compares all dicom files to the nidb database entries. Can be very slow<br><br> <? } else { ?> <a href="studies.php?id=<?php echo $id; ?> &audit=1&fix=1">Fix file errors</a> - Removes duplicates and errant files, resets file count in nidb database. Can be very slow<br><br> </details> <? } ?> <? } ?> </td> </tr> </table> <br><br> <? if ($study_modality == "MR") { DisplayMRSeries($id, $study_num, $uid, $audit, $fix); } elseif ($study_modality == "CT") { DisplayCTSeries($id, $study_num, $uid, $audit, $fix); } else { DisplayGenericSeries($id, $study_modality); } ?> <br><br><br><br><br><br> <? DisplayAnalyses($id, $search_pipelineid, $search_name, $search_compare, $search_value, $search_type, $search_swversion, $imgperline); ?> <br><br><br><br><br><br> <? }
function DisplaySubject($id) { /* get privacy information */ $username = $_SESSION['username']; $sqlstring = "select user_id from users where username = '******'"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); $row = mysql_fetch_array($result, MYSQL_ASSOC); $userid = $row['user_id']; $sqlstring = "select c.*, d.* from subjects a left join enrollment b on a.subject_id = b.subject_id left join user_project c on b.project_id = c.project_id left join projects d on d.project_id = c.project_id where a.subject_id = '$id' and c.user_id = '$userid' and c.view_phi = 1"; //PrintSQL($sqlstring); $result = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $projectname = $row['project_name']; $projectcostcenter = $row['project_costcenter']; $phiprojectlist[] = "$projectname ($projectcostcenter)"; } $phiaccess = 1; } else { $phiaccess = 0; } $sqlstring = "select c.*, d.* from subjects a left join enrollment b on a.subject_id = b.subject_id left join user_project c on b.project_id = c.project_id left join projects d on d.project_id = c.project_id where a.subject_id = '$id' and c.user_id = '$userid' and c.view_data = 1"; //PrintSQL($sqlstring); $result = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $projectname = $row['project_name']; $projectcostcenter = $row['project_costcenter']; $dataprojectlist[] = "$projectname ($projectcostcenter)"; } $dataaccess = 1; } else { $dataaccess = 0; } /* check if they have enrollments for a valid project */ $sqlstring = "select a.* from enrollment a right join projects b on a.project_id = b.project_id where a.subject_id = $id"; //PrintSQL($sqlstring); $result = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result) > 0) { $hasenrollments = 1; } else { $hasenrollments = 0; } $urllist['Subject List'] = "subjects.php"; NavigationBar("Subjects", $urllist, 1, $phiaccess, $dataaccess, $phiprojectlist, $dataprojectlist); /* kick them out if they shouldn't be seeing anything on this page */ //if ((!$phiaccess) && (!$dataaccess) && (!$GLOBALS['isadmin'])) { //if ((!$phiaccess) && (!$dataaccess) && ($hasenrollments)) { // return; //} /* update the mostrecent table */ UpdateMostRecent($userid, $id,''); /* get all existing info about this subject */ $sqlstring = "select * from subjects where subject_id = $id"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); $row = mysql_fetch_array($result, MYSQL_ASSOC); $name = $row['name']; $dob = $row['birthdate']; $gender = $row['gender']; $ethnicity1 = $row['ethnicity1']; $ethnicity2 = $row['ethnicity2']; $handedness = $row['handedness']; $education = $row['education']; $phone1 = $row['phone1']; $email = $row['email']; $maritalstatus = $row['marital_status']; $smokingstatus = $row['smoking_status']; $uid = $row['uid']; $guid = $row['guid']; $cancontact = $row['cancontact']; //print_r($row); /* get the family UID */ $sqlstring = "select b.family_uid, b.family_name from family_members a left join families b on a.family_id = b.family_id where a.subject_id = $id"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); $row = mysql_fetch_array($result, MYSQL_ASSOC); $familyuid = $row['family_uid']; $familyname = $row['family_name']; /* get list of alternate subject UIDs */ $altuids = GetAlternateUIDs($id); list($lastname, $firstname) = explode("^",$name); list($lname, $fname) = explode("^",$name); $name = strtoupper(substr($fname,0,1)) . strtoupper(substr($lname,0,1)); switch ($gender) { case "U": $gender = "Unknown"; break; case "F": $gender = "Female"; break; case "M": $gender = "Male"; break; case "O": $gender = "Other"; break; } switch ($ethnicity1) { case "": $ethnicity1 = "Unknown"; break; case "hispanic": $ethnicity1 = "Hispanic/Latino"; break; case "nothispanic": $ethnicity1 = "Not hispanic/Latino"; break; } switch ($ethnicity2) { case "": $ethnicity2 = "Unknown"; break; case "indian": $ethnicity2 = "American Indian/Alaska Native"; break; case "asian": $ethnicity2 = "Asian"; break; case "black": $ethnicity2 = "Black/African American"; break; case "islander": $ethnicity2 = "Hawaiian/Pacific Islander"; break; case "white": $ethnicity2 = "White"; break; } switch ($handedness) { case "U": $handedness = "Unknown"; break; case "R": $handedness = "Right"; break; case "L": $handedness = "Left"; break; case "A": $handedness = "Ambidextrous"; break; } switch ($education) { case 0: $education = "Unknown"; break; case 1: $education = "Grade School"; break; case 2: $education = "Middle School"; break; case 3: $education = "High School/GED"; break; case 4: $education = "Trade School"; break; case 5: $education = "Associates Degree"; break; case 6: $education = "Bachelors Degree"; break; case 7: $education = "Masters Degree"; break; case 8: $education = "Doctoral Degree"; break; } ?> <br> <style> details[open] { border: 1px solid #ccc; background-color: #eee} </style> <table width="100%" cellpadding="4"> <tr> <td valign="top" align="center"> <table class="download"> <tr> <td class="title"> <?php echo $uid; ?> </td> </tr> <tr> <td align="center" colspan="2" style="border-radius:5px; background-color: white; padding: 5px"> <div align="left" style="font-weight: bold; font-size: 12pt">Demographics</div> <div align="left"> <? if ($phiaccess) { ?> <details> <summary class="tiny" style="color:darkred">Edit or delete</summary> <div style="padding:5px; font-size:11pt"> <a href="subjects.php?action=editform&id=<?php echo $id; ?> ">Edit Demographics</a> <br><br><br> <? if ($GLOBALS['isadmin']) { ?> <a href="subjects.php?action=deleteconfirm&id=<?php echo $id; ?> "><span style="color: red; text-decoration:underline">Delete</span></a> <? } ?> </div> </details> <? } ?> </div> <br> <table class="reviewtable"> <tr> <td class="label">Subject initials</td> <td class="value"><?php echo $name; ?> </td> </tr> <tr> <td class="label">Date of birth</td> <td class="value"><?php echo $dob; ?> </td> </tr> <tr> <td class="label">Gender</td> <td class="value"><?php echo $gender; ?> </td> </tr> <tr> <td class="label" style="white-space:nowrap;">Alternate UIDs</td> <td class="value"> <? foreach ($altuids as $altid) { if (strlen($altid) > 20) { echo "<span title='$altid'>" . substr($altid,0,20) . "...</span> "; } else { echo "$altid "; } } ?> </td> </tr> <tr> <td class="label">Ethnicity1&2</td> <td class="value"><?php echo $ethnicity1; ?> , <?php echo $ethnicity2; ?> </td> </tr> <tr> <td class="label">Handedness</td> <td class="value"><?php echo $handedness; ?> </td> </tr> <tr> <td class="label">Education</td> <td class="value"><?php echo $education; ?> </td> </tr> <tr> <td class="label">Phone</td> <td class="value"><?php echo $phone1; ?> </td> </tr> <tr> <td class="label">E-mail</td> <td class="value"><?php echo $email; ?> </td> </tr> <tr> <td class="label">Marital Status</td> <td class="value"><?php echo $maritalstatus; ?> </td> </tr> <tr> <td class="label">Smoking Status</td> <td class="value"><?php echo $smokingstatus; ?> </td> </tr> <tr> <td class="label">GUID</td> <td class="value"><?php echo $guid; ?> </td> </tr> <tr> <td class="label">Can contact?</td> <td class="value"><?php echo $cancontact; ?> </td> </tr> </table> <br> <br><br> <div align="left" style="font-weight: bold; font-size: 12pt">Family</div> <div align="left"> <? if ($phiaccess) { ?> <details> <summary class="tiny" style="color:darkred">Add family members</summary> <table style="font-size: 10pt"> <? /* display existing subject relations */ $sqlstring = "select a.*, b.uid from subject_relation a left join subjects b on a.subjectid2 = b.subject_id where a.subjectid1 = $id"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $subjectid2 = $row['subjectid2']; $relation = $row['relation']; $uid2 = $row['uid']; switch ($relation) { case "siblingf": $relation = "half-sibling (same father)"; break; case "siblingm": $relation = "half-sibling (same mother)"; break; case "sibling": $relation = "sibling"; break; case "parent": $relation = "parent"; break; case "child": $relation = "child"; break; } ?> <tr> <td><?php echo $uid; ?> is the <b><?php echo $relation; ?> </b> of <a href="subjects.php?id=<?php echo $subjectid2; ?> "><?php echo $uid2; ?> </a></td> </tr> <? } ?> <script> $(function() { $( "#uid2" ).autocomplete({ source: "autocomplete_uid.php", minLength: 2, autoFocus: true }); }); </script> <style> .ui-autocomplete { max-height: 100px; overflow-y: auto; /* prevent horizontal scrollbar */ overflow-x: hidden; /* add padding to account for vertical scrollbar */ padding-right: 20px; } /* IE 6 doesn't support max-height * we use height instead, but this forces the menu to always be this tall */ * html .ui-autocomplete { height: 100px; } </style> <tr> <form action="subjects.php" method="post"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="hidden" name="action" value="addrelation"> <td> <br><br> <?php echo $uid; ?> is the <br> <select name="relation"> <option value="siblingm">Half-sibling (same mother)</option> <option value="siblingf">Half-sibling (same father)</option> <option value="sibling">Sibling</option> <option value="parent">Parent</option> <option value="child">Child</option> </select> of <input type="text" size="10" name="uid2" id="uid2"/> <br> <input type="checkbox" name="makesymmetric" value="1" checked title="If subject 1 is the parent of subject 2, a corresponding relation will also show subject 2 is a child of subject 1">Make symmetric <input type="submit" value="Add relation"></td> </form> </tr> </table> </details> <? } ?> </div> <br> <table class="reviewtable"> <tr> <td class="label">Family UID</td> <td class="value"><?php echo $familyuid; ?> </td> </tr> <tr> <td class="label">Family name</td> <td class="value"><?php echo $familyname; ?> </td> </tr> </table> <br> </td> </tr> </table> </td> <td valign="top" align="center"> <table class="download"> <tr> <td class="title"> Projects </td> <form action="subjects.php" method="post"> <td align="right" style="color: white"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="hidden" name="action" value="enroll"> <span style="font-size:10pt">Enroll subject in project:</span> <select name="projectid"> <? $sqlstring = "select a.*, b.user_fullname from projects a left join users b on a.project_pi = b.user_id where a.project_status = 'active' and a.instance_id = " . $_SESSION['instanceid'] . " order by a.project_name"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $project_id = $row['project_id']; $project_name = $row['project_name']; $project_costcenter = $row['project_costcenter']; $project_enddate = $row['project_enddate']; $user_fullname = $row['user_fullname']; if (strtotime($project_enddate) < strtotime("now")) { $style="color: gray"; } else { $style = ""; } //echo "[" . strtotime($project_enddate) . ":" . strtotime("now") . "]<br>"; ?> <option value="<?php echo $project_id; ?> " style="<?php echo $style; ?> "><?php echo $project_name; ?> (<?php echo $project_costcenter; ?> )</option> <? } ?> </select> <input type="submit" value="Enroll"> </td> </form> </tr> <? $sqlstringA = "select a.project_id 'projectid', a.*, b.*, enroll_startdate, enroll_enddate from enrollment a left join projects b on a.project_id = b.project_id where a.subject_id = $id"; //$resultA = mysql_query($sqlstringA) or die("Query failed: " . mysql_error() . "<br><i>$sqlstringA</i><br>"); $resultA = MySQLQuery($sqlstringA, __FILE__, __LINE__); //PrintSQL($sqlstringA); while ($rowA = mysql_fetch_array($resultA, MYSQL_ASSOC)) { $enrollmentid = $rowA['enrollment_id']; $enroll_startdate = $rowA['enroll_startdate']; $enroll_enddate = $rowA['enroll_enddate']; $enrollgroup = $rowA['enroll_subgroup']; $projectid = $rowA['projectid']; $project_name = $rowA['project_name']; $costcenter = $rowA['project_costcenter']; $project_enddate = $rowA['project_enddate']; $enrolldate = date('M j, Y g:ia',strtotime($enroll_startdate)); if ($row['irb_consent'] != "") { $irb = "Y"; } else { $irb = "N"; } //echo "$enroll_enddate <--> " . date("Y-m-d H:i:s") . "<br>"; if (($enroll_enddate > date("Y-m-d H:i:s")) || ($enroll_enddate == "0000-00-00 00:00:00")) { $enrolled = true; } else { $enrolled = false; } /* check if this user has data access to this project */ $projectaccess = 1; $sqlstring2 = "select view_data from user_project where project_id = $projectid and view_data = 1 and user_id = $userid"; $result2 = MySQLQuery($sqlstring2, __FILE__, __LINE__); if (mysql_num_rows($result2) < 1) { $projectaccess = 0; } $subjectaltids = implode2(',',GetAlternateUIDs($id, $enrollmentid)); ?> <script type="text/javascript"> $(document).ready(function(){ $(".edit_inline<? echo $enrollmentid; ?>").editInPlace({ url: "group_inlineupdate.php", params: "action=editinplace&id=<? echo $enrollmentid; ?>", default_text: "<i style='color:#AAAAAA'>Click to add group name...</i>", bg_over: "white", bg_out: "lightyellow", }); }); </script> <tr> <td class="section" colspan="2"> <table class="subdownload" width="100%"> <tr> <td class="label" style="width: 200px; text-align: left; vertical-align: top;"> <?php echo $project_name; ?> (<?php echo $costcenter; ?> )<br><br> <div style="font-size:10pt; font-weight: normal;"> Enrolled: <span style="color: darkblue"><?php echo $enrolldate; ?> </span><br> <? if ($phiaccess) { ?> Group: <span id="enroll_subgroup" class="edit_inline<? echo $enrollmentid; ?>" style="background-color: lightyellow; padding: 1px 3px; font-size: 9pt;"><? echo $enrollgroup; ?></span><br> <? } ?> <b>ID:</b> <?php echo $subjectaltids; ?> <br> <? if ($enroll_enddate != "0000-00-00 00:00:00") { ?> <span style="color: darkred">Un-enroll date: <?php echo $enroll_enddate; ?> </span><br> <? } ?> <? if ($phiaccess) { ?> <!--Project end date: <?php echo $project_enddate; ?> --> Project status: <a href="projectreport.php?action=viewreport&enrollmentid=<?php echo $enrollmentid; ?> ">View report</a> </div> <? if (($enrolled) && ($GLOBALS['isadmin'])) { ?> <form action="subjects.php" method="post"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="hidden" name="action" value="changeproject"> <input type="hidden" name="enrollmentid" value="<?php echo $enrollmentid; ?> "> <br> <details> <summary class="tiny" style="color:darkred; font-weight:normal">Enroll in different project</summary> <span style="font-size: 10pt; font-weight: normal;">Un-enroll subject from this project and enroll in this project, moving all imaging, assessments, and measures:</span> <select name="newprojectid"> <? $sqlstring = "select a.*, b.user_fullname from projects a left join users b on a.project_pi = b.user_id where a.project_status = 'active' order by a.project_name"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $project_id = $row['project_id']; $project_name = $row['project_name']; $project_costcenter = $row['project_costcenter']; $project_enddate = $row['project_enddate']; $user_fullname = $row['user_fullname']; if (strtotime($project_enddate) < strtotime("now")) { $style="color: gray"; } else { $style = ""; } //echo "[" . strtotime($project_enddate) . ":" . strtotime("now") . "]<br>"; ?> <option value="<?php echo $project_id; ?> " style="<?php echo $style; ?> "><?php echo $project_name; ?> (<?php echo $project_costcenter; ?> )</option> <? } ?> </select> <input type="submit" value="Move"> </form> </details> <? } /* end if phi access */ } /* end if enrolled */ ?> </td> <td class="main"> <? if (!$projectaccess) { echo "No data access privileges to this project"; } else { ?> <table width="100%"> <tr> <td><b>Imaging studies</b> </td> <td align="right"> <? if (!$enrolled) { ?> <span style="color: #666">Subject is un-enrolled. Cannot create new studies</span> <? } else { ?> <!--<a href="subjects.php?action=newstudy&enrollmentid=<?php echo $enrollmentid; ?> &id=<?php echo $id; ?> " style="font-size:11pt">Create new study</a>--> <form action="subjects.php" method="post"> <td align="right"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="hidden" name="enrollmentid" value="<?php echo $enrollmentid; ?> "> <input type="hidden" name="action" value="newstudy"> <span style="font-size:10pt">Create new study:</span> <select name="modality"> <option value="" style="<?php echo $style; ?> ">(Select modality)</option> <? $sqlstring = "select * from modalities order by mod_code"; $result = MySQLQuery($sqlstring, __FILE__, __LINE__); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $mod_code = $row['mod_code']; $mod_desc = $row['mod_desc']; ?> <option value="<?php echo $mod_code; ?> " style="<?php echo $style; ?> ">[<?php echo $mod_code; ?> ] <?php echo $mod_desc; ?> </option> <? } ?> </select> <input type="submit" value="Create"> </td> </form> <? } ?> </td> </tr> </table> <? $sqlstring = "select a.*, datediff(a.study_datetime, c.birthdate) 'ageatscan' from studies a left join enrollment b on a.enrollment_id = b.enrollment_id left join subjects c on b.subject_id = c.subject_id where a.enrollment_id = $enrollmentid order by a.study_datetime desc"; //$result2 = mysql_query($sqlstring) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring</i><br>"); $result2 = MySQLQuery($sqlstring, __FILE__, __LINE__); if (mysql_num_rows($result2) > 0) { ?> <table width="100%" class="smalldisplaytable" style="background-color: #FFFFFF; border-radius: 5px; width: 100%; padding:5px"> <thead> <th>#</th> <th>Modality</th> <th>Date</th> <th>Age<span class="tiny"> y</span></th> <th>Physician</th> <th>Operator</th> <th>Site</th> <th>Study ID</th> <th>Visit</th> <th>Rad Read</th> </thead> <tbody> <? while ($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $study_id = $row2['study_id']; $study_num = $row2['study_num']; $study_modality = $row2['study_modality']; $study_datetime = $row2['study_datetime']; $study_ageatscan = $row2['study_ageatscan']; $calcage = number_format($row2['ageatscan']/365.25,1); $study_operator = $row2['study_operator']; $study_performingphysician = $row2['study_performingphysician']; $study_site = $row2['study_site']; $study_type = $row2['study_type']; $study_status = $row2['study_status']; $study_doradread = $row2['study_doradread']; if (trim($study_ageatscan) != 0) { $age = $study_ageatscan; } else { $age = $calcage; } ?> <tr onMouseOver="this.style.backgroundColor='#9EBDFF'" onMouseOut="this.style.backgroundColor=''"> <td><a href="studies.php?id=<?php echo $study_id; ?> "><?php echo $study_num; ?> </a></td> <td><?php echo $study_modality; ?> </td> <td><?php echo $study_datetime; ?> </td> <td><?php echo number_format($age, 1); ?> </td> <td><?php echo $study_performingphysician; ?> </td> <td><?php echo $study_operator; ?> </td> <td><?php echo $study_site; ?> </td> <td><tt><?php echo $uid; echo $study_num; ?> </tt></td> <td><?php echo $study_type; ?> </td> <td><? if ($study_doradread) { echo "✓"; } ?></td> </tr> <? } ?> </table> <? } else { ?> <div style="font-size: 9pt; background-color:white; text-align: center; border: 1px solid #888; border-radius:5px; padding:3px">No imaging studies</div> <? } ?> <? if ($_SESSION['enablebeta']) { ?> <br><br> <!-- instruments table --> <table width="100%"> <tr> <td><b>Assessments</b> <?php echo PrintBeta(); ?> </td> <form action="assessments.php" method="post"> <td align="right"> <? if (!$enrolled) { $disabled = "disabled"; } else { $disabled = ""; } ?> <input type="hidden" name="enrollmentid" value="<?php echo $enrollmentid; ?> "> <input type="hidden" name="action" value="create"> <span style="font-size: 10pt">Add assessment:</span> <select name="formid" <?php echo $disabled; ?> > <option value="">(Select assessment)</option> <? $sqlstringB = "select * from assessment_forms where form_ispublished = 1 order by form_title"; //$resultB = mysql_query($sqlstringB) or die("Query failed: " . mysql_error() . "<br><i>$sqlstringB</i><br>"); $resultB = MySQLQuery($sqlstringB, __FILE__, __LINE__); while ($rowB = mysql_fetch_array($resultB, MYSQL_ASSOC)) { $form_id = $rowB['form_id']; $form_title = $rowB['form_title']; ?> <option value="<?php echo $form_id; ?> " style="<?php echo $style; ?> "><?php echo $form_title; ?> </option> <? } ?> </select> <input type="submit" value="Create" <?php echo $disabled; ?> > </td> </form> </tr> </table> <? $sqlstring3 = "select a.*, b.form_title from assessments a left join assessment_forms b on a.form_id = b.form_id where a.enrollment_id = $enrollmentid"; //$result3 = mysql_query($sqlstring3) or die("Query failed: " . mysql_error() . "<br><i>$sqlstring3</i><br>"); $result3 = MySQLQuery($sqlstring3, __FILE__, __LINE__); if (mysql_num_rows($result3) > 0) { ?> <table width="100%" class="smalldisplaytable" style="background-color: #FFFFFF; border-radius: 5px; width: 100%; padding:5px"> <thead> <th>Instrument</th> <th>Date</th> <th>Experimentor</th> <th>Rater</th> <th>Complete?</th> </thead> <tbody> <? while ($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { $experiment_id = $row3['experiment_id']; $form_title = $row3['form_title']; $exp_admindate = $row3['exp_admindate']; $experimentor = $row3['experimentor']; $rater_username = $row3['rater_username']; $iscomplete = $row3['iscomplete']; if ($iscomplete) { $action = "view"; } else { $action = "edit"; } ?> <tr onMouseOver="this.style.backgroundColor='#9EBDFF'" onMouseOut="this.style.backgroundColor=''"> <td><a href="assessments.php?action=<?php echo $action; ?> &experimentid=<?php echo $experiment_id; ?> "><?php echo $form_title; ?> </a></td> <td><?php echo $exp_admindate; ?> </td> <td><?php echo $experimentor; ?> </td> <td><?php echo $rater_username; ?> </td> <td><? if ($iscomplete) { echo "✔"; } else { ?> <a href="assessments.php?action=completed&experimentid=<?php echo $experiment_id; ?> ">Mark as complete</a> <? } ?></td> </tr> <? } ?> </table> <? } else { ?> <div style="font-size: 9pt; background-color:white; text-align: center; border: 1px solid gray; border-radius:5px; padding:3px">No assessments</div> <? } ?> <? } ?> <br> <!-- phenotypic measures table --> <table width="100%"> <tr> <td><b>Phenotypic </b><a href="measures.php?enrollmentid=<?php echo $enrollmentid; ?> ">measures</a></td> </tr> </table> <? $sqlstring3 = "select * from measures a left join measurenames b on a.measurename_id = b.measurename_id where enrollment_id = $enrollmentid"; $result3 = MySQLQuery($sqlstring3, __FILE__, __LINE__); $numrows = mysql_num_rows($result3); if ($numrows > 0) { ?> <div style="-moz-column-count:2; -webkit-column-count:2; column-count:2; width: 100%; font-size:9pt; background-color: white; padding: 4px; border-radius:5px; -moz-column-rule:1px outset #DDD; -webkit-column-rule:1px outset #DDD; column-rule:1px outset #DDD; border:1px solid #888"> <? while ($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { $measureid = $row3['measure_id']; $measure_name = $row3['measure_name']; $measure_type = $row3['measure_type']; $measure_valuestring = $row3['measure_valuestring']; $measure_valuenum = $row3['measure_valuenum']; $measure_rater = $row3['measure_rater']; $measure_rater2 = $row3['measure_rater2']; $measure_isdoubleentered = $row3['measure_isdoubleentered']; $measure_datecomplete = $row3['measure_datecomplete']; switch ($measure_type) { case 's': $value = $measure_valuestring; break; case 'n': $value = $measure_valuenum; break; } if (!$measure_isdoubleentered) { $color="red"; } else { $color="darkblue"; } ?> <?php echo $measure_name; ?> <span style="color: <?php echo $color; ?> "><b><?php echo $value; ?> </b></span><br> <? } ?> </div> <? } else { ?> <div style="font-size: 9pt; background-color:white; text-align: center; border: 1px solid #888; border-radius:5px; padding:3px">No measures</div> <? } ?> <? if ($_SESSION['enablebeta']) { ?> <br> <!-- prescriptions table --> <table width="100%"> <tr> <td><a href="prescriptions.php?enrollmentid=<?php echo $enrollmentid; ?> ">Prescriptions</a> <span class="tiny">medications/treatments/substance use</span> <?php echo PrintBeta(); ?> </td> </tr> </table> <? $sqlstring3 = "select *, date_format(rx_startdate,'%Y-%m-%d') 'startdate', date_format(rx_enddate,'%Y-%m-%d') 'enddate' from prescriptions where enrollment_id = $enrollmentid"; $result3 = MySQLQuery($sqlstring3, __FILE__, __LINE__); $numrows = mysql_num_rows($result3); if ($numrows > 0) { ?> <details> <summary>Prescription list</summary> <table> <tr> <td>Rx</td> <td>Route</td> <td>Amount</td> <td>Dates</td> </tr> <? while ($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { $rx_id = $row3['rx_id']; $startdate = $row3['startdate']; $enddate = $row3['enddate']; $rx_dose = $row3['rx_doseamount']; $rx_dosefreq = $row3['rx_dosefrequency']; $rx_route = $row3['rx_route']; $rx_name = $row3['rx_name']; $rx_group = $row3['rx_group']; ?> <tr> <td><?php echo $rx_name; ?> </td> <td><?php echo $rx_route; ?> </td> <td><?php echo $rx_dose; ?> /<?php echo $rx_dosefreq; ?> </td> <td><?php echo $startdate; ?> -<?php echo $enddate; ?> </td> </tr> <? } ?> </table> <? } else { ?> <div style="font-size: 9pt; background-color:white; text-align: center; border: 1px solid #888; border-radius:5px; padding:3px">No prescriptions</div> <? } ?> <? } ?> </td> <? } ?> </tr> </table> </td> </tr> <? } ?> </table> </td> </tr> </table> <br><br><bR><br><br> <? }