default: $method = ""; $machine_result = ""; $test_date = ""; break; } $result = ""; if (!empty($row_override_result)) { $or = end(explode("::", $row_override_result)); $or = explode("|||", $or); $result = $or[0]; $test_date = ""; } else { $result = $machine_result; } $result = getVLNumericResult($result, $machine_type, $factor); $numerical_result = getNumericalResult($result); $suppressed = isSuppressed2($numerical_result, $sample_type, $test_date); switch ($suppressed) { case 'YES': // patient suppressed, according to the guidlines at that time $smiley = "smiley.smile.gif"; $recommendation = getRecommendation($suppressed, $sampleVLTestDate, $sampleType); break; case 'NO': // patient suppressed, according to the guidlines at that time $smiley = "smiley.sad.gif"; $recommendation = getRecommendation($suppressed, $sampleVLTestDate, $sampleType); break; default: $smiley = "smiley.sad.gif";
/** * function to retrieve the result */ function getVLResult($machineType,$worksheetID,$sampleID,$factor) { global $default_resultFailureNewSampleMessage; $result=0; //first check if any result overrides are in place if($worksheetID && getDetailedTableInfo2("vl_results_override","sampleID='$sampleID' and worksheetID='$worksheetID'","id")) { $result=getDetailedTableInfo2("vl_results_override","sampleID='$sampleID' and worksheetID='$worksheetID'","result"); return $result; } elseif(!$worksheetID && getDetailedTableInfo2("vl_results_override","sampleID='$sampleID'","id")) { $result=getDetailedTableInfo2("vl_results_override","sampleID='$sampleID'","result"); return $result; } else { $rocheFailedResult=0; $rocheFailedResult="Invalid Test Result. Insufficient sample remained to repeat the assay."; $abbottFailedResult=0; $abbottFailedResult="Failed."; if($machineType=="roche") { if(isResultFailed($machineType,($worksheetID?$worksheetID:""),$sampleID)) { /* * 15/Sept/14: * Hellen (hnansumba@gmail.com, CPHL) requested that once a sample has failed more than once, * there is insufficient sample left for a re-run hence; * Change result to read "invalid test result. Insufficient sample remained to repeat the assay" */ if(getDetailedTableInfo3("vl_results_merged","lower(machine)='".strtolower($machineType)."' and vlSampleID='$sampleID'","count(id)","num")>1 && getDetailedTableInfo2("vl_results_merged","lower(machine)='".strtolower($machineType)."' and vlSampleID='$sampleID' order by created limit 1","resultAlphanumeric")==$rocheFailedResult) { /* * 21/Jan/15: * (sewyisaac@yahoo.co.uk) * Regarding the report where we do not have results, this is the massage to I propose. * There is No Result Given. The Test Failed the Quality Control Criteria. We advise you send a a new sample. * * 23/Dec/2015 * Request from Joseph Kibirige (joseph.kibirige@yahoo.com, CPHL) and Prossy Mbabazi (pronam2000@yahoo.com, CPHL) * when a sample has failed twice, automatically override the 2nd result with * "There is No Result Given. The Test Failed the Quality Control Criteria. We advise you send a a new sample." */ logResultOverride($sampleID,$worksheetID,$default_resultFailureNewSampleMessage); //return return $default_resultFailureNewSampleMessage; } else { //return return $rocheFailedResult; } } else { $result=getDetailedTableInfo2("vl_results_roche",($worksheetID?"worksheetID='$worksheetID' and ":"")."SampleID='$sampleID' order by created desc limit 1","Result"); $result=getVLNumericResult($result,$machineType,$factor); return $result; } } elseif($machineType=="abbott") { if(isResultFailed($machineType,($worksheetID?$worksheetID:""),$sampleID)) { /* * 15/Sept/14: * Hellen (hnansumba@gmail.com, CPHL) requested that once a sample has failed more than once, * there is insufficient sample left for a re-run hence; * Change result to read "invalid test result. Insufficient sample remained to repeat the assay" * * 22/Sept/14 * Adjustment made to recognize both samples as failures */ if(getDetailedTableInfo3("vl_results_merged","lower(machine)='".strtolower($machineType)."' and vlSampleID='$sampleID'","count(id)","num")>1 && getDetailedTableInfo2("vl_results_merged","lower(machine)='".strtolower($machineType)."' and vlSampleID='$sampleID' order by created limit 1","resultAlphanumeric")==$abbottFailedResult) { /* * 21/Jan/15: * (sewyisaac@yahoo.co.uk) * Regarding the report where we do not have results, this is the massage to I propose. * There is No Result Given. The Test Failed the Quality Control Criteria. We advise you send a a new sample. * * 23/Dec/2015 * Request from Joseph Kibirige (joseph.kibirige@yahoo.com, CPHL) and Prossy Mbabazi (pronam2000@yahoo.com, CPHL) * when a sample has failed twice, automatically override the 2nd result with * "There is No Result Given. The Test Failed the Quality Control Criteria. We advise you send a a new sample." */ logResultOverride($sampleID,$worksheetID,$default_resultFailureNewSampleMessage); //return return $default_resultFailureNewSampleMessage; } else { //return return $abbottFailedResult; } } else { $result=getDetailedTableInfo2("vl_results_abbott",($worksheetID?"worksheetID='$worksheetID' and ":"")."sampleID='$sampleID' order by created desc limit 1","result"); $result=getVLNumericResult($result,$machineType,$factor); return $result; } } } }
'$assayCalibrationTime','$reagentLotNumber','$reagentLotExpirationDate', '$controlLotNumber','$controlExpirationDate','$controlRange', '$calibratorLotNumber','$calibratorExpirationDate','$calibratorLogConcentration', '$resultComment','$targetMR','$icMR', '$datetime','$trailSessionUser'),"; //automatically log whether this sample should be repeated $abbottSampleID=0; $abbottSampleID=getDetailedTableInfo2("vl_samples","vlSampleID='$sampleID' limit 1","id"); $log_repeat_values .= logRepeat("abbott",$abbottSampleID,$worksheetID,$result,$flags); //log into vl_results_merged //alphanumeric result $resultAlphanumeric=0; //$resultAlphanumeric=getVLResult("abbott",$worksheetID,$sampleID,$factor); $resultAlphanumeric = getVLNumericResult($result,$machineType,$factor); //numeric result $resultNumeric=0; $resultNumeric=getVLNumericResultOnly($resultAlphanumeric); $is_res_valid=isResultValid($resultAlphanumeric); //checks for validity of the result $spprssn_status=isSuppressed($is_res_valid,$resultNumeric); //get the suppression status //log into vl_results_merged $merged_values .= "('abbott','$worksheetID','$sampleID','$resultAlphanumeric', '$resultNumeric','$spprssn_status','$datetime','$trailSessionUser'),"; /*mysqlquery("insert ignore into vl_results_merged (machine,worksheetID,vlSampleID,resultAlphanumeric, resultNumeric,suppressed,created,createdby) values