Compare commits
44
Commits
1ea0c96381
...
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 | ||
|
|
0771b98790 | ||
|
|
004c0e4d5d | ||
|
|
0f11722f09 | ||
|
|
e71185004c | ||
|
|
52893f4eb9 | ||
|
|
0fb1978a0e | ||
|
|
37443d678c | ||
|
|
6ff9168713 | ||
|
|
ba76a18580 | ||
|
|
619f75ff5e | ||
|
|
6f7beddec6 | ||
|
|
f2c4fb19eb |
No files matched your search
@@ -1,59 +0,0 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailpit
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
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=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
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,72 +0,0 @@
|
||||
<<<<<<< HEAD
|
||||
# lis
|
||||
|
||||
Laboratory Information System
|
||||
=======
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[WebReinvent](https://webreinvent.com/)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Jump24](https://jump24.co.uk)**
|
||||
- **[Redberry](https://redberry.international/laravel/)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
- **[byte5](https://byte5.de)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
>>>>>>> afc9cdf (Unggahan Awal)
|
||||
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Poli;
|
||||
use App\Ruangan;
|
||||
use App\Organisms;
|
||||
|
||||
use Validator;
|
||||
use Session;
|
||||
|
||||
class PoliController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
if (Session::get('previlage') == ''){
|
||||
return redirect('/login');
|
||||
} else {
|
||||
$data = [];
|
||||
$data['polis'] = Poli::all();
|
||||
$data['ruangans'] = Ruangan::all();
|
||||
return view('admin.poli', $data);
|
||||
}
|
||||
}
|
||||
public function storePoli(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'poli' => 'required',
|
||||
'poli' => 'required',
|
||||
'modaliti' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$poli = $request->input('poli');
|
||||
$subpoli = $request->input('subpoli');
|
||||
$subsubpoli = $request->input('subsubpoli');
|
||||
$modaliti = $request->input('modaliti');
|
||||
Poli::create([
|
||||
'poli' => $request->input('poli'),
|
||||
'subpoli' => $request->input('subpoli'),
|
||||
'subsubpoli'=> $request->input('subsubpoli'),
|
||||
'modaliti' => $request->input('modaliti'),
|
||||
'modaliti2' => $request->input('modaliti2')
|
||||
]);
|
||||
$tulis = 'Data '.$poli.' '.$subpoli.' '.$subsubpoli.' Saved..!!';
|
||||
return response()->json(['status' => 'success', 'message' => $tulis]);
|
||||
}
|
||||
}
|
||||
public function getListPoli() {
|
||||
$results = Poli::orderBy('subpoli', 'ASC')->get();
|
||||
echo json_encode($results);
|
||||
}
|
||||
public function updatePoli(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'poli' => 'required',
|
||||
'subpoli' => 'required',
|
||||
'modaliti' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$id = $request->input('id');
|
||||
$poli = $request->input('poli');
|
||||
$subpoli = $request->input('subpoli');
|
||||
$subsubpoli = $request->input('subsubpoli');
|
||||
Poli::where('id', $id)->update([
|
||||
'poli' => $poli,
|
||||
'subpoli' => $subpoli,
|
||||
'subsubpoli'=> $subsubpoli,
|
||||
'modaliti' => $request->input('modaliti'),
|
||||
'modaliti2' => $request->input('modaliti2')
|
||||
]);
|
||||
$tulis = 'Data '.$poli.' '.$subpoli.' '.$subsubpoli.' Updated..!!';
|
||||
return response()->json(['status' => 'success', 'message' => $tulis]);
|
||||
}
|
||||
}
|
||||
public function deletePoli(Request $request) {
|
||||
$id = $request->id;
|
||||
$poli = Poli::find($id);
|
||||
$poli->delete();
|
||||
return back();
|
||||
}
|
||||
public function storeRuangan(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'poli' => 'required',
|
||||
'ruangan' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
Ruangan::create([
|
||||
'poli' => $request->input('poli'),
|
||||
'ruangan' => $request->input('ruangan')
|
||||
]);
|
||||
Session::flash('message', 'Data berhasil disimpan');
|
||||
Session::flash('alert-class', 'alert-success');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
public function getListRuangan(Request $request) {
|
||||
$results = Ruangan::all();
|
||||
echo json_encode($results);
|
||||
}
|
||||
public function updateRuangan(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'poli' => 'required',
|
||||
'ruangan' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$id = $request->input('id');
|
||||
Ruangan::where('id', $id)->update([
|
||||
'poli' => $request->input('poli'),
|
||||
'ruangan' => $request->input('ruangan')
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function deleteRuangan(Request $request) {
|
||||
$id = $request->id;
|
||||
$ruangan = Ruangan::find($id);
|
||||
$ruangan->delete();
|
||||
return back();
|
||||
}
|
||||
}
|
||||
@@ -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"]
|
||||
@@ -0,0 +1,55 @@
|
||||
# LIS (Laboratory Information System)
|
||||
|
||||
**Laboratory Information System (LIS)** adalah sistem yang digunakan untuk mengelola informasi terkait dengan laboratorium, mulai dari manajemen data sampel, hasil tes, hingga laporan dan pengolahan data terkait laboratorium.
|
||||
|
||||
## Developer
|
||||
Aplikasi ini dikembangkan oleh tim pengembang dari **CV. Swandhana**.
|
||||
|
||||
**Alamat:**
|
||||
Jl. Lamandau 18A, Bunulrejo, Blimbing, Malang
|
||||
|
||||
**Nomor Telepon (WA):**
|
||||
081359108565
|
||||
|
||||
## Manual Book
|
||||
Untuk panduan pengguna atau manual book dari LIS, dapat diunduh melalui link berikut:
|
||||
[Download Manual Book](http://10.10.123.218/manual.pdf)
|
||||
|
||||
## Fitur
|
||||
- Pengelolaan data sampel laboratorium
|
||||
- Pengolahan dan analisis hasil tes
|
||||
- Pembuatan laporan otomatis
|
||||
- Integrasi dengan perangkat laboratorium (optional)
|
||||
|
||||
## Instalasi
|
||||
1. Clone repository ini ke sistem lokal Anda:
|
||||
```bash
|
||||
git clone https://git.rssa.top/dwi_vendor/lis/repository.git
|
||||
```
|
||||
2. Masuk ke dalam folder proyek:
|
||||
```bash
|
||||
cd repository
|
||||
```
|
||||
3. Instal dependensi yang diperlukan:
|
||||
```bash
|
||||
composer install
|
||||
```
|
||||
|
||||
4. Konfigurasi `.env` sesuai dengan kebutuhan aplikasi Anda.
|
||||
5. Jalankan server aplikasi:
|
||||
```bash
|
||||
php artisan serve
|
||||
```
|
||||
|
||||
## Teknologi yang Digunakan
|
||||
- **Laravel** (PHP Framework)
|
||||
- **MySQL** (Database)
|
||||
- **Bootstrap** (Frontend)
|
||||
- **jQuery** (Frontend)
|
||||
|
||||
## Kontribusi
|
||||
Jika Anda ingin berkontribusi pada proyek ini, silakan buat **pull request** atau **issue** terkait.
|
||||
|
||||
## Lisensi
|
||||
Proyek ini dilisensikan di bawah lisensi MIT. Lihat file **LICENSE** untuk informasi lebih lanjut.
|
||||
|
||||
+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);
|
||||
+335
-93
@@ -6,7 +6,6 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Http\Controllers\SendMail;
|
||||
use App\Services\AstmMessageService;
|
||||
|
||||
use App\Poli;
|
||||
use App\Periksa;
|
||||
use App\DataListiner;
|
||||
@@ -52,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');
|
||||
@@ -131,6 +135,7 @@ class DokterController extends Controller
|
||||
$data['periksa'] = $periksa;
|
||||
$data['keterangan'] = $keterangan;
|
||||
$data['tandatangananalis'] = $tandatangananalis;
|
||||
$data['ttdanalis'] = $tandatangananalis;
|
||||
$data['tandatangan'] = $tandatangan;
|
||||
$data['ppds'] = $ppds;
|
||||
$data['kopsurat'] = $kopsurat;
|
||||
@@ -174,63 +179,75 @@ class DokterController extends Controller
|
||||
public function reportppds() {
|
||||
$previlage = Session('previlage');
|
||||
if ($previlage == 'developer' OR $previlage == 'supervisor') {
|
||||
$data = [];
|
||||
$dokters = User::where('previlage', 'supervisor')->get();
|
||||
$allppds = User::where('previlage', 'ppds')->get();
|
||||
$allanalis = User::where('previlage', 'analis')->get();
|
||||
$organismslis = Organisms::where('kelompok', 'biakankultur')->groupBy('category')->select('category')->get();
|
||||
$i = 0;
|
||||
foreach ($organismslis as $rorganisme) {
|
||||
$j = 0;
|
||||
$category = $rorganisme->category;
|
||||
$rooms = Organisms::where('kelompok', 'biakankultur')->where('category', $category)->orderBy('name', 'ASC')->get();
|
||||
foreach ($rooms as $room) {
|
||||
$data['organismes'][$i][$j]['id'] = $room->id;
|
||||
$data['organismes'][$i][$j]['name'] = $room->name;
|
||||
$j++;
|
||||
$data = [
|
||||
'dokters' => User::where('previlage', 'supervisor')->get(),
|
||||
'allppds' => User::where('previlage', 'ppds')->get(),
|
||||
'allanalis' => User::where('previlage', 'analis')->get(),
|
||||
'lokasi' => 'Lab Mikrobiologi',
|
||||
'master' => 'mikro',
|
||||
'antrkrmsitu' => 0,
|
||||
];
|
||||
$allOrganisms = Organisms::orderBy('name', 'ASC')->get();
|
||||
$groupOrganisms = function ($kelompok) use ($allOrganisms) {
|
||||
$organisms = $allOrganisms->where('kelompok', $kelompok);
|
||||
if ($organisms->isEmpty()) {
|
||||
return [
|
||||
'organismes' => [[['id' => 0, 'name' => 'No Data']]],
|
||||
'categories' => ['No Data'],
|
||||
];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$x = 0;
|
||||
foreach ($organismslis as $rows) {
|
||||
$data['bacterycateggories'][$x] = $rows->category;
|
||||
$x++;
|
||||
}
|
||||
if ($x == 0){
|
||||
$data['organismes'][0][0]['id'] = 0;
|
||||
$data['organismes'][0][0]['name'] = 'No Data';
|
||||
$data['bacterycateggories'][0] = 'No Data';
|
||||
}
|
||||
$mikroorganismelist = Organisms::where('kelompok', 'mikroorganisme')->groupBy('category')->select('category')->get();
|
||||
$i = 0;
|
||||
foreach ($mikroorganismelist as $rorganisme) {
|
||||
$j = 0;
|
||||
$category = $rorganisme->category;
|
||||
$rooms = Organisms::where('kelompok', 'mikroorganisme')->where('category', $category)->orderBy('name', 'ASC')->get();
|
||||
foreach ($rooms as $room) {
|
||||
$data['mikroorganismes'][$i][$j]['id'] = $room->id;
|
||||
$data['mikroorganismes'][$i][$j]['name'] = $room->name;
|
||||
$j++;
|
||||
$grouped = $organisms->groupBy('category');
|
||||
$organismes = [];
|
||||
$categories = [];
|
||||
$i = 0;
|
||||
foreach ($grouped as $category => $items) {
|
||||
$categories[] = $category;
|
||||
$j = 0;
|
||||
foreach ($items as $item) {
|
||||
$organismes[$i][$j] = ['id' => $item->id, 'name' => $item->name];
|
||||
$j++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
return [
|
||||
'organismes' => $organismes,
|
||||
'categories' => $categories,
|
||||
];
|
||||
};
|
||||
$biakankulturData = $groupOrganisms('biakankultur');
|
||||
$mikroorganismeData = $groupOrganisms('mikroorganisme');
|
||||
|
||||
// Gabungkan data
|
||||
$data = array_merge($data, [
|
||||
'organismes' => $biakankulturData['organismes'],
|
||||
'bacterycateggories' => $biakankulturData['categories'],
|
||||
'mikroorganismes' => $mikroorganismeData['organismes'],
|
||||
'mikroorganismestlist' => $mikroorganismeData['categories'],
|
||||
]);
|
||||
$kelompokMapping = [
|
||||
'jsonsputum' => 'Sputum',
|
||||
'jsonswabtenggorok' => 'Swab Tenggorok',
|
||||
'jsonurine' => 'Urine',
|
||||
'jsonswabperineum' => 'Swab perineum',
|
||||
'jsonselepitel' => 'Sel Epitel',
|
||||
'jsonselradang' => 'Sel Radang',
|
||||
'jsonmikroorganisme' => 'Q Mikroorganisme',
|
||||
'jsonjumlahlactobacillus' => 'Lactobacillus',
|
||||
'jsonjumlahgardnerella' => 'Gardnerella',
|
||||
'jsonjumlahmobiluncus' => 'Mobiluncus',
|
||||
'jsonpewarnaanziehlnielsen' => 'Pewarnaan Ziehl Nielsen',
|
||||
'jsonpewarnaanneisser' => 'Pewarnaan Neisser',
|
||||
'jsonpewarnaannegatif' => 'Pewarnaan Negatif',
|
||||
'jsonpewarnaanspora' => 'Pewarnaan Spora',
|
||||
'jsonmediabap' => 'Media BAP',
|
||||
'jsonmediacap' => 'Media CAP',
|
||||
'jsonmediamcconkey' => 'Media Mc Conkey',
|
||||
'jsonpemeriksaantl' => 'Pemeriksaan Tambahan Lainnya',
|
||||
'jsonbiakankultur' => 'Biakan Kultur',
|
||||
];
|
||||
foreach ($kelompokMapping as $key => $kelompok) {
|
||||
$data[$key] = $allOrganisms->where('kelompok', $kelompok)->values();
|
||||
}
|
||||
$x = 0;
|
||||
foreach ($mikroorganismelist as $rows) {
|
||||
$data['mikroorganismestlist'][$x] = $rows->category;
|
||||
$x++;
|
||||
}
|
||||
if ($x == 0){
|
||||
$data['mikroorganismes'][0][0]['id'] = 0;
|
||||
$data['mikroorganismes'][0][0]['name'] = 'No Data';
|
||||
$data['mikroorganismestlist'][0] = 'No Data';
|
||||
}
|
||||
$data['allppds'] = $allppds;
|
||||
$data['dokters'] = $dokters;
|
||||
$data['allanalis'] = $allanalis;
|
||||
$data['antrkrmsitu']= PeriksaSYNC::where('created_by', Session('username'))->where('status', '')->count();
|
||||
$data['lokasi'] = 'Lab Mikrobiologi';
|
||||
$data['master'] = 'mikro';
|
||||
$previlage = Session('previlage');
|
||||
return view('dokter.pemeriksaan', $data);
|
||||
} else {
|
||||
$data = [];
|
||||
@@ -478,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']);
|
||||
}
|
||||
@@ -569,8 +586,8 @@ class DokterController extends Controller
|
||||
'modality' => $modality,
|
||||
'jumlah' => $jumlah,
|
||||
'foto' => $tanggal,
|
||||
'nmradiografer' => Session('nama'),
|
||||
'radiografer' => Session('id'),
|
||||
'nmanalis' => Session('nama'),
|
||||
'analis' => Session('id'),
|
||||
]);
|
||||
} else {
|
||||
Periksa::where('id', $idperiksa)->update([
|
||||
@@ -583,8 +600,8 @@ class DokterController extends Controller
|
||||
'dlp' => $dlp,
|
||||
'modality' => $modality,
|
||||
'jumlah' => $jumlah,
|
||||
'radiografer' => Session('id'),
|
||||
'nmradiografer' => Session('nama'),
|
||||
'analis' => Session('id'),
|
||||
'nmanalis' => Session('nama'),
|
||||
'foto' => $tanggal,
|
||||
'status' => 'Telah di kirim ke worklist/modalitas',
|
||||
'excutor' => null,
|
||||
@@ -856,6 +873,128 @@ class DokterController extends Controller
|
||||
$pesan = $e->getMessage();
|
||||
}
|
||||
return $pesan;
|
||||
} else if ($worklist == 'isandasar'){
|
||||
try {
|
||||
$dokter_id = 0;
|
||||
$analis = 0;
|
||||
$ppds3 = 0;
|
||||
$nmanalis = '';
|
||||
$nmdokter = '';
|
||||
$nmppdssenior = '';
|
||||
if ($request->input('komponen') == 'analis' OR $request->input('komponen') == 'ppds3' OR $request->input('komponen') == 'dokter'){
|
||||
if ($request->input('isi') != 0){
|
||||
if ($request->input('komponen') == 'analis'){
|
||||
$analis = $request->input('isi');
|
||||
$getnama = User::where('id', $analis)->first();
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'analis' => $analis,
|
||||
'nmanalis' => $getnama->nama
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'ppds3'){
|
||||
$ppds3 = $request->input('isi');
|
||||
$getnama = User::where('id', $ppds3)->first();
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'ppds3' => $ppds3,
|
||||
'nmppdssenior' => $getnama->nama
|
||||
]);
|
||||
} else {
|
||||
$dokter_id = $request->input('isi');
|
||||
$getnama = User::where('id', $dokter_id)->first();
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'dokter_id' => $dokter_id,
|
||||
'nmdokter' => $getnama->nama
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if ($request->input('komponen') == 'analis'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'analis' => 0,
|
||||
'nmanalis' => '',
|
||||
'nmdrafter' => Session('nama'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'ppds3'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'ppds3' => 0,
|
||||
'nmppdssenior' => '',
|
||||
'nmdrafter' => Session('nama'),
|
||||
]);
|
||||
} else {
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'dokter_id' => 0,
|
||||
'nmdokter' => '',
|
||||
'nmdrafter' => Session('nama'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else if ($request->input('komponen') == 'klinis'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'klinis' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_media'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_media' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_potsputum'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_potsputum' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_poturine'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_poturine' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_oshe'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_oshe' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_obyekglass'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_obyekglass' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_botolbd'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_botolbd' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_parafilm'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_parafilm' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_tips'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_tips' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'bhp_cottonswab'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_cottonswab' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'id_esbl'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'id_esbl' => $request->input('isi'),
|
||||
]);
|
||||
} else if ($request->input('komponen') == 'id_mrsa'){
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'id_mrsa' => $request->input('isi'),
|
||||
]);
|
||||
} else {
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
'bhp_antibiotiktambahan' => $request->input('isi'),
|
||||
]);
|
||||
}
|
||||
KomponenJawaban::updateOrCreate(
|
||||
[
|
||||
'accnumber' => $nofoto,
|
||||
'template' => $request->input('jenis'),
|
||||
'komponen' => $request->input('komponen'),
|
||||
],
|
||||
[
|
||||
'isidata' => $request->input('isi'),
|
||||
'created_by' => Session('nama')
|
||||
]
|
||||
);
|
||||
$pesan = $nofoto.' Saved '.$request->input('jenis');
|
||||
} catch (Exception $e) {
|
||||
$pesan = $e->getMessage();
|
||||
}
|
||||
return $pesan;
|
||||
} else if ($worklist == 'mappingalat'){
|
||||
try {
|
||||
Periksa::where('nofoto', $nofoto)->update([
|
||||
@@ -941,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(
|
||||
@@ -952,6 +1092,8 @@ class DokterController extends Controller
|
||||
'resistance' => $item['resistance'],
|
||||
'value' => $item['value'],
|
||||
'interpretation' => $item['interpretation'],
|
||||
'created_at' => $getdataawal->daftar ?? date('Y-m-d H:i:s'),
|
||||
'updated_at' => $getdataawal->akhir ?? date('Y-m-d H:i:s'),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -961,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>';
|
||||
@@ -991,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 = '';
|
||||
@@ -1030,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');
|
||||
@@ -1066,15 +1269,22 @@ class DokterController extends Controller
|
||||
$tabel = $tabel.'</table>';
|
||||
}
|
||||
if ($orderid != 0){
|
||||
if ($getdata->subantibiotik !== null && $getdata->subantibiotik != ''){
|
||||
$antibiotik = $getdata->subantibiotik;
|
||||
} else {
|
||||
$antibiotik = $getdata->antibiotik;
|
||||
}
|
||||
RekapAntibiotik::updateOrCreate(
|
||||
[
|
||||
'orderid' => $orderid,
|
||||
'antibiotic' => $getdata->antibiotik.' '.$getdata->subantibiotik,
|
||||
'antibiotic' => $antibiotik,
|
||||
],
|
||||
[
|
||||
'resistance' => $getdata->diskcontent,
|
||||
'value' => $setval,
|
||||
'interpretation' => $setnilai,
|
||||
'created_at' => $getdataawal->daftar ?? date('Y-m-d H:i:s'),
|
||||
'updated_at' => $getdataawal->akhir ?? date('Y-m-d H:i:s'),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -1119,23 +1329,30 @@ 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>';
|
||||
}
|
||||
if ($orderid != 0){
|
||||
if ($getdata->subantibiotik !== null && $getdata->subantibiotik != ''){
|
||||
$antibiotik = $getdata->subantibiotik;
|
||||
} else {
|
||||
$antibiotik = $getdata->antibiotik;
|
||||
}
|
||||
RekapAntibiotik::updateOrCreate(
|
||||
[
|
||||
'orderid' => $orderid,
|
||||
'antibiotic' => $getdata->antibiotik.' '.$getdata->subantibiotik,
|
||||
'antibiotic' => $antibiotik,
|
||||
],
|
||||
[
|
||||
'resistance' => $getdata->diskcontent,
|
||||
'value' => $setval,
|
||||
'interpretation' => $setnilai,
|
||||
'created_at' => $getdataawal->daftar ?? date('Y-m-d H:i:s'),
|
||||
'updated_at' => $getdataawal->akhir ?? date('Y-m-d H:i:s'),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -1178,8 +1395,8 @@ class DokterController extends Controller
|
||||
'modality' => $modality,
|
||||
'jumlah' => $jumlah,
|
||||
'foto' => $tanggal,
|
||||
'nmradiografer' => Session('nama'),
|
||||
'radiografer' => Session('id'),
|
||||
'excutor' => Session('id'),
|
||||
'nmexcutor' => Session('nama'),
|
||||
]);
|
||||
} else {
|
||||
Periksa::where('id', $idperiksa)->update([
|
||||
@@ -1192,8 +1409,8 @@ class DokterController extends Controller
|
||||
'dlp' => $dlp,
|
||||
'modality' => $modality,
|
||||
'jumlah' => $jumlah,
|
||||
'radiografer' => Session('id'),
|
||||
'nmradiografer' => Session('nama'),
|
||||
'excutor' => Session('id'),
|
||||
'nmexcutor' => Session('nama'),
|
||||
'foto' => $tanggal,
|
||||
'status' => 'Telah di kirim ke worklist/modalitas',
|
||||
'excutor' => null,
|
||||
@@ -1308,7 +1525,7 @@ class DokterController extends Controller
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$tlsstatus = 'Draft Saved';
|
||||
$tlsstatus = 'Proses Analisis Sampel';
|
||||
Riwayat::create([
|
||||
'nofoto' => $nofoto,
|
||||
'jawaban' => $surat,
|
||||
@@ -1514,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();
|
||||
@@ -1524,6 +1770,9 @@ class DokterController extends Controller
|
||||
} else if ($idpasien == 'listkodespesimen'){
|
||||
$getsirab = Organisms::where('kelompok', 'listkodespesimen')->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
|
||||
echo json_encode($getsirab);
|
||||
} else if ($idpasien == 'allany'){
|
||||
$getsirab = Organisms::whereNotIn('kelompok', ['biakankultur', 'mikroorganisme', 'listkodespesimen'])->orderBy('category', 'ASC')->orderBy('name', 'ASC')->get();
|
||||
echo json_encode($getsirab);
|
||||
} else {
|
||||
$files = Periksa::where('pasien_id', $idpasien)->orderBy('created_at', 'DESC')->get();
|
||||
foreach ($files as $file) {
|
||||
@@ -1612,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) {
|
||||
@@ -2056,14 +2295,14 @@ class DokterController extends Controller
|
||||
$reques = $periksa->reques;
|
||||
$asuransi = $periksa->asuransi;
|
||||
$foto = $periksa->foto;
|
||||
$radiografer= $periksa->radiografer;
|
||||
$analis= $periksa->analis;
|
||||
$nofoto = $periksa->nofoto;
|
||||
$namapoli = $periksa->getRuangan->poli ?? 'Deleted Data Ruang';
|
||||
|
||||
if (is_null($radiografer)){
|
||||
if (is_null($analis)){
|
||||
Periksa::where('id', $idperiksa)->update([
|
||||
'radiografer' => Session('id'),
|
||||
'nmradiografer' => Session('nama'),
|
||||
'analis' => Session('id'),
|
||||
'nmanalis' => Session('nama'),
|
||||
'foto' => date("Y-m-d H:i:s")
|
||||
]);
|
||||
}
|
||||
@@ -2285,7 +2524,7 @@ class DokterController extends Controller
|
||||
'nmppdsjunior' => $periksa->nmppdsjunior,
|
||||
'nmppdsmiddle2' => $periksa->nmppdsmiddle2,
|
||||
'nmppdsjunior2' => $periksa->nmppdsjunior2,
|
||||
'nmradiografer' => $periksa->nmradiografer,
|
||||
'nmanalis' => $periksa->nmanalis,
|
||||
'nmexcutor' => $periksa->nmexcutor,
|
||||
'klinisi' => $periksa->klinisi,
|
||||
'klinis' => $periksa->klinis,
|
||||
@@ -2335,7 +2574,7 @@ class DokterController extends Controller
|
||||
'nmppdsjunior' => $periksa->nmppdsjunior,
|
||||
'nmppdsmiddle2' => $periksa->nmppdsmiddle2,
|
||||
'nmppdsjunior2' => $periksa->nmppdsjunior2,
|
||||
'nmradiografer' => $periksa->nmradiografer,
|
||||
'nmanalis' => $periksa->nmanalis,
|
||||
'nmexcutor' => $periksa->nmexcutor,
|
||||
'klinisi' => $periksa->klinisi,
|
||||
'klinis' => $periksa->klinis,
|
||||
@@ -2565,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';
|
||||
@@ -2572,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++;
|
||||
}
|
||||
}
|
||||
+439
-227
File diff suppressed because one or more lines are too long
@@ -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' => '',
|
||||
@@ -0,0 +1,576 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Poli;
|
||||
use App\Ruangan;
|
||||
use App\Organisms;
|
||||
use App\XFiles;
|
||||
use App\SIMBHPJenis;
|
||||
use App\SIMBHPReport;
|
||||
use App\User;
|
||||
|
||||
use Validator;
|
||||
use Session;
|
||||
|
||||
class PoliController extends Controller
|
||||
{
|
||||
public function index() {
|
||||
if (Session::get('previlage') == ''){
|
||||
return redirect('/login');
|
||||
} else {
|
||||
$data = [];
|
||||
$data['polis'] = Poli::all();
|
||||
$data['ruangans'] = Ruangan::all();
|
||||
return view('admin.poli', $data);
|
||||
}
|
||||
}
|
||||
public function viewGudangIndex() {
|
||||
if (Session::get('previlage') == ''){
|
||||
return redirect('/login');
|
||||
} else {
|
||||
$tasks = [];
|
||||
$homebase = url("/");
|
||||
$sekarang = date("Y-m-d");
|
||||
$pegawais = User::select('id', 'nama', 'previlage')->orderBy('nama', 'ASC')->get();
|
||||
$cdatane = SIMBHPJenis::all();
|
||||
$cjenis = count($cdatane);
|
||||
if ($cjenis == 0){
|
||||
$tasks['jjenis'][0]['jenis'] = 'Belum Ada Jenis Barang';
|
||||
$tasks['jjenis'][0]['satuan'] = '';
|
||||
} else {
|
||||
$i = 0;
|
||||
foreach($cdatane as $rdata){
|
||||
$tasks['jjenis'][$i]['jenis'] = $rdata->jenis;
|
||||
$tasks['jjenis'][$i]['satuan'] = $rdata->satuan;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$getdebet = SIMBHPReport::select(DB::raw('SUM(pemasukan) as pemasukan'))->groupBy('marking')->first();
|
||||
if (isset($getdebet->pemasukan)){
|
||||
$totpemasukan = $getdebet->pemasukan;
|
||||
} else { $totpemasukan = 0 ;}
|
||||
$getkredit = SIMBHPReport::select(DB::raw('SUM(pengeluaran) as pengeluaran'))->groupBy('marking')->first();
|
||||
if (isset($getkredit->pengeluaran)){
|
||||
$totpepengeluaran = $getkredit->pengeluaran;
|
||||
} else { $totpepengeluaran = 0 ;}
|
||||
|
||||
$tasks['masuk'] = $totpemasukan;
|
||||
$tasks['keluar'] = $totpepengeluaran;
|
||||
$tasks['pegawai'] = $pegawais;
|
||||
$tasks['tahunne'] = date("Y");
|
||||
$tasks['tanggal'] = $sekarang;
|
||||
$tasks['sidebar'] = 'simbhp';
|
||||
$previlage = Session('previlage');
|
||||
return view('admin.gudang', $tasks);
|
||||
}
|
||||
}
|
||||
public function storePoli(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'poli' => 'required',
|
||||
'poli' => 'required',
|
||||
'modaliti' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$poli = $request->input('poli');
|
||||
$subpoli = $request->input('subpoli');
|
||||
$subsubpoli = $request->input('subsubpoli');
|
||||
$modaliti = $request->input('modaliti');
|
||||
Poli::create([
|
||||
'poli' => $request->input('poli'),
|
||||
'subpoli' => $request->input('subpoli'),
|
||||
'subsubpoli'=> $request->input('subsubpoli'),
|
||||
'modaliti' => $request->input('modaliti'),
|
||||
'modaliti2' => $request->input('modaliti2')
|
||||
]);
|
||||
$tulis = 'Data '.$poli.' '.$subpoli.' '.$subsubpoli.' Saved..!!';
|
||||
return response()->json(['status' => 'success', 'message' => $tulis]);
|
||||
}
|
||||
}
|
||||
public function getListPoli() {
|
||||
$results = Poli::orderBy('subpoli', 'ASC')->get();
|
||||
echo json_encode($results);
|
||||
}
|
||||
public function updatePoli(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'poli' => 'required',
|
||||
'subpoli' => 'required',
|
||||
'modaliti' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$id = $request->input('id');
|
||||
$poli = $request->input('poli');
|
||||
$subpoli = $request->input('subpoli');
|
||||
$subsubpoli = $request->input('subsubpoli');
|
||||
Poli::where('id', $id)->update([
|
||||
'poli' => $poli,
|
||||
'subpoli' => $subpoli,
|
||||
'subsubpoli'=> $subsubpoli,
|
||||
'modaliti' => $request->input('modaliti'),
|
||||
'modaliti2' => $request->input('modaliti2')
|
||||
]);
|
||||
$tulis = 'Data '.$poli.' '.$subpoli.' '.$subsubpoli.' Updated..!!';
|
||||
return response()->json(['status' => 'success', 'message' => $tulis]);
|
||||
}
|
||||
}
|
||||
public function deletePoli(Request $request) {
|
||||
$id = $request->id;
|
||||
$poli = Poli::find($id);
|
||||
$poli->delete();
|
||||
return back();
|
||||
}
|
||||
public function storeRuangan(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'poli' => 'required',
|
||||
'ruangan' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
Ruangan::create([
|
||||
'poli' => $request->input('poli'),
|
||||
'ruangan' => $request->input('ruangan')
|
||||
]);
|
||||
Session::flash('message', 'Data berhasil disimpan');
|
||||
Session::flash('alert-class', 'alert-success');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
public function getListRuangan(Request $request) {
|
||||
$results = Ruangan::all();
|
||||
echo json_encode($results);
|
||||
}
|
||||
public function updateRuangan(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'id' => 'required',
|
||||
'poli' => 'required',
|
||||
'ruangan' => 'required'
|
||||
]);
|
||||
if($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Please fill input field or fill with right input']);
|
||||
} else {
|
||||
$id = $request->input('id');
|
||||
Ruangan::where('id', $id)->update([
|
||||
'poli' => $request->input('poli'),
|
||||
'ruangan' => $request->input('ruangan')
|
||||
]);
|
||||
}
|
||||
}
|
||||
public function deleteRuangan(Request $request) {
|
||||
$id = $request->id;
|
||||
$ruangan = Ruangan::find($id);
|
||||
$ruangan->delete();
|
||||
return back();
|
||||
}
|
||||
public function jsonRekapbhp() {
|
||||
$tahun = date("Y");
|
||||
$thnlalu = $tahun - 1;
|
||||
$totale = 0;
|
||||
$arraysurat = [];
|
||||
$getdata = SIMBHPJenis::all();
|
||||
if (!empty($getdata)){
|
||||
foreach($getdata as $hasil){
|
||||
$jenis = $hasil->kodejenis;
|
||||
$satuan = $hasil->satuan;
|
||||
$tlsjenis = $hasil->jenis;;
|
||||
$getdebet = SIMBHPReport::select(DB::raw('SUM(pemasukan) as pemasukan'))->where('jenis', $tlsjenis)->groupBy('jenis')->first();
|
||||
if (isset($getdebet->pemasukan)){
|
||||
$totpemasukan = $getdebet->pemasukan;
|
||||
} else { $totpemasukan = 0 ;}
|
||||
$getkredit = SIMBHPReport::select(DB::raw('SUM(pengeluaran) as pengeluaran'))->where('jenis', $tlsjenis)->groupBy('jenis')->first();
|
||||
if (isset($getkredit->pengeluaran)){
|
||||
$totpepengeluaran = $getkredit->pengeluaran;
|
||||
} else { $totpepengeluaran = 0 ;}
|
||||
|
||||
$saldoakhir = $totpemasukan - $totpepengeluaran;
|
||||
$arraysurat[] = array(
|
||||
'id' => $hasil->id,
|
||||
'satuan' => $satuan,
|
||||
'jenis' => $jenis,
|
||||
'tlsjenis' => $tlsjenis,
|
||||
'saldo' => number_format( $saldoakhir , 0 , '.' , ',' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($arraysurat);
|
||||
}
|
||||
public function jsonReportbhp(Request $request) {
|
||||
$bulan = $request->input('val01');
|
||||
$tahun = $request->input('val02');
|
||||
$hasil = [];
|
||||
if ($tahun == 'ALL'){
|
||||
$bulan = date("m");
|
||||
$tahun = date("Y");
|
||||
$getdata = SIMBHPReport::where('bulan', $bulan)->where('tahun', $tahun)->orderBy('id', 'DESC')->get();
|
||||
} else {
|
||||
if ($bulan == 'ALL'){
|
||||
$getdata = SIMBHPReport::where('tahun', $tahun)->orderBy('id', 'DESC')->get();
|
||||
} else {
|
||||
$getdata = SIMBHPReport::where('bulan', $bulan)->where('tahun', $tahun)->orderBy('id', 'DESC')->get();
|
||||
}
|
||||
|
||||
}
|
||||
foreach($getdata as $rdata){
|
||||
$dd = $rdata->tanggal;
|
||||
$mm = $rdata->bulan;
|
||||
$yy = $rdata->tahun;
|
||||
$pengeluaran= $rdata->pengeluaran;
|
||||
$pemasukan = $rdata->pemasukan;
|
||||
if ($mm < 10){
|
||||
$tgllengkap = $dd.'-0'.$mm.'-'.$yy;
|
||||
} else {
|
||||
$tgllengkap = $dd.'-'.$mm.'-'.$yy;
|
||||
}
|
||||
if ($pengeluaran == '' OR $pengeluaran == 0) {$total = $pemasukan;}
|
||||
else { $total = $pengeluaran; }
|
||||
|
||||
$hasil[] = array(
|
||||
'id' => $rdata->id,
|
||||
'tanggal' => $rdata->tanggal,
|
||||
'bulan' => $rdata->bulan,
|
||||
'tahun' => $rdata->tahun,
|
||||
'deskripsi' => $rdata->deskripsi,
|
||||
'pemasukan' => number_format( $pemasukan , 0 , '.' , ',' ),
|
||||
'pengeluaran' => number_format( $pengeluaran , 0 , '.' , ',' ),
|
||||
'jenis' => $rdata->jenis,
|
||||
'keterangan' => $rdata->keterangan,
|
||||
'tgllengkap' => $tgllengkap,
|
||||
'total' => $total,
|
||||
);
|
||||
}
|
||||
echo json_encode($hasil);
|
||||
}
|
||||
public function jsonReportbhpPaginated(Request $request) {
|
||||
$tanggal = $request->input('tanggal');
|
||||
$deskripsi = $request->input('deskripsi');
|
||||
$kategori = $request->input('kategori');
|
||||
$lm = 10;
|
||||
$limit = ($request->input('limit') == null ? $lm : $request->input('limit'));
|
||||
$order = ($request->input('order') == null ? 'id desc' : $request->input('order'));
|
||||
$data = new SIMBHPReport;
|
||||
if ($kategori != null AND $kategori != '') $data = $data->where('jenis', $kategori);
|
||||
if ($tanggal != null AND $tanggal != '') $data = $data->where('created_at', 'LIKE', '%'.$tanggal.'%');
|
||||
if ($deskripsi != null AND $deskripsi != '') $data = $data->where('deskripsi', 'LIKE', '%'.$deskripsi.'%');
|
||||
$data = $data->orderByRaw($order)->paginate($limit);
|
||||
$hasil = [];
|
||||
$totaldata = $data->total();
|
||||
$debet = 0;
|
||||
$kredit = 0;
|
||||
if (!empty($data)){
|
||||
foreach($data as $rdata){
|
||||
$dd = $rdata->tanggal;
|
||||
$mm = $rdata->bulan;
|
||||
$yy = $rdata->tahun;
|
||||
$pengeluaran = $rdata->pengeluaran;
|
||||
$pemasukan = $rdata->pemasukan;
|
||||
$deskripsi = $rdata->deskripsi;
|
||||
$jenis = $rdata->jenis;
|
||||
$debet = $debet + $pemasukan;
|
||||
$kredit = $kredit + $pengeluaran;
|
||||
$cekjenis = SIMBHPJenis::where('kodejenis', $jenis)->first();
|
||||
if (isset($cekjenis->id)){
|
||||
$kodejenis = $cekjenis->kodejenis;
|
||||
$jenis = $cekjenis->jenis;
|
||||
$satuan = $cekjenis->satuan;
|
||||
} else {
|
||||
$kodejenis = $jenis;
|
||||
$jenis = '';
|
||||
$satuan = '';
|
||||
}
|
||||
|
||||
if ($jenis != ''){
|
||||
$deskripsi = '<strong>'.$jenis.'</strong><br />'.$deskripsi;
|
||||
}
|
||||
|
||||
if ($mm < 10){
|
||||
$tgllengkap = $yy.'-0'.$mm.'-'.$dd;
|
||||
} else {
|
||||
$tgllengkap = $yy.'-'.$mm.'-'.$dd;
|
||||
}
|
||||
if ($pengeluaran == '' OR $pengeluaran == 0) {
|
||||
$total = $pemasukan;
|
||||
$jentrans = 'PEMASUKAN';
|
||||
}
|
||||
else {
|
||||
$total = $pengeluaran;
|
||||
$jentrans = 'PENGELUARAN';
|
||||
}
|
||||
|
||||
$hasil[] = array(
|
||||
'id' => $rdata->id,
|
||||
'tanggal' => $rdata->tanggal,
|
||||
'bulan' => $rdata->bulan,
|
||||
'tahun' => $rdata->tahun,
|
||||
'tlsdeskripsi' => $deskripsi,
|
||||
'deskripsi' => $rdata->deskripsi,
|
||||
'pemasukan' => number_format( $pemasukan , 0 , '.' , ',' ),
|
||||
'pengeluaran' => number_format( $pengeluaran , 0 , '.' , ',' ),
|
||||
'jenis' => $kodejenis,
|
||||
'keterangan' => $rdata->keterangan,
|
||||
'tgllengkap' => $tgllengkap,
|
||||
'created_at' => $rdata->created_at,
|
||||
'nominal' => $total.' '.$satuan,
|
||||
'jentrans' => $jentrans,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$response = [
|
||||
'message' => 'List Data',
|
||||
'data' => $hasil,
|
||||
'totaldata' => $totaldata
|
||||
];
|
||||
return response()->json($response, 200);
|
||||
}
|
||||
public function exAddbarang(Request $request) {
|
||||
$deskripsi = $request->input('set01');
|
||||
$pos = $request->input('set02');
|
||||
$tanggal = $request->input('set03');
|
||||
$jumlah = $request->input('set04');
|
||||
$jenis = $request->input('set05');
|
||||
$postujuan = $request->input('set06');
|
||||
$alasan = $request->input('set07');
|
||||
$nama = Session('nama');
|
||||
if ($tanggal == '' OR is_null($tanggal)){
|
||||
$tanggal = date("d-m-Y");
|
||||
}
|
||||
$total = (int)str_replace(',','',$jumlah);
|
||||
if ($jenis == 'jenis'){ $jumlah = '-';}
|
||||
if ($deskripsi != '' and $pos != '' and $tanggal != '' and $jumlah != '' and $jenis != ''){
|
||||
if ($jenis == 'jenis'){
|
||||
$jenis = $request->input('set02');
|
||||
$satuan = $request->input('set03');
|
||||
$idne = $request->input('set04');
|
||||
$kodejenis = preg_replace('/\s+/', '', $jenis);
|
||||
if ($idne == 'new' OR $idne == ''){
|
||||
$ceksudah = SIMBHPJenis::where('kodejenis', $kodejenis)->where('satuan', $satuan)->count();
|
||||
if ($ceksudah != 0){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => $jenis.' Sudah Ada, Silahkan Masukkan Jenis Barang Lain']);
|
||||
return back();
|
||||
} else {
|
||||
$input = SIMBHPJenis::create([
|
||||
'kodejenis' => $kodejenis,
|
||||
'jenis' => $jenis,
|
||||
'satuan' => $satuan,
|
||||
]);
|
||||
if ($input){
|
||||
return response()->json(['status' => 'Success', 'message' => 'Data '.$jenis.' Sukses Ditambahkan']);
|
||||
return back();
|
||||
} else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => $jenis.' Gagal di masukkan, silahkan ulangi beberapa saat lagi']);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ceksudah = SIMBHPJenis::where('id', '!=', $idne)->where('kodejenis', $kodejenis)->where('satuan', $satuan)->count();
|
||||
if ($ceksudah != 0){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => $jenis.' Sudah Ada, Silahkan Masukkan Jenis Barang Lain']);
|
||||
return back();
|
||||
} else {
|
||||
$input = SIMBHPJenis::where('id', $idne)->update([
|
||||
'kodejenis' => $kodejenis,
|
||||
'jenis' => $jenis,
|
||||
'satuan' => $satuan,
|
||||
]);
|
||||
if ($input){
|
||||
return response()->json(['status' => 'Success', 'message' => 'Data '.$jenis.' Sukses Diupdate']);
|
||||
return back();
|
||||
} else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => $jenis.' Gagal di masukkan, silahkan ulangi beberapa saat lagi']);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$ahrf = explode("-", $tanggal);
|
||||
$tahun = $ahrf[0];
|
||||
if(isset($ahrf[1])){
|
||||
$wulan = (int)$ahrf[1];
|
||||
} else { $wulan = date("m"); $wulan = (int)$wulan; }
|
||||
if(isset($ahrf[2])){
|
||||
$dino = (int)$ahrf[2];
|
||||
} else { $dino = date("d"); }
|
||||
if ($jenis == 'pemasukan'){
|
||||
$bayar = SIMBHPReport::create([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'deskripsi' => $deskripsi,
|
||||
'pemasukan' => $total,
|
||||
'pengeluaran' => null,
|
||||
'jenis' => $pos,
|
||||
'keterangan' => '',
|
||||
'marking' => '',
|
||||
]);
|
||||
} else if ($jenis == 'pengeluaran'){
|
||||
$getnama = User::where('id', $deskripsi)->first();
|
||||
$nama = $getnama->nama ?? 'Unkown';
|
||||
$deskripsi = 'Diterima oleh '.$nama;
|
||||
$getdebet = SIMBHPReport::select(DB::raw('SUM(pemasukan) as pemasukan'))->where('jenis', $pos)->groupBy('jenis')->first();
|
||||
if (isset($getdebet->pemasukan)){
|
||||
$totpemasukan = $getdebet->pemasukan;
|
||||
} else { $totpemasukan = 0 ;}
|
||||
$getkredit = SIMBHPReport::select(DB::raw('SUM(pengeluaran) as pengeluaran'))->where('jenis', $pos)->groupBy('jenis')->first();
|
||||
if (isset($getkredit->pengeluaran)){
|
||||
$totpepengeluaran = $getkredit->pengeluaran;
|
||||
} else { $totpepengeluaran = 0 ;}
|
||||
$totpepengeluaran = $totpepengeluaran + $total;
|
||||
if ($totpepengeluaran > $totpemasukan){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Nominal Melebihi Stok']);
|
||||
return back();
|
||||
} else {
|
||||
$bayar = SIMBHPReport::create([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'deskripsi' => $deskripsi,
|
||||
'pemasukan' => null,
|
||||
'pengeluaran' => $total,
|
||||
'jenis' => $pos,
|
||||
'keterangan' => '',
|
||||
'marking' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
} else if ($jenis == 'editor'){
|
||||
if ($alasan == ''){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Alasan Perubahan Data Wajib Di Isi!!!']);
|
||||
return back();
|
||||
} else {
|
||||
$getdebet = SIMBHPReport::select(DB::raw('SUM(pemasukan) as pemasukan'))->where('jenis', $pos)->groupBy('jenis')->first();
|
||||
if (isset($getdebet->pemasukan)){
|
||||
$totpemasukan = $getdebet->pemasukan;
|
||||
} else { $totpemasukan = 0 ;}
|
||||
$getkredit = SIMBHPReport::select(DB::raw('SUM(pengeluaran) as pengeluaran'))->where('jenis', $pos)->groupBy('jenis')->first();
|
||||
if (isset($getkredit->pengeluaran)){
|
||||
$totpepengeluaran = $getkredit->pengeluaran;
|
||||
} else { $totpepengeluaran = 0 ;}
|
||||
$totpepengeluaran = $totpepengeluaran + $total;
|
||||
|
||||
$rdatalama = SIMBHPReport::where('id', $postujuan)->first();
|
||||
$ldeskripsi = $rdatalama->deskripsi;
|
||||
$lpemasukan = $rdatalama->pemasukan;
|
||||
$lpengeluaran = $rdatalama->pengeluaran;
|
||||
$ljenis = $rdatalama->jenis;
|
||||
$marking = $rdatalama->marking;
|
||||
if ($lpengeluaran == '' OR $lpengeluaran == 0) {
|
||||
$ltotal = number_format( $lpemasukan , 0 , '.' , ',' );
|
||||
if ($marking != ''){
|
||||
SIMBHPReport::where('marking', $marking)->whereNotIn('id', [$postujuan])->update([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'pengeluaran' => $total
|
||||
]);
|
||||
}
|
||||
$bayar = SIMBHPReport::where('id', $postujuan)->update([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'deskripsi' => $deskripsi,
|
||||
'jenis' => $pos,
|
||||
'pemasukan' => $total,
|
||||
'keterangan' => $alasan,
|
||||
'updated_at' => date("Y-m-d H:i:s")
|
||||
]);
|
||||
} else {
|
||||
$totpepengeluaran = $totpepengeluaran + $total;
|
||||
if ($totpepengeluaran > $totpemasukan){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Nominal Melebihi Stok']);
|
||||
return back();
|
||||
} else {
|
||||
$ltotal = number_format( $lpengeluaran , 0 , '.' , ',' );
|
||||
if ($marking != ''){
|
||||
SIMBHPReport::where('marking', $marking)->whereNotIn('id', [$postujuan])->update([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'pemasukan' => $total
|
||||
]);
|
||||
}
|
||||
$bayar = SIMBHPReport::where('id', $postujuan)->update([
|
||||
'tanggal' => $dino,
|
||||
'bulan' => $wulan,
|
||||
'tahun' => $tahun,
|
||||
'deskripsi' => $deskripsi,
|
||||
'jenis' => $pos,
|
||||
'pengeluaran' => $total,
|
||||
'keterangan' => $alasan,
|
||||
'updated_at' => date("Y-m-d H:i:s")
|
||||
]);
|
||||
}
|
||||
}
|
||||
$baris1 = '<table class="table table-bordered table-striped"><tr><td colspan=2><p align=center><b>Data Lama</b></p></td><td colspan=2><p align=center><b>Data Perubahan</b></p></td></tr>';
|
||||
$baris2 = '<tr><td>Deskripsi</td><td>'.$ldeskripsi.'</td><td><font color=red>Diubah Menjadi</font></td><td>'.$deskripsi.'</td></tr>';
|
||||
$baris3 = '<tr><td>Jenis</td><td>'.$ljenis.'</td><td><font color=red>Diubah Menjadi</font></td><td>'.$pos.'</td></tr>';
|
||||
$baris4 = '<tr><td>Total</td><td>'.$ltotal.'</td><td><font color=red>Diubah Menjadi</font></td><td>'.$jumlah.'</td></tr>';
|
||||
$baris5 = '<tr><td><b>Dengan Alasan</b></td><td colspan=3>'.$alasan.'</td</tr>';
|
||||
$baris6 = '<tr><td><b>Eksekutor</b></td><td colspan=3>'.Session('nama').'</td</tr></table>';
|
||||
$perubahan = $baris1.$baris2.$baris3.$baris4.$baris5.$baris6;
|
||||
Xfiles::create([
|
||||
'xmarking' => 'SIMBHP-'.$postujuan.'-'.time(),
|
||||
'xtabel' => 'History SIMBHP',
|
||||
'xjenis' => '',
|
||||
'xfile' => $perubahan
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if ($alasan == ''){
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Alasan Perubahan Data Wajib Di Isi!!!']);
|
||||
return back();
|
||||
}
|
||||
else {
|
||||
$rdatalama = SIMBHPReport::where('id', $postujuan)->first();
|
||||
$ldeskripsi = $rdatalama->deskripsi;
|
||||
$lpemasukan = $rdatalama->pemasukan;
|
||||
$lpengeluaran = $rdatalama->pengeluaran;
|
||||
$ljenis = $rdatalama->jenis;
|
||||
$marking = $rdatalama->marking;
|
||||
if ($lpengeluaran == '' or $lpengeluaran == 0) {
|
||||
$ltotal = number_format( $lpemasukan , 0 , '.' , ',' );
|
||||
} else {
|
||||
$ltotal = number_format( $lpengeluaran , 0 , '.' , ',' );
|
||||
}
|
||||
$baris1 = '<table class="table table-bordered table-striped"><tr><td colspan=2><p align=center><b>Data Lama</b></p></td><td colspan=2><p align=center><b>Data Perubahan</b></p></td></tr>';
|
||||
$baris2 = '<tr><td>Deskripsi</td><td>'.$ldeskripsi.'</td><td colspan=2><font color=red>DIHAPUS</font></td></tr>';
|
||||
$baris3 = '<tr><td>Jenis</td><td>'.$ljenis.'</td><td colspan=2><font color=red>DIHAPUS</font></td></tr>';
|
||||
$baris4 = '<tr><td>Total</td><td>'.$ltotal.'</td><td colspan=2><font color=red>DIHAPUS</font></td></tr>';
|
||||
$baris5 = '<tr><td><b>Dengan Alasan</b></td><td colspan=3>'.$alasan.'</td</tr>';
|
||||
$baris6 = '<tr><td><b>Eksekutor</b></td><td colspan=3>'.Session('nama').'</td</tr></table>';
|
||||
$perubahan = $baris1.$baris2.$baris3.$baris4.$baris5.$baris6;
|
||||
|
||||
Xfiles::create([
|
||||
'xmarking' => 'SIMBHP-'.$postujuan.'-'.time(),
|
||||
'xtabel' => 'History SIMBHP',
|
||||
'xjenis' => '',
|
||||
'xfile' => $perubahan
|
||||
]);
|
||||
if ($marking != ''){
|
||||
$bayar = SIMBHPReport::where('marking', $marking)->delete();
|
||||
} else {
|
||||
$bayar = SIMBHPReport::where('id', $postujuan)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($bayar){
|
||||
return response()->json(['status' => 'Success', 'message' => 'Transaksi '.$jenis.' Sukses Dilaksanakan']);
|
||||
return back();
|
||||
} else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Update Gagal, Pastikan Data Yang anda Isi Sudah Sesuai']);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return response()->json(['icon' => 'error', 'warna' => '#bf441d', 'status' => 'Gagal', 'message' => 'Pastikan Formnya Anda Isi dengan Lengkap']);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
+147
-1
@@ -12,6 +12,7 @@ use App\Dokter;
|
||||
use App\Pasien;
|
||||
use App\Jadwalperiksa;
|
||||
use App\Riwayat;
|
||||
use App\RekapAntibiotik;
|
||||
use DateTime;
|
||||
use Carbon\Carbon;
|
||||
use Session;
|
||||
@@ -29,7 +30,7 @@ class ReportController extends Controller
|
||||
set_time_limit(0);
|
||||
$bulan = $request->input('bulan');
|
||||
$tahun = $request->input('tahun');
|
||||
if ($bulan == 'ALL' || $bulan == 'Pick Month') {
|
||||
if ($bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::selectRaw('SUM(id) as jumlah, DATE(daftar) as day')->whereYear('daftar', $tahun)->groupBy(DB::raw('daftar'))->orderBy('daftar', 'ASC')->get();
|
||||
$bulan = '';
|
||||
} else {
|
||||
@@ -306,4 +307,149 @@ class ReportController extends Controller
|
||||
echo json_encode($arraylist);
|
||||
}
|
||||
}
|
||||
public function genRekapAntibiotik(Request $request) {
|
||||
$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);
|
||||
}
|
||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||
} else {
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->orderBy('daftar', 'asc')->get();
|
||||
}
|
||||
|
||||
$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');
|
||||
$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);
|
||||
}
|
||||
if ($bulan == '' OR $bulan == 'ALL' OR $bulan == 'Pick Month') {
|
||||
$orderbydate = Periksa::whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = array(
|
||||
'Oxacillin-OX',
|
||||
'Cefoxitin-FOX',
|
||||
'Benzylpenicillin-P',
|
||||
'Ampicillin-AM',
|
||||
'Azithromycin-AZM',
|
||||
'Erythromycin-ERY',
|
||||
'Cefazolin-CZO',
|
||||
'Cefepime-FEP',
|
||||
'Cefixime-CFM',
|
||||
'Cefotaxime-CTX',
|
||||
'Cefuroxime-CXM',
|
||||
'Ceftazidime-CAZ',
|
||||
'Ceftriaxone-CRO',
|
||||
'Ceftazidime/Avibactam-CZA',
|
||||
'Piperacilin/Tazobactam-TZP',
|
||||
'Ampicillin/Sulbactam-SAM',
|
||||
'Amoxicillin/Clavulanate-AMC',
|
||||
'Cefoperazon/Sulbactam-SCF',
|
||||
'Aztreonam-ATM',
|
||||
'Ceftaroline-CPT',
|
||||
'Ciprofloxacin-CIP',
|
||||
'Levofloxacin-LEV',
|
||||
'Moxifloxacin-MFX',
|
||||
'Clindamycin-CLI',
|
||||
'Colistin-CS', //tidak ada
|
||||
'Tetracyclin-TCY',
|
||||
'Tigecycline-TGC', //double
|
||||
'Gentamicin-GM',
|
||||
'Amikacin-AN',
|
||||
'Meropenem-MEM',
|
||||
'Imipenem-IPM',
|
||||
'Doripenem-DOR',
|
||||
'Ertapenem-ETP',
|
||||
'Minocycline-MNO',
|
||||
'Doxycycline-DOX',
|
||||
'Spectinomycin-SPT',
|
||||
'Tigecycline-TGC', //sama-ini
|
||||
'Trimethoprim/Sulfamethoxazole-SXT',
|
||||
'Fosfomycin-FOS',
|
||||
'Vancomycin-VAN',
|
||||
'Linezolid-LNZ',
|
||||
'Fluconazole', //tidak ada
|
||||
'Voriconazole', //tidak ada
|
||||
'Caspofungin', //tidak ada
|
||||
'Micafungin', //tidak ada
|
||||
'Amphotericin B', //tidak ada
|
||||
'Flucytosine' //tidak ada
|
||||
);
|
||||
} else {
|
||||
$orderbydate = Periksa::whereMonth('daftar', $bulan)->whereYear('daftar', $tahun)->get();
|
||||
$jsonantibiotik = array(
|
||||
'Oxacillin-OX',
|
||||
'Cefoxitin-FOX',
|
||||
'Benzylpenicillin-P',
|
||||
'Ampicillin-AM',
|
||||
'Azithromycin-AZM',
|
||||
'Erythromycin-ERY',
|
||||
'Cefazolin-CZO',
|
||||
'Cefepime-FEP',
|
||||
'Cefixime-CFM',
|
||||
'Cefotaxime-CTX',
|
||||
'Cefuroxime-CXM',
|
||||
'Ceftazidime-CAZ',
|
||||
'Ceftriaxone-CRO',
|
||||
'Ceftazidime/Avibactam-CZA',
|
||||
'Piperacilin/Tazobactam-TZP',
|
||||
'Ampicillin/Sulbactam-SAM',
|
||||
'Amoxicillin/Clavulanate-AMC',
|
||||
'Cefoperazon/Sulbactam-SCF',
|
||||
'Aztreonam-ATM',
|
||||
'Ceftaroline-CPT',
|
||||
'Ciprofloxacin-CIP',
|
||||
'Levofloxacin-LEV',
|
||||
'Moxifloxacin-MFX',
|
||||
'Clindamycin-CLI',
|
||||
'Colistin-CS',
|
||||
'Tetracyclin-TCY',
|
||||
'Tigecycline-TGC',
|
||||
'Gentamicin-GM',
|
||||
'Amikacin-AN',
|
||||
'Meropenem-MEM',
|
||||
'Imipenem-IPM',
|
||||
'Doripenem-DOR',
|
||||
'Ertapenem-ETP',
|
||||
'Minocycline-MNO',
|
||||
'Doxycycline-DOX',
|
||||
'Spectinomycin-SPT',
|
||||
'Tigecycline-TGC',
|
||||
'Trimethoprim/Sulfamethoxazole-SXT',
|
||||
'Fosfomycin-FOS',
|
||||
'Vancomycin-VAN',
|
||||
'Linezolid-LNZ',
|
||||
'Fluconazole',
|
||||
'Voriconazole',
|
||||
'Caspofungin',
|
||||
'Micafungin',
|
||||
'Amphotericin B',
|
||||
'Flucytosine'
|
||||
);
|
||||
}
|
||||
return view('admin.glassreport', compact('orderbydate', 'jsonantibiotik', 'bulan', 'tahun'));
|
||||
}
|
||||
}
|
||||
+65
-1
@@ -20,7 +20,9 @@ class TemplateController extends Controller
|
||||
if (Session::get('previlage') == ''){
|
||||
return redirect('/login');
|
||||
} else {
|
||||
$data = [];
|
||||
$data = [];
|
||||
$getsirab = Organisms::whereNotIn('kelompok', ['biakankultur', 'mikroorganisme', 'listkodespesimen'])->select('kelompok')->groupBy('kelompok')->orderBy('kelompok', 'ASC')->get();
|
||||
$data['parameters'] = $getsirab;
|
||||
return view('admin.template', $data);
|
||||
}
|
||||
}
|
||||
@@ -273,6 +275,68 @@ 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;
|
||||
|
||||
if ($id == 'new'){
|
||||
$ceksudah = Organisms::where('name', $request->name)->where('category', $category)->where('kelompok', $request->kelompok)->count();
|
||||
if ($ceksudah == 0){
|
||||
$data = Organisms::create([
|
||||
'name' => $request->name,
|
||||
'category' => $category,
|
||||
'kelompok' => $request->kelompok
|
||||
]);
|
||||
} 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', $category)->where('kelompok', $request->kelompok)->count();
|
||||
if ($ceksudah == 0){
|
||||
$data = Organisms::where('id', $id)->update([
|
||||
'name' => $request->name,
|
||||
'category' => $category,
|
||||
'kelompok' => $request->kelompok
|
||||
]);
|
||||
} 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 ($id == 'new'){
|
||||
$data = new SiraB;
|
||||
+1
-1
@@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'registerpasien', 'registerjson', 'ekstrakhasil', 'prosesbatal'
|
||||
'registerpasien', 'registerjson', 'ekstrakhasil', 'prosesbatal', 'cekaksess'
|
||||
];
|
||||
}
|
||||
@@ -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 = [];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SIMBHPJenis extends Model
|
||||
{
|
||||
protected $table = "simbhpjenis";
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SIMBHPReport extends Model
|
||||
{
|
||||
protected $table = "simbhpreport";
|
||||
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 15173 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in New Issue
Block a user