Update Minor_2 Hasil Test Pasien
This commit is contained in:
parent
4f2e45fe72
commit
291f74766b
@ -3,7 +3,7 @@ namespace App\Controllers;
|
||||
|
||||
class PrintResult extends BaseController {
|
||||
|
||||
public function otherTests($resultData, $data){
|
||||
public function otherTests($resultData, $data, $note){
|
||||
|
||||
// var_dump($data);die();
|
||||
|
||||
@ -111,10 +111,6 @@ class PrintResult extends BaseController {
|
||||
|
||||
$resultTest ="";
|
||||
|
||||
$note = "-";
|
||||
// $notes = end($resultData);
|
||||
// $note = $notes['RESULT'] == "" ? "-" : $notes['RESULT'];
|
||||
|
||||
// Untuk Collection
|
||||
if ($data[1] != null) {
|
||||
$colltext = '';
|
||||
@ -197,15 +193,13 @@ class PrintResult extends BaseController {
|
||||
";
|
||||
$lastDiv="</div>";
|
||||
|
||||
|
||||
$tempChapEng = "";
|
||||
$tempChapInd = "";
|
||||
|
||||
// array_pop($resultData);
|
||||
|
||||
$i=0;
|
||||
foreach ($resultData as $item) {
|
||||
|
||||
// Untuk Spasi Depth
|
||||
$space="";
|
||||
if ($item['RESULT'] != null) {
|
||||
$j=0;
|
||||
@ -226,6 +220,7 @@ class PrintResult extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
// Untuk Penamaan Serum Khusus test
|
||||
if ($item["RESULT"] == null) {
|
||||
$serum_type = "";
|
||||
}else {
|
||||
@ -239,6 +234,18 @@ class PrintResult extends BaseController {
|
||||
$tempChapInd = $item['chap_ind'];
|
||||
|
||||
$i++;
|
||||
|
||||
// Melebihi batas Kertas
|
||||
if($i % 30 == 0) {
|
||||
$resultTest .= "</table></div>";
|
||||
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||
$i=0;
|
||||
$resultTest = "";
|
||||
}
|
||||
|
||||
if($i==0){
|
||||
$i++;
|
||||
}
|
||||
// Untuk Chapter
|
||||
$resultTest .= "
|
||||
<tr align='left' class='chapter'>
|
||||
@ -248,20 +255,21 @@ class PrintResult extends BaseController {
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
// // Melebihi batas Kertas
|
||||
// if($i % 30 == 0) {
|
||||
// $resultTest .= "</table></div>";
|
||||
// $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||
// $i=0;
|
||||
// $resultTest = "";
|
||||
// }
|
||||
// Melebihi batas Kertas
|
||||
if($i % 30 == 0 && $i!=0) {
|
||||
$resultTest .= "</table></div>";
|
||||
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||
$i=0;
|
||||
$resultTest = "";
|
||||
}
|
||||
|
||||
$i++;
|
||||
if ($item['RESTYPE'] == "CE"){
|
||||
$resvalue = $item['RESULT'];
|
||||
} else if ($item['RESTYPE'] == null) {
|
||||
$resvalue = $item['RESULT'];
|
||||
} else {
|
||||
$resvalue = $item['RESVALUE'];
|
||||
}
|
||||
@ -275,7 +283,7 @@ class PrintResult extends BaseController {
|
||||
<tr>
|
||||
<td colspan='1' class=''>
|
||||
<!-- <pre> ".$space . $i.". ".$item["test_eng"]." ". "<small>".$item["test_ind"]."</small></pre> -->
|
||||
<pre>" . $space . $item["test_eng"]." "."<small><i>".$item["test_ind"]."</i></small></pre>
|
||||
<pre>" . $space . $i.". ". $item["test_eng"]." "."<small><i>".$item["test_ind"]."</i></small></pre>
|
||||
<!-- <pre> ".$space."<small>".$item["test_ind"]."</small></pre> -->
|
||||
</td>
|
||||
<td class=''>" . $resflag . "</td>
|
||||
@ -286,9 +294,8 @@ class PrintResult extends BaseController {
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
||||
// Melebihi batas Kertas
|
||||
if($i % 30 == 0) {
|
||||
if($i % 30 == 0 && $i != 0) {
|
||||
$resultTest .= "</table></div>";
|
||||
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||
$i=0;
|
||||
@ -380,45 +387,30 @@ class PrintResult extends BaseController {
|
||||
left join cmod.dbo.CM_DICT_TESTS cdt on dt.TESTCODE=cdt.TESTCODE
|
||||
left join cmod.dbo.CM_RESULTS cr on cr.ACCESSNUMBER=r.ACCESSNUMBER and cr.TESTCODE=cdt.TESTCODE and cr.TESTCODE=dt.TESTCODE
|
||||
where r.ACCESSNUMBER='$access'
|
||||
ORDER BY dc.CHAPID, t.TESTORDER
|
||||
ORDER BY t.TESTORDER
|
||||
";
|
||||
|
||||
$query = $db->query($sql);
|
||||
$results = $query->getResultArray();
|
||||
|
||||
// // Seleksi data yang mengandung "URINE"
|
||||
// $data_urine = array_filter($results, function($item) {
|
||||
// $chapterid = $item["CHAPID"];
|
||||
// $tesscode = $item['TESTCODE'];
|
||||
// // Memfilter data dengan CHAPID 3, 61, atau 62
|
||||
// return $chapterid == 3 || $chapterid == 61 || $chapterid == 62 || $tesscode == 'NOTE';
|
||||
// });
|
||||
// // Seleksi data yang mengandung "FESES"
|
||||
// $data_feces = array_filter($results, function($item) {
|
||||
// $chapterid = $item["CHAPID"];
|
||||
// $tesscode = $item['TESTCODE'];
|
||||
// // Memfilter data yang 4
|
||||
// return $chapterid == 4 || $chapterid == 5 || $tesscode == 'NOTE';
|
||||
// });
|
||||
// // Seleksi data yang tidak mengandung "urine" dan "feces"
|
||||
// $data_others = array_filter($results, function($item) {
|
||||
// $chapterid = $item["CHAPID"];
|
||||
// $tesscode = $item['TESTCODE'];
|
||||
// // Memfilter data yang bukan
|
||||
// return $chapterid !== 3 && $chapterid !== 4 && $chapterid !== 61 && $chapterid !== 62 || $tesscode == 'NOTE';
|
||||
// });
|
||||
|
||||
$data_pregnancy = array_filter($results, function($item) {
|
||||
$serum_type = $item["serum_type"];
|
||||
$tesscode = $item["TESTCODE"];
|
||||
return $serum_type == 'Urine' && $tesscode == 'PPT';
|
||||
$test_eng = $item["test_eng"];
|
||||
return $serum_type == 'Urine' && ($tesscode == 'PPT' || $test_eng == "Pregnancy Test");
|
||||
});
|
||||
$data_urine_lengkap = array_filter($results, function($item) {
|
||||
$serum_type = $item["serum_type"];
|
||||
$tesscode = $item["TESTCODE"];
|
||||
return $serum_type == 'Urine' && $tesscode != 'PPT';
|
||||
$test_eng = $item["test_eng"];
|
||||
$chap_eng = $item["chap_eng"];
|
||||
return $serum_type == 'Urine' && $tesscode != 'PPT' && $test_eng != "Pregnancy Test" && $chap_eng != "MICROBIOLOGY";
|
||||
});
|
||||
$data_urine_kultur = array_filter($results, function($item) {
|
||||
$serum_type = $item["serum_type"];
|
||||
$chap_eng = $item["chap_eng"];
|
||||
return $serum_type == 'Urine' && $chap_eng == "MICROBIOLOGY";
|
||||
});
|
||||
|
||||
$data_feces_stc2 = array_filter($results, function($item) {
|
||||
$serum_type = $item["serum_type"];
|
||||
$tesscode = $item["TESTCODE"];
|
||||
@ -441,24 +433,40 @@ class PrintResult extends BaseController {
|
||||
return $serum_type != 'Feces' && $serum_type != 'Urine' && $chapter_eng != 'Note';
|
||||
});
|
||||
|
||||
$notes = array_filter($results, function($item) {
|
||||
$chap_id = $item["CHAPID"];
|
||||
$chap_eng = $item["chap_eng"];
|
||||
return $chap_id == 54 && $chap_eng == "Note";
|
||||
});
|
||||
// Mengambil elemen pertama dari hasil filter
|
||||
$notes = reset($notes); // Ambil elemen pertama
|
||||
$note = $notes["RESULT"] ?? "-"; // Ambil nilai RESULT, atau null jika tidak ada
|
||||
|
||||
|
||||
$fullPage = "";
|
||||
if ($data_urine_lengkap != null) {
|
||||
$fullPage .= $this->otherTests($data_urine_lengkap, $data);
|
||||
|
||||
if ($data_others != null) {
|
||||
$fullPage .= $this->otherTests($data_others, $data, $note);
|
||||
}
|
||||
|
||||
if ($data_urine_kultur != null) {
|
||||
$fullPage .= $this->otherTests($data_urine_kultur, $data, $note);
|
||||
}
|
||||
if ($data_pregnancy != null) {
|
||||
$fullPage .= $this->otherTests($data_pregnancy, $data);
|
||||
$fullPage .= $this->otherTests($data_pregnancy, $data, $note);
|
||||
}
|
||||
if ($data_feces_lengkap != null) {
|
||||
$fullPage .= $this->otherTests($data_feces_lengkap, $data);
|
||||
if ($data_urine_lengkap != null) {
|
||||
$fullPage .= $this->otherTests($data_urine_lengkap, $data, $note);
|
||||
}
|
||||
|
||||
if ($data_feces_stc2 != null) {
|
||||
$fullPage .= $this->otherTests($data_feces_stc2, $data);
|
||||
$fullPage .= $this->otherTests($data_feces_stc2, $data, $note);
|
||||
}
|
||||
if ($data_feces_stc4 != null) {
|
||||
$fullPage .= $this->otherTests($data_feces_stc4, $data);
|
||||
$fullPage .= $this->otherTests($data_feces_stc4, $data, $note);
|
||||
}
|
||||
if ($data_others != null) {
|
||||
$fullPage .= $this->otherTests($data_others, $data);
|
||||
if ($data_feces_lengkap != null) {
|
||||
$fullPage .= $this->otherTests($data_feces_lengkap, $data, $note);
|
||||
}
|
||||
|
||||
return view('result_report', ['data' => $fullPage]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user