function prompt_critical_reportable($sample_id)
{
    $all_details = get_all_details_of_a_sample($sample_id);
    if ($all_details == FALSE) {
        return;
    }
    $critical = 'no';
    foreach ($all_details as $ex_data) {
        //echo '<pre>';
        //print_r($ex_data);
        //$sample_type,$code,$result
        $ret = check_critical_abnormal_reportable($ex_data['sample_type'], $ex_data['code'], $ex_data['result']);
        //echo '<h1>'.$ex_data['result'].'-'.$ret.'</h1>';
        if ($ret == '1' || $ret == '2' || $ret == '4' || $ret == '3') {
            $critical = 'yes';
            $result = get_examination_result_id(1005, $sample_id);
            check_critical_reporting($sample_id);
            echo '	<tr>
					<td>' . $sample_id . '</td>
					<td>' . $ex_data['patient_id'] . '</td>
					<td>' . $ex_data['patient_name'] . '</td>
					<td>' . $ex_data['sample_type'] . '</td>
					<td>' . $ex_data['preservative'] . '</td>
					<td>' . $ex_data['code'] . '</td>					
					<td>' . $ex_data['result'] . '</td>
					<td>' . $ex_data['clinician'] . '</td>
					<td>' . $ex_data['unit'] . '</td>	
					<td>' . $ex_data['location'] . '</td>
					</tr>';
        }
    }
    if ($critical == 'yes') {
        echo '	<tr>
				<td>' . $ex_data['location'] . '</td>
				<td colspan=10>
					<input type=text  size="80" name=\'result_1005_' . $sample_id . '\' value=\'' . $result . '\'>
				</td>
				</tr><tr bgcolor=lightpink><td colspan=10>.....</td></tr>';
    }
}
Beispiel #2
0
function print_report_pdf_A5($sample_id_array, $doctor)
{
    $acr_check_code = array('-1' => '', '-2' => '', '-3' => '', '0' => '', '1' => 'low absurd', '2' => 'high absurd', '3' => 'low critical', '4' => 'high critical', '5' => '', '6' => '');
    //A5=210,148
    $pdf = new MYPDF_NABL('L', 'mm', 'A5', true, 'UTF-8', false);
    $pdf->sample_id_array = $sample_id_array;
    $pdf->doctor = $doctor;
    $pdf->login = $_SESSION['login'];
    // set default monospaced font
    //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(10, 50);
    //set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, 10);
    //set image scale factor
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->SetFont('times', '', 10);
    $pdf->SetFont('helvetica', '', 8);
    foreach ($sample_id_array as $value) {
        $pdf->sample_id = $value;
        $pdf->startPageGroup();
        $pdf->AddPage();
        $linkk = start_nchsls();
        $sql_examination_data = 'select * from examination where sample_id=\'' . $pdf->sample_id . '\' order by name_of_examination';
        $result_examination_data = mysql_query($sql_examination_data, $linkk);
        $counter = 45;
        $pdf->SetFont('helvetica', '', 10);
        $border = 0;
        while ($examination_array = mysql_fetch_assoc($result_examination_data)) {
            $counter = $counter + 5;
            if ($examination_array['id'] < 1000) {
                //available 190 mm
                //10+40+40+40+20+40
                $pdf->SetXY(10, $counter);
                $pdf->Cell($w = 10, $h = 0, $examination_array['NABL_Accredited'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(20, $counter);
                $pdf->Cell($w = 40, $h = 0, $examination_array['name_of_examination'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(60, $counter);
                $pdf->Cell($w = 40, $h = 0, $examination_array['result'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(100, $counter);
                $pdf->Cell($w = 40, $h = 0, $examination_array['referance_range'] . ' ' . $examination_array['unit'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(140, $counter);
                $acr = $acr_check_code[check_critical_abnormal_reportable($examination_array['sample_id'], $examination_array['code'])];
                $pdf->Cell($w = 20, $h = 0, $acr, $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(160, $counter);
                $pdf->Cell($w = 40, $h = 0, $examination_array['method_of_analysis'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                if ($counter >= 120) {
                    $counter = 45;
                    $pdf->AddPage();
                }
            } else {
                $pdf->SetXY(10, $counter);
                $pdf->Cell($w = 50, $h = 0, trim($examination_array['name_of_examination'], 'Z_'), $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                $pdf->SetXY(60, $counter);
                $pdf->Cell($w = 140, $h = 0, $examination_array['result'], $border, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
                if ($counter >= 120) {
                    $counter = 45;
                    $pdf->AddPage();
                }
            }
        }
    }
    $pdf->Output('report.pdf', 'I');
}
Beispiel #3
0
function print_sample($sample_id, $Technician, $Doctor)
{
    global $lab_name, $section_name, $address_phone, $nabl_symbol, $blank_symbol, $nabl_cert_no, $blank_cert_no, $bypass_autoverification;
    $attachment_exist = 'no';
    $link = start_nchsls();
    $sql_sample_data = 'select * from sample where sample_id=' . $sample_id;
    $sql_examination_data = 'select * from examination where sample_id=\'' . $sample_id . '\' order by name_of_examination';
    global $acr_check_code;
    ////////find if any one is accredited
    $NABL_acc_counter = 0;
    $result_examination_data_for_accr = mysql_query($sql_examination_data, $link);
    while ($acc_array = mysql_fetch_assoc($result_examination_data_for_accr)) {
        if ($acc_array['NABL_Accredited'] == 'Yes') {
            $NABL_acc_counter++;
        }
    }
    if ($NABL_acc_counter > 0) {
        $symbol = $nabl_symbol;
        $cert_no = $nabl_cert_no;
    } else {
        $symbol = $blank_symbol;
        $cert_no = $blank_cert_no;
    }
    /////////////////////
    if (mysql_num_rows($result_sample_data = mysql_query($sql_sample_data, $link)) > 0) {
        $sample_array = mysql_fetch_assoc($result_sample_data);
        echo '
			<table border=0 style="border-collapse:collapse;">';
        if (strlen($Doctor) > 0) {
            echo '<tr>
					<td colspan=20 align=center>
						<table border=0>
							<tr><th colspan=20><u><h2>' . $lab_name . '</h2></u></td></tr>
							<tr><th  colspan=2 align=center>' . $address_phone . '</td></td></tr>
							<tr>
								<td>
									<table border=0>
									<tr><td align=center ><img src="' . $symbol . '" height="96" width=90" /></td></tr>
									<tr><td width=10 align="center"><font size="1">' . $cert_no . '</font></td></tr>
									</table>
								</td>
								<td>
									<table border=0>
									<tr><th halign=center>Laboratory Examination Report</th></tr>
									<tr><th align=center>' . $section_name . '</th></tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>';
        } else {
            echo '<tr><th colspan=10><font color=red>THIS IS NOT A REPORT. DO NOT PRINT</font></th></tr>';
        }
        echo '<tr style="border:1px solid #000;">
								<td>
									<table border=0>
										<tr><td><b>Patient Name</b></td><td>' . $sample_array['patient_name'] . '</td></tr>
										<tr><td><b>MRD Number</b></td><td>' . $sample_array['patient_id'] . '</td></tr>
									</table>
								</td>	
								<td align=right>
									<table border=0>
										<tr><td><b>' . $sample_array['clinician'] . '</td><td><b>Unit:</b>' . $sample_array['unit'] . '</td></tr>
										<tr><td><b>Ward/OPD</b></td><td>' . $sample_array['location'] . '</td></tr>
									</table>
								</td>						
				</tr>

				<tr style="border:1px solid #000;">
								<td>
									<table border=0>
										<tr><td style=\'font-size:150%\'>Sample ID:<b>' . $sample_array['sample_id'] . '</b>(';
        //comment line below when bypassing autoverification
        echo $sample_array['status'];
        echo ')</td></tr>
										<tr><td><b>' . $sample_array['sample_details'] . '</b></td></tr>
									</table>
								</td>	
								<td align=right>
									<table border=0>
										<tr><td><b>Sample Type:</b>' . $sample_array['sample_type'] . '</td></tr>
										<tr><td><b>Preservative:</b>' . $sample_array['preservative'] . '</td></tr>
									</table>
								</td>						
				</tr>';
        echo '
							<tr  style="border:1px solid #000;"><td colspan=3><b>Collection time/Diagnosis/Age/Sex:</b>' . $sample_array['sample_collection_time'] . '</b></td></tr>
							<tr  style="border:1px solid #000;"><td><b>Receipt Time:</b>' . $sample_array['sample_receipt_time'] . '</td><td align=right><b>Report time:</b>' . strftime('%Y-%m-%d %H:%M:%S') . '</td></tr>
													
			';
        if (mysql_num_rows($result_examination_data = mysql_query($sql_examination_data, $link)) > 0) {
            //<table border=0 RULES=COLS FRAME=BOX style="border-collapse:collapse;  margin-top:50px">
            echo '
				<tr><td colspan=2>
				<table border=1 style="border-collapse:collapse;  margin-top:50px">
						<tr>
							<th>Accr.</th>
							<th>Examination</th>
							<th>Result</th>
							<th>Ref.R</th>
							<th>Alert</th>
							<th>Method</th>
						</tr>';
            while ($examination_array = mysql_fetch_assoc($result_examination_data)) {
                if ($examination_array['id'] < 1000) {
                    echo '<tr>';
                    echo '<td>' . $examination_array['NABL_Accredited'] . '</td>';
                    echo '<td>' . $examination_array['name_of_examination'] . '</td>';
                    echo '<td>' . $examination_array['result'] . '</td>';
                    echo '<td>' . $examination_array['referance_range'] . ' ' . $examination_array['unit'] . '</td>';
                    echo '<td>';
                    echo $acr_check_code[check_critical_abnormal_reportable($sample_array['sample_type'], $examination_array['code'], $examination_array['result'])];
                    echo '</td>';
                    echo '<td>' . $examination_array['method_of_analysis'] . '</td>';
                    //echo '<td>'.$examination_array['details'].'</td>';
                    echo '</tr>';
                } elseif ($examination_array['id'] >= 1000) {
                    if ($examination_array['id'] == 1008) {
                        $attachment_exist = 'yes';
                    }
                    echo '
						<tr>
							<td colspan="10" >
								<table border=0>
									<tr>
					<tr><td><b>' . trim($examination_array['name_of_examination'], 'Z_') . ':</b></td><td>' . $examination_array['result'] . '</td></tr>
									</tr>
								</table>	
							</td>
						</tr>';
                }
            }
            echo '<tr><th colspan=20>The tests marked with \'No\' in the first column are not accredited by NABL</th></tr>';
            echo '</table>';
        }
        echo '	<tr>
						<td colspan=24 align=center>
							<table border=1 style="border-collapse:collapse;  margin-top:50px">
								<tr>
									<td>Sign:</td></td><td width=200></td><td rowspan=2 width=150></td>
									<td>Sign:</td><td width=200></td>
								</tr>
								
								<tr>
									<td align=center colspan=2>' . $Technician . '</td>
									<td   align=center colspan=2>' . $Doctor . '</td>
								</tr>
								
							</table>								
						</td>
					</tr>
						';
        if ($attachment_exist == 'no') {
            echo '<tr><td align=center colspan=6>-----End of Report-----</td></tr>';
        }
        echo '</table>';
        if ($attachment_exist == 'yes') {
            echo '<h2 style="page-break-before: always;"></h2>';
            print_attachment($sample_id);
        }
        //return TRUE;
    } else {
        return FALSE;
    }
}
$wth = $pdf->getPageWidth() - 10;
$linkk = start_nchsls();
$sql_examination_data = 'select * from examination where sample_id=\'' . $sample_id . '\' order by name_of_examination';
$result_examination_data = mysql_query($sql_examination_data, $linkk);
$counter = 55;
$pdf->SetFont('helvetica', '', 8);
while ($examination_array = mysql_fetch_assoc($result_examination_data)) {
    //if($examination_array['id']<1000)
    //{
    $pdf->SetY($counter);
    $counter = $counter + 5;
    $pdf->Cell($w = $wth * 0.1, $h = 0, $examination_array['NABL_Accredited'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['name_of_examination'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['result'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['referance_range'] . ' ' . $examination_array['unit'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    $acr = $acr_check_code[check_critical_abnormal_reportable($examination_array['sample_id'], $examination_array['code'])];
    $pdf->Cell($w = $wth * 0.1, $h = 0, $acr, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    $pdf->Cell($w = $wth * 0.2, $h = 0, $examination_array['method_of_analysis'], $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M');
    //}
    //else
    //{
    //		$pdf->SetY($counter);$counter=$counter+5;
    //		$pdf->Cell($w=$wth*0.2, $h=0, $examination_array['name_of_examination'],$border=0, $ln=0, $align='', $fill=false, $link='',
    //		$stretch=1, $ignore_min_height=false, $calign='T', $valign='M');
    //		$pdf->Cell($w=$wth*0.8, $h=0, $examination_array['result'],$border=0, $ln=0, $align='', $fill=false, $link='',
    //		$stretch=1, $ignore_min_height=false, $calign='T', $valign='M');
    //}
}
// print a block of text using Write()
/**
	 * This method prints text from the current position.<br />