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 {
|
class PrintResult extends BaseController {
|
||||||
|
|
||||||
public function otherTests($resultData, $data){
|
public function otherTests($resultData, $data, $note){
|
||||||
|
|
||||||
// var_dump($data);die();
|
// var_dump($data);die();
|
||||||
|
|
||||||
@ -111,10 +111,6 @@ class PrintResult extends BaseController {
|
|||||||
|
|
||||||
$resultTest ="";
|
$resultTest ="";
|
||||||
|
|
||||||
$note = "-";
|
|
||||||
// $notes = end($resultData);
|
|
||||||
// $note = $notes['RESULT'] == "" ? "-" : $notes['RESULT'];
|
|
||||||
|
|
||||||
// Untuk Collection
|
// Untuk Collection
|
||||||
if ($data[1] != null) {
|
if ($data[1] != null) {
|
||||||
$colltext = '';
|
$colltext = '';
|
||||||
@ -197,15 +193,13 @@ class PrintResult extends BaseController {
|
|||||||
";
|
";
|
||||||
$lastDiv="</div>";
|
$lastDiv="</div>";
|
||||||
|
|
||||||
|
|
||||||
$tempChapEng = "";
|
$tempChapEng = "";
|
||||||
$tempChapInd = "";
|
$tempChapInd = "";
|
||||||
|
|
||||||
// array_pop($resultData);
|
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($resultData as $item) {
|
foreach ($resultData as $item) {
|
||||||
|
|
||||||
|
// Untuk Spasi Depth
|
||||||
$space="";
|
$space="";
|
||||||
if ($item['RESULT'] != null) {
|
if ($item['RESULT'] != null) {
|
||||||
$j=0;
|
$j=0;
|
||||||
@ -226,6 +220,7 @@ class PrintResult extends BaseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Untuk Penamaan Serum Khusus test
|
||||||
if ($item["RESULT"] == null) {
|
if ($item["RESULT"] == null) {
|
||||||
$serum_type = "";
|
$serum_type = "";
|
||||||
}else {
|
}else {
|
||||||
@ -233,36 +228,49 @@ class PrintResult extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$resflag = $item["RESFLAG"] == "N" ? '' : $item["RESFLAG"];
|
$resflag = $item["RESFLAG"] == "N" ? '' : $item["RESFLAG"];
|
||||||
|
|
||||||
if ($tempChapEng != $item['chap_eng']) {
|
if ($tempChapEng != $item['chap_eng']) {
|
||||||
$tempChapEng = $item['chap_eng'];
|
$tempChapEng = $item['chap_eng'];
|
||||||
$tempChapInd = $item['chap_ind'];
|
$tempChapInd = $item['chap_ind'];
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
// Untuk Chapter
|
|
||||||
$resultTest .= "
|
// Melebihi batas Kertas
|
||||||
<tr align='left' class='chapter'>
|
if($i % 30 == 0) {
|
||||||
<td colspan='5'>
|
$resultTest .= "</table></div>";
|
||||||
<pre><b>".$tempChapEng."</b></pre>
|
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||||
|
$i=0;
|
||||||
|
$resultTest = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i==0){
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
// Untuk Chapter
|
||||||
|
$resultTest .= "
|
||||||
|
<tr align='left' class='chapter'>
|
||||||
|
<td colspan='5'>
|
||||||
|
<pre><b>".$tempChapEng."</b></pre>
|
||||||
<!-- <pre><b>".$i.". ".$tempChapEng."</b></pre> -->
|
<!-- <pre><b>".$i.". ".$tempChapEng."</b></pre> -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Melebihi batas Kertas
|
// Melebihi batas Kertas
|
||||||
// if($i % 30 == 0) {
|
if($i % 30 == 0 && $i!=0) {
|
||||||
// $resultTest .= "</table></div>";
|
$resultTest .= "</table></div>";
|
||||||
// $fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||||
// $i=0;
|
$i=0;
|
||||||
// $resultTest = "";
|
$resultTest = "";
|
||||||
// }
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
if ($item['RESTYPE'] == "CE"){
|
if ($item['RESTYPE'] == "CE"){
|
||||||
$resvalue = $item['RESULT'];
|
$resvalue = $item['RESULT'];
|
||||||
} else {
|
} else if ($item['RESTYPE'] == null) {
|
||||||
|
$resvalue = $item['RESULT'];
|
||||||
|
} else {
|
||||||
$resvalue = $item['RESVALUE'];
|
$resvalue = $item['RESVALUE'];
|
||||||
}
|
}
|
||||||
$reff = $item["REFRANGE"];
|
$reff = $item["REFRANGE"];
|
||||||
@ -275,7 +283,7 @@ class PrintResult extends BaseController {
|
|||||||
<tr>
|
<tr>
|
||||||
<td colspan='1' class=''>
|
<td colspan='1' class=''>
|
||||||
<!-- <pre> ".$space . $i.". ".$item["test_eng"]." ". "<small>".$item["test_ind"]."</small></pre> -->
|
<!-- <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> -->
|
<!-- <pre> ".$space."<small>".$item["test_ind"]."</small></pre> -->
|
||||||
</td>
|
</td>
|
||||||
<td class=''>" . $resflag . "</td>
|
<td class=''>" . $resflag . "</td>
|
||||||
@ -286,9 +294,8 @@ class PrintResult extends BaseController {
|
|||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
// Melebihi batas Kertas
|
// Melebihi batas Kertas
|
||||||
if($i % 30 == 0) {
|
if($i % 30 == 0 && $i != 0) {
|
||||||
$resultTest .= "</table></div>";
|
$resultTest .= "</table></div>";
|
||||||
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
$fullPage .= $headPage.$resultTest.$footerPage.$lastDiv;
|
||||||
$i=0;
|
$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_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
|
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'
|
where r.ACCESSNUMBER='$access'
|
||||||
ORDER BY dc.CHAPID, t.TESTORDER
|
ORDER BY t.TESTORDER
|
||||||
";
|
";
|
||||||
|
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
$results = $query->getResultArray();
|
$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) {
|
$data_pregnancy = array_filter($results, function($item) {
|
||||||
$serum_type = $item["serum_type"];
|
$serum_type = $item["serum_type"];
|
||||||
$tesscode = $item["TESTCODE"];
|
$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) {
|
$data_urine_lengkap = array_filter($results, function($item) {
|
||||||
$serum_type = $item["serum_type"];
|
$serum_type = $item["serum_type"];
|
||||||
$tesscode = $item["TESTCODE"];
|
$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) {
|
$data_feces_stc2 = array_filter($results, function($item) {
|
||||||
$serum_type = $item["serum_type"];
|
$serum_type = $item["serum_type"];
|
||||||
$tesscode = $item["TESTCODE"];
|
$tesscode = $item["TESTCODE"];
|
||||||
@ -441,26 +433,42 @@ class PrintResult extends BaseController {
|
|||||||
return $serum_type != 'Feces' && $serum_type != 'Urine' && $chapter_eng != 'Note';
|
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 = "";
|
$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_pregnancy != null) {
|
|
||||||
$fullPage .= $this->otherTests($data_pregnancy, $data);
|
|
||||||
}
|
|
||||||
if ($data_feces_lengkap != null) {
|
|
||||||
$fullPage .= $this->otherTests($data_feces_lengkap, $data);
|
|
||||||
}
|
|
||||||
if ($data_feces_stc2 != null) {
|
|
||||||
$fullPage .= $this->otherTests($data_feces_stc2, $data);
|
|
||||||
}
|
|
||||||
if ($data_feces_stc4 != null) {
|
|
||||||
$fullPage .= $this->otherTests($data_feces_stc4, $data);
|
|
||||||
}
|
|
||||||
if ($data_others != null) {
|
|
||||||
$fullPage .= $this->otherTests($data_others, $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($data_urine_kultur != null) {
|
||||||
|
$fullPage .= $this->otherTests($data_urine_kultur, $data, $note);
|
||||||
|
}
|
||||||
|
if ($data_pregnancy != null) {
|
||||||
|
$fullPage .= $this->otherTests($data_pregnancy, $data, $note);
|
||||||
|
}
|
||||||
|
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, $note);
|
||||||
|
}
|
||||||
|
if ($data_feces_stc4 != null) {
|
||||||
|
$fullPage .= $this->otherTests($data_feces_stc4, $data, $note);
|
||||||
|
}
|
||||||
|
if ($data_feces_lengkap != null) {
|
||||||
|
$fullPage .= $this->otherTests($data_feces_lengkap, $data, $note);
|
||||||
|
}
|
||||||
|
|
||||||
return view('result_report', ['data' => $fullPage]);
|
return view('result_report', ['data' => $fullPage]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user