Compare commits
32
Commits
0771b98790
..
duidev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b915caad7 | ||
|
|
ab494fddf8 | ||
|
|
fef0acb867 | ||
|
|
c7ecb66ba1 | ||
|
|
2af18f0f68 | ||
|
|
0cecf8760c | ||
|
|
094ceb0b9f | ||
|
|
92e7cad787 | ||
|
|
d9e70fc1e9 | ||
|
|
d77047db52 | ||
|
|
2d4c608bc9 | ||
|
|
77ae72b154 | ||
|
|
0c47dc4166 | ||
|
|
62c2e6bf8e | ||
|
|
79da34a3e3 | ||
|
|
0f7bdcefc5 | ||
|
|
132d0a0d5f | ||
|
|
1bbf9c00f1 | ||
|
|
9437483030 | ||
|
|
8289968849 | ||
|
|
cd3f9f1628 | ||
|
|
3237dbf10c | ||
|
|
cedb72d57f | ||
|
|
87255f9965 | ||
|
|
9471bf22f5 | ||
|
|
6871d14f94 | ||
|
|
8b4404e8fe | ||
|
|
79cfca44c4 | ||
|
|
bd1e35c511 | ||
|
|
027610b61b | ||
|
|
c6e3e37ca1 | ||
|
|
7f9daeeef3 |
No files matched your search
@@ -1,68 +0,0 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=production
|
||||
APP_KEY=base64:pIyfhWd8ewTeJqFNn6RYYIEOtGeprZ8cPzczyrMItNk=
|
||||
APP_DEBUG=false
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=daily
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=lismikro
|
||||
DB_USERNAME=lismikro
|
||||
DB_PASSWORD=lismikro
|
||||
|
||||
DB_CONNECTIONLTR=mysql
|
||||
DB_HOST_SQLLTR=10.10.120.14
|
||||
DB_PORT_SQLLTR=3306
|
||||
DB_DATABASE_SQLLTR=lis_mikro
|
||||
DB_USERNAME_SQLLTR=lis_listener
|
||||
DB_PASSWORD_SQLLTR=1234567890
|
||||
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=2400
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_HOST=smtp.gmail.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USERNAME=[email protected]
|
||||
MAIL_PASSWORD=ysnraxskgxfkeszm
|
||||
MAIL_ENCRYPTION=tls
|
||||
QUEUE_DRIVER=sync
|
||||
MAIL_FROM_ADDRESS="[email protected]"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=878723
|
||||
PUSHER_APP_KEY=461fe095afe037987c11
|
||||
PUSHER_APP_SECRET=c03b22f3d6c148426f67
|
||||
PUSHER_APP_CLUSTER=ap1
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# Ignore environment files
|
||||
|
||||
mergekemain.sh
|
||||
# Ignore Laravel cache, logs, and storage
|
||||
/htdocs/storage/*
|
||||
/database
|
||||
!/htdocs/storage/.gitignore
|
||||
/htdocs/.env
|
||||
# Ignore bootstrap cache
|
||||
/htdocs/bootstrap/cache/*
|
||||
/htdocs/listenerlis/listener.log
|
||||
/htdocs/listenerlis/tcp_raw_data.bin
|
||||
.env
|
||||
!/htdocs/bootstrap/cache/.gitignore
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('samples', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('patient_name', 250)->nullable();
|
||||
$table->string('test_details', 255)->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('samples');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('test_results', function (Blueprint $table) {
|
||||
$table->id(); // ID primary key
|
||||
$table->unsignedBigInteger('sample_id'); // Kolom referensi
|
||||
$table->text('result'); // Kolom result
|
||||
$table->string('status', 50); // Kolom status
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
// Foreign key
|
||||
$table->foreign('sample_id')->references('id')->on('samples')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('test_results');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
services:
|
||||
# NginxProxyManager
|
||||
#---------------------------------------------------------------#
|
||||
# Authentik Database
|
||||
postgresql:
|
||||
image: docker.io/library/postgres:12-alpine
|
||||
mem_limit: 1g
|
||||
cpus: 1.0
|
||||
container_name: laravel-db
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||
start_period: 20s
|
||||
interval: 30s
|
||||
retries: 5
|
||||
timeout: 5s
|
||||
volumes:
|
||||
- ./database:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${PG_PASS:?database password required}
|
||||
POSTGRES_USER: ${PG_USER:-authentik}
|
||||
POSTGRES_DB: ${PG_DB:-authentik}
|
||||
env_file:
|
||||
- .env
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
laravel:
|
||||
build:
|
||||
context: ./htdocs
|
||||
dockerfile: Dockerfile
|
||||
container_name: laravel
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./htdocs:/var/www/html
|
||||
ports:
|
||||
- "8088:8080"
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
command: php artisan serve --host=0.0.0.0 --port=8080
|
||||
networks:
|
||||
- proxy
|
||||
python-listener:
|
||||
build:
|
||||
context: ./htdocs/listenerlis
|
||||
dockerfile: Dockerfile
|
||||
container_name: python-listener
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./htdocs/listenerlis:/app
|
||||
ports:
|
||||
- "5000:5000"
|
||||
- "6001:6001"
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- proxy
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
@@ -0,0 +1,72 @@
|
||||
FROM php:8.3-fpm
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
pkg-config \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
libmagickwand-dev \
|
||||
libreadline-dev \
|
||||
libsodium-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
unzip \
|
||||
git \
|
||||
curl \
|
||||
zip \
|
||||
build-essential \
|
||||
autoconf \
|
||||
libtool \
|
||||
libsqlite3-dev \
|
||||
mariadb-client \
|
||||
libpq-dev \
|
||||
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
|
||||
&& docker-php-ext-install \
|
||||
dom \
|
||||
xml \
|
||||
xsl \
|
||||
bcmath \
|
||||
calendar \
|
||||
exif \
|
||||
ftp \
|
||||
gd \
|
||||
gettext \
|
||||
mbstring \
|
||||
pcntl \
|
||||
pdo_mysql \
|
||||
pdo_sqlite \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
posix \
|
||||
shmop \
|
||||
simplexml \
|
||||
sockets \
|
||||
sodium \
|
||||
zip \
|
||||
imap \
|
||||
xmlwriter \
|
||||
&& pecl install imagick \
|
||||
&& docker-php-ext-enable imagick \
|
||||
&& apt-get purge -y --auto-remove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
WORKDIR /var/www/html
|
||||
# Install Laravel 10.10 secara langsung (opsional jika project belum ada)
|
||||
# RUN composer create-project laravel/laravel:^10 /var/www/html
|
||||
|
||||
# Set permission
|
||||
#RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
|
||||
|
||||
EXPOSE 9000
|
||||
#CMD ["php-fpm"]
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
+1
-1
@@ -22,7 +22,7 @@ class ProcessAstmMessages extends Command
|
||||
public function handle()
|
||||
{
|
||||
// Ambil data dari DataListener
|
||||
$dataListener = DataListiner::whereNull('processed')->get();
|
||||
$dataListener = DataListiner::where('processed', '0')->orderBy('created_at', 'DESC')->get();
|
||||
if ($dataListener) {
|
||||
$jumlah = count($dataListener);
|
||||
$pesan = $this->astmMessageService->processAstmMessages($dataListener);
|
||||
+111
-22
@@ -51,6 +51,11 @@ define( 'API_ACCESS_KEY', 'AAAA6YBXh1k:APA91bFL0q7QAXQGohXMpTwHco79f13C8PFk1Oo8k
|
||||
|
||||
class DokterController extends Controller
|
||||
{
|
||||
protected $lisServiceUrl;
|
||||
public function __construct()
|
||||
{
|
||||
$this->lisServiceUrl = env('LIS_SERVICE_URL', 'http://localhost:5000');
|
||||
}
|
||||
protected static function genSurat($id, $tabel){
|
||||
if ($tabel == 'dengan kop'){
|
||||
$kopsurat = url('/templateimage/kopsurat.png');
|
||||
@@ -490,7 +495,7 @@ class DokterController extends Controller
|
||||
'nmppdssenior' => $cekppds3->nama ?? null,
|
||||
'nmexcutor' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'status' => 'Draft Saved'
|
||||
'status' => 'Proses Analisis Sampel'
|
||||
]);
|
||||
return response()->json(['icon' => 'success', 'status' => 'Success', 'message' => 'Expertise Saved']);
|
||||
}
|
||||
@@ -1075,6 +1080,7 @@ class DokterController extends Controller
|
||||
]);
|
||||
}
|
||||
}
|
||||
$jsondata = json_decode($jsondata, true);
|
||||
if(is_array($jsondata) && count($jsondata) > 0){
|
||||
foreach ($jsondata as $item){
|
||||
RekapAntibiotik::updateOrCreate(
|
||||
@@ -1097,9 +1103,9 @@ class DokterController extends Controller
|
||||
$gentabel = RekapAntibiotik::where('orderid', $orderid)->get();
|
||||
if (!empty($gentabel)){
|
||||
$nomor = 1;
|
||||
$isidata = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="65%"><strong>Antibiotik</strong></td><td width="15%"><strong>Value</strong></td><td width="15%"><strong>S/I/R</strong></td></tr>';
|
||||
$isidata = $isidata.'<br /><table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="65%"><strong>Antibiotik</strong></td><td width="15%"><strong>Value</strong></td><td width="15%"><strong>S/I/R</strong></td></tr>';
|
||||
foreach($gentabel as $rtabel){
|
||||
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->antibiotic.'</td<td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
|
||||
$isidata = $isidata.'<tr><td>'.$nomor.'</td><td>'.$rtabel->resistance.'</td><td>'.$rtabel->value.'</td><td>'.$rtabel->interpretation.'</td></tr>';
|
||||
$nomor++;
|
||||
}
|
||||
$isidata = $isidata.'</table>';
|
||||
@@ -1127,7 +1133,7 @@ class DokterController extends Controller
|
||||
}
|
||||
return response()->json(['pesan' => $pesan, 'organism' => $organism]);
|
||||
return back();
|
||||
} else if ($worklist == 'getbbachtect' OR $worklist == 'getmgit' OR $worklist == 'getgenexpert' OR $worklist == 'getabbot'){
|
||||
} else if ($worklist == 'getbbachtect' OR $worklist == 'getmgit' OR $worklist == 'getabbot'){
|
||||
$isidata = $request->input('isi');
|
||||
try {
|
||||
$ketemu = '';
|
||||
@@ -1166,6 +1172,67 @@ class DokterController extends Controller
|
||||
$pesan = $isidata.'<br />'.$e->getMessage();
|
||||
}
|
||||
return $pesan;
|
||||
} else if ($worklist == 'getgenexpert'){
|
||||
$isidata = $request->input('isi');
|
||||
try {
|
||||
$ketemu = '';
|
||||
$cekada = ResultSample::where('accession_number', 'LIKE', $nofoto.'%')->get();
|
||||
if ($cekada->isNotEmpty()){
|
||||
foreach($cekada as $rows){
|
||||
$ketemu .= ($ketemu ? '<br />' : '') . $rows->test_status;
|
||||
}
|
||||
} else {
|
||||
$payload = [
|
||||
'command' => 'request_result',
|
||||
'data' => [
|
||||
'sample_id' => $nofoto
|
||||
],
|
||||
];
|
||||
$response = Http::timeout(30)->post($this->lisServiceUrl . '/command', $payload);
|
||||
if ($response->successful()) {
|
||||
Log::info('Permintaan hasil berhasil dikirim ke LIS service.', [
|
||||
'sample_id' => $nofoto,
|
||||
'response' => $response->json()
|
||||
]);
|
||||
} else {
|
||||
Log::error('Gagal terhubung ke LIS service saat meminta hasil.', [
|
||||
'sample_id' => $nofoto,
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body()
|
||||
]);
|
||||
}
|
||||
}
|
||||
if ($ketemu != ''){
|
||||
if (is_null($isidata) || $isidata == ''){
|
||||
$isidata = $ketemu;
|
||||
} else {
|
||||
$isidata = $isidata.'<br />'.$ketemu;
|
||||
}
|
||||
}
|
||||
if (!is_null($isidata) && $isidata != ''){
|
||||
KomponenJawaban::updateOrCreate(
|
||||
[
|
||||
'accnumber' => $nofoto,
|
||||
'template' => $request->input('jenis'),
|
||||
'komponen' => $request->input('komponen'),
|
||||
],
|
||||
[
|
||||
'isidata' => $isidata,
|
||||
'created_by' => Session('nama')
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$pesan = $isidata;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$pesan = (is_null($isidata) ? '' : $isidata . '<br />') . 'Error: ' . $e->getMessage();
|
||||
Log::error('Exception dalam fungsi requestResult.', [
|
||||
'sample_id' => $nofoto,
|
||||
'exception' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
return response($pesan, 200);
|
||||
} else if ($worklist == 'addviralload'){
|
||||
$tabelawal = $request->input('tabelawal');
|
||||
$idtabel = $request->input('idtabel');
|
||||
@@ -1262,10 +1329,10 @@ class DokterController extends Controller
|
||||
$setval = $batasbawah;
|
||||
}
|
||||
if ($nomor == 1){
|
||||
$tabel = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="20%"><strong>Antibiotik</strong></td><td width="20%"><strong>Sub</strong></td><td width="10%"><strong>Disc Content</strong></td><td width="5%"><strong>S/I/R</strong></td></tr><tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.'</td><td>'.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr></table>';
|
||||
$tabel = '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><td width="5%"><strong>No</strong></td><td width="20%"><strong>Antibiotik</strong></td><td width="20%"><strong>Sub</strong></td><td width="10%"><strong>Disc Content</strong></td><td width="5%"><strong>S/I/R</strong></td></tr><tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.' '.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr></table>';
|
||||
|
||||
} else {
|
||||
$baris = '<tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.'</td><td>'.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr>';
|
||||
$baris = '<tr><td>'.$nomor.'</td><td>'.$getdata->antibiotik.' '.$getdata->subantibiotik.'</td><td>'.$getdata->diskcontent.'</td><td>'.$setnilai.'</td></tr>';
|
||||
$tabel = str_replace('</table>', $baris, $tabelawal);
|
||||
$tabel = $tabel.'</table>';
|
||||
}
|
||||
@@ -1458,7 +1525,7 @@ class DokterController extends Controller
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$tlsstatus = 'Draft Saved';
|
||||
$tlsstatus = 'Proses Analisis Sampel';
|
||||
Riwayat::create([
|
||||
'nofoto' => $nofoto,
|
||||
'jawaban' => $surat,
|
||||
@@ -1664,6 +1731,35 @@ class DokterController extends Controller
|
||||
'antibiotikall' => $antibiotikall,
|
||||
);
|
||||
}
|
||||
|
||||
$getsirab = SiraB::orderBy('family', 'ASC')->orderBy('spesies', 'ASC')->where('cek', '0')->get();
|
||||
foreach($getsirab as $row){
|
||||
$family = $row->family;
|
||||
$spesies= $row->spesies;
|
||||
$getallantibiotik = SiraB::where('family', $family)->get();
|
||||
foreach ($getallantibiotik as $row2){
|
||||
SiraB::updateOrCreate(
|
||||
[
|
||||
'family' => $row->family,
|
||||
'spesies' => $row->spesies,
|
||||
'antibiotik' => $row2->antibiotik,
|
||||
'subantibiotik' => $row2->subantibiotik,
|
||||
],
|
||||
[
|
||||
'diskcontent' => $row2->diskcontent,
|
||||
'batasatas' => $row2->batasatas,
|
||||
'midrange' => $row2->midrange,
|
||||
'batasbawah' => $row2->batasbawah,
|
||||
'sumber' => $row2->sumber,
|
||||
'kodedok' => $row2->kodedok,
|
||||
'atu' => $row2->atu,
|
||||
'kelompok' => $row2->kelompok,
|
||||
'glassreportname' => trim($row2->glassreportname),
|
||||
'cek' => '1',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($arrayfiles);
|
||||
} else if ($idpasien == 'Bakteri'){
|
||||
$getsirab = Organisms::where('kelompok', 'biakankultur')->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
|
||||
@@ -1765,20 +1861,10 @@ class DokterController extends Controller
|
||||
$arrnofoto = explode('-', $nofoto);
|
||||
$nofoto = $arrnofoto[0];
|
||||
if ($statuse != 'Selesai'){
|
||||
Periksa::where('noregister', $noregister)
|
||||
->where('daftar', $daftar)
|
||||
->where('status', 'Telah di kirim ke worklist/modalitas')
|
||||
->update([
|
||||
'status' => 'Diperiksa',
|
||||
'excutor' => $idpemeriksa,
|
||||
]);
|
||||
Periksa::where('noregister', $noregister)
|
||||
->where('daftar', $daftar)
|
||||
->where('status', null)
|
||||
->update([
|
||||
'status' => 'Diperiksa',
|
||||
'excutor' => $idpemeriksa,
|
||||
]);
|
||||
Periksa::where('id', $id)->update([
|
||||
'status' => 'Pemeriksaan Sampel',
|
||||
'excutor' => $idpemeriksa,
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function getFoto(Request $request) {
|
||||
@@ -2718,6 +2804,9 @@ class DokterController extends Controller
|
||||
foreach($idcetak as $rid){
|
||||
$periksa = Periksa::where('id', $rid)->first();
|
||||
if (isset($periksa->id)){
|
||||
Periksa::where('id', $periksa->id)->update([
|
||||
'status' => 'Penerimaan Sampel',
|
||||
]);
|
||||
if ($kanan == ''){
|
||||
$kolomttd = '<td><font color="grey">'.$nomor.'</font></td><td> </td>';
|
||||
$kanan = '1';
|
||||
@@ -2725,7 +2814,7 @@ class DokterController extends Controller
|
||||
$kolomttd = '<td> </td><td><font color="grey">'.$nomor.'</font></td>';
|
||||
$kanan = '';
|
||||
}
|
||||
$cetak = $cetak.'<tr><td align="center">'.$nomor.'</td><td>'.$periksa->nofoto.'</td><td>'.$periksa->noregister.'</td><td>'.$periksa->nmpasien.'</td><td>'.$periksa->jkpasien.'</td><td>'.$periksa->mulai.'</td><td>'.$periksa->asalpasien.'</td><td>'.$periksa->kd_spesimen.'</td><td>'.$periksa->nm_spesimen.'</td>'.$kolomttd.'</tr>';
|
||||
$cetak = $cetak.'<tr><td align="center">'.$nomor.'</td><td>'.$periksa->nofoto.'</td><td>'.$periksa->noregister.'</td><td>'.$periksa->nmpasien.'</td><td>'.$periksa->jkpasien.'</td><td>'.$periksa->mulai.'</td><td>'.$periksa->asalpasien.'</td><td>'.$periksa->kd_spesimen.'</td><td>'.$periksa->nm_spesimen.'</td>'.$kolomttd.'</tr>';
|
||||
$nomor++;
|
||||
}
|
||||
}
|
||||
+279
-111
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
use App\Services\AstmMessageService;
|
||||
use App\Services\SerialCommunicationService;
|
||||
use App\Http\Controllers\SendMail;
|
||||
@@ -29,21 +31,57 @@ use Validator;
|
||||
use Session;
|
||||
use DateTime;
|
||||
use QrCode;
|
||||
use Exception;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Connection;
|
||||
use Aranyasen\HL7\Segment;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Aranyasen\HL7\Segments\PV1;
|
||||
use Aranyasen\HL7\Segments\OBR;
|
||||
use Aranyasen\HL7\Segments\ORC;
|
||||
use Aranyasen\HL7\Segments\PID;
|
||||
use Aranyasen\HL7\Segments\OBX;
|
||||
use Aranyasen\HL7\Segments\NTE;
|
||||
use Aranyasen\HL7\Segments\EVN;
|
||||
|
||||
class FrontpageController extends Controller
|
||||
{
|
||||
protected $lisServiceUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Mengambil URL service dari file .env, dengan fallback default
|
||||
$this->lisServiceUrl = env('LIS_SERVICE_URL', 'http://10.10.120.14:5000');
|
||||
}
|
||||
private function sendRegistrationToLis(array $data)
|
||||
{
|
||||
// Memetakan data dari fungsi register Anda ke format yang dibutuhkan LIS service
|
||||
// PENTING: Pastikan pemetaan ini benar, terutama 'test_code'.
|
||||
$payload = [
|
||||
'command' => 'register_patient',
|
||||
'data' => [
|
||||
'patient_name' => $data['nama'],
|
||||
'patient_id' => $data['noregister'], // Menggunakan no register sebagai ID Pasien
|
||||
'sample_id' => $data['nofoto'], // Menggunakan nofoto sebagai ID Sampel unik
|
||||
'test_code' => $data['kd_spesimen'],// Kode tes spesifik untuk GeneXpert (e.g., MTBRIF)
|
||||
'test_name' => $data['nm_spesimen'],
|
||||
'dob' => $data['tgllahir'] ? \Carbon\Carbon::parse($data['tgllahir'])->format('Ymd') : '',
|
||||
'gender' => $data['jk'],
|
||||
],
|
||||
];
|
||||
try {
|
||||
$response = Http::timeout(30)->post($this->lisServiceUrl . '/command', $payload);
|
||||
|
||||
if ($response->failed()) {
|
||||
Log::error('Gagal mengirim data pendaftaran ke LIS service.', [
|
||||
'sample_id' => $data['nofoto'],
|
||||
'status' => $response->status(),
|
||||
'response' => $response->body()
|
||||
]);
|
||||
} else {
|
||||
Log::info('Data pendaftaran berhasil dikirim ke LIS service.', [
|
||||
'sample_id' => $data['nofoto'],
|
||||
'response' => $response->json()
|
||||
]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Log::error('Koneksi ke LIS service gagal saat pendaftaran.', [
|
||||
'sample_id' => $data['nofoto'],
|
||||
'exception' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function index() {
|
||||
$data = [];
|
||||
$data['antrkrmsitu']= PeriksaSYNC::where('created_by', Session('username'))->where('status', '')->count();
|
||||
@@ -588,8 +626,8 @@ class FrontpageController extends Controller
|
||||
$insurance = $request->input('asuransi') ?? 'UMM';
|
||||
$rekues = $request->input('layanan');
|
||||
$urgensi = $request->input('urgensi') ?? 'Elective';
|
||||
$kd_spesimen = $request->input('kd_spesimen') ?? '';
|
||||
$nm_spesimen = $request->input('nm_spesimen') ?? '';
|
||||
$kd_spesimen = $request->input('kode') ?? '';
|
||||
$nm_spesimen = $request->input('spesimen') ?? '';
|
||||
$klinis = $request->input('klinis');
|
||||
$notransaksi = $request->input('notransaksi');
|
||||
$telpon = str_replace('_', '', $telpon);
|
||||
@@ -724,6 +762,27 @@ class FrontpageController extends Controller
|
||||
'orderid' => $notransaksi,
|
||||
]);
|
||||
$pesan = $nofoto;
|
||||
DB::table('paslab')->insert([
|
||||
'rnoreg' => $nofoto,
|
||||
'nama' => $nama,
|
||||
'norm' => $noregister,
|
||||
'rtglast' => $mulai,
|
||||
'alamat' => $alamat,
|
||||
'rjenis' => $jk,
|
||||
'umur' => $usia,
|
||||
'namadok' => $klinisi,
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $rekues,
|
||||
'alat' => 'ALL',
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'flg_vitek1' => false,
|
||||
'flg_vitek2' => false,
|
||||
'flg_bd1' => false,
|
||||
'flg_bd2' => false,
|
||||
'flg_gxp' => false,
|
||||
]);
|
||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||
PendaftaranOnListiner::updateOrCreate(
|
||||
[
|
||||
@@ -748,6 +807,7 @@ class FrontpageController extends Controller
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
if ($pesan != ''){
|
||||
return response()->json(['status' => 'Sukses', 'message' => $pesan], 201);
|
||||
@@ -756,21 +816,8 @@ class FrontpageController extends Controller
|
||||
}
|
||||
}
|
||||
public function registerApi(Request $request) {
|
||||
//$dataJson = json_encode($request->input());
|
||||
//$decodedFirst = json_decode($dataJson, true);
|
||||
Log::info(' Incomming '.json_encode($request->input()));
|
||||
$decodedData = $request->json()->all();
|
||||
//$decodedData = $request->input();
|
||||
//if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
// Log::error('JSON Decode Error (First): ' . json_last_error_msg());
|
||||
// return response()->json(['error' => 'Invalid first-level JSON data'], 400);
|
||||
//}
|
||||
//$innerJson = key($decodedFirst);
|
||||
//$decodedData = json_decode($innerJson, true);
|
||||
//if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
// Log::error('JSON Decode Error (Second): ' . json_last_error_msg());
|
||||
// return response()->json(['error' => 'Invalid second-level JSON data'], 400);
|
||||
//}
|
||||
$norm = $decodedData['norm'] ?? null;
|
||||
$nama = $decodedData['nama'] ?? null;
|
||||
$alamat = $decodedData['alamat'] ?? config('global.addressapps');
|
||||
@@ -784,23 +831,42 @@ class FrontpageController extends Controller
|
||||
$bpjs = $decodedData['nobpjs'] ?? '0';
|
||||
$drpeminta = $decodedData['drpeminta'] ?? null;
|
||||
$tlsasal = $decodedData['asalpasien'] ?? null;
|
||||
$rekues = $decodedData['layanan'] ?? null;
|
||||
//$rekues = $decodedData['layanan'] ?? null;
|
||||
$statusbayar = $decodedData['statusbayar'] ?? null;
|
||||
$notransaksi = $decodedData['notransaksi'] ?? null;
|
||||
$insurance = $decodedData['asuransi'] ?? 'UMM';
|
||||
$klinis = $decodedData['klinis'] ?? null;
|
||||
$klinisi = $decodedData['klinisi'] ?? $drpeminta;
|
||||
$kd_spesimen = $decodedData['kd_spesimen'] ?? null;
|
||||
$nm_spesimen = $decodedData['nm_spesimen'] ?? null;
|
||||
$rekues = $decodedData['kode'] ?? null;
|
||||
$nm_spesimen = $decodedData['spesimen'] ?? null;
|
||||
$pengambilan = $decodedData['pengambilan'] ?? null;
|
||||
$nmrs = $decodedData['namarspengirim'] ?? 'RSSA Malang';
|
||||
$telpon = str_replace('_', '', $nohap);
|
||||
$rekues = str_replace('_', ' ', $rekues);
|
||||
//$rekues = str_replace('_', ' ', $rekues);
|
||||
$tlsasal = str_replace('_', ' ', $tlsasal);
|
||||
$klinisi = str_replace('_', ' ', $klinisi);
|
||||
$nama = str_replace('_', ' ', $nama);
|
||||
$alamat = str_replace('_', ' ', $alamat);
|
||||
|
||||
$kd_spesimen = '';
|
||||
$getkodespesimen= Organisms::where('name', $nm_spesimen)->where('kelompok', 'listkodespesimen')->first();
|
||||
if (isset($getkodespesimen->category)){
|
||||
$kd_spesimen= $getkodespesimen->category;
|
||||
} else {
|
||||
$cekdulu = explode(' ', $nm_spesimen);
|
||||
if (isset($cekdulu[1])){
|
||||
$kd_spesimen = str_replace('.', '', $cekdulu[0]);
|
||||
} else {
|
||||
foreach ($cekdulu as $kata) {
|
||||
$kd_spesimen .= substr($kata, 0, 1);
|
||||
}
|
||||
}
|
||||
Organisms::create([
|
||||
'name' => $nm_spesimen,
|
||||
'category' => $kd_spesimen,
|
||||
'kelompok' => 'listkodespesimen'
|
||||
]);
|
||||
|
||||
}
|
||||
$iddokter = '';
|
||||
$ruangan = 1;
|
||||
$kelompok = 'admin';
|
||||
@@ -926,6 +992,27 @@ class FrontpageController extends Controller
|
||||
]);
|
||||
$pesan = $nofoto;
|
||||
try {
|
||||
DB::table('paslab')->insert([
|
||||
'rnoreg' => $nofoto,
|
||||
'nama' => $nama,
|
||||
'norm' => $noregister,
|
||||
'rtglast' => $mulai,
|
||||
'alamat' => $alamat,
|
||||
'rjenis' => $jk,
|
||||
'umur' => $usia,
|
||||
'namadok' => $dokter,
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $rekues,
|
||||
'alat' => 'ALL',
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'flg_vitek1' => false,
|
||||
'flg_vitek2' => false,
|
||||
'flg_bd1' => false,
|
||||
'flg_bd2' => false,
|
||||
'flg_gxp' => false,
|
||||
]);
|
||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||
PendaftaranOnListiner::updateOrCreate(
|
||||
[
|
||||
@@ -950,6 +1037,18 @@ class FrontpageController extends Controller
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
]
|
||||
);
|
||||
/*
|
||||
$dataForLis = [
|
||||
'nama' => $nama,
|
||||
'noregister' => $noregister,
|
||||
'nofoto' => $nofoto,
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'jk' => $jk,
|
||||
];
|
||||
$this->sendRegistrationToLis($dataForLis);
|
||||
*/
|
||||
}
|
||||
return response()->json(['status' => 'Sukses', 'message' => $pesan], 201);
|
||||
} catch (Exception $e) {
|
||||
@@ -969,8 +1068,8 @@ class FrontpageController extends Controller
|
||||
return back();
|
||||
} else {
|
||||
$jk = $request->input('jk');
|
||||
$nik = $request->input('nik');
|
||||
$bpjs = $request->input('bpjs');
|
||||
$nik = $request->input('nik') ?? time();
|
||||
$bpjs = $request->input('bpjs') ?? time();
|
||||
$alamat = $request->input('alamat') ?? config('global.addressapps');
|
||||
$kota = $request->input('kota') ?? config('global.subdomainapps');
|
||||
$noregister = $request->input('noregister');
|
||||
@@ -997,8 +1096,15 @@ class FrontpageController extends Controller
|
||||
$jenisgambar = $request->input('jenisgambar');
|
||||
$file = $request->input('file');
|
||||
$poli_id = $request->input('poli_id') ?? 1;
|
||||
$kd_spesimen = $request->input('kd_spesimen') ?? '';
|
||||
$nm_spesimen = $request->input('nm_spesimen') ?? '';
|
||||
$cekkodespes = Organisms::where('id', $ruangan)->first();
|
||||
if (isset($cekkodespes->name)){
|
||||
$nm_spesimen = $cekkodespes->name;
|
||||
$kd_spesimen = $cekkodespes->category;
|
||||
} else {
|
||||
$kd_spesimen = $request->input('kd_spesimen') ?? '';
|
||||
$nm_spesimen = $request->input('nm_spesimen') ?? '';
|
||||
}
|
||||
|
||||
$reques = 'Specimen';
|
||||
$kelompok = Session('previlage');
|
||||
$daftar = date('Y-m-d H:i:s');
|
||||
@@ -1110,7 +1216,7 @@ class FrontpageController extends Controller
|
||||
$modality = $check->modaliti ?? 'OT';
|
||||
$modaliti2 = $check->modaliti2 ?? '';
|
||||
if (isset($check->subsubpoli)){
|
||||
$rekues = $subpoli.' - '.$subsubpoli;
|
||||
$rekues = $subpoli.' - '.$check->subsubpoli;
|
||||
} else {
|
||||
$rekues = $subpoli;
|
||||
}
|
||||
@@ -1158,6 +1264,26 @@ class FrontpageController extends Controller
|
||||
'pendaftar' => Session('previlage'),
|
||||
'nmpendaftar' => Session('nama'),
|
||||
]);
|
||||
DB::table('paslab')->insert([
|
||||
'rnoreg' => $nofoto,
|
||||
'nama' => $nama,
|
||||
'norm' => $noregister,
|
||||
'rtglast' => $mulai,
|
||||
'alamat' => $alamat,
|
||||
'rjenis' => $jk,
|
||||
'umur' => $usia,
|
||||
'namadok' => $dokter,
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $rekues,
|
||||
'alat' => 'ALL',
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'flg_vitek1' => false,
|
||||
'flg_vitek2' => false,
|
||||
'flg_bd1' => false,
|
||||
'flg_bd2' => false,
|
||||
]);
|
||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||
PendaftaranOnListiner::updateOrCreate(
|
||||
[
|
||||
@@ -1182,6 +1308,18 @@ class FrontpageController extends Controller
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
]
|
||||
);
|
||||
/*
|
||||
$dataForLis = [
|
||||
'nama' => $nama,
|
||||
'noregister' => $noregister,
|
||||
'nofoto' => $nofoto,
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'jk' => $jk,
|
||||
];
|
||||
$this->sendRegistrationToLis($dataForLis);
|
||||
*/
|
||||
}
|
||||
$pesan = $pesan.' Nomor Lokal '.$nofoto.' dengan No. Urut '.$noloket.' Berhasil di Simpan';
|
||||
if ($pesan != ''){
|
||||
@@ -1245,7 +1383,7 @@ class FrontpageController extends Controller
|
||||
$modality = $check->modaliti ?? 'OT';
|
||||
$modaliti2 = $check->modaliti2 ?? '';
|
||||
if (isset($check->subsubpoli)){
|
||||
$rekues = $subpoli.' - '.$subsubpoli;
|
||||
$rekues = $subpoli.' - '.$check->subsubpoli;
|
||||
} else {
|
||||
$rekues = $subpoli;
|
||||
}
|
||||
@@ -1273,6 +1411,30 @@ class FrontpageController extends Controller
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
]);
|
||||
$ceksudah = DB::table('paslab')->where('rnoreg', $nofoto)->count();
|
||||
if ($ceksudah == 0){
|
||||
DB::table('paslab')->insert([
|
||||
'rnoreg' => $nofoto,
|
||||
'nama' => $nama,
|
||||
'norm' => $noregister,
|
||||
'rtglast' => $mulai,
|
||||
'alamat' => $alamat,
|
||||
'rjenis' => $jk,
|
||||
'umur' => $usia,
|
||||
'namadok' => $getdata->dokter ?? 'Unkown',
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $rekues,
|
||||
'alat' => 'ALL',
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'flg_vitek1' => false,
|
||||
'flg_vitek2' => false,
|
||||
'flg_bd1' => false,
|
||||
'flg_bd2' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
$pesan = $pesan.' Data Berhasil di Update';
|
||||
if ($kd_spesimen != '' AND $nm_spesimen != ''){
|
||||
PendaftaranOnListiner::updateOrCreate(
|
||||
@@ -1291,13 +1453,25 @@ class FrontpageController extends Controller
|
||||
'rjenis' => $jk,
|
||||
'kodedok' => Session('id'),
|
||||
'namadok' => Session('nama'),
|
||||
'ruangan' => $kamar,
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $rekues,
|
||||
'alat' => 'All',
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
]
|
||||
);
|
||||
/*
|
||||
$dataForLis = [
|
||||
'nama' => $nama,
|
||||
'noregister' => $noregister,
|
||||
'nofoto' => $nofoto,
|
||||
'kd_spesimen' => $kd_spesimen,
|
||||
'nm_spesimen' => $nm_spesimen,
|
||||
'tgllahir' => $tgllahir,
|
||||
'jk' => $jk,
|
||||
];
|
||||
$this->sendRegistrationToLis($dataForLis);
|
||||
*/
|
||||
}
|
||||
if ($pesan != ''){
|
||||
if ($file != '' AND $jenisgambar != ''){
|
||||
@@ -1334,81 +1508,38 @@ class FrontpageController extends Controller
|
||||
$modality = $request->input('reques');
|
||||
$cekdata = Periksa::where('nofoto', $nofoto)->first();
|
||||
if (isset($cekdata->id)){
|
||||
$senderName = 'LIS_System';
|
||||
$versionNumber = 'V1.0';
|
||||
$nama = $cekdata->nmpasien;
|
||||
$jk = $cekdata->jkpasien;
|
||||
$urgensi = $cekdata->urgensi ?? 'Elective';
|
||||
$alamat = $cekdata->alamatpasien ?? 'Malang';
|
||||
$arrayttl = explode(" ", $nama);
|
||||
$fname = iconv("UTF-8", "tis-620", $arrayttl[0]);
|
||||
if (isset($arrayttl[1])){
|
||||
$tengah = iconv("UTF-8", "tis-620", $arrayttl[1]);
|
||||
}
|
||||
if (isset($arrayttl[2])){
|
||||
$blakang = iconv("UTF-8", "tis-620", $arrayttl[2]);
|
||||
} else {
|
||||
$blakang = $tengah;
|
||||
$tengah = '';
|
||||
}
|
||||
if ($jk == 'L'){ $panggilan = 'TN'; $jk = 'M'; }
|
||||
else if ($jk == 'P') { $panggilan = 'NY'; $jk = 'F'; }
|
||||
else { $panggilan = 'UNK'; $jk = 'O'; }
|
||||
$panggilan = '';
|
||||
if ($blakang == ''){ $blakang = $fname; }
|
||||
if ($urgensi == 'Elective'){ $urgensi = 'INPATIENT'; $prioritas = 'R'; }
|
||||
else if ($urgensi == 'CITO'){ $urgensi = 'EMERGENCY'; $prioritas = 'A'; }
|
||||
else { $urgensi = 'OUTPATIENT'; $prioritas = 'A'; }
|
||||
$patient = [
|
||||
'id' => $cekdata->id,
|
||||
'last_name' => $fname,
|
||||
'first_name' => $blakang,
|
||||
'middle_name' => $tengah,
|
||||
'suffix' => $panggilan,
|
||||
'dob' => $cekdata->noregister,
|
||||
'sex' => $jk,
|
||||
'address' => $alamat.'^^MALANG^^ID^65123',
|
||||
'phone' => $cekdata->tlppasien,
|
||||
'admitting_physician' => $cekdata->klinisi ?? 'Dokter Pengirim'
|
||||
];
|
||||
$order = [
|
||||
'accession_number' => $cekdata->nofoto,
|
||||
'isolate_number' => 'MGIT^TestName',
|
||||
'organism' => $cekdata->reques ?? 'Mycobacterium tuberculosis',
|
||||
'exclude_isolate' => 'No',
|
||||
'priority' => $prioritas,
|
||||
'collection_date_time' => date("YmdHi"),
|
||||
'collected_by' => $cekdata->nmradiografer ?? Session('nama'),
|
||||
'received_by' => Session('nama'),
|
||||
'specimen_action_code' => '',
|
||||
'isolate_source_test' => 'Blood',
|
||||
'isolate_source_test_start_time'=> date("YmdHi"),
|
||||
'receipt_date_time' => date("YmdHi"),
|
||||
'specimen_type' => 'Blood Culture',
|
||||
'body_site' => 'Lung',
|
||||
'ordering_physician' => $cekdata->klinisi ?? 'Dokter Pengirim',
|
||||
'ordering_physician_phone' => '',
|
||||
'ordering_physician_fax' => '',
|
||||
'ordering_physician_pager' => '',
|
||||
'specimen_user_field_1' => '',
|
||||
'specimen_user_field_2' => '',
|
||||
'specimen_user_field_3' => '',
|
||||
'specimen_user_field_4' => '',
|
||||
'specimen_user_field_5' => '',
|
||||
'finalized_date_time' => date("YmdHi"),
|
||||
'specimen_reimbursement_value' => '100',
|
||||
'test_reimbursement_value' => '50',
|
||||
'isolate_classification' => 'Nosocomial'
|
||||
];
|
||||
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'excutor' => Session('id'),
|
||||
'nmexcutor' => Session('nama'),
|
||||
]);
|
||||
try {
|
||||
if ($modality == 'genexpert01' OR $modality == 'genexpert02' OR $modality == 'genexpert03'){
|
||||
$pesan = $this->Hl7Register($cekdata->id, $modality);
|
||||
} else {
|
||||
$pesan = 'Cannot send on Serial Port From Server';
|
||||
$ceksudah = DB::table('paslab')->where('rnoreg', $nofoto)->count();
|
||||
if ($ceksudah == 0){
|
||||
DB::table('paslab')->insert([
|
||||
'rnoreg' => $nofoto,
|
||||
'nama' => $nama,
|
||||
'norm' => $cekdata->noregister,
|
||||
'rtglast' => $cekdata->mulai,
|
||||
'alamat' => $alamat,
|
||||
'rjenis' => $jk,
|
||||
'umur' => $cekdata->usia,
|
||||
'namadok' => $getdata->dokter ?? 'Unkown',
|
||||
'ruangan' => 'Mikrobiologi',
|
||||
'tes' => $cekdata->reques,
|
||||
'alat' => 'ALL',
|
||||
'kd_spesimen' => $cekdata->kd_spesimen,
|
||||
'nm_spesimen' => $cekdata->nm_spesimen,
|
||||
'tgllahir' => $cekdata->tgllahirpasien,
|
||||
'flg_vitek1' => false,
|
||||
'flg_vitek2' => false,
|
||||
'flg_bd1' => false,
|
||||
'flg_bd2' => false,
|
||||
]);
|
||||
}
|
||||
}catch (Exception $e) {
|
||||
$pesan = $e->getMessage();
|
||||
@@ -1427,23 +1558,56 @@ class FrontpageController extends Controller
|
||||
if ($nofoto == 'noregister'){
|
||||
$noregister = $request->input('noregister');
|
||||
$tabel = '';
|
||||
$periksa = Periksa::where('noregister', $noregister)->where('tgllahirpasien', $tgllahir)->get();
|
||||
if (!empty($periksa)){
|
||||
$lists = DB::table('periksa')
|
||||
->select('periksa.*', 'organisms.satuan as satuanperspesimen', 'organisms.nilai as nilaiperspesimen')
|
||||
->leftJoin('periksa', 'organisms.category', 'periksa.kd_spesimen')
|
||||
->where('periksa.noregister', $noregister)
|
||||
->where('periksa.tgllahirpasien', $tgllahir)
|
||||
->get();
|
||||
if (!empty($lists)){
|
||||
$tabel = '<div class="timeline">';
|
||||
$kanan = '';
|
||||
foreach($periksa as $rows){
|
||||
$status = $rows->status;
|
||||
foreach($lists as $rows){
|
||||
$status = $rows->status;
|
||||
$id_periksa = $rows->id;
|
||||
if ( !empty($rows->rating) ) {
|
||||
$saved_rating = $rows->rating;
|
||||
$bintang_html = '';
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
if ( $i <= $saved_rating ) {
|
||||
$bintang_html .= '<i class="fa fa-star" style="font-size:18px; color:orange;"></i>';
|
||||
} else {
|
||||
$bintang_html .= '<i class="fa fa-star-o" style="font-size:18px; color:orange;"></i>';
|
||||
}
|
||||
}
|
||||
$ratingBintang = '
|
||||
<div class="rating-stars" data-id="'.$id_periksa.'">
|
||||
<small class="text-muted">Terimka kasih atas rating yang diberikan:</small><br>
|
||||
'.$bintang_html.'
|
||||
</div>';
|
||||
} else {
|
||||
$ratingBintang = '
|
||||
<div class="rating-stars" data-id="'.$id_periksa.'">
|
||||
<small class="text-muted">Beri Rating:</small><br>
|
||||
<i class="fa fa-star-o" style="cursor:pointer; font-size:18px; color:orange;" onclick="btnisiRating('.$id_periksa.', 1)"></i>
|
||||
<i class="fa fa-star-o" style="cursor:pointer; font-size:18px; color:orange;" onclick="btnisiRating('.$id_periksa.', 2)"></i>
|
||||
<i class="fa fa-star-o" style="cursor:pointer; font-size:18px; color:orange;" onclick="btnisiRating('.$id_periksa.', 3)"></i>
|
||||
<i class="fa fa-star-o" style="cursor:pointer; font-size:18px; color:orange;" onclick="btnisiRating('.$id_periksa.', 4)"></i>
|
||||
<i class="fa fa-star-o" style="cursor:pointer; font-size:18px; color:orange;" onclick="btnisiRating('.$id_periksa.', 5)"></i>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if ($status == 'Selesai'){
|
||||
$tombolcetak = url('/').'/hasil/'.$rows->nofoto;
|
||||
$tombolcetak = '<a href="'.$tombolcetak.'"><button type="button" class="btn btn-icon waves-effect waves-light btn-success"> <i class="fa fa-print"></i> </button></a>';
|
||||
} else {
|
||||
$tombolcetak = '';
|
||||
$tombolcetak = 'Masih dalam proses dan perkiraan selesai adalah '.$rows->nilaiperspesimen.' '.$rows->satuanperspesimen.' dari sample diterima';
|
||||
}
|
||||
if ($kanan == ''){
|
||||
$tabel = $tabel.'<article class="timeline-item"><div class="timeline-desk"><div class="panel"><div class="timeline-box"><span class="arrow"></span><span class="timeline-icon bg-custom"><i class="mdi mdi-adjust"></i></span><h4 class="text-custom">'.$rows->daftar.'</h4><p class="timeline-date text-muted"><small>'.$rows->reques.'</small></p><p>'.$rows->status.'</p><div class="btn btn-group">'.$tombolcetak.'</div></div></div></div></article>';
|
||||
$tabel = $tabel.'<article class="timeline-item"><div class="timeline-desk"><div class="panel"><div class="timeline-box"><span class="arrow"></span><span class="timeline-icon bg-custom"><i class="mdi mdi-adjust"></i></span><h4 class="text-custom">'.$rows->daftar.'</h4><p class="timeline-date text-muted"><small>'.$rows->reques.'</small></p><p>'.$rows->status.'</p>'.$ratingBintang.'<div class="btn btn-group">'.$tombolcetak.'</div></div></div></div></article>';
|
||||
$kanan = 'kanan';
|
||||
} else {
|
||||
$tabel = $tabel.'<article class="timeline-item alt"><div class="timeline-desk"><div class="panel"><div class="timeline-box"><span class="arrow-alt"></span><span class="timeline-icon bg-custom"><i class="mdi mdi-adjust"></i></span><h4 class="text-custom">'.$rows->daftar.'</h4><p class="timeline-date text-muted"><small>'.$rows->reques.'</small></p><p>'.$rows->status.'</p><div class="btn btn-group">'.$tombolcetak.'</div></div></div></div></article>';
|
||||
$tabel = $tabel.'<article class="timeline-item alt"><div class="timeline-desk"><div class="panel"><div class="timeline-box"><span class="arrow-alt"></span><span class="timeline-icon bg-custom"><i class="mdi mdi-adjust"></i></span><h4 class="text-custom">'.$rows->daftar.'</h4><p class="timeline-date text-muted"><small>'.$rows->reques.'</small></p><p>'.$rows->status.'</p>'.$ratingBintang.'<div class="btn btn-group">'.$tombolcetak.'</div></div></div></div></article>';
|
||||
$kanan = '';
|
||||
}
|
||||
}
|
||||
@@ -1452,6 +1616,10 @@ class FrontpageController extends Controller
|
||||
$tabel = 'Data Tidak ditemukan, Pastikan Kembali Apakah No. RM ('.$noregister.') dan tanggal lahir ('.$tgllahir.') sudah benar';
|
||||
}
|
||||
echo $tabel;
|
||||
} else if ($nofoto == 'isirating'){
|
||||
Periksa::where('id', $request->input('id'))->update([
|
||||
'rating' => $request->input('rating')
|
||||
]);
|
||||
} else {
|
||||
$periksa = Periksa::where('nofoto', $nofoto)->where('tgllahirpasien', $tgllahir)->first();
|
||||
if (isset($periksa->id)){
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LisController extends Controller
|
||||
{
|
||||
/**
|
||||
* Alamat IP dan port dari service Python/Flask.
|
||||
* Sebaiknya diletakkan di file .env
|
||||
* LIS_SERVICE_URL=http://127.0.0.1:5000
|
||||
*/
|
||||
protected $lisServiceUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Mengambil URL service dari file .env, dengan fallback default
|
||||
$this->lisServiceUrl = env('LIS_SERVICE_URL', 'http://localhost:5000');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mengirim perintah untuk mendaftarkan tes pasien baru ke GeneXpert.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function registerPatient(Request $request)
|
||||
{
|
||||
// Validasi input dari request (sangat direkomendasikan)
|
||||
$validatedData = $request->validate([
|
||||
'patient_name' => 'required|string|max:100',
|
||||
'patient_id' => 'required|string|max:50',
|
||||
'sample_id' => 'required|string|max:50',
|
||||
'test_code' => 'required|string|max:20',
|
||||
'test_name' => 'sometimes|string|max:50',
|
||||
'dob' => 'sometimes|date_format:Ymd',
|
||||
'gender' => 'sometimes|string|in:M,F,O,U',
|
||||
]);
|
||||
|
||||
// Membangun payload sesuai format yang diharapkan oleh app.py
|
||||
$payload = [
|
||||
'command' => 'register_patient',
|
||||
'data' => $validatedData,
|
||||
];
|
||||
|
||||
try {
|
||||
// Mengirim request POST ke service Python
|
||||
$response = Http::timeout(30) // Set timeout 30 detik
|
||||
->post($this->lisServiceUrl . '/command', $payload);
|
||||
|
||||
// Cek jika request gagal di level HTTP
|
||||
if ($response->failed()) {
|
||||
Log::error('Gagal terhubung ke LIS service saat registrasi.', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body()
|
||||
]);
|
||||
return response()->json([
|
||||
'error' => 'Tidak dapat terhubung ke LIS service.',
|
||||
'details' => $response->body()
|
||||
], 503); // Service Unavailable
|
||||
}
|
||||
|
||||
// Mengembalikan response dari service Python ke client
|
||||
return response()->json($response->json(), $response->status());
|
||||
|
||||
} catch (\Illuminate\Http\Client\ConnectionException $e) {
|
||||
Log::error('Koneksi ke LIS service gagal.', ['exception' => $e->getMessage()]);
|
||||
return response()->json(['error' => 'Koneksi ke LIS service gagal.'], 504); // Gateway Timeout
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mengirim perintah untuk meminta ulang hasil tes berdasarkan Sample ID.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function requestResult(Request $request)
|
||||
{
|
||||
// Validasi input
|
||||
$validatedData = $request->validate([
|
||||
'sample_id' => 'required|string|max:50',
|
||||
]);
|
||||
|
||||
// Membangun payload
|
||||
$payload = [
|
||||
'command' => 'request_result',
|
||||
'data' => $validatedData,
|
||||
];
|
||||
|
||||
try {
|
||||
// Mengirim request POST ke service Python
|
||||
$response = Http::timeout(30)->post($this->lisServiceUrl . '/command', $payload);
|
||||
|
||||
if ($response->failed()) {
|
||||
Log::error('Gagal terhubung ke LIS service saat meminta hasil.', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body()
|
||||
]);
|
||||
return response()->json([
|
||||
'error' => 'Tidak dapat terhubung ke LIS service.',
|
||||
'details' => $response->body()
|
||||
], 503);
|
||||
}
|
||||
|
||||
return response()->json($response->json(), $response->status());
|
||||
|
||||
} catch (\Illuminate\Http\Client\ConnectionException $e) {
|
||||
Log::error('Koneksi ke LIS service gagal.', ['exception' => $e->getMessage()]);
|
||||
return response()->json(['error' => 'Koneksi ke LIS service gagal.'], 504);
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
-30
@@ -224,41 +224,118 @@ class ListController extends Controller
|
||||
$id = $request->input('val01');
|
||||
$alasan = $request->input('val02');
|
||||
$tabel = $request->input('val03');
|
||||
if ($alasan == ''){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Mohon isi semua form']);
|
||||
return back();
|
||||
} else {
|
||||
if ($tabel == 'aktif'){
|
||||
$alasan = 'Dibatalkan dengan alasan '.$alasan;
|
||||
$input = Periksa::where('id', $id)->update([
|
||||
'noloket' => null,
|
||||
'status' => $alasan
|
||||
if ($id == 'buatulang'){
|
||||
$getdata= Periksa::where('id', $request->input('val02'))->first();
|
||||
if (isset($getdata->nofoto)){
|
||||
$ceksudah = Periksa::where('nofoto', 'LIKE', $getdata->nofoto.'_%')->count();
|
||||
$nomorbaru = $ceksudah++;
|
||||
$periksaid = Periksa::insertGetId([
|
||||
'mulai' => $getdata->mulai,
|
||||
'akhir' => $getdata->akhir,
|
||||
'noloket' => $getdata->noloket,
|
||||
'nofoto' => $getdata->nofoto.'_'.$nomorbaru,
|
||||
'noregister' => $getdata->noregister,
|
||||
'asalpasien' => $getdata->asalpasien,
|
||||
'nmrs' => $getdata->nmrs,
|
||||
'pasien_id' => $getdata->pasien_id,
|
||||
'nmpasien' => $getdata->nmpasien,
|
||||
'jkpasien' => $getdata->jkpasien,
|
||||
'ktp' => $getdata->ktp,
|
||||
'bpjs' => $getdata->bpjs,
|
||||
'tgllahirpasien'=> $getdata->tgllahirpasien,
|
||||
'tlppasien' => $getdata->tlppasien,
|
||||
'alamatpasien' => $getdata->alamatpasien,
|
||||
'reques' => $getdata->reques,
|
||||
'usia' => $getdata->usia,
|
||||
'berat' => $getdata->berat,
|
||||
'ruangan_id' => $getdata->ruangan_id,
|
||||
'ruangan' => $getdata->ruangan,
|
||||
'klinisi' => $getdata->klinisi,
|
||||
'klinis' => $getdata->klinis,
|
||||
'poli_id' => $getdata->poli_id,
|
||||
'kd_spesimen' => $getdata->kd_spesimen,
|
||||
'nm_spesimen' => $getdata->nm_spesimen,
|
||||
'keterangan' => '',
|
||||
'kesimpulan' => '',
|
||||
'asuransi' => $getdata->asuransi,
|
||||
'urgensi' => $getdata->urgensi,
|
||||
'daftar' => $getdata->daftar,
|
||||
'pendaftar' => Session('id'),
|
||||
'nmpendaftar' => Session('nama'),
|
||||
'orderid' => $getdata->orderid,
|
||||
]);
|
||||
$pesan = 'Order Expertise Canceled';
|
||||
} else if ($tabel == 'arsip'){
|
||||
$total = 0;
|
||||
$input = Periksa::whereIn('id', $id)->update([
|
||||
'status'=> 'Arsip'
|
||||
]);
|
||||
if ($input){
|
||||
$total++;
|
||||
}
|
||||
$pesan = 'Expertise Archieved '.$total;
|
||||
try {
|
||||
if ($getdata->kd_spesimen != '' AND $getdata->nm_spesimen != ''){
|
||||
PendaftaranOnListiner::updateOrCreate(
|
||||
[
|
||||
'rnoreg' => $getdata->nofoto,
|
||||
],
|
||||
[
|
||||
'rtglast' => date('Y-m-d'),
|
||||
'norm' => $getdata->noregister,
|
||||
'nama' => $getdata->nmpasien,
|
||||
'alamat' => $getdata->alamatpasien,
|
||||
'telp' => $getdata->tlppasien,
|
||||
'hp' => $getdata->tlppasien,
|
||||
'tgllahir' => $getdata->tgllahirpasien,
|
||||
'umur' => $getdata->usia,
|
||||
'rjenis' => $getdata->jkpasien,
|
||||
'kodedok' => Session('id'),
|
||||
'namadok' => Session('nama'),
|
||||
'ruangan' => $getdata->ruangan,
|
||||
'tes' => '',
|
||||
'alat' => 'All',
|
||||
'kd_spesimen' => $getdata->kd_spesimen,
|
||||
'nm_spesimen' => $getdata->nm_spesimen,
|
||||
]
|
||||
);
|
||||
}
|
||||
return response()->json(['status' => 'Sukses', 'message' => 'Data Order Berhasil di Gandakan'], 201);
|
||||
} catch (Exception $e) {
|
||||
return response()->json(['status' => 'Sukses', 'message' => 'Data Order Berhasil di Gandakan'], 201);
|
||||
}
|
||||
} else {
|
||||
$alasan = 'Dibatalkan dengan alasan '.$alasan;
|
||||
$input = Jadwalperiksa::where('id', $id)->update([
|
||||
'noloket' => null,
|
||||
'status' => $alasan
|
||||
]);
|
||||
$pesan = 'Schedulling Canceled';
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Data Tidak Valid']);
|
||||
return back();
|
||||
}
|
||||
if ($input){
|
||||
return response()->json(['icon' => 'success', 'warna' => '#5ba035', 'status' => 'Sukses', 'message' => $pesan]);
|
||||
return back();
|
||||
}else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'System Down, please try again in a few years...']);
|
||||
} else {
|
||||
if ($alasan == ''){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Mohon isi semua form']);
|
||||
return back();
|
||||
} else {
|
||||
if ($tabel == 'aktif'){
|
||||
$alasan = 'Dibatalkan dengan alasan '.$alasan;
|
||||
$input = Periksa::where('id', $id)->update([
|
||||
'noloket' => null,
|
||||
'status' => $alasan
|
||||
]);
|
||||
$pesan = 'Order Expertise Canceled';
|
||||
} else if ($tabel == 'arsip'){
|
||||
$total = 0;
|
||||
$input = Periksa::whereIn('id', $id)->update([
|
||||
'status'=> 'Arsip'
|
||||
]);
|
||||
if ($input){
|
||||
$total++;
|
||||
}
|
||||
$pesan = 'Expertise Archieved '.$total;
|
||||
} else {
|
||||
$alasan = 'Dibatalkan dengan alasan '.$alasan;
|
||||
$input = Jadwalperiksa::where('id', $id)->update([
|
||||
'noloket' => null,
|
||||
'status' => $alasan
|
||||
]);
|
||||
$pesan = 'Schedulling Canceled';
|
||||
}
|
||||
if ($input){
|
||||
return response()->json(['icon' => 'success', 'warna' => '#5ba035', 'status' => 'Sukses', 'message' => $pesan]);
|
||||
return back();
|
||||
}else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'System Down, please try again in a few years...']);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+33
-42
@@ -105,48 +105,39 @@ class PasienController extends Controller
|
||||
]);
|
||||
} else {
|
||||
try {
|
||||
$client = new Client();
|
||||
$res = $client->request('GET', 'http://10.10.123.51:8000/mr/'.$norm);
|
||||
$response_data = json_decode($res->getBody()->getContents());
|
||||
if (isset($response_data[0])) {
|
||||
$hasil = $response_data[0];
|
||||
$nama = $hasil->Nama;
|
||||
$alamat = $hasil->Alamat;
|
||||
$telpon = $hasil->Telp;
|
||||
$kota = $hasil->Kota;
|
||||
$kelamin = $hasil->JenisKelamin;
|
||||
$tgllahir = $hasil->tanggal_lahir;
|
||||
$nik = $hasil->nik;
|
||||
$bpjs = $hasil->bpjs;
|
||||
if ($kelamin == 'WANITA'){
|
||||
$kelamin = 'P';
|
||||
} else { $kelamin = 'L'; }
|
||||
return response()->json([
|
||||
'id' => 'new',
|
||||
'norm' => $norm,
|
||||
'telpon' => $telpon,
|
||||
'nama' => $nama,
|
||||
'tgl_lahir' => $tgllahir,
|
||||
'jk' => $kelamin,
|
||||
'alamat' => $alamat,
|
||||
'kota' => $kota,
|
||||
'nik' => $nik,
|
||||
'bpjs' => $bpjs,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'id' => '',
|
||||
'telpon' => '000000000',
|
||||
'norm' => $norm,
|
||||
'nama' => '',
|
||||
'tgl_lahir' => date("d-m-Y"),
|
||||
'jk' => 'L',
|
||||
'alamat' => 'Malang',
|
||||
'kota' => 'Malang',
|
||||
'nik' => '',
|
||||
'bpjs' => '',
|
||||
]);
|
||||
}
|
||||
$client = new Client();
|
||||
$res = $client->request('GET', env('GETPASIEN_API'), ['query' => ['limit' => 10, 'nomedis' => $norm]]);
|
||||
$response_data = json_decode($res->getBody()->getContents());
|
||||
if (isset($response_data->response[0])) {
|
||||
$hasil = $response_data->response[0];
|
||||
$nama = $hasil->Nama;
|
||||
$alamat = $hasil->Alamat;
|
||||
$telpon = $hasil->Telp;
|
||||
$kota = $hasil->Kota;
|
||||
$kelamin = $hasil->JenisKelamin;
|
||||
$tgllahir = $hasil->tanggal_lahir;
|
||||
return response()->json([
|
||||
'id' => 'new',
|
||||
'norm' => $norm,
|
||||
'telpon' => $telpon,
|
||||
'nama' => $nama,
|
||||
'tgl_lahir' => date('d-m-Y', strtotime($tgllahir)),
|
||||
'jk' => $kelamin,
|
||||
'alamat' => $alamat,
|
||||
'kota' => $kota,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'id' => '',
|
||||
'telpon' => '000000000',
|
||||
'norm' => $norm,
|
||||
'nama' => '',
|
||||
'tgl_lahir' => date("d-m-Y"),
|
||||
'jk' => 'L',
|
||||
'alamat' => 'Malang',
|
||||
'kota' => 'Malang',
|
||||
]);
|
||||
}
|
||||
}catch (Exception $e) {
|
||||
return response()->json([
|
||||
'id' => '',
|
||||
+24
-15
@@ -308,25 +308,34 @@ class ReportController extends Controller
|
||||
}
|
||||
}
|
||||
public function genRekapAntibiotik(Request $request) {
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
if ($tahun == '' OR is_null($tahun)){
|
||||
$getarray = explode('?', $bulan);
|
||||
$bulan = $getarray[0] ?? date('m');
|
||||
$tahun = $getarray[1] ?? date('Y');
|
||||
$bulan = str_replace('bulan=', '', $bulan);
|
||||
$tahun = str_replace('tahun=', '', $tahun);
|
||||
}
|
||||
$getarray = explode('?', $bulan);
|
||||
$bulan = $getarray[0] ?? date('m');
|
||||
$tahun = $getarray[1] ?? date('Y');
|
||||
$bulan = str_replace('bulan=', '', $bulan);
|
||||
$tahun = str_replace('tahun=', '', $tahun);
|
||||
}
|
||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||
} else {
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = RekapAntibiotik::whereIn('orderid', $orderbydate->pluck('id'))->get()->groupBy('orderid');
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||
}
|
||||
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
|
||||
}
|
||||
|
||||
$orderIds = $orderbydate->pluck('id');
|
||||
|
||||
$allAntibiotics = RekapAntibiotik::whereIn('orderid', $orderIds)->get();
|
||||
|
||||
$masterAntibioticList = $allAntibiotics->pluck('resistance')->unique()->sort()->values();
|
||||
|
||||
$jsonantibiotik = $allAntibiotics->groupBy('orderid')->map(function ($items) {
|
||||
return $items->pluck('interpretation', 'resistance');
|
||||
});
|
||||
|
||||
return view('admin.rekapantibiotik', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun', 'masterAntibioticList'));
|
||||
}
|
||||
public function genGlassReport(Request $request) {
|
||||
$data = [];
|
||||
$bulan = $request->input('bulan');
|
||||
+28
@@ -275,6 +275,34 @@ class TemplateController extends Controller
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Failed', 'message' => 'Unkown Error']);
|
||||
return back();
|
||||
}
|
||||
} else if ($tabel == 'Speciment'){
|
||||
if ($id == 'new'){
|
||||
$ceksudah = Organisms::where('name', $request->name)->where('category', $request->category)->where('kelompok', $request->kelompok)->count();
|
||||
if ($ceksudah == 0){
|
||||
$data = new Organisms;
|
||||
$inputData = $request->except(['id', 'tabel', '_token']);
|
||||
$data->fill($inputData);
|
||||
$data->save();
|
||||
} else {
|
||||
$pesan = $request->name.' ('.$request->category.') Sudah ada, Mohon ubah Data sebelum simpan kembali';
|
||||
}
|
||||
} else {
|
||||
$ceksudah = Organisms::where('id', '!=', $id)->where('name', $request->name)->where('category', $request->category)->where('kelompok', $request->kelompok)->count();
|
||||
if ($ceksudah == 0){
|
||||
$data = Organisms::find($id);
|
||||
$inputData = $request->except(['id', 'tabel', '_token']);
|
||||
$data->update($inputData);
|
||||
} else {
|
||||
$pesan = $request->name.' ('.$request->category.') Sudah ada, Mohon ubah Data sebelum simpan kembali';
|
||||
}
|
||||
}
|
||||
if ($data){
|
||||
return response()->json(['icon' => 'success', 'warna' => '#5ba035', 'status' => 'Success', 'message' => 'Saved']);
|
||||
return back();
|
||||
} else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Failed', 'message' => 'Unkown Error']);
|
||||
return back();
|
||||
}
|
||||
} else if ($tabel == 'Parameter'){
|
||||
$getdatalama = Organisms::where('kelompok', $request->kelompok)->first();
|
||||
$category = $getdatalama->category ?? $request->kelompok;
|
||||
@@ -24,6 +24,8 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//resolve(\Illuminate\Routing\UrlGenerator::class)->forceScheme('https');
|
||||
//parent::boot();
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ResultOnListiner extends Model
|
||||
{
|
||||
protected $connection = 'mysqllistener';
|
||||
protected $primaryKey = "urut";
|
||||
protected $table = "lis_phoenix";
|
||||
public $timestamps = false;
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
||||
@@ -231,110 +231,80 @@ class AstmMessageService
|
||||
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
||||
|
||||
} else {
|
||||
if (!empty($mltrData)){
|
||||
Log::info("Trying parser MTRSL :", $mltrData);
|
||||
$parsedData = [];
|
||||
$parsedData['antibiotics'] = [];
|
||||
$antibiotic = '';
|
||||
$resistance = '';
|
||||
$value = '';
|
||||
$interpretation = '';
|
||||
$mulaikirim = 0;
|
||||
$resultSample = new ResultSample();
|
||||
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 {
|
||||
$field = substr($field, 2);
|
||||
switch ($index) {
|
||||
case 0:
|
||||
$resultSample->sender_name = $alat;
|
||||
break;
|
||||
case 1:
|
||||
$resultSample->version_number = $field; // iiV2
|
||||
break;
|
||||
case 2:
|
||||
$resultSample->isolate_number = $field; // is000015F278BD
|
||||
break;
|
||||
case 4:
|
||||
$resultSample->patient_id = $field; // pi12009427
|
||||
break;
|
||||
case 5:
|
||||
$patientNames = explode(',', $field ?? null);
|
||||
if (count($patientNames) > 0) {
|
||||
$resultSample->patient_name_last = trim($patientNames[0]); // Last name
|
||||
}
|
||||
if (count($patientNames) > 1) {
|
||||
$resultSample->patient_name_first = trim($patientNames[1]); // First name
|
||||
}
|
||||
if (count($patientNames) > 2) {
|
||||
$resultSample->patient_name_middle = trim($patientNames[2]); // Middle name
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
$resultSample->address_street = $field; // plMANINJAU
|
||||
break;
|
||||
case 12:
|
||||
try {
|
||||
$resultSample->message_datetime = Carbon::parse($field)->format('Y-m-d') ?? null;
|
||||
}catch (Exception $e) {
|
||||
$resultSample->message_datetime = date('Y-m-d');
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
try {
|
||||
$resultSample->test_complete_datetime = Carbon::parse($field)->format('Y-m-d') ?? null;
|
||||
}catch (Exception $e) {
|
||||
$resultSample->test_complete_datetime = date('Y-m-d');
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
$resultSample->accession_number = substr($field, 6); // ci30112024.26859
|
||||
break;
|
||||
case 23:
|
||||
$resultSample->organism = $field; // o2Staphylococcus haemolyticus
|
||||
break;
|
||||
if (!empty($mltrData)) {
|
||||
Log::info("Trying robust parser for MTRSL:", $mltrData);
|
||||
|
||||
$resultSample = new ResultSample();
|
||||
$antibioticResults = [];
|
||||
$currentAntibiotic = [];
|
||||
|
||||
foreach ($mltrData as $field) {
|
||||
if (strlen($field) < 2) continue; // Lewati field kosong
|
||||
|
||||
// 1. Identifikasi TAG dan VALUE dari setiap field
|
||||
$tag = substr($field, 0, 2);
|
||||
$value = substr($field, 2);
|
||||
|
||||
// 2. Gunakan SWITCH pada TAG, bukan pada INDEX
|
||||
switch ($tag) {
|
||||
// == Data Pasien & Sampel ==
|
||||
case 'pi': $resultSample->patient_id = $value; break;
|
||||
case 'pn':
|
||||
$patientNames = explode(',', $value ?? null);
|
||||
$resultSample->patient_name_last = trim($patientNames[0] ?? '');
|
||||
$resultSample->patient_name_first = trim($patientNames[1] ?? '');
|
||||
$resultSample->patient_name_middle = trim($patientNames[2] ?? '');
|
||||
break;
|
||||
case 'pl': $resultSample->address_street = $value; break;
|
||||
case 'ci': $resultSample->accession_number = substr($value, 6); break;
|
||||
case 'o2': $resultSample->organism = $value; break;
|
||||
|
||||
// Tanggal bisa memiliki tag s1, s3, dll. Sesuaikan jika perlu
|
||||
case 's3':
|
||||
try {
|
||||
// Contoh parsing tanggal dari format Vitek: 08/25/2025
|
||||
$resultSample->test_complete_datetime = Carbon::createFromFormat('m/d/Y', $value)->format('Y-m-d H:i:s');
|
||||
} catch (Exception $e) {
|
||||
$resultSample->test_complete_datetime = now();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// == Logika Cerdas untuk Blok Antibiotik ==
|
||||
case 'ra':
|
||||
// 'ra' adalah sinyal bahwa blok antibiotik SEBELUMNYA sudah selesai.
|
||||
// Jika $currentAntibiotic tidak kosong, simpan ke hasil utama.
|
||||
if (!empty($currentAntibiotic)) {
|
||||
$antibioticResults[] = $currentAntibiotic;
|
||||
}
|
||||
// Reset untuk menampung data antibiotik yang baru.
|
||||
$currentAntibiotic = [];
|
||||
break;
|
||||
case 'a1': $currentAntibiotic['antibiotic'] = $value; break; // Kode Antibiotik
|
||||
case 'a2': $currentAntibiotic['resistance'] = $value; break; // Nama Antibiotik
|
||||
case 'a3': $currentAntibiotic['value'] = $value; break; // Nilai MIC
|
||||
case 'a4': $currentAntibiotic['interpretation'] = $value; break; // Interpretasi
|
||||
case 'an':
|
||||
// Jika 'an' ada, ini adalah interpretasi final, timpa yang sebelumnya.
|
||||
$currentAntibiotic['interpretation'] = $value;
|
||||
break;
|
||||
|
||||
// == Metadata Lainnya (opsional) ==
|
||||
case 'ii': $resultSample->version_number = $value; break;
|
||||
case 'is': $resultSample->isolate_number = $value; break;
|
||||
}
|
||||
}
|
||||
|
||||
//$resultSample->specimen_type = $parsedData['specimen_type'] ?? null; // Could be inferred
|
||||
//$resultSample->test_id = $parsedData['test_id'] ?? null;
|
||||
|
||||
// Result Record
|
||||
|
||||
$resultSample->additional_result = json_encode($parsedData['antibiotics']);
|
||||
// Penting: Simpan blok antibiotik TERAKHIR setelah loop selesai
|
||||
if (!empty($currentAntibiotic)) {
|
||||
$antibioticResults[] = $currentAntibiotic;
|
||||
}
|
||||
|
||||
$resultSample->sender_name = $alat ?? 'VITEK'; // Pastikan var $alat ada
|
||||
$resultSample->additional_result = json_encode($antibioticResults);
|
||||
|
||||
// Menyimpan data yang sudah diparse
|
||||
$resultSample->save();
|
||||
Log::info("Data MTRL Berhasil di Parse dan di simpan ", $resultSample->toArray());
|
||||
Log::info("Data MTRSL successfully parsed and saved.", $resultSample->toArray());
|
||||
return response()->json(['message' => 'Data berhasil diproses dan disimpan.']);
|
||||
} else {
|
||||
$headerData = explode("|", $response);
|
||||
Loaded 100 of 15170 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in New Issue
Block a user