DOWNLOAD PDF )"; } else{ $fname="/home/sites/nationalcordbloodprogram.com/www/patient_reg/docs/" . intval($_GET['id']) . ".PDF"; if(file_exists($filename) && is_readable($filename)){ $pdflink="( DOWNLOAD PDF )"; } } if($seclevel == "TPCU"){ $query = "SELECT *, request.doctor_id as doctor_id, request.transplant_center_id as transplant_center_id FROM request, doctor WHERE ( (doctor.seclevel = 'ADM' OR doctor.seclevel = 'NYBC') OR (doctor.seclevel = 'TC' AND doctor.transplant_center_id = request.transplant_center_id) OR (doctor.seclevel = 'DR' AND doctor.doctor_id = request.doctor_id) ) AND request.deleted='N' AND request_id = " . $HTTP_GET_VARS['id']; #echo $query; } else { $query = "SELECT *, request.doctor_id as doctor_id, request.transplant_center_id as transplant_center_id FROM request, doctor WHERE username = \"" . getenv("REMOTE_USER") . "\" AND ( (doctor.seclevel = 'ADM' OR doctor.seclevel = 'NYBC') OR (doctor.seclevel = 'TC' AND doctor.transplant_center_id = request.transplant_center_id) OR (doctor.seclevel = 'DR' AND doctor.doctor_id = request.doctor_id) ) AND request.deleted='N' AND request_id = " . $HTTP_GET_VARS['id']; } $result = mysql_query($query) or die(mysql_error()); if( mysql_num_rows($result) ) { $data = mysql_fetch_array($result, MYSQL_ASSOC); $exists = 1; } } else { $query = "SELECT * FROM doctor WHERE username = \"" . getenv("REMOTE_USER") . "\""; $result = mysql_query($query) or die(mysql_error()); $data = mysql_fetch_array($result, MYSQL_ASSOC); } $edit = 0; if ( $HTTP_GET_VARS['mode'] == "edit" ) { $edit = 1; } $month = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); print << var fields = new Array('patientlast','family name','alpha','patientfirst','given name','alpha','patientgender','patient gender','radio','patientdob_m','month of birth','select','patientdob_d','day of birth','select','patientdob_y','year of birth','select','patientdob','date of birth','date','patientdob','date of birth','comparedate NOW today','patientdob','date of birth','comparedate diagdate diagnosis date','patientrace','ethnicity/race','select','diagnosis_id','diagnosis','select','diagdate_d','diagnosis day','select','diagdate_m','diagnosis month','select','diagdate_y','diagnosis year','select','diagdate','diagnosis date','date','diagdate','diagnosis date','comparedate NOW today','transplant_center_id','Transplant Center','select','doctor_id','Requesting Doctor','select','HLAA1','HLA A1','select','HLAA2','HLA A2','select','HLAB1','HLA B1','select','HLAB2','HLA B2','select','HLADR1','HLA DR1','select','HLADR2','HLA DR2','select','patientwt','Body Weight','weight','testdate','date of test','comparedate NOW today'); var allele_fields = new Array('A1', 'A2', 'B1', 'B2', 'DR1', 'DR2' ); HTML; // print ""; if($exists) { //print '
'; print << HTML; print ""; } else { //print ''; print << HTML; } ?>
SEARCH REQUEST
Select "Check Recent Request Status" on the menu bar to view Preliminary Match Report.

HTML; print <<      B: HTML; if ( $valuec1 && $valuec2 ) { print <<      C: HTML; } if ( $valuedr1 || $valuedr2 ) { print <<      DR: HTML; if ( $value_dr1 || $value_dr2 ) { print <<$valuedr1, $valuedr2 / $value_dr1, $value_dr2 HTML; } else { print <<$valuedr1, $valuedr2 HTML; } } else if ( $value_dr1 || $value_dr2 ) { print <<      DR: HTML; if ( $valuedr1 || $valuedr2 ) { print <<$valuedr1, $valuedr2 / $value_dr1, $value_dr2 HTML; } else { print <<$value_dr1, $value_dr2 HTML; } } print <<
PATIENT REGISTRATION

Date:

* Patient's Last Name/Family Name: '; ?>

* First Name: '; ?>
* Birthdate: '; while(list($key,$mnth) = each($month)) { $key++; if($mnth == $month[(int)$value[1] - 1]) { print ""; } else { print ""; } } print ''; print ''; print ''; } ?>

* Ethnicity/Race: '; $query = "SELECT * FROM races ORDER BY racename"; $r = mysql_query($query) or die(mysql_error()); while( $line = mysql_fetch_array($r, MYSQL_ASSOC) ) { if($edit) { if( $data['patientrace'] == $line['racecode']) print ""; else print ""; } elseif( $data['patientrace'] == $line['racecode']) { print $line['racename']; } } if ($edit) print ''; ?>

* Gender: Male"; print " Female"; } elseif($data['patientgender'] == 'F') { print " Male"; print " Female"; } else { print " Male"; print " Female"; } } elseif($exists) { if($data['patientgender'] == 'M') { print "Male"; } elseif( $data['patientgender'] == 'F') { print "Female"; } } elseif($edit) { print " Male"; print " Female"; } ?>
* Diagnosis: '; print ''; } $query = "SELECT * FROM diagnosis ORDER BY diag_desc"; $r = mysql_query($query) or die(mysql_error()); while( $line = mysql_fetch_array($r, MYSQL_ASSOC) ) { if($edit) { if( $data['diagnosis_id'] == $line['diagnosis_id']) print ""; else print ""; } elseif( $data['diagnosis_id'] == $line['diagnosis_id']) { print $line['diag_desc']; } } if(!$edit && $data['diagnosis_id']==99999){ print "Other Diagnosis (see below)"; } if ($edit) print ''; ?>
Other Diagnosis: $value"; elseif($edit) print '

Other Diagnosis (if not listed above):
'; ?>

* Date of Diagnosis: '; reset($month); while(list($key,$mnth) = each($month)) { $key++; if($mnth == $month[(int)$value[1] - 1]) { print ""; } else { print ""; } } print ''; print ''; print ''; } ?>

Stage: '; ?>

* BodyWeight (kg) '; ?>

Patient's HLA TYPING:
Please fax original HLA LAB REPORT for Class I and Class II High Resolution to fax number (212) 570-9061.
HLA      A: $valuea1, $valuea2 $valueb1, $valueb2 $valuec1, $valuec2
HTML; //print "A: $valuea1 $valuea2 B: $valueb1 $valueb2 C: $valuec1 $valuec2 DR: $valuedr1 $valuedr2 DRB: $valuedrb1a $valuedrb1b"; } else { $A1 = get_hla($data,"HLAA1"); $A2 = get_hla($data,"HLAA2"); $B1 = get_hla($data,"HLAB1"); $B2 = get_hla($data,"HLAB2"); $DR1 = get_hla($data,"HLADR1"); $DR2 = get_hla($data,"HLADR2"); /* allele values */ if( $data["DR1"] ) { $value_dr1 = $data["DR1"]; } if ( $data["DR2" ] ) { $value_dr2 = $data["DR2"]; } if( $data["A1"] ) { $value_a1 = $data["A1"]; } if ( $data["A2" ] ) { $value_a2 = $data["A2"]; } if( $data["B1"] ) { $value_b1 = $data["B1"]; } if ( $data["B2" ] ) { $value_b2 = $data["B2"]; } print << Serology Allele * A: $A1 $A2 * B: $B1 $B2 * DR: $DR1 $DR2   Please type 'bl' when field is blank. HTML; /* echo get_hla($data,"HLAA1"); echo get_hla($data,"HLAA2"); print " *B: "; echo get_hla($data,"HLAB1"); echo get_hla($data,"HLAB2"); print " : "; echo ""; echo ""; //echo get_hla($data,"HLAC1"); //echo get_hla($data,"HLAC2"); print " *DR: "; echo get_hla($data,"HLADR1"); echo get_hla($data,"HLADR2"); print " DRB1: "; echo ""; echo ""; //echo get_hla($data,"HLADRB1A"); //echo get_hla($data,"HLADRB1B"); */ /* print ''; print ''; print "B: "; print ''; print ''; print "C: "; print ''; print ''; print "DR: "; print ''; print ''; print "DRB: "; print ''; print ''; */ } ?> HLA Laboratory: '; ?> Date of Test: '; reset($month); while(list($key,$mnth) = each($month)) { $key++; if($mnth == $month[(int)$value[1] - 1]) { print ""; } else { print ""; } } print ''; print ''; print ''; } ?> NOTE: if a potential match is found, confirmatory HLA typing of patient will be required. NYBC's National Cord Blood Program will do confirmatory typing for no charge.
  * Transplant Center: '; $query = "SELECT * FROM transplant_center WHERE deleted = 'N' ORDER BY name"; $r = mysql_query($query) or die(mysql_error()); while( $line = mysql_fetch_array($r, MYSQL_ASSOC) ) { if($edit) { if( $data['transplant_center_id'] == $line['transplant_center_id']) print ""; else print ""; } elseif( $data['transplant_center_id'] == $line['transplant_center_id']) { print "{$line['name']}" ; } } print ''; } else { $query = "SELECT name, transplant_center_id FROM transplant_center WHERE transplant_center_id = {$data['transplant_center_id']}"; $r = mysql_query($query) or die(mysql_error()); $line = mysql_fetch_array($r, MYSQL_ASSOC); print $line["name"]; print ""; } ?>   Have you started a search for a marrow donor? Transplant Center Contact:
'; ?>   Yes"; print " No"; } elseif($data['searchstarted'] == 'N') { print " Yes"; print " No"; } else { print " Yes"; print " No"; } } elseif($exists) { if($data['searchstarted'] == 'Y') { print "Yes"; } elseif($data['searchstarted'] == 'N') { print "No"; } } elseif($edit) { print " Yes"; print " No"; } ?> * Requesting Doctor: '; $query = "SELECT * FROM doctor where transplant_center_id = $tcid AND deleted ='N' ORDER BY lastname"; $r = mysql_query($query) or die(mysql_error()); while( $line = mysql_fetch_array($r, MYSQL_ASSOC) ) { if($edit) { if( $data['doctor_id'] == $line['doctor_id']) print ""; else print ""; } elseif( $data['doctor_id'] == $line['doctor_id']) { print"{$line['firstname']} {$line['lastname']}" ; } } print ''; } else { $query = "SELECT * FROM doctor WHERE doctor_id = {$data['doctor_id']}"; $r = mysql_query($query) or die(mysql_error()); $line = mysql_fetch_array($r, MYSQL_ASSOC); print "{$line['lastname']}, {$line['firstname']}"; print ""; } ?>   Preliminary"; print " Formal"; } elseif($data['searchtype'] == 'F') { print " Preliminary"; print " Formal"; } else { print " Preliminary"; print " Formal"; } } elseif($exists) { if($data['searchtype'] == 'P') { print "Preliminary"; } elseif($data['searchtype'] == 'F') { print "Formal"; } } elseif($edit) { print " Preliminary"; print " Formal"; } ?>     Search Outcome: Match"; print " None"; } elseif($data['searchoutcome'] == 'N') { print " Match"; print " None"; } else { print " Match"; print " None"; } } elseif($exists) { if($data['searchoutcome'] == 'M') { print "Match"; } elseif($data['searchoutcome'] == 'N') { print "None"; } } elseif($edit) { print " Match"; print " None"; } ?> "; print ""; } elseif($edit) { print ""; } elseif($exists) { print "

"; } ?>
"; foreach($types[$db_key] as $op) { $theop = $op; if( $theop == $data[$db_key] ) { $selected = "selected"; } $res .= ""; $selected = ""; } $res .= ""; return $res; } function get_hla($data,$key) { $res=""; $types["HLAA1"]=array("",1,2,3,9,10,11,19,23,24,25,26,27,28,29,30,31,32,33,34,36,43,66,68,69,74,80); $types["HLAA2"]=array("","bl",1,2,3,9,10,11,19,23,24,25,26,28,29,30,31,32,33,34,36,43,66,68,69,74,80); $types["HLAB1"]=array("",5,7,8,12,13,14,15,16,17,18,21,22,27,35,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,70,71,72,73,75,76,77,78,81); $types["HLAB2"]=array("","bl",5,7,8,12,13,14,15,16,17,18,21,22,27,35,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,70,71,72,73,75,76,77,78,81); $types["HLAC1"]=array("help","help","help"); $types["HLAC2"]=array("help","help","help"); $types["HLADRB1A"]=array("",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); $types["HLADRB1B"]=array("","bl",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); $types["HLADR1"]=array("",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); $types["HLADR2"]=array("","bl",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18); $types["DR1"] = array("0101","0102","0103","0104","0105","0106","0107","0108","0109","0110", "0111","0112","0113","0114","0115","0116","0301","0302","0303","0304", "0305","0306","0307","0308","0309","0310","0311","0312","0313","0314", "0315","0316","0317","0318","0319","0320","0321","0322","0323","0324", "0325","0326","0327","0328","0329","0330","0331","0401","0402","0403", "0404","0405","0406","0407","0408","0409","0410","0411","0412","0413", "0414","0415","0416","0417","0418","0419","0420","0421","0422","0423", "0424","0425","0426","0427","0428","0429","0430","0431","0432","0433", "0434","0435","0436","0437","0438","0439","0440","0441","0442","0443", "0444","0445","0446","0447","0448","0449","0450","0451","0452","0453", "0454","0455","0456","0457","0458","0459","0460","0461","0462","0463", "0701","0703","0704","0705","0706","0707","0708","0709","0710","0711", "0712","0801","0802","0803","0804","0805","0806","0807","0808","0809", "0810","0811","0812","0813","0814","0815","0816","0817","0818","0819", "0820","0821","0822","0823","0824","0825","0826","0827","0828","0829", "0830","0831","0832","0901","0902","0903","0904","0905","0906","1", "10","1001","11","1101","1102","1103","1104","1105","1106","1107", "1108","1109","1110","1111","1112","1113","1114","1115","1116","1117", "1118","1119","1120","1121","1122","1123","1124","1125","1126","1127", "1128","1129","1130","1131","1132","1133","1134","1135","1136","1137", "1138","1139","1140","1141","1142","1143","1144","1145","1146","1147", "1148","1149","1150","1151","1152","1153","1154","1155","1156","1157", "1158","1159","1160","12","1201","1202","1203","1204","1205","1206", "1207","1208","1209","1210","1211","1212","1213","1214","1215","13", "1301","1302","1303","1304","1305","1306","1307","1308","1309","1310", "1311","1312","1313","1314","1315","1316","1317","1318","1319","1320", "1321","1322","1323","1324","1325","1326","1327","1328","1329","1330", "1331","1332","1333","1334","1335","1336","1337","1338","1339","1340", "1341","1342","1343","1344","1345","1346","1347","1348","1349","1350", "1351","1352","1353","1354","1355","1356","1357","1358","1359","1360", "1361","1362","1363","1364","1365","1366","1367","1368","1369","1370", "1371","1372","1373","1374","1375","14","1401","1402","1403","1404", "1405","1406","1407","1408","1409","1410","1411","1412","1413","1414", "1415","1416","1417","1418","1419","1420","1421","1422","1423","1424", "1425","1426","1427","1428","1429","1430","1431","1432","1433","1434", "1435","1436","1437","1438","1439","1440","1441","1442","1443","1444", "1445","1446","1447","1448","1449","1450","1451","1452","1453","1454", "1455","1456","1457","1458","1459","1460","1461","1462","1463","1464", "15","1501","1502","1503","1504","1505","1506","1507","1508","1509", "1510","1511","1512","1513","1514","1515","1516","1517","1518","1519", "1520","1521","1522","16","1601","1602","1603","1604","1605","1607", "1608","1609","1610","1611","17","18","2","3","4","6","7","8","9","bl" ); $types["DR2"] = array("0101","0102","0103","0104","0105","0106","0107","0108","0109","0110", "0111","0112","0113","0114","0115","0116","0301","0302","0303","0304", "0305","0306","0307","0308","0309","0310","0311","0312","0313","0314", "0315","0316","0317","0318","0319","0320","0321","0322","0323","0324", "0325","0326","0327","0328","0329","0330","0331","0401","0402","0403", "0404","0405","0406","0407","0408","0409","0410","0411","0412","0413", "0414","0415","0416","0417","0418","0419","0420","0421","0422","0423", "0424","0425","0426","0427","0428","0429","0430","0431","0432","0433", "0434","0435","0436","0437","0438","0439","0440","0441","0442","0443", "0444","0445","0446","0447","0448","0449","0450","0451","0452","0453", "0454","0455","0456","0457","0458","0459","0460","0461","0462","0463", "0701","0703","0704","0705","0706","0707","0708","0709","0710","0711", "0712","0801","0802","0803","0804","0805","0806","0807","0808","0809", "0810","0811","0812","0813","0814","0815","0816","0817","0818","0819", "0820","0821","0822","0823","0824","0825","0826","0827","0828","0829", "0830","0831","0832","0901","0902","0903","0904","0905","0906","1", "10","1001","11","1101","1102","1103","1104","1105","1106","1107", "1108","1109","1110","1111","1112","1113","1114","1115","1116","1117", "1118","1119","1120","1121","1122","1123","1124","1125","1126","1127", "1128","1129","1130","1131","1132","1133","1134","1135","1136","1137", "1138","1139","1140","1141","1142","1143","1144","1145","1146","1147", "1148","1149","1150","1151","1152","1153","1154","1155","1156","1157", "1158","1159","1160","12","1201","1202","1203","1204","1205","1206", "1207","1208","1209","1210","1211","1212","1213","1214","1215","13", "1301","1302","1303","1304","1305","1306","1307","1308","1309","1310", "1311","1312","1313","1314","1315","1316","1317","1318","1319","1320", "1321","1322","1323","1324","1325","1326","1327","1328","1329","1330", "1331","1332","1333","1334","1335","1336","1337","1338","1339","1340", "1341","1342","1343","1344","1345","1346","1347","1348","1349","1350", "1351","1352","1353","1354","1355","1356","1357","1358","1359","1360", "1361","1362","1363","1364","1365","1366","1367","1368","1369","1370", "1371","1372","1373","1374","1375","14","1401","1402","1403","1404", "1405","1406","1407","1408","1409","1410","1411","1412","1413","1414", "1415","1416","1417","1418","1419","1420","1421","1422","1423","1424", "1425","1426","1427","1428","1429","1430","1431","1432","1433","1434", "1435","1436","1437","1438","1439","1440","1441","1442","1443","1444", "1445","1446","1447","1448","1449","1450","1451","1452","1453","1454", "1455","1456","1457","1458","1459","1460","1461","1462","1463","1464", "15","1501","1502","1503","1504","1505","1506","1507","1508","1509", "1510","1511","1512","1513","1514","1515","1516","1517","1518","1519", "1520","1521","1522","16","1601","1602","1603","1604","1605","1607", "1608","1609","1610","1611","17","18","2","3","4","6","7","8","9","bl" ); $res .= ""; return $res; } function request_history($id){ $query="SELECT user, action, date FROM request_history WHERE request_id=$id ORDER BY date desc"; $result = mysql_query($query) or die(mysql_error()); if( mysql_num_rows($result) ) { $i=0; echo "REQUEST HISTORY
\n"; echo "\n"; while( $line = mysql_fetch_array($result, MYSQL_ASSOC) ) { if($clr=="#ffffff"){ $clr="#cccccc";} else{ $clr="#ffffff"; } echo "\n"; } echo "
UserActionDate
" . $line["user"] . "" . $line["action"] . "" . $line["date"] . "
\n"; } } ?>