Merge remote-tracking branch 'origin/feature/prices'

This commit is contained in:
R
2023-02-01 00:42:44 +07:00
7 changed files with 292 additions and 62 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Dokter extends Model
{
use HasFactory, SoftDeletes;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tm_dokter';
protected $primaryKey = 'nID';
public function jadwalDokter()
{
return $this->hasMany(JadwalDokter::class, 'nIDDokter', 'nID');
}
}

View File

@@ -17,4 +17,11 @@ class Healthcare extends Model
protected $connection = 'oldlms';
protected $table = 'tm_healthcare';
protected $primaryKey = 'nID';
public function jadwalDokter()
{
return $this->hasMany(JadwalDokter::class, 'nIDHealthCare', 'nID');
}
}

View File

@@ -19,4 +19,14 @@ class JadwalDokter extends Model
protected $table = 'tx_jadwal_dokter';
protected $primaryKey = 'nID';
public function jadwalDokterDay()
{
return $this->hasMany(JadwalDokterDay::class, 'nIDJadwalDokter', 'nID');
}
public function healthcare()
{
return $this->belongsTo(Healthcare::class, 'nIDHealthCare', 'nID');
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\OLDLMS;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class JadwalDokterDay extends Model
{
use HasFactory, SoftDeletes;
const CREATED_AT = 'dCreateOn';
const UPDATED_AT = 'dUpdateOn';
const DELETED_AT = 'dDeleteOn';
protected $connection = 'oldlms';
protected $table = 'tx_jadwal_dokter_detail';
protected $primaryKey = 'nID';
}

View File

@@ -39,19 +39,36 @@ class LmsApi
$data['channel'] = 'Website';
}
$res = self::http()->post( self::baseUrl() . '/jadwaldokter', $data)->json();
$res = self::http()->post(self::baseUrl() . '/jadwaldokter', $data)->json();
// Reformat Jam Data
$res['data'] = collect($res['data'])->map(function($day) {
$res['data'] = collect($res['data'])->map(function ($day) {
$day['Jam'] = !empty($day['Jam']) ? explode(', ', $day['Jam']) : null;
return $day;
})->toArray();
return $res;
}
/**
* dokter
*
*
*/
public static function dokter($kodeRs, $channel = 'hospitaloka', $timeout = 30)
{
$data = [
'rs' => $kodeRs,
'channel' => $channel,
];
$res = self::http()->timeout($timeout)->post('http://lmsapi.primaya.id/dokter', $data)->json();
return $res;
}
/**
* jadwalDokterTersedia
*
@@ -72,21 +89,20 @@ class LmsApi
$data['channel'] = 'Website';
}
$res = self::http()->post( self::baseUrl() . '/jadwaldoktertersedia', $data)->json();
$res = self::http()->post(self::baseUrl() . '/jadwaldoktertersedia', $data)->json();
// Reformat Jam Data
$res['data'] = collect($res['data'])->map(function($day) {
$res['data'] = collect($res['data'])->map(function ($day) {
// Change jam to Jam to Standarize
$day['Jam'] = !empty($day['jam']) ? explode(', ', $day['jam']) : null;
unset($day['jam']);
return $day;
})->toArray();
return $res;
}
/**
* checkMedrec
*
@@ -113,11 +129,11 @@ class LmsApi
throw new Exception('name, birth_date, nik, phone are required in $patientData');
}
$res = self::http()->post( self::baseUrl() . '/medrec_nama', $data)->json();
$res = self::http()->post(self::baseUrl() . '/medrec_nama', $data)->json();
return $res;
}
/**
* checkGantung
*
@@ -126,7 +142,7 @@ class LmsApi
* @return void
*/
public static function checkGantung($HISKodeRS, $HISMedrec, $patientData)
{
{
$data = [
'rs' => $HISKodeRS,
'rm' => $HISMedrec,
@@ -141,11 +157,11 @@ class LmsApi
throw new Exception('name, birth_date are required in $patientData');
}
$res = self::http()->post( self::baseUrl() . '/cek_gantung', $data)->json();
$res = self::http()->post(self::baseUrl() . '/cek_gantung', $data)->json();
return $res;
}
/**
* checkSlot
*
@@ -156,9 +172,9 @@ class LmsApi
* @param string $type HIS Slot Type walkin, teleconsultation
* @return void
*/
public static function checkSlot( $HISKodeRS, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $type )
public static function checkSlot($HISKodeRS, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $type)
{
$data = [
'rs' => $HISKodeRS,
'dr' => $HISKodeDokter,
@@ -169,11 +185,11 @@ class LmsApi
$data['channel'] = 'Website';
}
$res = self::http()->post( self::baseUrl() . '/cek_slot', $data)->json();
$res = self::http()->post(self::baseUrl() . '/cek_slot', $data)->json();
return $res;
}
/**
* appointmentBaru
*
@@ -189,7 +205,8 @@ class LmsApi
* @param mixed $userId
* @return void
*/
public static function appointmentBaru( $HISKodeRS, $HISKodeDep, $HISKodeDokter, $jenisTC, $tanggalAppointment, $jamAppointment, $jumlahBayar, $kodePembayaran, $patientData, $userId ) {
public static function appointmentBaru($HISKodeRS, $HISKodeDep, $HISKodeDokter, $jenisTC, $tanggalAppointment, $jamAppointment, $jumlahBayar, $kodePembayaran, $patientData, $userId)
{
$data = [
'rs' => $HISKodeRS,
'dep' => $HISKodeDep,
@@ -220,11 +237,11 @@ class LmsApi
'jam' => $jamAppointment,
];
$res = self::http()->post( self::baseUrl() . '/appointment_baru', $data)->json();
$res = self::http()->post(self::baseUrl() . '/appointment_baru', $data)->json();
return $res;
}
/**
* appointment
*
@@ -241,7 +258,8 @@ class LmsApi
* @param mixed $userId
* @return void
*/
public static function appointment( $HISKodeRS, $HISKodeDep, $HISKodeDokter, $jenisTC, $tanggalAppointment, $jamAppointment, $jumlahBayar, $kodePembayaran, $HISMedrec, $patientData, $userId ) {
public static function appointment($HISKodeRS, $HISKodeDep, $HISKodeDokter, $jenisTC, $tanggalAppointment, $jamAppointment, $jumlahBayar, $kodePembayaran, $HISMedrec, $patientData, $userId)
{
$data = [
'rs' => $HISKodeRS,
'dep' => $HISKodeDep,
@@ -259,11 +277,11 @@ class LmsApi
'jam' => $jamAppointment,
];
$res = self::http()->post( self::baseUrl() . '/appointment', $data)->json();
$res = self::http()->post(self::baseUrl() . '/appointment', $data)->json();
return $res;
}
/**
* appointmentEdit
*
@@ -277,7 +295,7 @@ class LmsApi
* @param mixed $patientData
* @return void
*/
public static function appointmentEdit( $HISRegid, $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $HISMedrec, $patientData )
public static function appointmentEdit($HISRegid, $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $HISMedrec, $patientData)
{
$data = [
'regid' => $HISRegid,
@@ -293,11 +311,11 @@ class LmsApi
'jam' => $jamAppointment,
];
$res = self::http()->post( self::baseUrl() . '/appointment_edit', $data)->json();
$res = self::http()->post(self::baseUrl() . '/appointment_edit', $data)->json();
return $res;
}
/**
* booking
*
@@ -314,7 +332,8 @@ class LmsApi
* @param mixed $nomorRujukanBPJS
* @return void
*/
public static function booking( $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $HISMedrec, $patientData, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null ) {
public static function booking($HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $HISMedrec, $patientData, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null)
{
$data = [
'rs' => $HISKodeRS,
'dep' => $HISKodeDep,
@@ -334,11 +353,11 @@ class LmsApi
'norujukan' => $nomorRujukanBPJS
];
$res = self::http()->post( self::baseUrl() . '/booking', $data)->json();
$res = self::http()->post(self::baseUrl() . '/booking', $data)->json();
return $res;
}
/**
* bookingBaru
*
@@ -354,7 +373,8 @@ class LmsApi
* @param mixed $nomorRujukanBPJS
* @return void
*/
public static function bookingBaru( $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $patientData, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null) {
public static function bookingBaru($HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $patientData, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null)
{
$data = [
'rs' => $HISKodeRS,
'dep' => $HISKodeDep,
@@ -385,12 +405,12 @@ class LmsApi
'nokartu' => $nomorKartuBPJS,
'norujukan' => $nomorRujukanBPJS
];
$res = self::http()->post( self::baseUrl() . '/booking_baru', $data)->json();
$res = self::http()->post(self::baseUrl() . '/booking_baru', $data)->json();
return $res;
}
/**
* bookingEdit
* Used for Rescheduling appointment
@@ -409,7 +429,8 @@ class LmsApi
* @param mixed $nomorRujukanBPJS
* @return void
*/
public static function bookingEdit( $kodeBooking, $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $tanggalAppointmentBaru, $jamAppointmentBaru, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null ) {
public static function bookingEdit($kodeBooking, $HISKodeRS, $HISKodeDep, $HISKodeDokter, $tanggalAppointment, $jamAppointment, $tanggalAppointmentBaru, $jamAppointmentBaru, $jenisPenjamin = 0, $namaPenjamin = '', $nomorKartuBPJS = null, $nomorRujukanBPJS = null)
{
$data = [
'kodebooking' => $kodeBooking,
'rs' => $HISKodeRS,
@@ -424,16 +445,16 @@ class LmsApi
'tglbaru' => $tanggalAppointmentBaru,
'jambaru' => $jamAppointmentBaru,
];
$res = self::http()->post( self::baseUrl() . '/booking_edit', $data)->json();
$res = self::http()->post(self::baseUrl() . '/booking_edit', $data)->json();
return $res;
}
public static function bookingPaket($kodeRs, $kodeDep, $rm, $ktp, $nama_pasien, $tgl_lahir, $email, $telp, $tgl, $jam, $jenis_penjamin, $penjamin, $paket, $jenis_paket)
{
throw new Exception("Not Implemented", 1);
$url = Http::withHeaders([
'id' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE3NWZiNDI0LTA4MzMtNGZiMS1iOWNhLWQwMzQ5Nzc'
])->post('http://lmsapidev.primaya.id/booking_paket', [
@@ -485,7 +506,7 @@ class LmsApi
$jenis_paket
) {
throw new Exception("Not Implemented", 1);
$url = Http::withHeaders([
'id' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE3NWZiNDI0LTA4MzMtNGZiMS1iOWNhLWQwMzQ5Nzc'
])->post('http://lmsapidev.primaya.id/booking_baru_paket', [
@@ -537,7 +558,7 @@ class LmsApi
$jenis_paket
) {
throw new Exception("Not Implemented", 1);
$url = Http::withHeaders([
'id' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjE3NWZiNDI0LTA4MzMtNGZiMS1iOWNhLWQwMzQ5Nzc'
])->post('http://lmsapidev.primaya.id/booking_edit_paket', [
@@ -558,7 +579,7 @@ class LmsApi
return $url;
}
public static function bookingBayar( $kodeBooking, $HISKodeRS, $tanggalBooking, $jumlahBayar, $merchantCode, $merchantOrderId, $reference)
public static function bookingBayar($kodeBooking, $HISKodeRS, $tanggalBooking, $jumlahBayar, $merchantCode, $merchantOrderId, $reference)
{
$data = [
"rs" => $HISKodeRS,
@@ -570,9 +591,9 @@ class LmsApi
'merchantorderid' => $merchantOrderId,
'reference' => $reference,
];
$res = self::http()->post( self::baseUrl() . '/booking_bayar', $data)->json();
$res = self::http()->post(self::baseUrl() . '/booking_bayar', $data)->json();
return $res;
}
@@ -603,4 +624,4 @@ class LmsApi
return $url;
}
}
}

View File

@@ -0,0 +1,143 @@
<?php
namespace Database\Seeders;
use App\Models\OLDLMS\Healthcare;
use App\Models\OLDLMS\JadwalDokter;
use App\Models\OLDLMS\JadwalDokterDay;
use App\Services\LmsApi;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class JadwalDokterSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$mapHealthcare = [
'Q',
'C',
'D',
'E',
'F',
'M',
'O',
'P',
'Q',
'N',
'SG',
'BW',
'SK',
'PK',
'CK',
'DE'
];
$healthcares = Healthcare::whereIn('sKodeRS', $mapHealthcare)->get();
foreach ($healthcares as $healthcare) {
$jadwalDokterDay = LmsApi::dokter($healthcare->sKodeRS, 'hospitaloka', 300);
if (empty($jadwalDokterDay['data'])) {
continue;
}
$listDokter = $jadwalDokterDay['data'];
foreach ($listDokter as $dokter) {
$jadwalDokter = JadwalDokter::where('sIDDokter', $dokter['id'])->where('sDepartmenID', $dokter['DepartemenID'])->first() ?? null;
if ($jadwalDokter == null) {
continue;
}
// if ($jadwalDokter->nID != 1901) {
// continue;
// }
$jadwalDokterDay = $jadwalDokter->jadwalDokterDay()->get() ?? null;
// JadwalDokterDay::where('nIDJadwalDokter', $jadwalDokter->nID)->get() ?? null;
if ($jadwalDokterDay == null) {
continue;
}
// dd($dokter);
$listShcedule = $dokter['JadwalDokter'];
foreach ($jadwalDokterDay as $day) {
$NewJam = "";
foreach ($listShcedule as $key => $schedule) {
$jam = $schedule['Jam'];
$cek = $schedule['Jam'];
//jika jam memiliki hurug A-Z
if (preg_match('/[A-Z]/', $jam)) {
$jam = $jam;
} else {
//jika terdapat titik
if (strpos($jam, ".") !== false) {
//ganti titik dengan : dan tambahkan 00
$jam = str_replace(".", ":", $jam);
//jika jam nya terdapat strip
if (strpos($jam, "-") !== false) {
//jika didepan strip dan belakang strip ada spasi
if (strpos($jam, " ") !== false) {
//hapus spasi
$jam = str_replace(" ", "", $jam);
}
// try{
$jam = explode("-", $jam);
$jam = $jam[0] . " - " . $jam[1];
// } catch (\Exception $e) {
// $this->command->error($cek . "Id dokter : " . $jadwalDokter->nID);
// }
} else {
$jam = $jam;
}
} else {
//jika terdapat strip
if (strpos($jam, "-") !== false) {
//jika hanya ada strip tidak ada yang lain
if (strlen($jam) > 1) {
//jika sudah ada : maka diabaikan
if (strpos($jam, ":") !== false) {
$jam = explode("-", $jam);
$jam = $jam[0] . " - " . $jam[1];
} else {
//jika didepan strip ada spasi
if (strpos($jam, " ") !== false) {
//hapus spasi
$jam = str_replace(" ", "", $jam);
}
$jam = explode("-", $jam);
$jam = $jam[0] . ":00 - " . $jam[1] . ":00";
}
}
} else if (strpos($jam, ":") !== false) {
$jam = $jam;
} else {
$jam = $jam . ":00";
}
}
}
if ($day->sHari == $schedule['Hari']) {
if ($schedule['Jam'] == null) {
$NewJam = "";
} else {
$NewJam = $jam;
}
} else {
continue;
}
}
$day->sJam = $NewJam;
$day->save();
}
}
}
}
}

View File

@@ -1,13 +1,13 @@
, PHSM , PHBU , PHMA , PHPK , PHPC , PHBW , PEVH , PHTA , PHSB , PHKA , PHBB , PHBT
Administrasi Rawat Jalan," 50,000 "," 50,000 "," 50,000 "," 50,000 "," 50,000 "," 25,000 "," 50,000 "," 50,000 "," 50,000 "," 50,000 "," 50,000 "," 50,000 "
Konsultasi Dokter Umum," 66,000 "," 100,000 "," 110,000 "," 110,000 "," 100,000 "," 60,000 "," 120,000 "," 125,000 "," 90,000 "," 100,000 "," 100,000 "," 100,000 "
Konsultasi Dokter Spesialis," 165,000 "," 230,000 "," 300,000 "," 220,000 "," 300,000 "," 130,000 "," 270,000 "," 300,000 "," 195,000 "," 215,000 "," 230,000 "," 230,000 "
Konsultasi Dokter Sub Spesialis / Konsultan," 275,000 "," 329,000 "," 370,000 "," 303,000 "," 400,000 "," 140,000 "," 350,000 "," 385,000 "," 250,000 "," 305,000 "," 329,000 "," 329,000 "
Telekonsultasi Dokter Umum," 56,000 "," 85,000 "," 94,000 "," 94,000 "," 60,000 "," 51,000 "," 102,000 "," 106,000 "," 77,000 "," 85,000 "," 85,000 "," 85,000 "
Telekonsultasi Dokter Spesialis," 141,000 "," 196,000 "," 255,000 "," 187,000 "," 265,000 "," 111,000 "," 230,000 "," 255,000 "," 165,000 "," 180,000 "," 115,000 "," 115,000 "
Telekonsultasi Dokter Sub Spesialis," 234,000 "," 280,000 "," 315,000 "," 258,000 "," 359,000 "," 119,000 "," 298,000 "," 327,000 "," 212,000 "," 250,000 "," 165,000 "," 165,000 "
Konsultasi Professor I,,," 370,000 ",," 500,000 ",," 800,000 ",,,,,
Konsultasi Professor II,,," 450,000 ",," 500,000 ",," 600,000 ",,,,,
Konsultasi Dokter Umum (Hari Libur),,," 150,000 ",,,,,," 120,000 ",,,
Konsultasi Dokter Spesialis (Hari Libur),,," 350,000 ",,,," 320,000 ",," 215,000 ",,,
Konsultasi Laktasi,,,," 165,000 ",,," 550,000 "," 150,000 ",," 159,000 ",,
Administrasi Rawat Jalan,50000,50000,50000,50000,50000,25000,50000,50000,50000,50000,50000,50000
Konsultasi Dokter Umum,66000,100000,110000,110000,100000,60000,120000,125000,90000,100000,100000,100000
Konsultasi Dokter Spesialis,165000,230000,300000,220000,300000,130000,270000,300000,195000,215000,230000,230000
Konsultasi Dokter Sub Spesialis / Konsultan,275000,329000,370000,303000,400000,140000,350000,385000,250000,305000,329000,329000
Telekonsultasi Dokter Umum,56000,85000,94000,94000,60000,51000,102000,106000,77000,85000,85000,85000
Telekonsultasi Dokter Spesialis,141000,196000,255000,187000,265000,111000,230000,255000,165000,180000,180000,115000
Telekonsultasi Dokter Sub Spesialis,234000,280000,315000,258000,359000,119000,298000,327000,212000,250000,250000,165000
Konsultasi Professor I,,,370000,,500000,,800000,,,,,
Konsultasi Professor II,,,450000,,500000,,600000,,,,,
Konsultasi Dokter Umum (Hari Libur),,,150000,,,,,,120000,,,
Konsultasi Dokter Spesialis (Hari Libur),,,350000,,,,320000,,215000,,,
Konsultasi Laktasi,,,,165000,,,550000,150000,,159000,,
1 PHSM PHBU PHMA PHPK PHPC PHBW PEVH PHTA PHSB PHKA PHBB PHBT
2 Administrasi Rawat Jalan 50,000 50000 50,000 50000 50,000 50000 50,000 50000 50,000 50000 25,000 25000 50,000 50000 50,000 50000 50,000 50000 50,000 50000 50,000 50000 50,000 50000
3 Konsultasi Dokter Umum 66,000 66000 100,000 100000 110,000 110000 110,000 110000 100,000 100000 60,000 60000 120,000 120000 125,000 125000 90,000 90000 100,000 100000 100,000 100000 100,000 100000
4 Konsultasi Dokter Spesialis 165,000 165000 230,000 230000 300,000 300000 220,000 220000 300,000 300000 130,000 130000 270,000 270000 300,000 300000 195,000 195000 215,000 215000 230,000 230000 230,000 230000
5 Konsultasi Dokter Sub Spesialis / Konsultan 275,000 275000 329,000 329000 370,000 370000 303,000 303000 400,000 400000 140,000 140000 350,000 350000 385,000 385000 250,000 250000 305,000 305000 329,000 329000 329,000 329000
6 Telekonsultasi Dokter Umum 56,000 56000 85,000 85000 94,000 94000 94,000 94000 60,000 60000 51,000 51000 102,000 102000 106,000 106000 77,000 77000 85,000 85000 85,000 85000 85,000 85000
7 Telekonsultasi Dokter Spesialis 141,000 141000 196,000 196000 255,000 255000 187,000 187000 265,000 265000 111,000 111000 230,000 230000 255,000 255000 165,000 165000 180,000 180000 115,000 180000 115,000 115000
8 Telekonsultasi Dokter Sub Spesialis 234,000 234000 280,000 280000 315,000 315000 258,000 258000 359,000 359000 119,000 119000 298,000 298000 327,000 327000 212,000 212000 250,000 250000 165,000 250000 165,000 165000
9 Konsultasi Professor I 370,000 370000 500,000 500000 800,000 800000
10 Konsultasi Professor II 450,000 450000 500,000 500000 600,000 600000
11 Konsultasi Dokter Umum (Hari Libur) 150,000 150000 120,000 120000
12 Konsultasi Dokter Spesialis (Hari Libur) 350,000 350000 320,000 320000 215,000 215000
13 Konsultasi Laktasi 165,000 165000 550,000 550000 150,000 150000 159,000 159000