This commit is contained in:
Duidev Software House
2025-10-04 10:00:04 +07:00
parent 8fd45c65d5
commit 5dde5579e2
+32 -30
View File
@@ -302,36 +302,26 @@ class AstmMessageService
$resultSample = new ResultSample(); $resultSample = new ResultSample();
foreach ($mltrData as $index => $field) { foreach ($mltrData as $index => $field) {
if ($field == 'ra'){
if ($antibiotic != ''){
$parsedData['antibiotics'][] = [
'antibiotic' => $antibiotic, // Antibiotik
'resistance' => $resistance, // Hasil Resistansi
'value' => $value, // Nilai
'interpretation'=> $interpretation // Interpretasi
];
$antibiotic = '';
$resistance = '';
$value = '';
$interpretation = '';
} else {
$mulaikirim = 1;
}
} else {
if ($mulaikirim == 1){
$antibiotic = substr($field, 2);
$mulaikirim++;
} else if ($mulaikirim == 2){
$resistance = substr($field, 2);
$mulaikirim++;
} else if ($mulaikirim == 3){
$value = substr($field, 2);
$mulaikirim++;
} else if ($mulaikirim == 4){
$interpretation = substr($field, 2);
$mulaikirim++;
} else {
$cekbersih = trim($field, '"'); $cekbersih = trim($field, '"');
if (strpos($cekbersih, 'a1') === 0) {
// Kode dari alat
}
if (strpos($cekbersih, 'a2') === 0) {
$antibiotic = substr($field, 2); // Nama antibiotik
$mulaikirim++;
}
if (strpos($cekbersih, 'a3') === 0) {
$value = substr($field, 2); // Nilai MIC
$mulaikirim++;
}
if (strpos($cekbersih, 'a4') === 0) {
$interpretation = substr($field, 2); // S, I, atau R
$mulaikirim++;
}
if (strpos($cekbersih, 'an') === 0) {
$resistance = substr($field, 2); // Catatan resistansi
$mulaikirim++;
}
if (strpos($cekbersih, 'mt') === 0) { if (strpos($cekbersih, 'mt') === 0) {
$resultSample->sender_name = substr($cekbersih, 2); $resultSample->sender_name = substr($cekbersih, 2);
} }
@@ -386,7 +376,19 @@ class AstmMessageService
if (strpos($cekbersih, 's4') === 0) { if (strpos($cekbersih, 's4') === 0) {
$tanggalkeluar = $tanggalkeluar.' '.substr($cekbersih, 2); $tanggalkeluar = $tanggalkeluar.' '.substr($cekbersih, 2);
} }
} if ($antibiotic != ''){
$parsedData['antibiotics'][] = [
'antibiotic' => $antibiotic, // Antibiotik
'resistance' => $resistance, // Hasil Resistansi
'value' => $value, // Nilai
'interpretation'=> $interpretation // Interpretasi
];
$antibiotic = '';
$resistance = '';
$value = '';
$interpretation = '';
} else {
$mulaikirim = 1;
} }
} }