Compare commits
1 Commits
main
...
peserta-renaldy
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcde54700f |
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\DoctorModel;
|
||||
use App\Models\HealthCareServiceModel;
|
||||
use App\Models\DoctorHealthcareService;
|
||||
|
||||
class DoctorController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function doctorByHealthcareService(Request $request)
|
||||
{
|
||||
$nomor_poli = $request->poli;
|
||||
|
||||
if ($nomor_poli != null) {
|
||||
$select_poli = HealthCareServiceModel::where('id', $nomor_poli)->first();
|
||||
|
||||
if ($select_poli != null) {
|
||||
$select_doctors_by_poli = DoctorHealthcareService::where('fk_ms_healthcare_service_id', $select_poli->id)->get();
|
||||
|
||||
return $select_doctors_by_poli;
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'msg' => 'poliklinik tidak ditemukan, id poliklinik : '.$nomor_poli
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'msg' => 'id poliklinik tidak terisi'
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\HealthCareServiceModel;
|
||||
use App\Models\HealthCareServiceSchedule;
|
||||
use App\Models\HealthCareServiceShift;
|
||||
|
||||
class HealthCareServiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$healthcareService = HealthCareServiceModel::with(
|
||||
['ref_healthcare_type', 'ref_service_type']
|
||||
)->get();
|
||||
|
||||
$healthcareServiceSchedule = HealthCareServiceSchedule::get();
|
||||
|
||||
$healthcareServiceShift = HealthCareServiceShift::get();
|
||||
|
||||
return response()->json([
|
||||
'ms_healthcare_service' => $healthcareService,
|
||||
'ms_healthcare_service_schedule' => $healthcareServiceSchedule,
|
||||
'ms_healthcare_service_shift' => $healthcareServiceShift
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\PatientModel;
|
||||
|
||||
class PatientController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$no_rekam_medis = $request->norm;
|
||||
|
||||
if ($no_rekam_medis != null) {
|
||||
$selectPatient = PatientModel::where('medical_record_number', $no_rekam_medis)
|
||||
->with(['attachment', 'paymentType'])
|
||||
->first();
|
||||
|
||||
if ($selectPatient != null) {
|
||||
return $selectPatient;
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'msg' => 'pasien tidak ditemukan, nomor rekam medis : '.$no_rekam_medis
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'msg' => 'nomor rekam medis tidak terisi'
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DoctorHealthcareService extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_doctor_healthcare_service';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DoctorModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_doctor';
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HealthCareServiceModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_healthcare_service';
|
||||
|
||||
public function ref_healthcare_type()
|
||||
{
|
||||
return $this->belongsTo(RefHealthCareType::class, 'fk_ref_healthcare_type_id');
|
||||
}
|
||||
|
||||
public function ref_service_type()
|
||||
{
|
||||
return $this->belongsTo(RefServiceType::class, 'fk_ref_service_type_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HealthCareServiceSchedule extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_healthcare_service_schedule';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HealthCareServiceShift extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_healthcare_service_shift';
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PatientAttachment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_patient_attachment';
|
||||
|
||||
public function patient()
|
||||
{
|
||||
return $this->belongsTo(PatientModel::class, 'fk_ms_patient_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PatientModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_patient';
|
||||
|
||||
public function attachment(){
|
||||
return $this->hasMany(PatientAttachment::class, 'fk_ms_patient_id');
|
||||
}
|
||||
|
||||
public function paymentType(){
|
||||
return $this->hasMany(PatientPaymentType::class, 'fk_ms_patient_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PatientPaymentType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'master.ms_patient_payment_type';
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RefHealthCareType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "reference.ref_healthcare_type";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RefServiceType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "reference.ref_service_type";
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->namespace('App\\Http\\Controllers\\Api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Api\Admin;
|
||||
use App\Http\Controllers\Controller\HealthCareServiceController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
@@ -14,6 +16,9 @@ use App\Http\Controllers\Api\Admin;
|
||||
|
|
||||
*/
|
||||
Route::post('get-customer',[Admin::class,'getCustomer']);
|
||||
Route::get('patients/search', 'PatientController@search');
|
||||
Route::get('doctors', 'DoctorController@doctorByHealthcareService');
|
||||
Route::get('poliklinik', 'HealthCareServiceController@index');
|
||||
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
|
||||
Reference in New Issue
Block a user