diff --git a/app/Console/Commands/DisableLabAccess.php b/app/Console/Commands/DisableLabAccess.php
index 967a35a..c11178d 100644
--- a/app/Console/Commands/DisableLabAccess.php
+++ b/app/Console/Commands/DisableLabAccess.php
@@ -2,7 +2,7 @@
namespace App\Console\Commands;
-use App\Models\Laboratory;
+use App\Models\Organization;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -41,7 +41,7 @@ class DisableLabAccess extends Command
public function handle()
{
try{
- $labs = Laboratory::query()->where('record_status_id', 1)
+ $labs = Organization::query()->where('record_status_id', 1)
->whereRaw("DATEDIFF(end_date, CURDATE())<=-7")
->update(['record_status_id' => 0]);
Log::channel('jobs')->info($labs);
diff --git a/app/Console/Commands/NotifyExpireLab.php b/app/Console/Commands/NotifyExpireLab.php
index 6d7ef33..a91f6a5 100644
--- a/app/Console/Commands/NotifyExpireLab.php
+++ b/app/Console/Commands/NotifyExpireLab.php
@@ -2,7 +2,7 @@
namespace App\Console\Commands;
-use App\Models\Laboratory;
+use App\Models\Organization;
use App\Models\Publication;
use App\Models\PublicationReceiver;
use Illuminate\Console\Command;
@@ -43,10 +43,10 @@ class NotifyExpireLab extends Command
public function handle()
{
try{
- $labs = Laboratory::query()->where('record_status_id', 1)
+ $labs = Organization::query()->where('record_status_id', 1)
->whereNotNull('end_date')
->whereRaw("DATEDIFF(end_date, CURDATE())=7")->get();
-
+
Log::channel('jobs')->info($labs);
foreach ($labs as $lab){
@@ -65,7 +65,7 @@ class NotifyExpireLab extends Command
PublicationReceiver::query()->create([
'publication_id' => $publication->id,
- 'lab_id' => $lab->id,
+ 'organization_id' => $lab->id,
'created_by' => 1
]);
}
diff --git a/app/Helpers/Helpers.php b/app/Helpers/Helpers.php
index 5a70b0c..8db9acd 100644
--- a/app/Helpers/Helpers.php
+++ b/app/Helpers/Helpers.php
@@ -56,7 +56,7 @@ class Helpers
str_pad(substr($hexTimestamp, 11, 3),3,'0',STR_PAD_LEFT).
str_pad(mt_rand(1,99),2,'0',STR_PAD_LEFT);
}
-
+
public static function generateUuIdForManual($prefixClass, $manual_code){
return $prefixClass . '-'.date('ymd').'-'.$manual_code;
}
@@ -87,7 +87,7 @@ class Helpers
if($sex == 1) return __('sample.sex_m');
return __('sample.sex_f');
}
-
+
public static function getGenderfull($sex){
if($sex == 1) return __('sample.sex_male');
return __('sample.sex_female');
@@ -145,10 +145,10 @@ class Helpers
INNER JOIN publication_receivers pr
ON pr.publication_id = p.id
WHERE DATE(NOW()) BETWEEN start_date AND end_date AND p.record_status_id = 1
- AND pr.lab_id = " . Session::get('base_lab_id'));
+ AND pr.organization_id = " . Session::get('base_organization_id'));
return $publication;
}
-
+
public static function generatePatientBotLink($individual_type = 'patient',$labId, $patientId)
{
$botUsername = env('TELEGRAM_BOT_NAME'); // e.g. "MyLabBot"
diff --git a/app/Http/Controllers/AntibioticController.php b/app/Http/Controllers/AntibioticController.php
deleted file mode 100644
index a639c18..0000000
--- a/app/Http/Controllers/AntibioticController.php
+++ /dev/null
@@ -1,101 +0,0 @@
-model = $antibioticModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_antibiotic'])) return redirect(url('my-profile'));
- $antibiotics = $this->model::with(['lab'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->when(!empty($request->kword), function ($antibiotics) use($request){
- $antibiotics->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('antibiotic', ['antibiotics' => AntibioticResource::collection($antibiotics)]);
- }
-
- public function save(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_antibiotic'])) return false;
- $validator = \Validator::make($request->all(), ['name_en' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('antibiotic.create_fail'), 'errors' => $validator->errors()->all()]);
- $antibiotic = $this->model::query()->create([ 'name_en' => $request->name_en, 'weight' => $request->weight]);
- return response()->json(['success' => true, 'message' => __('antibiotic.create_success'), 'data' => [$antibiotic]]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('antibiotic.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_antibiotic'])) return false;
- $validator = \Validator::make($request->all(), ['name_en' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('antibiotic.update_fail'), 'errors' => $e->getMessage()]);
- $data = array(
- 'name_en' => $request->name_en,
- 'weight' => $request->weight
- );
- $this->model::query()->where('id', $request->uid)->update($data);
- return response()->json(['success' => true, 'message' => __('antibiotic.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('antibiotic.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $antibiotic = $this->model::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('antibiotic.get_success'), 'data' => new AntibioticResource($antibiotic)]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('antibiotic.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_antibiotic'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('antibiotic.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('antibiotic.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('antibiotic.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('antibiotic.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/Api/SampleResultController.php b/app/Http/Controllers/Api/SampleResultController.php
index 045857e..d7540a6 100644
--- a/app/Http/Controllers/Api/SampleResultController.php
+++ b/app/Http/Controllers/Api/SampleResultController.php
@@ -41,7 +41,7 @@ class SampleResultController extends Controller
}
}
}
- return response()->json(['success' => true, 'message' => __('Laboratory result already pushed!')]);
+ return response()->json(['success' => true, 'message' => __('Organization result already pushed!')]);
} catch (\Exception $e){
return response()->json(['success' => false, 'message' => __('Failed while pushing laboratory result!'), 'errors' => $e->getMessage()]);
}
diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php
deleted file mode 100644
index 66ad79e..0000000
--- a/app/Http/Controllers/AppointmentController.php
+++ /dev/null
@@ -1,117 +0,0 @@
-model = new Appointment();
- $this->patientModel = new Patient();
- $this->physicianModel = new Physician();
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_appointment'])) return redirect(url('my-profile'));
- $conceptCodes = $this->model::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->groupBy('appointment_type')->get('appointment_type');
- $patients = $this->patientModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => BaseModel::RECORD_STATUS_ACTIVE])->limit(20)->get();
- $physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('name_en', 'ASC')->get();
- $appointments = $this->model::with(['patient', 'doctor'])->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->appointment_type), function ($query) use($request){
- $query->where('appointment_type', $request->appointment_type);
- })->when(!empty($request->appointment_date), function ($query) use($request) {
- $query->whereDate('appointment_date', date('Y-m-d', strtotime($request->appointment_date)));
- })->orderBy('appointment_date','desc')->paginate(config('labis.pagination.perpage', 10));
- return view('appointment', ['appointments' => $appointments, 'conceptCodes' => $conceptCodes, 'patients' => $patients, 'patient_id' => 0, 'physicians' => $physicians]);
- }
-
- public function store(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_appointment'])) return false;
- $validator = \Validator::make($request->all(), ['patient_id' => 'required', 'appointment_date' => 'required', 'appointment_type' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('appointment.create_fail'), 'errors' => $validator->errors()->all()]);
-
- $app=new Appointment();
- $app->patient_id=$request->patient_id;
- $app->appointment_date=date('Y-m-d H:i:s', strtotime($request->appointment_date));
- $app->appointment_type=$request->appointment_type;
- $app->description=$request->description;
- $app->doctor_id=$request->doctor_id;
- $app->lab_id=$this->baseLabId;
- $app->save();
- return response()->json(['success' => true, 'message' => __('appointment.create_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('appointment.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try {
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_appointment'])) return false;
- $validator = \Validator::make($request->all(), ['patient_id' => 'required', 'appointment_date' => 'required', 'appointment_type' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('appointment.update_fail'), 'errors' => $validator->errors()->all()]);
- $app=Appointment::find($request->uid);
- $app->appointment_date=date('Y-m-d H:i:s', strtotime($request->appointment_date));
- $app->appointment_type=$request->appointment_type;
- $app->description=$request->description;
- $app->doctor_id=$request->doctor_id;
- $app->lab_id=$this->baseLabId;
- $app->save();
- return response()->json(['success' => true, 'message' => __('appointment.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('appointment.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $test = $this->model::query()->where(['lab_id' => $this->baseLabId, 'id' => $request->uid])->get()->first();
- return response()->json(['success' => true, 'message' => __('appointment.get_success'), 'data' => $test]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('appointment.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_appointment'])) return false;
- $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('appointment.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('appointment.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function getAlertNofication(){
- try{
- $appointments = $this->model::with(['patient:id,name_en,phone_number', 'doctor:id,name_en'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->whereBetween('appointment_date', [Carbon::today(), Carbon::today()->addDays(2)])->orderBy('appointment_date','desc')->get();
- $count = $appointments->count();
- return response()->json(['success' => true, 'message' => __('appointment.get_success'), 'data' => $appointments, 'count' => $count]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('appointment.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-}
diff --git a/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
index ddfbe1e..215ccea 100644
--- a/app/Http/Controllers/Auth/AuthenticatedSessionController.php
+++ b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
@@ -39,7 +39,7 @@ class AuthenticatedSessionController extends Controller
->log('User Login');
$request->session()->regenerate();
- if (!$request->session()->has('base_lab_id')) {
+ if (!$request->session()->has('base_organization_id')) {
return redirect()->route('base');
}
return redirect()->intended(RouteServiceProvider::HOME);
@@ -61,7 +61,7 @@ class AuthenticatedSessionController extends Controller
])
->log('User Logout');
Auth::guard('web')->logout();
-
+
$request->session()->invalidate();
diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php
index 689d09e..7187b1b 100644
--- a/app/Http/Controllers/BaseController.php
+++ b/app/Http/Controllers/BaseController.php
@@ -3,16 +3,12 @@
namespace App\Http\Controllers;
use App\Enums\RecordStatusEnum;
use App\Enums\UtilEnum;
-use App\Models\AgeGroup;
-use App\Models\Department;
-use App\Models\PatientType;
use App\Models\Role;
use App\Models\User;
-use App\Models\UserLabCover;
-use App\Models\WardTransaction;
+use App\Models\UserOrganization;
use Carbon\Carbon;
use Illuminate\Http\Request;
-use App\Models\Laboratory;
+use App\Models\Organization;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
@@ -20,52 +16,55 @@ use Illuminate\Support\Facades\Redis;
class BaseController extends Controller
{
+ public function __construct()
+ {
+ }
+
function getLabs(){
return parent::getAccessAbleLabs();
}
public function index(Request $request){
- $labs = Laboratory::query()->where('record_status_id', RecordStatusEnum::ACTIVE)
+ $organizations = Organization::query()->where('record_status_id', RecordStatusEnum::ACTIVE)
->whereIn('id', $this->getLabs()->pluck('id')->toArray())
->orderBy('created_at','desc')->get();
- $request->session()->put('base_lab_coverages', $labs->pluck('name_en')->toArray());
+ $request->session()->put('base_organization_coverages', $organizations->pluck('name_en')->toArray());
// check it only one base default assign base session, else redirect to base view
- if(count($labs)==1){
- $request->session()->put('base_lab_id', $labs->first()->id);
- $request->session()->put('base_lab_name', $labs->first()->name_en);
- $request->session()->put('base_lab', $labs[0]->toArray());
- if ($request->session()->has('base_lab_id')) {
+ if(count($organizations)==1){
+ $request->session()->put('base_organization_id', $organizations->first()->id);
+ $request->session()->put('base_organization_name', $organizations->first()->name_en);
+ $request->session()->put('base_organization', $organizations[0]->toArray());
+ if ($request->session()->has('base_organization_id')) {
return redirect('/dashboard');
}
}
- return view('base', ['labs' => $labs]);
+ return view('base', ['organizations' => $organizations]);
}
public function forget(Request $request){
- if ($request->session()->has('base_lab_id')) {
- $request->session()->forget('base_lab_id');
- $request->session()->forget('base_lab_name');
- $request->session()->forget('base_lab');
- $request->session()->forget('base_lab');
- $request->session()->forget('base_lab_coverages');
+ if ($request->session()->has('base_organization_id')) {
+ $request->session()->forget('base_organization_id');
+ $request->session()->forget('base_organization_name');
+ $request->session()->forget('base_organization');
+ $request->session()->forget('base_organization_coverages');
return redirect()->route('base');
}
}
public function store(Request $request){
- $validator = \Validator::make($request->all(), [ 'lab_id' => 'required']);
+ $validator = \Validator::make($request->all(), [ 'organization_id' => 'required']);
if ($validator->fails())
{
session()->flash('error', 'Invalid credentials');
return redirect()->route('base');
}
- $lab = Laboratory::query()->find($request->lab_id);
- $request->session()->put('base_lab_id', $request->lab_id);
- $request->session()->put('base_lab_name', $lab->name_en);
- $request->session()->put('base_lab', $lab->toArray());
- if (!$request->session()->has('base_lab_id')) {
+ $organization = Organization::query()->find($request->organization_id);
+ $request->session()->put('base_organization_id', $request->organization_id);
+ $request->session()->put('base_organization_name', $organization->name_en);
+ $request->session()->put('base_organization', $organization->toArray());
+ if (!$request->session()->has('base_organization_id')) {
return redirect()->route('base');
}
return redirect('/dashboard');
diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php
deleted file mode 100644
index 207d771..0000000
--- a/app/Http/Controllers/CommentController.php
+++ /dev/null
@@ -1,112 +0,0 @@
-model = $comment;
- $this->department = $department;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_comment'])) return redirect(url('my-profile'));
- $departments = $this->department::query()->where(['lab_id' => Session::get('base_lab_id'), BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('name_en','asc')->get();
- $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
- $comments = $this->model::with(['sample_type','sample_type.department'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($comments) use($request){
- $comments->whereRaw("replace(comment_desc, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('comment', ['comments' => $comments, 'departments' => $departments]);
- }
-
- public function save(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_comment'])) return false;
- $validator = \Validator::make($request->all(), ['comment_desc' => 'required', 'sample_type_id' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('comment.create_fail'), 'errors' => $validator->errors()->all()]);
- foreach ($request->sample_type_id as $sample_type) {
- $comment = $this->model::query()->create([
- 'comment_desc' => $request->comment_desc,
- 'sample_type_id' => $sample_type,
- 'lab_id' => $this->baseLabId
- ]);
- }
- return response()->json(['success' => true, 'message' => __('comment.create_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('comment.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try {
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_comment'])) return false;
- $validator = \Validator::make($request->all(), ['comment_desc' => 'required', 'sample_type_id' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('comment.update_fail'), 'errors' => $validator->errors()->all()]);
- $data = array(
- 'comment_desc' => $request->comment_desc,
- 'sample_type_id' => $request->sample_type_id
- );
- $this->model::query()->where('id', $request->uid)->update($data);
- return response()->json(['success' => true, 'message' => __('comment.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('comment.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $test = $this->model::with('sample_type')->find($request->uid);
- return response()->json(['success' => true, 'message' => __('comment.get_success'), 'data' => $test]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('comment.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_comment'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('comment.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('comment.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('comment.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('comment.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index d13005e..069baae 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -6,9 +6,9 @@ use App\Enums\RecordStatusEnum;
use App\Models\BaseModel;
use App\Models\Commune;
use App\Models\District;
-use App\Models\Laboratory;
+use App\Models\Organization;
use App\Models\Province;
-use App\Models\UserLabCover;
+use App\Models\UserOrganization;
use App\Models\Village;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
@@ -18,12 +18,12 @@ abstract class Controller
{
function getAccessAbleLabs(){
$recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
- $labs = Laboratory::query()->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)->get();
+ $organizations = Organization::query()->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)->get();
if(Auth::id()!=1){
- $labIds = UserLabCover::query()->where('user_id', Auth::id())->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->pluck('lab_id')->toArray();
- $labs = $labs->whereIn('id', $labIds);
+ $organizationId = UserOrganization::query()->where('user_id', Auth::id())->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->pluck('organization_id')->toArray();
+ $organizations = $organizations->whereIn('id', $organizationId);
}
- return $labs;
+ return $organizations;
}
function province(){
@@ -52,33 +52,10 @@ abstract class Controller
}
public function location(){
- // discount_type = [1 => '%', 2 => 'USD']
- return Laboratory::query()->find(Session::get('base_lab_id'))->only([
+ return Organization::query()->find(Session::get('base_organization_id'))->only([
+ 'id',
'name_en',
- 'name_kh',
- 'short_name',
- 'sample_number',
- 'patient_code',
- 'verify_label',
- 'technician_label',
- 'discount_type',
- 'logo',
- 'address_kh',
- 'address_en',
- 'phone_number',
- 'email',
- 'shareable_lab_result',
- 'result_header_id',
- 'show_result_footer',
- 'abnormal_result_font_weight',
- 'abnormal_text_color',
- 'exchange_rate',
- 'lab_category_id',
- 'currency',
- 'is_hide_inv_discount',
- 'is_hide_comission_percentage',
- 'invoice_template_id',
- 'alternative_logo'
+ 'name_kh'
]);
}
diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php
index 48f08e1..8f52536 100644
--- a/app/Http/Controllers/DashboardController.php
+++ b/app/Http/Controllers/DashboardController.php
@@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use App\Enums\RecordStatusEnum;
use App\Models\BaseModel;
-use App\Models\Invoice;
use App\Models\Sample;
use App\Http\Controllers\Helper\GlobalController;
@@ -16,14 +15,13 @@ class DashboardController extends Controller
{
protected $sampleModel;
protected $invoiceModel;
- private $baseLabId;
+ private $baseOrganizationId;
protected $base;
- public function __construct(Sample $sampleModel, Invoice $invoiceModel){
+ public function __construct(Sample $sampleModel){
$this->sampleModel = $sampleModel;
- $this->invoiceModel = $invoiceModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
@@ -53,7 +51,7 @@ class DashboardController extends Controller
//income
$todayIncome = $this->getTodayIncome();
$todayIncome+=$this->getDailyReportV2(date('Y-m-d'), date('Y-m-d'));
- $yesterdayIncome = $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ $yesterdayIncome = $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('invoice_date', date('Y-m-d', strtotime('-1 day')))->sum('gross_total');
$yesterdayIncome+=$this->getDailyReportV2(date('Y-m-d', strtotime('-1 day')), date('Y-m-d', strtotime('-1 day')));
if($yesterdayIncome>0){
@@ -114,9 +112,9 @@ class DashboardController extends Controller
$displaySampleResult = $monlthlySample;
} elseif ($q->dt == 'this_year'){
- $yearSamples = $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ $yearSamples = $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereYear('admission_date', date('Y'))->count();
- $last_yearSample = $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ $last_yearSample = $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereYear('admission_date', (date('Y')-1))->count();
if($last_yearSample>0){
$growthSample = (($yearSamples - $last_yearSample) / $last_yearSample);
@@ -167,7 +165,7 @@ class DashboardController extends Controller
else{
$todayIncome = $this->getTodayIncome();
$todayIncome+=$this->getDailyReportV2(date('Y-m-d'), date('Y-m-d'));
- $yesterdayIncome = $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ $yesterdayIncome = $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('invoice_date', date('Y-m-d', strtotime('-1 day')))->sum('gross_total');
$yesterdayIncome+=$this->getDailyReportV2(date('Y-m-d', strtotime('-1 day')), date('Y-m-d', strtotime('-1 day')));
if($yesterdayIncome>0){
@@ -261,36 +259,36 @@ class DashboardController extends Controller
//get total sample count for dashboard by lab id
function getTotalRejectedSampleCount(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)->count();
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)->count();
}
function getTodayRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereDate('admission_date', date('Y-m-d'))->get();
}
function getYesterdayRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereDate('admission_date', date('Y-m-d', strtotime('-1 day')))->get();
}
function getThisMonthRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereBetween('admission_date', [date('Y-m-01 00:00:00'), date('Y-m-t 23:59:59')])->get();
}
function getPreviousMonthRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereBetween('admission_date', [date("Y-m-d 00:00:00", strtotime("first day of previous month")), date("Y-m-d 23:59:59", strtotime("last day of previous month"))])->get();
}
function getThisYearRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereYear('admission_date', date('Y'))->get();
}
function getLastYearRejectedSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('sample_condition', 0)
->whereYear('admission_date', (date('Y')-1))->get();
}
@@ -299,109 +297,109 @@ class DashboardController extends Controller
function getTotalSampleCount(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->count();
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->count();
}
//get yesterday sample count for dashboard by lab id
function getYesterdaySampleCount(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('admission_date', date('Y-m-d', strtotime('-1 day')))->count();
}
function getTodaySamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('admission_date', date('Y-m-d'))->get();
}
function getThisMonthSamples(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date('Y-m-01 00:00:00'), date('Y-m-t 23:59:59')])->get();
}
function getPreviousMonthSamples(){
- return $this->sampleModel::with(['patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::with(['patient'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date("Y-m-d 00:00:00", strtotime("first day of previous month")), date("Y-m-d 23:59:59", strtotime("last day of previous month"))])->get();
}
function getLastYearAverage(){
- return $this->sampleModel::with(['patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::with(['patient'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date('Y-01-01 00:00:00', strtotime('-1 year')), date('Y-12-31 23:59:59', strtotime('-1 year'))])->count();
}
function getTodayIncome(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('invoice_date', date('Y-m-d'))->sum('gross_total');
}
function getThisMonthIncome(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('invoice_date', [date('Y-m-01 00:00:00'), date('Y-m-t 23:59:59')])->sum('gross_total');
}
function getPreviousMonthIncome(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('invoice_date', [date("Y-m-d 00:00:00", strtotime("first day of previous month")), date("Y-m-d 23:59:59", strtotime("last day of previous month"))])->sum('gross_total');
}
function getLastYearIncome(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('invoice_date', [date('Y-01-01 00:00:00', strtotime('-1 year')), date('Y-12-31 23:59:59', strtotime('-1 year'))])->sum('gross_total');
}
function getTotalIncome(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->sum('gross_total');
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->sum('gross_total');
}
function getTotalPatient(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->distinct('patient_id')->count('patient_id');
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->distinct('patient_id')->count('patient_id');
}
function getTodayPatient(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('admission_date', date('Y-m-d'))->distinct('patient_id')->count('patient_id');
}
function getYesterdayPatient(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereDate('admission_date', date('Y-m-d', strtotime('-1 day')))->distinct('patient_id')->count('patient_id');
}
function getThisMonthPatient(){
- return $this->sampleModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date('Y-m-01 00:00:00'), date('Y-m-t 23:59:59')])->distinct('patient_id')->count('patient_id');
}
function getPreviousMonthPatient(){
- return $this->sampleModel::with(['patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::with(['patient'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date("Y-m-d 00:00:00", strtotime("first day of previous month")), date("Y-m-d 23:59:59", strtotime("last day of previous month"))])->distinct('patient_id')->count('patient_id');
}
function getLastYearPatient(){
- return $this->sampleModel::with(['patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::with(['patient'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date('Y-01-01 00:00:00', strtotime('-1 year')), date('Y-12-31 23:59:59', strtotime('-1 year'))])->distinct('patient_id')->count('patient_id');
}
function getThisYearPatient(){
- return $this->sampleModel::with(['patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->sampleModel::with(['patient'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->whereBetween('admission_date', [date('Y-01-01 00:00:00'), date('Y-12-31 23:59:59')])->distinct('patient_id')->count('patient_id');
}
function getTotalInvoice(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->count();
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->count();
}
function getTotalPaidInvoice(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('balance', 0)->count();
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('balance', 0)->count();
}
function getTotalUnpaidInvoice(){
- return $this->invoiceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('balance', '>', 0)->count();
+ return $this->invoiceModel::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->where('balance', '>', 0)->count();
}
function getSampleSourceChart($period = 2){
- $samplePeriodCondition = " and s.lab_id = ".$this->baseLabId;
+ $samplePeriodCondition = " and s.organization_id = ".$this->baseOrganizationId;
if($period == 1) $samplePeriodCondition.= " and date(s.admission_date)='".date('Y-m-d')."'"; // today
if($period == 2) $samplePeriodCondition.= " and s.admission_date BETWEEN '".date('Y-m-01 00:00:00')."' AND '".date('Y-m-t 23:59:59')."'"; // this month
if($period == 3) $samplePeriodCondition.= " and s.admission_date BETWEEN '".date('Y-01-01 23:59:59')."' AND '".date('Y-12-31 23:59:59')."'"; // this year
@@ -422,7 +420,7 @@ class DashboardController extends Controller
) sample
ON sample.sample_source_id = ss.`id`
WHERE ss.`record_status_id` = 1
- AND ss.`lab_id` = ".$this->baseLabId."
+ AND ss.`organization_id` = ".$this->baseOrganizationId."
");
$sampleSourceDataArray = [];
foreach ($sampleSourceData as $data){
@@ -458,7 +456,7 @@ class DashboardController extends Controller
FROM samples s
WHERE YEAR(s.`admission_date`) between ".$fromYear." and ".$toYear."
AND s.`record_status_id` = 1
- AND s.`lab_id` = ".$this->baseLabId."
+ AND s.`organization_id` = ".$this->baseOrganizationId."
GROUP BY MONTH(s.`admission_date`), YEAR(s.`admission_date`) ");
return $sampleByYear;
}
@@ -482,14 +480,14 @@ class DashboardController extends Controller
sum(r.bank_repayment_amount) as total_bank_paid,
0 as total_owe
from repayments r
- inner join invoices inv on inv.id = r.invoice_id and r.lab_id = inv.lab_id and inv.record_status_id = 1
- inner join samples s on s.`id` = inv.`sample_id` and s.`lab_id` = inv.`lab_id` and s.`record_status_id` = 1
- inner join patients p on p.`id` = s.`patient_id` and p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss ON ss.id = s.`sample_source_id` AND ss.`lab_id` = s.`lab_id`
+ inner join invoices inv on inv.id = r.invoice_id and r.organization_id = inv.organization_id and inv.record_status_id = 1
+ inner join samples s on s.`id` = inv.`sample_id` and s.`organization_id` = inv.`organization_id` and s.`record_status_id` = 1
+ inner join patients p on p.`id` = s.`patient_id` and p.`organization_id` = s.`organization_id`
+ INNER JOIN sample_sources ss ON ss.id = s.`sample_source_id` AND ss.`organization_id` = s.`organization_id`
INNER JOIN physicians ps ON ps.`id` = s.`physician_id`
where r.`record_status_id` = 1
AND DATE(r.repayment_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- and r.lab_id= ".$this->baseLabId."
+ and r.organization_id= ".$this->baseOrganizationId."
group by r.`repayment_date`,
ss.`name_en`,
p.`name_en`,
@@ -515,14 +513,14 @@ class DashboardController extends Controller
$current = DB::table('samples')
->selectRaw('MONTH(admission_date) as month, COUNT(*) as total')
->whereYear('admission_date', $thisYear)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->groupBy('month')
->pluck('total', 'month');
$previous = DB::table('samples')
->selectRaw('MONTH(admission_date) as month, COUNT(*) as total')
->whereYear('admission_date', $lastYear)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->groupBy('month')
->pluck('total', 'month');
@@ -547,14 +545,14 @@ class DashboardController extends Controller
$current = DB::table('invoices')
->selectRaw('MONTH(invoice_date) as month, SUM(gross_total) as total')
->whereYear('invoice_date', $thisYear)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->groupBy('month')
->pluck('total', 'month');
$previous = DB::table('invoices')
->selectRaw('MONTH(invoice_date) as month, SUM(gross_total) as total')
->whereYear('invoice_date', $lastYear)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->groupBy('month')
->pluck('total', 'month');
@@ -585,13 +583,13 @@ class DashboardController extends Controller
FROM samples s
WHERE s.`record_status_id` = 1
and year(s.admission_date) = ".$thisYear."
- AND s.lab_id = ".$this->baseLabId."
+ AND s.organization_id = ".$this->baseOrganizationId."
GROUP BY s.`sample_source_id`
) sample
ON sample.sample_source_id = ss.`id`
WHERE ss.`record_status_id` = 1
- AND ss.`lab_id` = ".$this->baseLabId."
+ AND ss.`organization_id` = ".$this->baseOrganizationId."
ORDER BY total_samples DESC
LIMIT 10
");
@@ -615,13 +613,13 @@ class DashboardController extends Controller
INNER JOIN departments sd ON sd.id = st.`department_id`
WHERE s.`record_status_id` = 1
and year(s.admission_date) = ".$thisYear."
- AND s.lab_id = ".$this->baseLabId."
+ AND s.organization_id = ".$this->baseOrganizationId."
GROUP BY st.`department_id`
) sample
ON sample.department_id = d.`id`
WHERE d.`record_status_id` = 1
- AND d.`lab_id` = ".$this->baseLabId."
+ AND d.`organization_id` = ".$this->baseOrganizationId."
ORDER BY d.`name_en`
");
return response()->json($samplePanelData);
diff --git a/app/Http/Controllers/DepartmentController.php b/app/Http/Controllers/DepartmentController.php
deleted file mode 100644
index 9ac9dcf..0000000
--- a/app/Http/Controllers/DepartmentController.php
+++ /dev/null
@@ -1,108 +0,0 @@
-model = $department;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_department'])) return redirect(url('my-profile'));
- $standardDepartments = $this->model::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'is_standard' => 1])->get(['id','name_en'])->unique('name_en');
- $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
- $departments = $this->model::query()->with(['samples'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($departments) use($request){
- $departments->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy('weight','asc')->paginate(config('labis.pagination.perpage', 10));
- return view('department', ['departments' => $departments, 'labs' => $this->labs, 'standardDepartments' => $standardDepartments]);
- }
-
- public function save(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_department'])) return false;
- $validator = \Validator::make($request->all(), ['name_en' => 'required']);
- if ($validator->fails()){
- return response()->json(['success' => false, 'message' => __('department.create_fail'), 'errors' => $validator->errors()->all()]);
- }
-
- $new = $this->model::query()->firstOrNew(['name_en' => $request->name_en, 'lab_id' => $this->baseLabId]);
- $new->name_en = $request->name_en;
- $new->weight = $request->weight;
- $new->lab_id = $this->baseLabId;
- $new->created_at = date('Y-m-d H:i:s');
- $new->created_by = Auth::user()->id;
- $new->record_status_id = RecordStatusEnum::ACTIVE;
- $new->save();
-
- return response()->json(['success' => true, 'message' => __('department.create_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('department.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_department'])) return false;
- $validator = \Validator::make($request->all(), [
- 'name_en' => 'required',
- 'weight' => 'nullable'
- ]);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('department.update_fail'), 'errors' => $validator->errors()->all()]);
- $data = array(
- 'name_en' => $request->name_en,
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- $this->model::query()->where('id', $request->uid)->update($data);
- return response()->json(['success' => true, 'message' => __('department.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('department.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $department = $this->model::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('department.get_success'), 'data' => $department]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('department.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_department'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('department.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('department.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('department.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('department.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php
deleted file mode 100644
index 03664a7..0000000
--- a/app/Http/Controllers/InvoiceController.php
+++ /dev/null
@@ -1,327 +0,0 @@
-model = $invoiceModel;
- $this->sampleModel = $sampleModel;
- $this->invoiceDetailModel = $invoiceDetailModel;
- $this->patientModel = $patientModel;
- $this->laboratoryConfigures = new LabConfigure();
- $this->physicianModel = $physicianModel;
-
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- $this->labs = parent::getAccessAbleLabs();
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_invoice'])) return redirect(url('my-profile'));
- $recordStatusConditions = Auth::id()==1 ? [RecordStatusEnum::ACTIVE , RecordStatusEnum::DELETE] : [RecordStatusEnum::ACTIVE];
-
- $oweInvoices = $this->model::with(['sample.patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->where('balance','>', 0)->get();
- $physicians = $this->physicianModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
-
- $invoices = $this->model::with(['sample','repayments'])
- ->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->from_date) && !empty($request->to_date), function ($inv) use ($request){
- $inv->whereBetween('invoice_date',[date('Y-m-d',strtotime($request->from_date)), date('Y-m-d',strtotime($request->to_date))]);
- })
- ->when(isset($request->physician) && !empty($request->physician), function($inv) use ($request){
- $inv->whereIn('sample_id', $this->sampleModel::query()->where('physician_id', $request->physician)->pluck('id'));
- })
- ->when(!empty(trim($request->kword)), function ($inv) use($request, $recordStatusConditions){
- $inv->whereRaw("replace(invoice_code, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
- ->orWhereIn('sample_id', $this->sampleModel::query()
- ->whereIn('patient_id', $this->patientModel::query()
- ->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
- ->orWhereRaw("replace(phone_number, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
- ->orWhere('patient_uuid','like','%'.$request->kword.'%')->pluck('id')->toArray()
- )->orwhereRaw("replace(sample_number, ' ','') like '%".str_replace(" ","",$request->kword)."%'")->pluck('id')->toArray()
- )->where('lab_id', $this->baseLabId)->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions);
- })->orderBy('invoice_code','desc')->paginate(20);
- if(Auth::id()==1){
- //dd($invoices->pluck('repayments'));
- }
- return view('v_invoice.invoice', ['invoices' => $invoices, 'labSettings' => (object) $this->location(), 'oweInvoices' => $oweInvoices, 'physicians' => $physicians]);
- }
-
- public function create($sample_id = null){
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_invoice'])) return redirect(url('my-profile'));
- $samples = $this->sampleModel::query()->with('invoice')
- ->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->whereDoesntHave('invoice')->get();
- return view('v_invoice.new_invoice', [
- 'samples' => $samples,
- 'sample_id' => $sample_id
- ]);
- }
-
- public function store(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_invoice'])) return redirect(url('my-profile'));
- $invoiceNumber = $this->generateAutoId($request->invoice_date);
- $is_hide_discount = isset($request->is_hide_discount) ? 1: 0;
- $requests = collect($request)->merge(['lab_id'=>$this->baseLabId, 'invoice_code' => $invoiceNumber, 'is_hide_discount' => $is_hide_discount, 'exchange_rate' => ((object) $this->location())->exchange_rate])->except(['first_paid_date']);
- $invoice = $this->model::query()->create($requests->all());
- $invoiceDetailRequest = collect($request->test_sample_id);
- $items = $invoiceDetailRequest->map(function ($row, $key) use($request, $invoice) {
- $invoiceDetailRow = $this->invoiceDetailModel::query()->create([
- 'invoice_id' => $invoice->id,
- 'test_sample_id' => $request->test_sample_id[$key],
- 'discount_type' => $request->item_discount_type[$key],
- 'discount' => $request->item_discount[$key],
- 'test_name' => $request->test_name[$key],
- 'qty' => 1,
- 'unit_price' => $request->unit_price[$key],
- ]);
- return [];
- });
- DB::commit();
- $request->session()->flash('message','invoice-success');
- if(isset($request->save_print_invoice) && $request->save_print_invoice=='save_preview_invoice'){
- return redirect('invoice/edit/'.$invoice->id.'?print');
- }
- return redirect()->back();
- } catch (\Exception $e){
- DB::rollBack();
- $request->session()->flash('message','invoice-error');
- return redirect()->back();
- }
- }
-
- public function edit($id){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_invoice', 'update_invoice'])) return redirect(url('my-profile'));
- $invoice = $this->model::query()->with('invoiceDetail.testSample.sample.department','creator','modifier')->where(['lab_id' => $this->baseLabId, 'id' => $id])->first();
-
- $samples = $this->sampleModel::query()->where('id', $invoice->sample_id)->first();
-
- $refreshItemItem = $this->refreshItemItem($invoice->sample_id);
-
-
- $labConfigures = $this->laboratoryConfigures::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get()->toArray();
-
- return view('v_invoice.edit_invoice', [
- 'samples' => [$samples],
- 'invoice' => $invoice,
- 'invoice_id' => $id,
- 'sample_id' => $invoice->sample_id,
- 'labSettings' => (object) $this->location(),
- 'refreshItemItem' => $refreshItemItem,
- 'labConfigures' => $labConfigures,
- 'is_need_refresh_invoice' => (count($refreshItemItem) == count($invoice->invoiceDetail)) ? 0 : 1
- ]);
- }
-
- public function update(Request $invoiceUpdateRequest){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_invoice'])) return redirect(url('my-profile'));
- $is_hide_discount = isset($invoiceUpdateRequest->is_hide_discount) ? 1: 0;
- $requests = collect($invoiceUpdateRequest)->only(['invoice_note','total','discount','gross_total','deposit' ,'bank_deposit', 'balance','invoice_date','exchange_rate'])->merge(['is_hide_discount' => $is_hide_discount, 'updated_by' => Auth::id(), 'updated_at' => date('Y-m-d H:i:s')]);
- $invoice = $this->model::query()->where(['id' => $invoiceUpdateRequest->uid, 'lab_id' => $this->baseLabId])->update($requests->all());
- $invoiceDetailRequest = collect($invoiceUpdateRequest->test_sample_id);
- $items = $invoiceDetailRequest->map(function ($row, $key) use($invoiceUpdateRequest) {
- $invDetail = $this->invoiceDetailModel::query()->where(['invoice_id' => $invoiceUpdateRequest->uid, 'test_sample_id' => $invoiceUpdateRequest->test_sample_id[$key]])->first();
- if (empty($invDetail)) {
- $invoiceDetailRow = $this->invoiceDetailModel::query()->create([
- 'invoice_id' => $invoiceUpdateRequest->uid,
- 'test_sample_id' => $invoiceUpdateRequest->test_sample_id[$key],
- 'discount_type' => $invoiceUpdateRequest->item_discount_type[$key],
- 'discount' => $invoiceUpdateRequest->item_discount[$key],
- 'test_name' => $invoiceUpdateRequest->test_name[$key],
- 'weight' => $invoiceUpdateRequest->weight[$key],
- 'qty' => 1,
- 'unit_price' => $invoiceUpdateRequest->unit_price[$key],
- ]);
- }
- else{
- $invoiceDetailRow = $this->invoiceDetailModel::query()->where([
- 'invoice_id' => $invoiceUpdateRequest->uid,
- 'test_sample_id' => $invoiceUpdateRequest->test_sample_id[$key]
- ])->update([
- 'weight' => $invoiceUpdateRequest->weight[$key]
- ]);
- }
- return [];
- });
- $this->invoiceDetailModel::query()->where('invoice_id', $invoiceUpdateRequest->uid)
- ->whereNotIn('test_sample_id', $invoiceUpdateRequest->test_sample_id)->delete();
- DB::commit();
- $invoiceUpdateRequest->session()->flash('message','invoice-success');
- return redirect()->back();
- } catch (\Exception $e){
- DB::rollBack();
- $invoiceUpdateRequest->session()->flash('message','invoice-error');
- return redirect()->back();
- }
- }
-
- /** Perform by ajax function
- * @param Request $request
- * @return \Illuminate\Http\JsonResponse
- */
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_invoice'])) return false;
- $invoice = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
- $invoice->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('invoice.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('invoice.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('invoice.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('invoice.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function getSampleTest($sampleId){
- try{
- $patientTypes = $this->sampleModel::query()->with([])->where([
- BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
- 'lab_id' => $this->baseLabId
- ])->get();
- return response()->json(['success'=> true , 'data' => $patientTypes]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
- }
- }
-
- public function generateAutoId($invoiceDate){
- $prefix = date('y',strtotime($invoiceDate));
- $invoiceCount = $this->model::query()->where('lab_id', $this->baseLabId)->whereRaw('year(invoice_date) ="'. date('Y',strtotime($invoiceDate)).'"')->count();
- return 'I-'.$this->base['short_name'].'-'.$prefix.'-'.(str_pad(($invoiceCount+1),5,'0',STR_PAD_LEFT));
- }
-
- public function paid($id){
- DB::beginTransaction();
- try{
- $invoice = $this->model::query()->find($id);
- $invoice->balance = 0;
- $invoice->deposit = $invoice->gross_total;
- $invoice->first_paid_date = date('Y-m-d');
- $invoice->save();
- DB::commit();
- return response()->json(['success' => true, 'message' => __('This invoice already paid')]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('Failed while trying to paid on invoice'), 'errors' => $e->getMessage()]);
- }
- }
-
- function refreshItemItem($sampleId){
- try{
- $resultItems = DB::select('
- SELECT
- d.`id` AS department_id,
- d.`name_en` AS department_name,
- d.weight as dweight,
- st.`id` AS sample_type_id,
- st.weight as sweight,
- st.`name_en` AS sample_type,
- ts.`id` AS test_sample_id,
- ts.`heading_id` AS parent_id,
- ts.`field_type`,
- ts.`usd_price`,
- ts.group_result,
- ts.description,
- t.`id` AS test_id,
- t.`name_en` AS test_name,
- tr.id as test_result_id,
- pct.`commission_type`,
- ifnull(pct.`commission_rate`, 0.00) as commission_rate,
- ifnull(pct.`partner_price`, 0.00) as partner_price,
- ts.weight
- FROM samples s
- INNER JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- INNER JOIN test_samples ts
- ON ts.id = tr.`test_sample_id`
- and ts.lab_id = tr.lab_id
- INNER JOIN tests t
- ON t.`id` = ts.`test_id`
- INNER JOIN sample_types st
- ON st.`id` = ts.`sample_type_id`
- INNER JOIN departments d
- ON d.`id` = st.`department_id`
- LEFT JOIN `physician_commisssion` AS pct
- ON pct.`test_sample_id` = ts.`id`
- AND pct.`physician_id` = s.`physician_id`
- WHERE s.`id` = '.$sampleId.'
- AND s.`lab_id`= '.$this->baseLabId.'
- AND tr.`record_status_id` = '.BaseModel::RECORD_STATUS_ACTIVE.'
- AND LENGTH(ts.group_result)>0
- AND ts.usd_price>0
- ORDER BY
- d.`weight`,
- st.`weight`,
- ts.`weight`');
- $departmentArray = array();
- foreach ($resultItems as $row){
- $net_amount = number_format((((!empty($row->commission_type) ? $row->commission_type : ((object) $this->location())->discount_type)) ==2 ? (($row->usd_price - $row->partner_price) - $row->commission_rate) :
- (($row->usd_price - $row->partner_price) * (1-$row->commission_rate/100))),2);
- $testItemArray = array(
- 'test_sample_id' => (string)$row->test_sample_id,
- 'test_id' => $row->test_id,
- 'test_name' => $row->test_name,
- 'closed_parent_id' => (string) (int)$row->parent_id,
- 'field_type' => (string) $row->field_type,
- 'usd_price' => $row->usd_price,
- 'group_result' => (string) $row->group_result,
- 'item_discount_type' => (!empty($row->commission_type) ? $row->commission_type : ((object) $this->location())->discount_type),
- 'item_discount_rate' => $row->commission_rate,
- 'item_discount' => $net_amount,
- 'discount_price' => ($row->usd_price - $net_amount)
- );
- $departmentArray[] = $testItemArray;
- }
- return $departmentArray;
- } catch (\Exception $e){
- return $e->getMessage();
- }
- }
-
-}
diff --git a/app/Http/Controllers/LabController.php b/app/Http/Controllers/LabController.php
deleted file mode 100644
index cd222f9..0000000
--- a/app/Http/Controllers/LabController.php
+++ /dev/null
@@ -1,486 +0,0 @@
-model = $model;
- $this->testSampleModel = $testSampleModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['system_settings'])) return redirect(url('my-profile'));
- $lab = $this->model::query()->find($this->baseLabId);
- return view('laboratory', ['info' => $lab]);
- }
-
- public function save(Request $request){
- try {
-
- $validator = \Validator::make($request->all(), [
- 'lab_name_en' => 'required',
- 'lab_code' => 'required|max:5',
- 'sample_number' => 'required',
- 'patient_code' => 'required',
- 'start_date' => 'required',
- 'end_date' => 'nullable'
- ]);
- if ($validator->fails()) {
- return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $validator->errors()->all()]);
- }
- $data = array(
- 'name_en' => $request->lab_name_en,
- 'name_kh' => $request->lab_name_kh,
- 'short_name' => $request->lab_code,
- 'sample_number' => $request->sample_number,
- 'patient_code' => $request->patient_code,
- 'phone_number' => $request->phone_number,
- 'lab_category_id' => $request->lab_category_id,
- 'is_auto_make_invoice' => $request->is_auto_make_invoice,
- 'email' => $request->email,
- 'shareable_lab_result' => isset($request->shareable_lab_result) ? 1 : 0,
- 'allow_external_request' => isset($request->allow_external_request) ? 1 : 0,
- 'is_hide_comission_percentage' => isset($request->is_hide_comission_percentage) ? $request->is_hide_comission_percentage : 0,
- 'is_hide_inv_discount' => 0,
- 'address_en' => $request->address_en,
- 'address_kh' => $request->address_kh,
- 'start_date' => ($request->start_date ? date('Y-m-d H:i:s', strtotime($request->start_date)) : null),
- 'end_date' => ($request->end_date ? date('Y-m-d H:i:s', strtotime($request->end_date)) : null),
- 'created_at' => date('Y-m-d H:i:s'),
- 'created_by' => Auth::id()
- );
- $this->model::query()->insert($data);
- return response()->json(['success' => true, 'message' => __('laboratory.create_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function updateInfo(Request $request){
- try {
- $validator = \Validator::make($request->all(), [
- 'name_en' => 'required',
- 'name_kh' => 'required',
- 'short_name' => 'required|max:3'
- ]);
- if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
- $data = array(
- 'name_en' => $request->name_en,
- 'name_kh' => $request->name_kh,
- 'short_name' => $request->short_name,
- 'email' => $request->email,
- 'phone_number' => $request->phone_number,
- 'address_en' => $request->address_en,
- 'address_kh' => $request->address_kh,
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- $this->model::query()->where('id', $this->baseLabId)->update($data);
- return redirect()->back();
- //return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
- } catch (\Exception $e){
- dd($e);
- //return redirect()->back();
- return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try {
-
- $validator = \Validator::make($request->all(), [
- 'lab_name_en' => 'required',
- 'lab_code' => 'required|max:5',
- 'sample_number' => 'required',
- 'patient_code' => 'required',
- 'start_date' => 'required',
- 'end_date' => 'nullable'
- ]);
- if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
- $data = array(
- 'name_en' => $request->lab_name_en,
- 'name_kh' => $request->lab_name_kh,
- 'short_name' => $request->lab_code,
- 'sample_number' => $request->sample_number,
- 'patient_code' => $request->patient_code,
- 'phone_number' => $request->phone_number,
- 'lab_category_id' => $request->lab_category_id,
- 'is_auto_make_invoice' => $request->is_auto_make_invoice,
- 'email' => $request->email,
- 'shareable_lab_result' => isset($request->shareable_lab_result) ? 1 : 0,
- 'allow_external_request' => isset($request->allow_external_request) ? 1 : 0,
- 'is_hide_comission_percentage' => isset($request->is_hide_comission_percentage) ? $request->is_hide_comission_percentage : 0,
- 'address_en' => $request->address_en,
- 'address_kh' => $request->address_kh,
- 'start_date' => ($request->start_date ? date('Y-m-d H:i:s', strtotime($request->start_date)) : null),
- 'end_date' => ($request->end_date ? date('Y-m-d H:i:s', strtotime($request->end_date)) : null),
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- $this->model::query()->where('id', $request->lab_id)->update($data);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $lab_id = $request->lab_id;
- $lab = $this->model::query()->where('id', $lab_id)->get()->first();
- return response()->json(['success' => true, 'message' => __('laboratory.get_success'), 'data' => $lab]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('laboratory.get_fail'), 'errors' => $e->getMessage()]);
- }
-
- }
-
- public function delete(Request $request){
- try{
- $this->model::query()->where('id', $request->lab_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('laboratory.delete_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('laboratory.delete_fail'), 'errors' => $e->getMessage()]);
- }
-
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->lab_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('laboratory.restore_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('laboratory.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function profile(){
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information'])) return redirect(url('my-profile'));
- $lab = $this->model::query()->find($this->baseLabId);
- return view('lab_profile', ['info' => $lab]);
- }
-
- public function labSettingSetters(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['system_settings'])) return redirect(url('my-profile'));
- $validator = \Validator::make($request->all(), [
- 'sample_number' => 'required|integer',
- 'patient_code' => 'required|integer',
- 'technician_label' => 'nullable',
- 'discount_type' => 'required|integer'
- ]);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array(
- 'sample_number' => $request->sample_number,
- 'currency' => $request->currency,
- 'patient_code' => $request->patient_code,
- 'technician_label' => $request->technician_label,
- 'discount_type' => $request->discount_type,
- 'phone_number' => $request->phone_number,
- 'email' => $request->email,
- 'exchange_rate' => $request->exchange_rate,
- //'is_hide_inv_discount' => $request->is_hide_inv_discount,
- 'abnormal_text_color' => $request->abnormal_text_color,
- 'show_result_footer' => $request->show_result_footer,
- 'abnormal_result_font_weight' => $request->abnormal_result_font_weight,
- 'result_header_id' => $request->result_header_id,
- 'is_auto_make_invoice' => $request->is_auto_make_invoice,
- 'invoice_template_id' => $request->invoice_template_id
- ));
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function uploadImage(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'avatar_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('logo' => $imageName));
- $image->move(public_path('storage/images/avatars/labs'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeLabLogo(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->logo)) {
- if (file_exists(public_path('storage/images/avatars/labs/' . $lab->logo))) {
- unlink(public_path('storage/images/avatars/labs/' . $lab->logo));
- $lab->logo = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function saveLabConfigure(Request $request){
- try{
- $validator = \Validator::make($request->all(), [
- 'attribute_code' => 'required|string',
- 'attribute_value' => 'required|string'
- ]);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
- $labSetting = $this->labConfigureModel::query()->firstOrNew(['atrribute_code' => $request->attribute_code, 'lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE]);
- $labSetting->assigned_attribute_value = $request->attribute_value;
- $labSetting->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $labSetting]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function initLabData(){
- return view('clone_lab',['labs' => $this->labs]);
- }
-
- function getLabData($labId){
- try{
- $department = Department::query()->with([
- 'samples',
- 'samples.testSamples',
- 'samples.testSamples.testValues',
- 'samples.testSamples.organisms',
- 'samples.testSamples.organisms.antibiotics'
- ])->where(['lab_id' => $labId, BaseModel::RECORD_STATUS_FIELD => 1])->get()->toArray();
- return response()->json(['success' => true, 'data' => $department]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => 'Error while retrieving lab data.']);
- }
- }
-
- /** Verify Image */
-
- public function uploadVerifyImage(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'verify_label_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('verify_label' => $imageName));
- $image->move(public_path('storage/images/avatars/labs'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeVerifyImage(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->verify_label)) {
- if (file_exists(public_path('storage/images/avatars/labs/' . $lab->verify_label))) {
- unlink(public_path('storage/images/avatars/labs/' . $lab->verify_label));
- $lab->verify_label = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- function updateHeading(){
- $targetLabTestSample = TestSample::query()->where(['lab_id' => 18,'sample_type_id'=>397, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->where('heading_id','>',0)->get();
- foreach ($targetLabTestSample as $targetTestSample){
- dd($targetTestSample);
- $source = TestSample::query()->where(['id' => $targetTestSample->heading_id, 'lab_id' => 29])->get();//->first();
- dd($source);
- $target = TestSample::query()->where(['lab_id' => 18, 'test_id' => $source->test_id , 'sample_type_id' => $targetTestSample->sample_type_id ])->get()->first();
-
- //TestSample::query()->where(['id' => $targetTestSample->id])->update([ 'heading_id' => $target->id]);
- }
- }
-
-
- public function uploadAlternativeLogo(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'alternative_logo_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('alternative_logo' => $imageName));
- $image->move(public_path('storage/images/avatars/labs/alternative_logo'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeAlternativeLogo(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->alternative_logo)) {
- if (file_exists(public_path('storage/images/avatars/labs/alternative_logo/' . $lab->alternative_logo))) {
- unlink(public_path('storage/images/avatars/labs/alternative_logo/' . $lab->alternative_logo));
- $lab->alternative_logo = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-// Alternative Verify Signature
- public function uploadAlterVerifySignature(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'alter_verify_sign_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('alter_verify_sign' => $imageName));
- $image->move(public_path('storage/images/avatars/labs'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeAlterVerifySignature(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->alter_verify_sign)) {
- if (file_exists(public_path('storage/images/avatars/labs/' . $lab->alter_verify_sign))) {
- unlink(public_path('storage/images/avatars/labs/' . $lab->alter_verify_sign));
- $lab->alter_verify_sign = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-// Alternative Labtech Signature
- public function uploadAlterLabtechSignature(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'alter_labtech_sign_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('alter_labtech_sign' => $imageName));
- $image->move(public_path('storage/images/avatars/labs'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeAlterLabtechSignature(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->alter_labtech_sign)) {
- if (file_exists(public_path('storage/images/avatars/labs/' . $lab->alter_labtech_sign))) {
- unlink(public_path('storage/images/avatars/labs/' . $lab->alter_labtech_sign));
- $lab->alter_labtech_sign = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- /** default footer */
- public function uploadDefaultFooter(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'default_footer_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('footer' => $imageName));
- $image->move(public_path('storage/images/avatars/labs/default_footer'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeDefaultFooter(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->footer)) {
- if (file_exists(public_path('storage/images/avatars/labs/default_footer/' . $lab->footer))) {
- unlink(public_path('storage/images/avatars/labs/default_footer/' . $lab->footer));
- $lab->footer = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
- /* default footer end */
-
- /** alternative footer */
- public function uploadAlternativeFooter(Request $request){
- try {
- $image = $request->file('image');
- $imageName = 'alternative_footer_'.$this->baseLabId.'.' . $image->getClientOriginalExtension();
- $lab = $this->model::query()->where('id', $this->baseLabId)->first();
- $lab->update(array('alternative_footer' => $imageName));
- $image->move(public_path('storage/images/avatars/labs/alternative_footer'), $imageName);
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function removeAlternativeFooter(Request $request){
- try {
- $lab = $this->model::query()->find($this->baseLabId);
- if(!empty($lab->alternative_footer)) {
- if (file_exists(public_path('storage/images/avatars/labs/alternative_footer/' . $lab->alternative_footer))) {
- unlink(public_path('storage/images/avatars/labs/alternative_footer/' . $lab->alternative_footer));
- $lab->alternative_footer = null;
- }
- }
- $lab->save();
- return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
- }catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
- /* alternative footer end */
-
-}
diff --git a/app/Http/Controllers/OrganismController.php b/app/Http/Controllers/OrganismController.php
index dced58e..a51d2cb 100644
--- a/app/Http/Controllers/OrganismController.php
+++ b/app/Http/Controllers/OrganismController.php
@@ -6,11 +6,6 @@ use App\Http\Controllers\Helper\GlobalController;
use App\Http\Requests\TestSampleCreateRequest;
use App\Models\BaseModel;
use App\Models\Organism;
-use App\Models\PatientType;
-use App\Models\SampleType;
-use App\Models\Test;
-use App\Models\TestNormalValue;
-use App\Models\TestSample;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
@@ -20,19 +15,19 @@ class OrganismController extends Controller
{
protected $model;
- protected $baseLabId;
+ protected $baseOrganizationId;
protected $labs;
public function __construct(Organism $organism){
$this->model = $organism;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
public function index(Request $request){
if(!GlobalController::user_can(Auth::user()->role_id, ['view_organism'])) return redirect(url('my-profile'));
$organisms = $this->model::with(['lab'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- //->where('lab_id', $this->baseLabId)
+ //->where('organization_id', $this->baseOrganizationId)
->when(!empty($request->kword), function ($organisms) use($request){
$organisms->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
})->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
@@ -48,7 +43,7 @@ class OrganismController extends Controller
$new->name_en = $request->name_en;
$new->weight = $request->weight;
$new->is_bold = $request->is_bold;
- $new->lab_id = $this->baseLabId;
+ $new->organization_id = $this->baseOrganizationId;
$new->created_at = date('Y-m-d H:i:s');
$new->created_by = Auth::id();
$new->record_status_id = RecordStatusEnum::ACTIVE;
diff --git a/app/Http/Controllers/OrganizationController.php b/app/Http/Controllers/OrganizationController.php
new file mode 100644
index 0000000..660cc42
--- /dev/null
+++ b/app/Http/Controllers/OrganizationController.php
@@ -0,0 +1,245 @@
+model = $model;
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
+ }
+
+ public function index(Request $request){
+ $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
+ $labs = $this->model::query()->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
+ ->when(Auth::id()!=1, function ($labs){
+ $labs->whereIn('id', $this->labs->pluck('id'));
+ })->when(!empty($request->kword), function ($labs) use($request){
+ $labs->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(name_kh, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhere('address_en','like','%'.$request->kword.'%')
+ ->orWhere('address_kh','like','%'.$request->kword.'%');
+ })->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('labis.pagination.perpage', 10));
+ return view('laboratory', ['laboratories' => $labs]);
+ }
+
+ public function save(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'lab_name_en' => 'required',
+ 'lab_code' => 'required|max:10',
+ 'sample_number' => 'required',
+ 'patient_code' => 'required',
+ 'start_date' => 'required',
+ 'end_date' => 'nullable'
+ ]);
+ if ($validator->fails()) {
+ return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $validator->errors()->all()]);
+ }
+ $data = array(
+ 'name_en' => $request->lab_name_en,
+ 'name_kh' => $request->lab_name_kh,
+ 'code' => $request->lab_code,
+ 'phone_number' => $request->phone_number,
+ 'email' => $request->email,
+ 'address_en' => $request->address_en,
+ 'address_kh' => $request->address_kh,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'created_by' => Auth::id()
+ );
+ $this->model::query()->insert($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.create_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function updateInfo(Request $request){
+ try {
+ $validator = \Validator::make($request->all(), [
+ 'name_en' => 'required',
+ 'name_kh' => 'required',
+ 'short_name' => 'required|max:10'
+ ]);
+ if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
+ $data = array(
+ 'name_en' => $request->name_en,
+ 'name_kh' => $request->name_kh,
+ 'short_name' => $request->short_name,
+ 'email' => $request->email,
+ 'phone_number' => $request->phone_number,
+ 'address_en' => $request->address_en,
+ 'address_kh' => $request->address_kh,
+ 'updated_at' => date('Y-m-d H:i:s'),
+ 'updated_by' => Auth::id()
+ );
+ $this->model::query()->where('id', $this->baseOrganizationId)->update($data);
+ return redirect()->back();
+ //return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
+ } catch (\Exception $e){
+ dd($e);
+ //return redirect()->back();
+ return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function update(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'lab_name_en' => 'required',
+ 'lab_code' => 'required|max:5',
+ 'sample_number' => 'required',
+ 'patient_code' => 'required',
+ 'start_date' => 'required',
+ 'end_date' => 'nullable'
+ ]);
+ if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
+ $data = array(
+ 'name_en' => $request->lab_name_en,
+ 'name_kh' => $request->lab_name_kh,
+ 'short_name' => $request->lab_code,
+ 'sample_number' => $request->sample_number,
+ 'patient_code' => $request->patient_code,
+ 'phone_number' => $request->phone_number,
+ 'lab_category_id' => $request->lab_category_id,
+ 'is_auto_make_invoice' => $request->is_auto_make_invoice,
+ 'email' => $request->email,
+ 'shareable_lab_result' => isset($request->shareable_lab_result) ? 1 : 0,
+ 'allow_external_request' => isset($request->allow_external_request) ? 1 : 0,
+ 'is_hide_comission_percentage' => isset($request->is_hide_comission_percentage) ? $request->is_hide_comission_percentage : 0,
+ 'address_en' => $request->address_en,
+ 'address_kh' => $request->address_kh,
+ 'start_date' => ($request->start_date ? date('Y-m-d H:i:s', strtotime($request->start_date)) : null),
+ 'end_date' => ($request->end_date ? date('Y-m-d H:i:s', strtotime($request->end_date)) : null),
+ 'updated_at' => date('Y-m-d H:i:s'),
+ 'updated_by' => Auth::id()
+ );
+ $this->model::query()->where('id', $request->organization_id)->update($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function get(Request $request){
+ try{
+ $organization_id = $request->organization_id;
+ $lab = $this->model::query()->where('id', $organization_id)->get()->first();
+ return response()->json(['success' => true, 'message' => __('laboratory.get_success'), 'data' => $lab]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.get_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function delete(Request $request){
+ try{
+ $this->model::query()->where('id', $request->organization_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::DELETE));
+ return response()->json(['success' => true, 'message' => __('laboratory.delete_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.delete_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function restore(Request $request){
+ try{
+ $this->model::query()->where('id', $request->organization_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE));
+ return response()->json(['success' => true, 'message' => __('laboratory.restore_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.restore_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function profile(){
+ if(!GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information'])) return redirect(url('my-profile'));
+ $organization = $this->model::query()->find($this->baseOrganizationId);
+ return view('organization_profile', ['info' => $organization]);
+ }
+
+ public function labSettingSetters(Request $request){
+ try{
+ if(!GlobalController::user_can(Auth::user()->role_id, ['system_settings'])) return redirect(url('my-profile'));
+ $validator = \Validator::make($request->all(), [
+ 'sample_number' => 'required|integer',
+ 'patient_code' => 'required|integer',
+ 'technician_label' => 'nullable',
+ 'discount_type' => 'required|integer'
+ ]);
+ if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
+ $lab = $this->model::query()->where('id', $this->baseOrganizationId)->first();
+ $lab->update(array(
+ 'sample_number' => $request->sample_number,
+ 'currency' => $request->currency,
+ 'patient_code' => $request->patient_code,
+ 'technician_label' => $request->technician_label,
+ 'discount_type' => $request->discount_type,
+ 'phone_number' => $request->phone_number,
+ 'email' => $request->email,
+ 'exchange_rate' => $request->exchange_rate,
+ //'is_hide_inv_discount' => $request->is_hide_inv_discount,
+ 'abnormal_text_color' => $request->abnormal_text_color,
+ 'show_result_footer' => $request->show_result_footer,
+ 'abnormal_result_font_weight' => $request->abnormal_result_font_weight,
+ 'result_header_id' => $request->result_header_id,
+ 'is_auto_make_invoice' => $request->is_auto_make_invoice,
+ 'invoice_template_id' => $request->invoice_template_id
+ ));
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
+ } catch (\Exception $e)
+ {
+ return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function uploadImage(Request $request){
+ try {
+ $image = $request->file('image');
+ $imageName = 'avatar_'.$this->baseOrganizationId.'.' . $image->getClientOriginalExtension();
+ $lab = $this->model::query()->where('id', $this->baseOrganizationId)->first();
+ $lab->update(array('logo' => $imageName));
+ $image->move(public_path('storage/images/avatars/labs'), $imageName);
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
+ }catch (\Exception $e){
+ return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function removeLabLogo(Request $request){
+ try {
+ $lab = $this->model::query()->find($this->baseOrganizationId);
+ if(!empty($lab->logo)) {
+ if (file_exists(public_path('storage/images/avatars/labs/' . $lab->logo))) {
+ unlink(public_path('storage/images/avatars/labs/' . $lab->logo));
+ $lab->logo = null;
+ }
+ }
+ $lab->save();
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
+ }catch (\Exception $e){
+ return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+}
diff --git a/app/Http/Controllers/PatientController.php b/app/Http/Controllers/PatientController.php
deleted file mode 100644
index 53eaa35..0000000
--- a/app/Http/Controllers/PatientController.php
+++ /dev/null
@@ -1,239 +0,0 @@
-model = $patientModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
-
- }
-
- function province(){
- return parent::province();
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_patient'])) return redirect(url('my-profile'));
- $provinces = $this->province();
- $patients = $this->model::with(['samples'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty(trim($request->kword)), function ($patients) use($request){
- $patients->whereRaw(
- "(replace(name_en, ' ', '') LIKE ? OR replace(phone_number, ' ', '') LIKE ? OR replace(patient_uuid, ' ', '') LIKE ? OR replace(khid_number, ' ', '') LIKE ?) and lab_id = ?",
- [
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- $this->baseLabId
- ]
- );
- })->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('patient', ['provinces' => $provinces, 'patients' => $patients, 'labSettings' => (object) $this->base]);
- }
-
- public function save(PatientCreateRequest $patientCreateRequest){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_patient'])) return false;
- $dob = $patientCreateRequest->dob;
- $datePart = explode("-",$dob);
- if($datePart[1]>12){
- $dob = $datePart[1].'-'.$datePart[0].'-'.$datePart[2];
- }
- $requests = collect($patientCreateRequest)->merge([
- 'lab_id' => $this->baseLabId,
- BaseModel::CREATED_AT_FIELD => date('Y-m-d H:i:s'),
- BaseModel::CREATED_BY_FIELD => Auth::id(),
- BaseModel::UPDATED_AT_FIELD => NULL,
- BaseModel::UPDATED_BY_FIELD => NULL,
- BaseModel::RECORD_STATUS_FIELD => BaseModel::RECORD_STATUS_ACTIVE
- ])->replace(
- [
- 'dob' => date('Y-m-d', strtotime($dob)),
- 'phone_number' => $patientCreateRequest->phone_number // preg_replace('/ /i', '', trim($patientCreateRequest->phone_number))
- ]);
-
- if(empty($patientCreateRequest->patient_uuid)) {
- $patientNumber = $this->generateAutoId(date('Y-m-d'));
- $requests = $requests->merge(['patient_uuid' => $patientNumber]);
- }
-
- $patient = $this->model::query()->create($requests->all());
- DB::commit();
- return response()->json(['success'=> true , 'message' => __('patient.create_success') , 'data' => $patient]);
- } catch (\Exception $e){
- DB::rollBack();
- Log::error($e);
- return response()->json(['success'=> false , 'message' => __('patient.create_fail') , 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(PatientUpdateRequest $patientUpdateRequest){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_patient'])) return false;
- $dob = $patientUpdateRequest->dob;
- $datePart = explode("-",$dob);
- if($datePart[1]>12){
- $dob = $datePart[1].'-'.$datePart[0].'-'.$datePart[2];
- }
-
- $requests = collect($patientUpdateRequest)->merge([
- BaseModel::UPDATED_AT_FIELD => date('Y-m-d H:i:s'),
- BaseModel::UPDATED_BY_FIELD => Auth::id()
- ])->replace([
- 'dob' => date('Y-m-d', strtotime($dob)),
- 'phone_number' => $patientUpdateRequest->phone_number // preg_replace('/ /i', '', trim($patientUpdateRequest->phone_number))
- ])->except(['patient_uuid','uid']);
- $patient = $this->model::query()->find($patientUpdateRequest->uid)->update($requests->all());
- DB::commit();
- return response()->json(['success'=> true , 'message' => __('patient.update_success'), 'data' => array('id' => $patientUpdateRequest->uid) ]);
- } catch (\Exception $e){
- DB::rollBack();
- Log::error($e);
- return response()->json(['success'=> false , 'message' => __('patient.update_fail'), 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function get(Request $request){
- try{
- $patient = $this->model::query()->find($request->uid);
- return response()->json(['success'=> true , 'message' => __('patient.get_success') , 'data' => $patient]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false , __('patient.get_fail'), 'errors' => $e->getMessage()]);
- }
-
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_patient'])) return false;
- $patient = $this->model::query()->find($request->uid);
- $patient->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success'=> true, 'message' => __('patient.delete_success'), 'data' => $patient]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false, 'message' => __('patient.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $patient = $this->model::query()->find($request->uid);
- $patient->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success'=> true, 'message' => __('patient.restore_success'), 'data' => $patient]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false, 'message' => __('patient.restore_success'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function search(Request $request)
- {
- try{
- $patients = $this->model::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
- ->when($request->kword!='', function($patients) use ($request) {
- $patients->whereRaw(
- "(replace(name_en, ' ', '') LIKE ? OR replace(phone_number, ' ', '') LIKE ? OR replace(patient_uuid, ' ', '') LIKE ? OR replace(khid_number, ' ', '') LIKE ?) and lab_id = ?",
- [
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- $this->baseLabId
- ]
- );
- })->orderBy('name_en','asc')->limit(config('labis.pagination.perpage', 10))->get();
- return response()->json(['success'=> true, __('patient.get_success'), 'data' => $patients]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false, __('patient.get_fail'), 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function patientSearchAjax(Request $request)
- {
- try{
- $provinces = $this->province();
- $patients = $this->model::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
- ->when($request->kword!='', function($patients) use ($request) {
- $patients->whereRaw(
- "(replace(name_en, ' ', '') LIKE ? OR replace(phone_number, ' ', '') LIKE ? OR replace(patient_uuid, ' ', '') LIKE ? OR replace(khid_number, ' ', '') LIKE ?) and lab_id = ?",
- [
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- '%' . str_replace(' ', '', $request->kword) . '%',
- $this->baseLabId
- ]
- );
- })->orderBy('name_en','asc')->paginate(config('labis.pagination.perpage', 10));
- return view('partials.patient_list', ['provinces' => $provinces, 'patients' => $patients, 'labSettings' => (object) $this->base]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false, __('patient.get_fail'), 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function generateAutoId($admissionDate){
- $prefix = date('y',strtotime($admissionDate));
- $patientCount = $this->model::query()->where('lab_id', $this->baseLabId)->whereRaw('year(created_at) ="'. date('Y',strtotime($admissionDate)).'"')->count();
- if($this->baseLabId==34) $patientCount = $patientCount+5; // solve problem when delete patient
- return 'P-'.$this->base['short_name'].'-'.$prefix.'-'.(str_pad(($patientCount+1),5,'0',STR_PAD_LEFT));
- }
-
-
- public function searchPatientToSelect2(Request $request){
- $patients = [];
- if(!empty(trim($request->term))){
- $patients = $this->model::query()
- ->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
- ->when(!empty(trim($request->term)), function ($patients) use($request){
- $patients->whereRaw(
- "(replace(name_en, ' ', '') LIKE ? OR replace(phone_number, ' ', '') LIKE ? OR replace(patient_uuid, ' ', '') LIKE ? OR replace(khid_number, ' ', '') LIKE ?) and lab_id = ?",
- [
- '%' . str_replace(' ', '', $request->term) . '%',
- '%' . str_replace(' ', '', $request->term) . '%',
- '%' . str_replace(' ', '', $request->term) . '%',
- '%' . str_replace(' ', '', $request->term) . '%',
- $this->baseLabId
- ]
- );
- })->limit(20)->orderBy('name_en', 'asc')->get();
- }
- $items = [];
- if(!empty($patients)){
- $items = $patients->map(function ($item){
- return array('id'=>$item->id, 'text' => $item->patient_uuid . ' - '.$item->name_en . ((!empty($item->phone_number) ? ' - '.$item->phone_number: '')));
- });
- }
- return response()->json(['results' => $items]);
- }
-
-
-
-}
diff --git a/app/Http/Controllers/PatientTypeController.php b/app/Http/Controllers/PatientTypeController.php
deleted file mode 100644
index 6aea06c..0000000
--- a/app/Http/Controllers/PatientTypeController.php
+++ /dev/null
@@ -1,115 +0,0 @@
-model = $patientType;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_patient_type'])) return redirect(url('my-profile'));
- $standardPatientTypes = $this->model::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'is_standard' => 1])->get(['id','name_en'])->unique('name_en');
- $patientTypes = $this->model::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- //->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($patientTypes) use ($request){
- $patientTypes->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('patient-type', ['patientTypes' => $patientTypes, 'standardPatientTypes' => $standardPatientTypes]);
- }
-
- public function save(PatientTypeCreateRequest $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_patient_type'])) return false;
- $new = $this->model::query()->firstOrNew(['name_en' => $request->name_en, 'gender' => $request->gender]);
- $new->name_en = $request->name_en;
- $new->gender = $request->gender;
- $new->range_start = $request->age_from;
- $new->range_start_unit = $request->age_from_unit;
- $new->range_start_sign = $request->age_from_sign;
- $new->range_end = $request->age_to;
- $new->range_end_unit = $request->age_to_unit;
- $new->range_end_sign = $request->age_to_sign;
- //$new->lab_id = $this->baseLabId;
- $new->save();
- DB::commit();
- return response()->json(['success' => true, 'message' => __('patient_type.create_success')]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('patient_type.create_fail'), 'errors' => $e->getMessage()]);
- }
-
- }
-
- public function update(PatientTypeCreateRequest $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_patient_type'])) return false;
- $data = array(
- 'name_en' => $request->name_en,
- 'range_start' => $request->age_from,
- 'range_start_unit' => $request->age_from_unit,
- 'gender' => $request->gender,
- 'range_end' => $request->age_to,
- 'range_end_unit' => $request->age_to_unit,
- //'lab_id' => $this->baseLabId,
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- $this->model::query()->where('id', $request->uid)->update($data);
- DB::commit();
- return response()->json(['success' => true, 'message' => __('patient_type.update_success')]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('patient_type.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $patientType = $this->model::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('patient_type.get_success'), 'data' => $patientType]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('patient_type.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_patient_type'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array( BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('patient_type.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('patient_type.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array( BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('patient_type.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('patient_type.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-
-}
diff --git a/app/Http/Controllers/PhysicianController.php b/app/Http/Controllers/PhysicianController.php
deleted file mode 100644
index 7fccf30..0000000
--- a/app/Http/Controllers/PhysicianController.php
+++ /dev/null
@@ -1,170 +0,0 @@
-physician = $physician;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_physician'])) return redirect(url('my-profile'));
- $physicians = $this->physician::with(['lab'])->where('record_status_id', RecordStatusEnum::ACTIVE)
- ->where('lab_id', Session::get('base_lab_id'))
- ->when(!empty($request->kword), function ($physicians) use ($request){
- $physicians->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })
- ->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('physician', ['physicians' => $physicians, 'labs' => parent::getAccessAbleLabs()]);
- }
-
- public function save(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_physician'])) return redirect(url('my-profile'));
- $validator = \Validator::make($request->all(), ['name_en' => 'required']);
- if ($validator->fails()) return response()->json(['errors'=>$validator->errors()->all()]);
- $imageName = NULL;
- $footerName = NULL;
- if($request->image)
- {
- request()->validate(['image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048']);
- $imageName = time().'.'.request()->image->getClientOriginalExtension();
- request()->image->move(public_path('storage/images/physician'), $imageName);
- }
- if($request->imageFooter)
- {
- request()->validate(['imageFooter' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048']);
- $footerName = time().'_footer.'.request()->imageFooter->getClientOriginalExtension();
- request()->imageFooter->move(public_path('storage/images/physician'), $footerName);
- }
-
- $new = $this->physician::query()->firstOrNew(['name_en' => $request->name_en, 'lab_id' => $this->baseLabId]);
- $new->name_en = $request->name_en;
- $new->phone = $request->phone;
- $new->lab_id = $this->baseLabId;
- $new->logo = $imageName;
- $new->footer = $footerName;
- $new->is_default = isset($request->is_default) ? 1 : 0;
- $new->created_at = date('Y-m-d H:i:s');
- $new->created_by = Auth::user()->id;
- $new->record_status_id = RecordStatusEnum::ACTIVE;
- $new->save();
-
- $request->session()->flash('msg','Physician has been inserted!');
- return redirect()->back();
- }
-
- public function update(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_physician'])) return redirect(url('my-profile'));
- $validator = \Validator::make($request->all(), [
- 'name_en' => 'required'
- ]);
- if ($validator->fails()) return response()->json(['errors'=>$validator->errors()->all()]);
- $imageName = NULL;
- $footerName = NULL;
- if($request->image)
- {
- request()->validate(['image' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048']);
- $imageName = time().'.'.request()->image->getClientOriginalExtension();
- request()->image->move(public_path('storage/images/physician'), $imageName);
- }
- if($request->imageFooter)
- {
- request()->validate(['imageFooter' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048']);
- $footerName = time().'_footer.'.request()->imageFooter->getClientOriginalExtension();
- request()->imageFooter->move(public_path('storage/images/physician'), $footerName);
- }
- $data = array(
- 'name_en' => $request->name_en,
- 'name_kh' => $request->name_kh,
- 'phone' => $request->phone,
- 'is_default' => isset($request->is_default) ? 1: 0,
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- if(!empty($imageName)){$data = array_merge($data, ['logo' => $imageName]);}
- if(!empty($footerName)){$data = array_merge($data, ['footer' => $footerName]);}
- $status = $this->physician::query()->where('id', $request->uid)->update($data);
- $request->session()->flash('msg','Physician has been updated!');
- return redirect()->back();
- }
-
- public function deletePhysicianLogo(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_physician'])) return false;
- $physician = $this->physician::query()->find($request->uid);
- if(file_exists(public_path('storage/images/physician/'.$physician->logo))){
- unlink(public_path('storage/images/physician/'.$physician->logo));
- $physician->logo = null;
- }
- $physician->save();
- return response()->json(['success'=> true , 'message' => __('physician.delete_photo_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('physician.delete_photo_failed')]);
- }
- }
-
- public function deletePhysicianFooter(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_physician'])) return false;
- $physician = $this->physician::query()->find($request->uid);
- if(file_exists(public_path('storage/images/physician/'.$physician->footer))){
- unlink(public_path('storage/images/physician/'.$physician->footer));
- $physician->footer = null;
- }
- $physician->save();
- return response()->json(['success'=> true , 'message' => __('physician.delete_photo_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('physician.delete_photo_failed')]);
- }
- }
-
- public function get(Request $request){
- try {
- $physician = $this->physician::query()->find($request->uid);
- return response()->json(['success'=> true , 'message' => __('physician.get_success'), 'data' => $physician]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('physician.get_fail')]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_physician'])) return false;
- $this->physician::query()->where('id', $request->uid)->update(array( BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success'=> true , 'message' => __('physician.delete_success')]);
- }
- catch (\Exception $e){
- return response()->json(['success'=> false , 'message' => __('physician.delete_fail')]);
- }
-
- }
-
- public function restore(Request $request){
- try {
- $this->physician::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('physician.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('physician.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/PublicationController.php b/app/Http/Controllers/PublicationController.php
index af9d5dc..5151798 100644
--- a/app/Http/Controllers/PublicationController.php
+++ b/app/Http/Controllers/PublicationController.php
@@ -20,8 +20,8 @@ class PublicationController extends Controller
public function __construct(Publication $publication){
$this->model = $publication;
$this->publicationReceiverModel = new PublicationReceiver();
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
public function index(Request $request){
@@ -35,7 +35,7 @@ class PublicationController extends Controller
public function save(Request $request){
try{
- $validator = \Validator::make($request->all(), ['start_date' => 'required', 'title_en' => 'required','lab_ids' => 'required']);
+ $validator = \Validator::make($request->all(), ['start_date' => 'required', 'title_en' => 'required','organization_ids' => 'required']);
if ($validator->fails()) return response()->json(['success' => false, 'message' => __('comment.create_fail'), 'errors' => $validator->errors()->all()]);
$publication = $this->model::query()->create([
@@ -46,10 +46,10 @@ class PublicationController extends Controller
'description' => $request->description
]);
- foreach ($request->lab_ids as $lab_id){
+ foreach ($request->organization_ids as $organization_id){
$this->publicationReceiverModel::query()->create([
'publication_id' => $publication->id,
- 'lab_id' => $lab_id,
+ 'organization_id' => $organization_id,
'created_by' => Auth::id()
]);
}
@@ -62,7 +62,7 @@ class PublicationController extends Controller
public function update(Request $request){
try {
- $validator = \Validator::make($request->all(), ['start_date' => 'required', 'title_en' => 'required', 'lab_ids' => 'required']);
+ $validator = \Validator::make($request->all(), ['start_date' => 'required', 'title_en' => 'required', 'organization_ids' => 'required']);
if ($validator->fails()) return response()->json(['success' => false, 'message' => __('comment.update_fail'), 'errors' => $validator->errors()->all()]);
$data = array(
'title_en' => $request->title_en,
@@ -73,10 +73,10 @@ class PublicationController extends Controller
);
$this->model::query()->where('id', $request->uid)->update($data);
$this->publicationReceiverModel::query()->where('publication_id', $request->uid)->delete();
- foreach ($request->lab_ids as $lab_id){
+ foreach ($request->organization_ids as $organization_id){
$this->publicationReceiverModel::query()->create([
'publication_id' => $request->uid,
- 'lab_id' => $lab_id,
+ 'organization_id' => $organization_id,
'created_by' => Auth::id()
]);
}
diff --git a/app/Http/Controllers/QuantityController.php b/app/Http/Controllers/QuantityController.php
deleted file mode 100644
index 3a2f8ae..0000000
--- a/app/Http/Controllers/QuantityController.php
+++ /dev/null
@@ -1,100 +0,0 @@
-model = $quantity;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_quantity'])) return redirect(url('my-profile'));
- $quantities = $this->model::with(['lab'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($quantities) use($request){
- $quantities->whereRaw("replace(quantity_name, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('quantity', ['quantities' => $quantities]);
- }
-
- public function save(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_quantity'])) return false;
- $validator = \Validator::make($request->all(), ['quantity_name' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('organism.create_fail'), 'errors' =>$validator->errors()->all()]);
- $new = $this->model::query()->firstOrNew(['quantity_name' => $request->quantity_name]);
- $new->quantity_name = $request->quantity_name;
- //$new->lab_id = $this->baseLabId;
- $new->save();
- return response()->json(['success' => true, 'message' => __('quantity.create_success'), 'data' => [$new]]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('quantity.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_quantity'])) return false;
- $validator = \Validator::make($request->all(), ['quantity_name' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('organism.update_fail'), 'errors' => $validator->errors()->all()]);
- $this->model::query()->where('id', $request->uid)->update(array('quantity_name' => $request->quantity_name));
- return response()->json(['success' => true, 'message' => __('quantity.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('quantity.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $quantity = $this->model::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('quantity.get_success'), 'data' => $quantity]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('quantity.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_quantity'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('quantity.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('quantity.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('quantity.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('quantity.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/RepaymentController.php b/app/Http/Controllers/RepaymentController.php
deleted file mode 100644
index 130133a..0000000
--- a/app/Http/Controllers/RepaymentController.php
+++ /dev/null
@@ -1,165 +0,0 @@
-model = new Repayment();
- $this->invoiceModel = new Invoice();
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_repayment'])) return redirect(url('my-profile'));
- $recordStatusConditions = Auth::id()==1 ? [RecordStatusEnum::ACTIVE , RecordStatusEnum::DELETE] : [RecordStatusEnum::ACTIVE];
- $invoices = $this->invoiceModel::with(['sample.patient'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->where('balance','>', 0)->get();
- $repayments = $this->model::query()
- ->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->from_date) && !empty($request->to_date), function ($inv) use ($request){
- $inv->whereBetween('repayment_date',[date('Y-m-d',strtotime($request->from_date)), date('Y-m-d',strtotime($request->to_date))]);
- })->when(!empty(trim($request->kword)), function ($inv) use($request, $recordStatusConditions){
- $inv->whereIn('invoice_id', $this->invoiceModel::query()
- ->whereRaw("replace(invoice_code, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
- ->orWhere('patient_uuid','like','%'.$request->kword.'%')->pluck('id')->toArray()
- )->where('lab_id', $this->baseLabId)->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions);
- })->orderBy('repayment_date','desc')->paginate(20);
- return view('repayment', ['oweInvoices' => $invoices, 'repayments' => $repayments, 'labSettings' => (object) $this->location()]);
- }
-
- public function store(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_repayment'])) return false;
- $data = array(
- 'invoice_id' => $request->invoice_id,
- 'amount_to_pay' => $request->amount_to_pay,
- 'discount' => $request->discount,
- 'amount_after_discount' => $request->amount_after_discount,
- 'discount_type' => $request->discount_type,
- 'cash_repayment_amount' => $request->cash_repayment_amount,
- 'bank_repayment_amount' => $request->bank_repayment_amount,
- 'repayment_date' => date('Y-m-d', strtotime($request->repayment_date)),
- 'payment_method' => $request->payment_method,
- 'bank_name' => $request->bank_name,
- 'transaction_ref' => $request->transaction_ref,
- 'exchange_rate' => $request->exchange_rate,
- 'lab_id' => $this->baseLabId,
- BaseModel::CREATED_AT => date('Y-m-d H:i:s'),
- BaseModel::CREATED_BY_FIELD => Auth::id()
- );
- $repayment = $this->model::query()->create($data);
- if($repayment){
- $invoice = $this->invoiceModel::query()->find($request->invoice_id);
- $totalRepayment = ($invoice->balance - ($request->cash_repayment_amount + $request->bank_repayment_amount));
- $invoice->deposit = ($invoice->deposit + $request->cash_repayment_amount);
- $invoice->bank_deposit = ($invoice->bank_deposit+$request->bank_repayment_amount);
- $invoice->balance = ($totalRepayment);
- $invoice->discount = $request->discount;
- $invoice->save();
- }
- else DB::rollBack();
- DB::commit();
- return response()->json(['success' => true, 'message' => __('invoice.create_success'), 'data' => $repayment]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => $e]);
- }
- }
-
-
- public function update(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_repayment'])) return false;
- $data = array(
- 'cash_repayment_amount' => $request->cash_repayment_amount,
- 'bank_repayment_amount' => $request->bank_repayment_amount,
- 'repayment_date' => date('Y-m-d', strtotime($request->repayment_date)),
- 'payment_method' => $request->payment_method,
- 'bank_name' => $request->bank_name,
- 'transaction_ref' => $request->transaction_ref,
- 'exchange_rate' => $request->exchange_rate
- );
-
- $prevRepayment = $this->model::query()->find($request->uid);
-
- $repayment = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->update($data);
- if($repayment){
-
- $reviseInvoice = $this->invoiceModel::query()->find($request->invoice_id);
- $totalRepayment = ($reviseInvoice->balance + $prevRepayment->cash_repayment_amount + $prevRepayment->bank_repayment_amount);
- $reviseInvoice->deposit = (($reviseInvoice->deposit + $prevRepayment->cash_repayment_amount) - $request->cash_repayment_amount);
- $reviseInvoice->bank_deposit = (($reviseInvoice->bank_deposit + $prevRepayment->bank_repayment_amount) - $request->bank_repayment_amount);
- $reviseInvoice->balance = $totalRepayment - ($request->cash_repayment_amount + $request->bank_repayment_amount);
- $reviseInvoice->save();
- }
- else DB::rollBack();
- DB::commit();
- return response()->json(['success' => true, 'message' => __('invoice.create_success'), 'data' => $repayment]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => $e->getMessage()]);
- }
- }
-
- /** Perform by ajax function
- * @param Request $request
- * @return \Illuminate\Http\JsonResponse
- */
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_repayment'])) return redirect(url('my-profile'));
- $repayment = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->get()->first();
- $reviseInvoice = $this->invoiceModel::query()->find($repayment->invoice_id);
- $totalRepayment = ($reviseInvoice->balance + $repayment->cash_repayment_amount + $repayment->bank_repayment_amount);
- $reviseInvoice->deposit = ($reviseInvoice->deposit - $repayment->cash_repayment_amount);
- $reviseInvoice->bank_deposit = ($reviseInvoice->bank_deposit - $repayment->bank_repayment_amount);
- $reviseInvoice->balance = $totalRepayment;
- $reviseInvoice->save();
- $repayment->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('invoice.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('invoice.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $data = $this->model::with(['invoice.sample.patient'])->find($request->uid);
- return response()->json(['success' => true, 'message' => __('invoice.get_success'), 'data' => $data]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('invoice.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function getInvoice(Request $request){
- try{
- $data = $this->invoiceModel::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('invoice.get_success'), 'data' => $data]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('invoice.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
deleted file mode 100644
index 7733fc1..0000000
--- a/app/Http/Controllers/ReportController.php
+++ /dev/null
@@ -1,1168 +0,0 @@
-model = $invoiceModel;
- $this->sampleModel = $sampleModel;
- $this->invoiceDetailModel = $invoiceDetailModel;
- $this->physicianModel = $physicianModel;
- $this->sampleSourceModel = $sampleSourceModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- $this->labs = parent::getAccessAbleLabs();
- }
-
- /**
- * ======================================
- * INVOICE REPORTS STARTED
- */
-
- public function dailyInvoiceReport($date, $reportType = 'daily'){
- try{
- $reportPeriodCondition = $reportType != 'daily' ? ' DATE_FORMAT(inv.`invoice_date`, "%Y-%m")= "'.date('Y-m',strtotime($date)).'" ' : ' DATE(inv.`invoice_date`) = "'.$date.'"';
- $arrData = array();
- $arrData['report_period'] = $date;
- $invoices = DB::select('
- SELECT
- inv.id as invoice_id,
- ps.`id` AS physician_id,
- ps.`name_en` AS physician_name,
- lb.`name_en` AS lab,
- p.`name_en` AS patient,
- inv.`discount`,
- inv.`total`,
- inv.`gross_total`,
- inv.`balance`,
- inv.`invoice_date`,
- req_test.req_tests
- FROM `invoices` inv
- INNER JOIN samples sp
- ON sp.id =inv.`sample_id` AND sp.`lab_id` = inv.`lab_id`
- INNER JOIN physicians ps
- ON ps.`id` = sp.`physician_id` AND ps.`lab_id` = sp.`lab_id`
- INNER JOIN `laboratories` lb
- ON lb.`id` = sp.`lab_id`
- INNER JOIN patients p
- ON p.`id` = sp.`patient_id` AND p.`lab_id` = sp.`lab_id`
- LEFT JOIN(
- SELECT
- tr.sample_id,
- GROUP_CONCAT(t.name_en SEPARATOR ", ") AS req_tests
- FROM `test_results` tr
- INNER JOIN test_samples ts
- ON ts.id = tr.test_sample_id
- AND ts.lab_id = tr.lab_id
- INNER JOIN tests t
- ON t.id = ts.test_id
- WHERE tr.lab_id = '.$this->baseLabId.'
- AND tr.record_status_id = 1
- GROUP BY tr.sample_id
- )req_test
- ON req_test.sample_id = sp.id
- WHERE '.$reportPeriodCondition.'
- AND inv.record_status_id = 1 AND sp.record_status_id = 1
- AND inv.lab_id = '.$this->baseLabId);
- $physicianArray = array();
- foreach ($invoices as $row) {
- $physicianArray[$row->physician_id]['physician_id'] = $row->physician_id;
- $physicianArray[$row->physician_id]['physician_name'] = $row->physician_name;
-
- $invoiceArray = array(
- 'id' => (string)$row->invoice_id,
- 'lab' => $row->lab,
- 'patient' => $row->patient,
- 'requested_tests' => (string) $row->req_tests,
- 'discount' => $row->discount,
- 'total_amount' => $row->total,
- 'net_amount' => $row->gross_total,
- 'owe_amount' => $row->balance
- );
- $physicianArray[$row->physician_id]['invoices'][] = $invoiceArray;
- }
- $arrData['report_data'] = $physicianArray;
- return response()->json(['success'=> true , 'data' => $arrData]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
-
- }
- }
-
- public function yearlyInvoiceReport($year){
- try{
- $arrData = array();
- $arrData['report_period'] = $year;
- $yearlyData = DB::select('
- SELECT
- DATE_FORMAT(inv.`invoice_date`, "%m") AS month_id,
- DATE_FORMAT(inv.`invoice_date`, "%M") AS month_name,
- SUM(1) AS total_invoices,
- SUM(inv.`gross_total`) AS net_amount,
- SUM(inv.`deposit`) AS paid_amount,
- SUM(inv.`balance`) AS owe_amount
- FROM `invoices` inv
- INNER JOIN samples sp
- ON sp.id =inv.`sample_id` AND sp.`lab_id` = inv.`lab_id`
- INNER JOIN physicians ps
- ON ps.`id` = sp.`physician_id` AND ps.`lab_id` = sp.`lab_id`
- INNER JOIN `laboratories` lb
- ON lb.`id` = sp.`lab_id`
- INNER JOIN patients p
- ON p.`id` = sp.`patient_id` AND p.`lab_id` = sp.`lab_id`
- WHERE YEAR(inv.`invoice_date`) = '.$year.'
- GROUP BY DATE_FORMAT(inv.`invoice_date`, "%M"), DATE_FORMAT(inv.`invoice_date`, "%m")
- ');
- $yearlyInvoiceArray = array();
- foreach ($yearlyData as $row) {
- $invoiceArray = array(
- 'month_number' => (string)$row->month_id,
- 'month_name' => $row->month_name,
- 'total_invoice' => $row->total_invoices,
- 'total_net_amount' => $row->net_amount,
- 'total_paid_amount' => $row->paid_amount,
- 'total_owe_amount' => $row->owe_amount
- );
- $yearlyInvoiceArray[] = $invoiceArray;
- }
- $arrData['report_data'] = $yearlyInvoiceArray;
- return response()->json(['success'=> true , 'data' => $arrData]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
- }
- }
-
- /**
- * ======================================
- * INVOICE REPORTS ENDED
- */
-
-
- /**
- * ======================================
- * SUMMARY REPORTS STARTED
- */
-
- public function summaryReport(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['generate_summary_report'])) return redirect(url('my-profile'));
- $startDate = $request->start_date;
- $endDate = $request->end_date;
- $arrData = array();
- $arrData['report_name'] = 'Summary Report';
- $arrData['report_period_from'] = $startDate;
- $arrData['report_period_to'] = $endDate;
- $reportData = DB::select('
- SELECT
- st.`id` AS sample_type_id,
- st.`name_en` AS sample_type,
- -- ts.group_result as test_name,
- ts.group_result,
- -- t.`name_en` AS test_name,
- SUM(IF(p.`gender` =1, 1, 0)) AS total_male_patient,
- SUM(IF(p.`gender` =1, 0, 1)) AS total_female_patient,
- SUM(1) AS total_patient
- FROM samples s
- INNER JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- INNER JOIN test_samples ts
- ON ts.id = tr.`test_sample_id`
- INNER JOIN tests t
- ON t.`id` = ts.`test_id`
- INNER JOIN sample_types st
- ON st.`id` = ts.`sample_type_id`
- INNER JOIN patients p
- ON p.id = s.patient_id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND tr.`record_status_id` = 1
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND ts.group_result IS NOT NULL AND ts.group_result <> ""
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY st.`id`,
- st.`name_en`,
- ts.group_result,
- t.`name_en`
- -- order by st.weight, ts.weight asc
- ');
- $summaryReportArray = array();
- $summary4Export = array();
- foreach ($reportData as $row) {
- $summaryReportArray[$row->sample_type_id]['sample_type'] = $row->sample_type;
- $arr = array(
- 'test_type' => $row->sample_type,
- 'group_result' => $row->group_result,
- // 'test_name' => (string)$row->test_name,
- 'total_male_patient' => (int)$row->total_male_patient,
- 'total_female_patient' => (int)$row->total_female_patient,
- 'total_patient' => (int)$row->total_patient
- );
- $summaryReportArray[$row->sample_type_id]['test_name'][] = $arr;
- $summary4Export[] = $arr;
- }
- $arrData['report_data'] = collect($summaryReportArray)->flatten(1)->toArray();
- if($request->export) return $this->exportSummaryReport($summary4Export);
- $arrData['sample_source_data'] = $this->getSummaryReportBySampleSource($startDate, $endDate);
- $arrData['test_category_data'] = $this->getSummaryReportByTestCategory($startDate, $endDate);
- $arrData['test_date_data'] = $this->getSummaryReportByReceiveDate($startDate, $endDate);
- $arrData['performed_by'] = $this->getSummaryReportByPerformer($startDate, $endDate);
-
- return view('aggregate_report', ['report_data' => $arrData, 'labSettings' => (object) $this->location()]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
- }
- }
-
-
-
- function getSummaryReportByTestCategory($startDate, $endDate){
- try{
- $reportData = DB::select('
- SELECT
- ts.category,
- SUM(IF(p.`gender` =1, 1, 0)) AS total_male_patient,
- SUM(IF(p.`gender` =1, 0, 1)) AS total_female_patient,
- SUM(1) AS total_patient
- FROM samples s
- INNER JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- INNER JOIN test_samples ts
- ON ts.id = tr.`test_sample_id`
- INNER JOIN tests t
- ON t.`id` = ts.`test_id`
- INNER JOIN sample_types st
- ON st.`id` = ts.`sample_type_id`
- INNER JOIN patients p
- ON p.id = s.patient_id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND tr.`record_status_id` = 1
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND ts.category IS NOT NULL AND ts.category <> ""
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY
- ts.category
- ');
- $sampleSourceReportArray = array();
- foreach ($reportData as $row) {
- $arr = array(
- //'test_type' => $row->sample_type,
- 'category' => $row->category,
- 'total_male_patient' => (int)$row->total_male_patient,
- 'total_female_patient' => (int)$row->total_female_patient,
- 'total_patient' => (int)$row->total_patient
- );
- $sampleSourceReportArray[] = $arr;
- }
- return $sampleSourceReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- function getSummaryReportBySampleSource($startDate, $endDate){
- try{
- $sampleSourceData = DB::select('
- SELECT
- ss.`name_en` AS clinic_name,
- SUM(IF(p.`gender` =1, 1, 0)) AS total_male_patient,
- SUM(IF(p.`gender` =1, 0, 1)) AS total_female_patient,
- SUM(1) AS total_patient
- FROM samples s
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss
- ON ss.id = s.`sample_source_id`
- AND ss.`lab_id` = s.`lab_id`
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY ss.`name_en`
- ');
- $sampleSourceReportArray = array();
- foreach ($sampleSourceData as $row) {
- $arr = array(
- 'clinic_name' => (string)$row->clinic_name,
- 'total_male_patient' => (int)$row->total_male_patient,
- 'total_female_patient' => (int)$row->total_female_patient,
- 'total_patient' => (int)$row->total_patient
- );
- $sampleSourceReportArray[] = $arr;
- }
- return $sampleSourceReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- function getSummaryReportByReceiveDate($startDate, $endDate){
- try{
- $sampleSourceData = DB::select('
- SELECT
- DATE_FORMAT(s.`received_date`, "%Y-%m-%d") AS received_date,
- SUM(IF(p.`gender` =1, 1, 0)) AS total_male_patient,
- SUM(IF(p.`gender` =1, 0, 1)) AS total_female_patient,
- SUM(1) AS total_patient
- FROM samples s
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY DATE_FORMAT(s.`received_date`, "%Y-%m-%d")
- ORDER BY s.`received_date`
- ');
- $sampleSourceReportArray = array();
- foreach ($sampleSourceData as $row) {
- $arr = array(
- 'received_date' => (string)$row->received_date,
- 'total_male_patient' => (int)$row->total_male_patient,
- 'total_female_patient' => (int)$row->total_female_patient,
- 'total_patient' => (int)$row->total_patient
- );
- $sampleSourceReportArray[] = $arr;
- }
- return $sampleSourceReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- function getSummaryReportByPerformer($startDate, $endDate){
- try{
- $sampleSourceData = DB::select('
- SELECT
- us.`name` AS performer_name,
- SUM(IF(p.`gender` =1, 1, 0)) AS total_male_patient,
- SUM(IF(p.`gender` =1, 0, 1)) AS total_female_patient,
- SUM(1) AS total_patient
- FROM samples s
- INNER JOIN patients p ON p.id = s.patient_id AND p.`lab_id` = s.`lab_id`
- INNER JOIN test_results AS tr ON s.id=tr.sample_id
- INNER JOIN users AS us ON tr.performed_by=us.id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY us.`name`
- ');
- $sampleSourceReportArray = array();
- foreach ($sampleSourceData as $row) {
- $arr = array(
- 'performer_name' => (string)$row->performer_name,
- 'total_male_patient' => (int)$row->total_male_patient,
- 'total_female_patient' => (int)$row->total_female_patient,
- 'total_patient' => (int)$row->total_patient
- );
- $sampleSourceReportArray[] = $arr;
- }
- return $sampleSourceReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
- /**
- * ======================================
- * SUMMARY REPORTS ENDED
- */
-
-
- /**
- * ======================================
- * DOCTOR REPORTS STARTED
- */
-
- public function doctorReport(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['generate_doctor_report'])) return redirect(url('my-profile'));
- $startDate = $request->start_date;
- $endDate = $request->end_date;
- $sampleSourceId = (isset($request->sample_source) && !empty($request->sample_source)) ? $request->sample_source : NULL;
- $physicianId = (isset($request->physician) && !empty($request->physician)) ? $request->physician : NULL;
- $arrData = array();
- $arrData['report_name'] = 'Doctor Report';
- $arrData['report_period_from'] = $startDate;
- $arrData['report_period_to'] = $endDate;
- $reportData = DB::select('
- SELECT
- ss.`name_en` AS sample_source_name,
- SUM(1) AS total_exam,
- SUM(tp.`total_price`) AS total_net_amount
- FROM samples s
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss
- ON ss.id = s.`sample_source_id`
- AND ss.`lab_id` = s.`lab_id`
-
- LEFT JOIN(
- SELECT
- s.id AS sample_id,
- s.`lab_id`,
- SUM(ts.`usd_price`) AS total_price
- FROM samples s
- INNER JOIN test_results r
- ON r.`sample_id` = s.`id`
- AND r.`lab_id` = s.`lab_id`
- INNER JOIN test_samples ts
- ON ts.`id` = r.`test_sample_id`
- WHERE s.`record_status_id`=1
- AND r.`record_status_id` =1
- AND ts.`record_status_id` =1
- GROUP BY s.`id`, s.`lab_id`
-
- ) tp ON tp.sample_id = s.id AND s.`lab_id` = tp.lab_id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY ss.`name_en`');
- $doctorReportArray = array();
- foreach ($reportData as $k=>$row) {
- $arr = array(
- 'no' => $k+1,
- 'sample_source_name' => (string)$row->sample_source_name,
- 'total_exam' => (int)$row->total_exam,
- 'total_net_amount' => (float)$row->total_net_amount
- );
- $doctorReportArray[] = $arr;
- }
-
- if(empty($sampleSourceId) && empty($physicianId)){
- $arrData['report_data'] = $doctorReportArray;
- $arrData['report_id'] = 1;
- if($request->export){
- return $this->exportDoctorSampleBase($arrData['report_data']);
- }
- } elseif (!empty($sampleSourceId) && empty($physicianId)){
- $arrData['report_data'] = $this->getDoctorReportGroupByPhysician($startDate, $endDate, $sampleSourceId);
- $arrData['report_id'] = 2;
- if($request->export){
- return $this->exportDoctorPhysicianBase($arrData['report_data']);
- }
- }else{
- $arrData['report_data'] = $this->getDoctorReportRawByPhysician($startDate, $endDate,$sampleSourceId, $physicianId);
- $arrData['report_id'] = 3;
- if($request->export){
- return $this->exportDoctorRawBase($arrData['report_data']);
- }
- }
-
- $printDoctorData = $this->getDoctorReportRawBySampleSource($startDate, $endDate, !empty($sampleSourceId) ? $sampleSourceId : 0 );
- $printRawByPhysician = $this->getDoctorReportRawByPhysician($startDate, $endDate,$sampleSourceId, $physicianId);
-
- //$printDoctorReportDetail = $this->getDoctorReportDetail($startDate, $endDate,$sampleSourceId, $physicianId);
-
- $sampleSources = $this->sampleSourceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
- $physicians = $this->physicianModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
-
- return view('doctor_report', ['report_data' => $arrData , 'sampleSources' => $sampleSources, 'physicians' => $physicians, 'labSettings' => (object) $this->location(), 'printDoctorData' => $printDoctorData, 'printRawByPhysician' => $printRawByPhysician]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
- }
- }
-
- function getDoctorReportGroupByPhysician($startDate, $endDate, $sampleSourceId = null){
- try{
- $sampleSourceCondition = !is_null($sampleSourceId) ? ' AND s.sample_source_id='.$sampleSourceId :'';
- $sampleSourceData = DB::select('
- SELECT
- ps.`name_en` AS physician_name,
- SUM(1) AS total_exam,
- SUM(tp.`total_price`) AS total_net_amount
- FROM samples s
-
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss
- ON ss.id = s.`sample_source_id`
- AND ss.`lab_id` = s.`lab_id`
- INNER JOIN physicians ps
- ON ps.`id` = s.`physician_id`
-
- LEFT JOIN(
- SELECT
- s.id AS sample_id,
- s.`lab_id`,
- SUM(ts.`usd_price`) AS total_price
- FROM samples s
- INNER JOIN test_results r
- ON r.`sample_id` = s.`id`
- AND r.`lab_id` = s.`lab_id`
- INNER JOIN test_samples ts
- ON ts.`id` = r.`test_sample_id`
- WHERE s.`record_status_id`=1
- AND r.`record_status_id` =1
- AND ts.`record_status_id` =1
- GROUP BY s.`id`, s.`lab_id`
-
- ) tp ON tp.sample_id = s.id AND s.`lab_id` = tp.lab_id
-
- WHERE s.`lab_id`= '.$this->baseLabId.'
- '.$sampleSourceCondition.'
-
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- GROUP BY ps.`name_en`;
- ');
- $physicianReportArray = array();
- foreach ($sampleSourceData as $k=>$row) {
- $arr = array(
- 'no' => $k+1,
- 'physician_name' => (string)$row->physician_name,
- 'total_exam' => (int)$row->total_exam,
- 'total_net_amount' => (float)$row->total_net_amount
- );
- $physicianReportArray[] = $arr;
- }
- return $physicianReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- public function getDoctorReportRawByPhysician($startDate, $endDate, $sample_source='', $physicianId = null){
- try{
- $physicianCondition = !empty($physicianId) && $physicianId!='All' ? ' AND s.physician_id='.$physicianId :'';
- $sample_sourceCondition = !empty($sample_source) ? ' AND ss.id='.$sample_source :'';
- $rawTestByPhysician = DB::select('
- SELECT
- s.received_date as `invoice_date`,
- ss.name_en as sample_source,
- p.`name_en` AS patient,
- s.`sample_number`,
- -- req_test.req_tests AS test_name,
- req_test.group_result as test_name,
- ps.`name_en` AS physician_name,
- tp.total_price AS total_amount,
- tp.total_price AS total_net_amount
- FROM samples s
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss
- ON ss.id = s.`sample_source_id`
- AND ss.`lab_id` = s.`lab_id`
- INNER JOIN physicians ps
- ON ps.`id` = s.`physician_id`
- LEFT JOIN(
- SELECT
- s.id AS sample_id,
- s.`lab_id`,
- SUM(ts.`usd_price`) AS total_price
- FROM samples s
- INNER JOIN test_results r
- ON r.`sample_id` = s.`id`
- AND r.`lab_id` = s.`lab_id`
- INNER JOIN test_samples ts
- ON ts.`id` = r.`test_sample_id`
- WHERE s.`record_status_id`=1
- AND r.`record_status_id` =1
- AND ts.`record_status_id` =1
- GROUP BY s.`id`, s.`lab_id`
-
- ) tp ON tp.sample_id = s.id AND s.`lab_id` = tp.lab_id
- LEFT JOIN(
- SELECT
- tr.sample_id,
- GROUP_CONCAT(t.name_en SEPARATOR ", ") AS req_tests,
- GROUP_CONCAT(DISTINCT CASE WHEN ts.lab_id = 22 THEN SUBSTR(ts.`group_result`, 1, 4) ELSE ts.`group_result` END SEPARATOR ", ") AS group_result
-
- FROM `test_results` tr
- INNER JOIN test_samples ts
- ON ts.id = tr.test_sample_id
- AND ts.lab_id = tr.lab_id
- INNER JOIN tests t
- ON t.id = ts.test_id
- WHERE tr.lab_id = '.$this->baseLabId.'
- AND tr.record_status_id = 1
- AND ts.`record_status_id` =1
- AND LENGTH(ts.`group_result`)>=1
- GROUP BY tr.sample_id
- )req_test
- ON req_test.sample_id = s.id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- '.$physicianCondition.'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- and req_test.group_result is not null
- '.$sample_sourceCondition.'
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).' order by s.received_date ASC "
- ');
- $physicianReportArray = array();
- foreach ($rawTestByPhysician as $row) {
- $arr = array(
- 'date' => (string)date('d-M-Y',strtotime($row->invoice_date)),
- 'sample_source' => (string) $row->sample_source,
- 'patient' => (string)$row->patient,
- 'sample_number' => (string)$row->sample_number,
- 'test_name' => (string)$row->test_name,
- 'physician' => (string)$row->physician_name,
- 'total_amount' => (float)$row->total_amount,
- 'total_net_amount' => (float)$row->total_net_amount,
- );
- $physicianReportArray[] = $arr;
- }
- asort($physicianReportArray);
- return $physicianReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- public function getDoctorReportRawBySampleSource($startDate, $endDate, $sampleSourceId){
- try{
- $rawDoctorReportPrint = DB::select('
- SELECT
- s.received_date as `register_date`,
- s.`sample_number`,
- p.`name_en` AS patient,
- ss.id sample_source_id,
- ss.name_en as sample_source,
- IF(p.gender=1, "M","F") as gender,
- p.dob,
- req_test.total_tests,
- req_test.total_price AS total_price
- FROM samples s
- INNER JOIN patients p
- ON p.id = s.patient_id
- AND p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss
- ON ss.id = s.`sample_source_id`
- AND ss.`lab_id` = s.`lab_id`
- LEFT JOIN(
- SELECT
- tr.sample_id,
- count(*) as total_tests,
- SUM(ts.`usd_price`) AS total_price
- FROM `test_results` tr
- INNER JOIN test_samples ts
- ON ts.id = tr.test_sample_id
- AND ts.lab_id = tr.lab_id
- INNER JOIN tests t
- ON t.id = ts.test_id
- WHERE tr.lab_id = '.$this->baseLabId.'
- AND tr.record_status_id = 1
- AND ts.`record_status_id` =1
- AND LENGTH(ts.`group_result`)>=1
- GROUP BY tr.sample_id
- )req_test
- ON req_test.sample_id = s.id
- WHERE s.`lab_id`= '.$this->baseLabId.'
- '.(!empty($sampleSourceId) ? 'AND s.sample_source_id='.$sampleSourceId:'').'
- AND s.`record_status_id` = 1
- AND p.`record_status_id` = 1
- AND DATE(s.received_date) BETWEEN "'.date('Y-m-d', strtotime($startDate)).'" AND "'.date('Y-m-d', strtotime($endDate)).'"
- ');
- $departmentArray = array();
- foreach ($rawDoctorReportPrint as $row){
- $departmentArray[$row->sample_source_id]['sample_source_id'] = $row->sample_source_id;
- $departmentArray[$row->sample_source_id]['sample_source'] = $row->sample_source;
- $testItemArray = array(
- 'register_date' => date('d/m/Y',strtotime($row->register_date)),
- 'sample_number' => $row->sample_number,
- 'patient' => $row->patient,
- 'gender' => $row->gender,
- 'age' => (string) Helpers::getAge($row->dob, $row->register_date),
- 'total_tests' => (integer) $row->total_tests,
- 'total_price' =>(float) $row->total_price
- );
- //dd($testItemArray);
- $departmentArray[$row->sample_source_id]['data'][] = $testItemArray;
- }
-
- //dd($departmentArray);
- return collect($departmentArray)->values();
-
- return $rawDoctorReportPrint;
- } catch (\Exception $e){
- return [];
- }
- }
-
-
- /**
- * ======================================
- * DOCTOR REPORTS ENDED
- */
-
-
- /**
- * ======================================
- * FINANCIAL REPORTS ENDED
- */
-
- public function financialReport(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['generate_financial_report'])) return redirect(url('my-profile'));
- $startDate = $request->start_date;
- $endDate = $request->end_date;
- $sampleSourceId = (isset($request->sample_source) && !empty($request->sample_source)) ? $request->sample_source : NULL;
- $physicianId = (isset($request->physician) && !empty($request->physician)) ? $request->physician : NULL;
- $arrData = array();
- $arrData['report_name'] = 'Financial Report';
- $arrData['report_period_from'] = $startDate;
- $arrData['report_period_to'] = $endDate;
-
- $financialReport = $this->getFinancialReport($startDate, $endDate,$sampleSourceId, $physicianId);
-
- if($request->export){
- return $this->exportFinancialReport($financialReport);
- }
-
-
-
- $sampleSources = $this->sampleSourceModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
- $physicians = $this->physicianModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
-
- return view('financial_report', ['report_data' => $arrData , 'sampleSources' => $sampleSources, 'physicians' => $physicians, 'labSettings' => (object) $this->location(), 'financialReport' => $financialReport]);
- } catch (\Exception $e){
- return response()->json(['success'=> false , 'errors' => $e->getMessage()]);
- }
- }
-
-
- public function getFinancialReport($startDate, $endDate, $sample_source='', $physicianId = null){
- try{
- //\DB::enableQueryLog();
- $physicianCondition = !empty($physicianId) && $physicianId!='All' ? ' AND s.physician_id='.$physicianId :'';
- $sample_sourceCondition = !empty($sample_source) ? ' AND ss.id='.$sample_source :'';
- $rawTestByPhysician = DB::select("
- select
- inv.`invoice_date`,
- ss.`name_en` as sample_source,
- p.`name_en` AS patient,
- s.`sample_number`,
- invd.test_name,
- inv.exchange_rate,
- ps.`name_en` AS physician_name,
- sum(inv.total) AS total_amount,
- sum(inv.gross_total) AS total_net_amount,
- sum(inv.total) - SUM(inv.gross_total) as discount,
- sum(ifnull(inv.deposit, 0)) as total_paid,
- sum(ifnull(inv.bank_deposit,0)) as total_bank_paid,
- -- sum(inv.gross_total) - SUM(inv.deposit) as total_owe,
- sum(inv.balance) as total_owe
- from invoices inv
- inner join samples s on s.`id` = inv.`sample_id` and s.`lab_id` = inv.`lab_id` and s.`record_status_id` = 1
- inner join patients p on p.`id` = s.`patient_id` and p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss ON ss.id = s.`sample_source_id` AND ss.`lab_id` = s.`lab_id`
- INNER JOIN physicians ps ON ps.`id` = s.`physician_id`
- inner join (
- select
- inv.id,
- group_concat(distinct invd.test_name SEPARATOR ', ') as test_name
- from invoice_details invd
- inner join invoices inv ON inv.id = invd.invoice_id
- WHERE inv.`record_status_id` = 1
- AND DATE(inv.invoice_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- AND inv.lab_id= ".$this->baseLabId."
- group by inv.id
- )invd
- on invd.id = inv.id
- where inv.`record_status_id` = 1
- ".$physicianCondition."
- ".$sample_sourceCondition."
- AND DATE(inv.invoice_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- and inv.lab_id= ".$this->baseLabId."
- group by inv.`invoice_date`,
- ss.`name_en`,
- p.`name_en`,
- s.`sample_number`,
- ps.`name_en`,
- invd.test_name,
- inv.exchange_rate
- order by sample_number asc
- ");
- //dd(\DB::getQueryLog());
- $physicianReportArray = array();
- $i = 1;
- foreach ($rawTestByPhysician as $row) {
- $arr = array(
- 'no' => strtotime($row->invoice_date),
- 'date' => (string)date('d-M-Y',strtotime($row->invoice_date)),
- 'sample_number' => (string)$row->sample_number,
- 'patient' => (string)$row->patient,
- 'test_name' => (string)$row->test_name,
- 'physician' => (string)$row->physician_name,
- 'exchange_rate' => @$row->exchange_rate,
- 'total_amount' => (float)$row->total_amount,
- 'total_discount' => (float)$row->discount,
- 'total_net_amount' => (float)$row->total_net_amount,
- 'total_paid' => (float)$row->total_paid,
- 'total_bank_paid' => (float)$row->total_bank_paid,
- 'total_owe' => (float)$row->total_owe,
- );
- $physicianReportArray[] = $arr;
- $i++;
- }
-
- if(($sample_source=='-1' || empty($sample_source)) && empty($physicianId)){
- $vaccinationReports = $this->getVaccinationReport($startDate, $endDate);
- foreach ($vaccinationReports as $vaccinationReport) {
- $arrVac = array(
- 'no' => strtotime($vaccinationReport->invoice_date),
- 'date' => (string)date('d-M-Y',strtotime($vaccinationReport->invoice_date)),
- 'sample_number' => (string)$vaccinationReport->sample_number,
- 'patient' => (string)$vaccinationReport->patient,
- 'test_name' => (string)$vaccinationReport->test_name,
- 'physician' => (string)$vaccinationReport->physician_name,
- 'exchange_rate' =>@$vaccinationReport->exchange_rate,
- 'total_amount' => (float)$vaccinationReport->total_amount,
- 'total_discount' => (float)$vaccinationReport->discount,
- 'total_net_amount' => (float)$vaccinationReport->total_net_amount,
- 'total_paid' => (float)$vaccinationReport->total_paid,
- 'total_bank_paid' => (float)$vaccinationReport->total_bank_paid,
- 'total_owe' => (float)$vaccinationReport->total_owe,
- );
- $physicianReportArray[] = $arrVac;
- $i++;
- }
- }
- if(($sample_source=='-2' || empty($sample_source)) && empty($physicianId)){
- //$dialyReports = $this->getDailyReport($startDate, $endDate, $physicianId);
- // if(Auth::id()==1){
- $dialyReports = $this->getDailyReportV2($startDate, $endDate, $physicianId);
- // }
-
- $j=1;
- foreach ($dialyReports as $vaccinationReport) {
- $arrVac = array(
- 'no' => strtotime($vaccinationReport->invoice_date),
- 'date' => (string)date('d-M-Y',strtotime($vaccinationReport->invoice_date)),
- 'sample_number' => (string)$vaccinationReport->sample_number,
- 'patient' => (string)$vaccinationReport->patient,
- 'test_name' => (string)$vaccinationReport->test_name,
- 'physician' => (string)$vaccinationReport->physician_name,
- 'exchange_rate' => @$vaccinationReport->exchange_rate,
- 'total_amount' => (float)$vaccinationReport->total_amount,
- 'total_discount' => (float)$vaccinationReport->discount,
- 'total_net_amount' => (float)$vaccinationReport->total_net_amount,
- 'total_paid' => (float)$vaccinationReport->total_paid,
- 'total_bank_paid' => (float)$vaccinationReport->total_bank_paid,
- 'total_owe' => (float)$vaccinationReport->total_owe,
- );
- $physicianReportArray[] = $arrVac;
- $j++;
- }
- }
-
-
-
-// Sort the array
-//usort($physicianReportArray, 'date_compare');
-
-sort($physicianReportArray);
- // dd($physicianReportArray);
- return $physicianReportArray;
- } catch (\Exception $e){
- return [];
- }
- }
-
- public function getDailyReport($startDate, $endDate, $physicianId = null){
- try{
- //\DB::enableQueryLog();
- $physicianCondition = !empty($physicianId) && $physicianId!='All' ? ' AND s.physician_id='.$physicianId :'';
- $rawTestByPhysician = DB::select("
- select
- inv.first_paid_date as `invoice_date`,
- ss.`name_en` as sample_source,
- p.`name_en` AS patient,
- s.`sample_number`,
- invd.test_name,
- inv.exchange_rate,
- ps.`name_en` AS physician_name,
- sum(inv.total) AS total_amount,
- sum(inv.gross_total) AS total_net_amount,
- sum(inv.total) - SUM(inv.gross_total) as discount,
- sum(ifnull(inv.deposit, 0)) as total_paid,
- sum(ifnull(inv.bank_deposit,0)) as total_bank_paid,
- -- sum(inv.gross_total) - SUM(inv.deposit) as total_owe,
- sum(inv.balance) as total_owe
- from invoices inv
- inner join samples s on s.`id` = inv.`sample_id` and s.`lab_id` = inv.`lab_id` and s.`record_status_id` = 1
- inner join patients p on p.`id` = s.`patient_id` and p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss ON ss.id = s.`sample_source_id` AND ss.`lab_id` = s.`lab_id`
- INNER JOIN physicians ps ON ps.`id` = s.`physician_id`
- inner join (
- select
- inv.id,
- group_concat(distinct invd.test_name SEPARATOR ', ') as test_name
- from invoice_details invd
- inner join invoices inv ON inv.id = invd.invoice_id
- WHERE inv.`record_status_id` = 1
- AND DATE(inv.first_paid_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- AND inv.lab_id= ".$this->baseLabId."
- group by inv.id
- )invd
- on invd.id = inv.id
- where inv.`record_status_id` = 1
- ".$physicianCondition."
- AND DATE(inv.first_paid_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- and inv.lab_id= ".$this->baseLabId."
- group by inv.`first_paid_date`,
- ss.`name_en`,
- p.`name_en`,
- s.`sample_number`,
- ps.`name_en`,
- invd.test_name,
- inv.exchange_rate
- order by sample_number asc
- ");
-
- return $rawTestByPhysician;
- } catch (\Exception $e){
- return [];
- }
- }
-
- public function getDailyReportV2($startDate, $endDate, $physicianId = null){
- try{
- //\DB::enableQueryLog();
- $physicianCondition = !empty($physicianId) && $physicianId!='All' ? ' AND s.physician_id='.$physicianId :'';
- $rawTestByPhysician = DB::select("
- select
- r.repayment_date as `invoice_date`,
- ss.`name_en` as sample_source,
- p.`name_en` AS patient,
- s.`sample_number`,
- concat('Repayment for invoice ',inv.invoice_code) as test_name,
- r.exchange_rate,
- ps.`name_en` AS physician_name,
- sum(r.cash_repayment_amount + r.bank_repayment_amount) AS total_amount,
- sum(r.cash_repayment_amount + r.bank_repayment_amount) AS total_net_amount,
- 0 as discount,
- sum(r.cash_repayment_amount) as total_paid,
- sum(r.bank_repayment_amount) as total_bank_paid,
- 0 as total_owe
- from repayments r
- inner join invoices inv on inv.id = r.invoice_id and r.lab_id = inv.lab_id and inv.record_status_id = 1
- inner join samples s on s.`id` = inv.`sample_id` and s.`lab_id` = inv.`lab_id` and s.`record_status_id` = 1
- inner join patients p on p.`id` = s.`patient_id` and p.`lab_id` = s.`lab_id`
- INNER JOIN sample_sources ss ON ss.id = s.`sample_source_id` AND ss.`lab_id` = s.`lab_id`
- INNER JOIN physicians ps ON ps.`id` = s.`physician_id`
- where r.`record_status_id` = 1
- ".$physicianCondition."
- AND DATE(r.repayment_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- and r.lab_id= ".$this->baseLabId."
- group by r.`repayment_date`,
- ss.`name_en`,
- p.`name_en`,
- s.`sample_number`,
- ps.`name_en`,
- r.exchange_rate,
- inv.invoice_code
- order by sample_number asc
- ");
-
- return $rawTestByPhysician;
- } catch (\Exception $e){
- dd($e);
- return [];
- }
- }
-
- public function getVaccinationReport($startDate, $endDate){
- try{
- //\DB::enableQueryLog();
- $rawTestByPhysician = DB::select("
- SELECT
- inv.vaccination_date AS `invoice_date`,
- 'Vaccination' AS sample_source,
- p.`name_en` AS patient,
- inv.invoice_code AS `sample_number`,
- invd.test_name,
- '' AS physician_name,
- inv.exchange_rate,
- SUM(inv.total) AS total_amount,
- SUM(inv.gross_total) AS total_net_amount,
- SUM(inv.total) - SUM(inv.gross_total) AS discount,
- SUM(IFNULL(inv.deposit, 0)) AS total_paid,
- SUM(IFNULL(inv.bank_deposit,0)) AS total_bank_paid,
- SUM(inv.balance) AS total_owe
- FROM vaccination_invoices inv
- INNER JOIN patients p ON p.`id` = inv.`patient_id` AND p.`lab_id` = inv.`lab_id`
- INNER JOIN (
- SELECT
- inv.id,
- GROUP_CONCAT(DISTINCT m.name SEPARATOR ', ') AS test_name
- FROM vaccination_invoice_details invd
- INNER JOIN vaccination_invoices inv ON inv.id = invd.vac_invoice_id
- INNER JOIN `medicine_items` mi ON mi.id = invd.medicine_item_id
- INNER JOIN medicines m ON m.id = mi.medicine_id
- WHERE inv.`record_status_id` = 1
- AND DATE(inv.vaccination_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- AND inv.lab_id= ".$this->baseLabId."
- GROUP BY inv.id
- )invd
- ON invd.id = inv.id
-
- WHERE inv.`record_status_id` = 1
-
- AND DATE(inv.vaccination_date) BETWEEN '".date('Y-m-d', strtotime($startDate))."' AND '".date('Y-m-d', strtotime($endDate))."'
- AND inv.lab_id= ".$this->baseLabId."
- GROUP BY inv.`vaccination_date`,
- p.`name_en`,
- inv.invoice_code,
- invd.test_name,
- inv.exchange_rate
- ORDER BY inv.invoice_code ASC
- ");
- //dd(\DB::getQueryLog());
- return $rawTestByPhysician;
- } catch (\Exception $e){
- return [];
- }
- }
-
-
- /**
- * =====================================
- * EXPORT FUNCTION STARTED
- */
-
- function exportDoctorSampleBase($arrData){
- $data = $arrData;
- $titleHeading = [
- __('No'),
- __('Sample Source'),
- __('Exam'),
- __('Net Amount'),
- ];
- $export = new DoctorSampleSourceExport($data);
- $export->setTitle(__('Doctor Report'));
- $export->setTitleHeadingTable($titleHeading);
- $dateTime = Carbon::now()->toDateTime()->format(DateFormatEnum::YmdHis);
- $fileName = 'doctor_report_by_sample'.$dateTime.'.xlsx';
- return Excel::download($export, $fileName);
- }
-
- function exportDoctorPhysicianBase($arrData){
- $data = $arrData;
- $titleHeading = [
- __('No'),
- __('Physician'),
- __('Exam'),
- __('Net Amount'),
- ];
- $export = new DoctorPhysicianExport($data);
- $export->setTitle(__('Doctor Report'));
- $export->setTitleHeadingTable($titleHeading);
- $dateTime = Carbon::now()->toDateTime()->format(DateFormatEnum::YmdHis);
- $fileName = 'doctor_report_by_physician'.$dateTime.'.xlsx';
- return Excel::download($export, $fileName);
- }
-
- function exportDoctorRawBase($arrData){
- $data = $arrData;
- $titleHeading = [
- __('Date'),
- __('Sample Source'),
- __('Patient'),
- __('Sample Number'),
- __('Test Name'),
- __('Physician'),
- __('Total Amount'),
- __('Net Amount'),
- ];
- $export = new DoctorPhysicianExport($data);
- $export->setTitle(__('Doctor Report'));
- $export->setTitleHeadingTable($titleHeading);
- $dateTime = Carbon::now()->toDateTime()->format(DateFormatEnum::YmdHis);
- $fileName = 'doctor_report'.$dateTime.'.xlsx';
- return Excel::download($export, $fileName);
- }
-
- function exportSummaryReport($arrData){
- $data = $arrData;
- $titleHeading = [
- __('Sample Type'),
- __('Test Type'),
- __('Male Patient'),
- __('Female Patient'),
- __('Total Patient')
- ];
- $export = new SummaryReportExport($data);
- $export->setTitle(__('Summary Report by Test Type'));
- $export->setTitleHeadingTable($titleHeading);
- $dateTime = Carbon::now()->toDateTime()->format(DateFormatEnum::YmdHis);
- $fileName = 'summary_report'.$dateTime.'.xlsx';
- return Excel::download($export, $fileName);
- }
-
- function exportFinancialReport($arrData){
- $data = $arrData;
- $titleHeading = [
- __('No'),
- __('Invoice Date'),
- __('Sample Number'),
- __('Patient Name'),
- __('Test Name'),
- __('Physician'),
- __('Exchange Rate'),
- __('Total'),
- __('Discount'),
- __('Net Amount'),
- __('Cash Pay'),
- __('Bank Pay'),
- __('Owe'),
- ];
- $export = new FinancialReportExport($data);
- $export->setTitle(__('Financial Report'));
- $export->setTitleHeadingTable($titleHeading);
- $dateTime = Carbon::now()->toDateTime()->format(DateFormatEnum::YmdHis);
- $fileName = 'financial_report'.$dateTime.'.xlsx';
- return Excel::download($export, $fileName);
- }
-
-
-
-}
diff --git a/app/Http/Controllers/RoleController.php b/app/Http/Controllers/RoleController.php
index aaf679f..d638aa8 100644
--- a/app/Http/Controllers/RoleController.php
+++ b/app/Http/Controllers/RoleController.php
@@ -19,21 +19,21 @@ class RoleController extends Controller
protected $roleModel;
protected $roleHasPermission;
- protected $baseLabId;
+ protected $baseOrganizationId;
protected $labs;
public function __construct(RoleHasPermission $roleHasPermission, Role $roleModel){
$this->roleModel = $roleModel;
$this->roleHasPermission = $roleHasPermission;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
public function index(Request $request){
if(!GlobalController::user_can(Auth::user()->role_id, ['view_user_role'])) return redirect(url('my-profile'));
$recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
$roles = $this->roleModel::with('lab')->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->whereNotIn('id', [UtilEnum::ADMINISTRATOR_ROLE])
->when(!empty($request->kword), function ($roles) use($request){
$roles->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
@@ -46,7 +46,7 @@ class RoleController extends Controller
if(!GlobalController::user_can(Auth::user()->role_id, ['create_user_role'])) return false;
$validator = \Validator::make($request->all(), ['name_en' => 'required']);
if ($validator->fails()) return response()->json(['success' => false, 'message' => __('system_role.create_fail'), 'errors'=>$validator->errors()->all()]);
- $new = $this->roleModel::query()->create(['name_en' => $request->name_en, 'lab_id' => $this->baseLabId]);
+ $new = $this->roleModel::query()->create(['name_en' => $request->name_en, 'organization_id' => $this->baseOrganizationId]);
return response()->json(['success' => true, 'message' => __('system_role.create_success')]);
} catch (\Exception $e){
return response()->json(['success' => false, 'message' => __('system_role.create_fail'), 'errors' => $e->getMessage()]);
diff --git a/app/Http/Controllers/SampleController.php b/app/Http/Controllers/SampleController.php
index a76572c..a4fbfab 100644
--- a/app/Http/Controllers/SampleController.php
+++ b/app/Http/Controllers/SampleController.php
@@ -48,7 +48,7 @@ class SampleController extends Controller
protected $organismResultModel;
protected $antibioticResultModel;
- protected $baseLabId;
+ protected $baseOrganizationId;
protected $base;
protected $invoiceModel;
@@ -74,8 +74,8 @@ class SampleController extends Controller
$this->invoiceDetailModel = $invoiceDetailModel;
$this->laboratoryConfigures = $laboratoryConfigures;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
public function index(Request $request){
@@ -83,7 +83,7 @@ class SampleController extends Controller
$recordStatusConditions = Auth::id()==1 ? [RecordStatusEnum::ACTIVE, RecordStatusEnum::DELETE] : [RecordStatusEnum::ACTIVE];
$samples = $this->model::with(['patient','sample_source'])
->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions)
- ->where('lab_id', $this->baseLabId)
+ ->where('organization_id', $this->baseOrganizationId)
->when(Auth::user()->role_id == UtilEnum::PHYSICIAN_ROLE, function($sample){
$sample->where('sample_source_id', Auth::user()->sample_source_id);
})->when(!empty(trim($request->kword)), function ($samples) use($request, $recordStatusConditions){
@@ -92,7 +92,7 @@ class SampleController extends Controller
->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
->orWhereRaw("replace(phone_number, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
->orWhere('patient_uuid','like','%'.$request->kword.'%')->pluck('id')->toArray()
- )->where('lab_id', $this->baseLabId)->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions);
+ )->where('organization_id', $this->baseOrganizationId)->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusConditions);
})->when(!empty(trim($request->sample_status)), function ($samples) use($request){
$samples->whereIn('id', $this->filterSampleStatus($request->sample_status));
})->when(!empty($request->sample_date) && empty($request->kword) , function ($samples) use($request){
@@ -131,10 +131,10 @@ class SampleController extends Controller
FROM samples s
LEFT JOIN test_results tr
ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
+ AND s.`organization_id` = tr.`organization_id`
LEFT JOIN test_samples ts
ON ts.id = tr.`test_sample_id`
- AND ts.lab_id = tr.lab_id
+ AND ts.organization_id = tr.organization_id
LEFT JOIN sample_types st
ON st.id = ts.`sample_type_id`
LEFT JOIN(
@@ -144,16 +144,16 @@ class SampleController extends Controller
FROM samples s
INNER JOIN test_results tr
ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
+ AND s.`organization_id` = tr.`organization_id`
INNER JOIN organism_results orgr
ON orgr.`test_result_id` = tr.`id`
- WHERE s.lab_id = '.$this->baseLabId.'
+ WHERE s.organization_id = '.$this->baseOrganizationId.'
AND tr.`record_status_id` = 1
AND orgr.`record_status_id` = 1
GROUP BY tr.id
) AS org_result
ON org_result.id = tr.`id`
- WHERE s.`lab_id` = '.$this->baseLabId.'
+ WHERE s.`organization_id` = '.$this->baseOrganizationId.'
AND s.`record_status_id` = 1
AND (tr.`record_status_id` = 1 OR tr.`record_status_id` IS NULL)
AND (st.`record_status_id` = 1 OR st.`record_status_id` IS NULL)
@@ -172,13 +172,13 @@ class SampleController extends Controller
public function create($patient_id = null){
if(!GlobalController::user_can(Auth::user()->role_id, ['create_sample'])) return redirect(url('my-profile'));
$rejectComments = $this->rejectCommentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('reject_comment', 'ASC')->get();
- $physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('name_en', 'ASC')->get();
- $sampleSources = $this->sampleSourceModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('name_en','ASC')->get();
- $patients = $this->patientModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
+ $physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->orderBy('name_en', 'ASC')->get();
+ $sampleSources = $this->sampleSourceModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->orderBy('name_en','ASC')->get();
+ $patients = $this->patientModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])
->when(!empty($patient_id), function ($patients) use ($patient_id){
- $patients->where(['id' => $patient_id, 'lab_id' => $this->baseLabId ]);
+ $patients->where(['id' => $patient_id, 'organization_id' => $this->baseOrganizationId ]);
})->orderBy(BaseModel::CREATED_AT_FIELD, 'DESC')->limit(30)->get();
- $testGroups = $this->testGroupModel::with(['testGroupDetails'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('created_at')->get();
+ $testGroups = $this->testGroupModel::with(['testGroupDetails'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('created_at')->get();
return view('new_sample', [
'labSettings' => (object) $this->base,
'physicians' => $physicians,
@@ -194,7 +194,7 @@ class SampleController extends Controller
public function generateAutoId($admissionDate){
$prefix = date('ymd',strtotime($admissionDate));
$sample = Sample::query();
- $sampleCount = $sample->where('lab_id', $this->baseLabId)->whereRaw('date(admission_date) ="'. date('Y-m-d',strtotime($admissionDate)).'"')->count();
+ $sampleCount = $sample->where('organization_id', $this->baseOrganizationId)->whereRaw('date(admission_date) ="'. date('Y-m-d',strtotime($admissionDate)).'"')->count();
return 'S-'.$this->base['short_name'].'-'.$prefix.'-'.(str_pad(($sampleCount+1),3,'0',STR_PAD_LEFT));
}
@@ -202,7 +202,7 @@ class SampleController extends Controller
DB::beginTransaction();
try{
if(!GlobalController::user_can(Auth::user()->role_id, ['create_sample'])) return false;
- $request = collect($sampleCreateRequest)->merge(['lab_id'=>$this->baseLabId]);
+ $request = collect($sampleCreateRequest)->merge(['organization_id'=>$this->baseOrganizationId]);
if(empty($sampleCreateRequest->sample_number)) {
$sampleNumber = $this->generateAutoId($sampleCreateRequest->admission_date);
$request = $request->merge(['sample_number' => $sampleNumber]);
@@ -242,7 +242,7 @@ class SampleController extends Controller
public function store1(SampleCreateRequest $sampleCreateRequest){
DB::beginTransaction();
try{
- $request = collect($sampleCreateRequest)->merge(['lab_id'=>$this->baseLabId]);
+ $request = collect($sampleCreateRequest)->merge(['organization_id'=>$this->baseOrganizationId]);
if(empty($sampleCreateRequest->sample_number)) {
$sampleNumber = $this->generateAutoId($sampleCreateRequest->admission_date);
$request = $request->merge(['sample_number' => $sampleNumber]);
@@ -259,12 +259,12 @@ class SampleController extends Controller
public function edit(Request $request, $id){ // url: base_url/sample/edit/[sample-id]
if(!GlobalController::user_can(Auth::user()->role_id, ['update_sample'])) return redirect(url('my-profile'));
- $sample = $this->model::with(['patient'/*'patient.telegramChatId'*/,'invoice'])->where(['lab_id' => $this->baseLabId,'id' => $id])->first();
+ $sample = $this->model::with(['patient'/*'patient.telegramChatId'*/,'invoice'])->where(['organization_id' => $this->baseOrganizationId,'id' => $id])->first();
$rejectComments = $this->rejectCommentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('reject_comment', 'ASC')->get();
- $physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('name_en', 'ASC')->get();
+ $physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->orderBy('name_en', 'ASC')->get();
$samplePhysician = $this->physicianModel::query()->where('id', $sample->physician_id)->first();
- $sampleSources = $this->sampleSourceModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('name_en','ASC')->get();
- $testGroups = $this->testGroupModel::with(['testGroupDetails'])->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('created_at')->get();
+ $sampleSources = $this->sampleSourceModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->orderBy('name_en','ASC')->get();
+ $testGroups = $this->testGroupModel::with(['testGroupDetails'])->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('created_at')->get();
$now = strtotime($sample->admission_date); // or your date as well
$your_date = strtotime($sample->patient->dob);
@@ -277,10 +277,10 @@ class SampleController extends Controller
$prevSample = [];
if(isset($_GET['previous_sample'])){
- $prevSample = $this->model::with(['patient','invoice'])->where(['lab_id' => $this->baseLabId, 'id' => $_GET['previous_sample']])->get();
+ $prevSample = $this->model::with(['patient','invoice'])->where(['organization_id' => $this->baseOrganizationId, 'id' => $_GET['previous_sample']])->get();
}
- $labConfigures = $this->laboratoryConfigures::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get()->toArray();
+ $labConfigures = $this->laboratoryConfigures::query()->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get()->toArray();
$resultTemplateId = (collect($labConfigures)->where('atrribute_code', 'RESULT_TEMPLATE')->pluck('assigned_attribute_value')->first());
if(!empty($resultTemplateId)){
@@ -314,7 +314,7 @@ class SampleController extends Controller
}
function getPreviousSample($patientId, $curSampleId){
- return $this->model::query()->where(['patient_id' => $patientId, 'lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ return $this->model::query()->where(['patient_id' => $patientId, 'organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->where('id','<', $curSampleId)->orderBy('id', 'desc')->get(['id','admission_date', 'sample_number']);
}
@@ -328,7 +328,7 @@ class SampleController extends Controller
try{
if(!GlobalController::user_can(Auth::user()->role_id, ['update_sample'])) return redirect(url('my-profile'));
$request = collect($sampleUpdateRequest)->except(['id','sample_number','patient_id','_token']);
- $patientSample = $this->model::query()->where(['id' => $sampleUpdateRequest->id, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $sampleUpdateRequest->id, 'organization_id' => $this->baseOrganizationId])->first();
$patientSample->update($request->all());
DB::commit();
$sampleUpdateRequest->session()->flash('message','Update success.');
@@ -348,7 +348,7 @@ class SampleController extends Controller
public function delete(Request $request){
try{
if(!GlobalController::user_can(Auth::user()->role_id, ['delete_sample'])) return false;
- $patientSample = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $request->uid, 'organization_id' => $this->baseOrganizationId])->first();
$patientSample->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
return response()->json(['success' => true, 'message' => __('sample.delete_success')]);
}
@@ -359,7 +359,7 @@ class SampleController extends Controller
public function restore(Request $request){
try{
- $patientSample = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $request->uid, 'organization_id' => $this->baseOrganizationId])->first();
$patientSample->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
return response()->json(['success' => true, 'message' => __('sample.restore_success')]);
}
@@ -371,7 +371,7 @@ class SampleController extends Controller
public function approve(Request $request){
try{
if(!GlobalController::user_can(Auth::user()->role_id, ['approve_result'])) return false;
- $patientSample = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $request->uid, 'organization_id' => $this->baseOrganizationId])->first();
$patientSample->update(array('approved_by' => Auth::id(), 'approved_date' => date('Y-m-d H:i:s')));
return response()->json(['success' => true, 'message' => __('sample.approve_success')]);
}
@@ -388,7 +388,7 @@ class SampleController extends Controller
DB::beginTransaction();
try{
if(!GlobalController::user_can(Auth::user()->role_id, ['create_sample', 'update_sample'])) return false;
- $this->sampleDetailModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'lab_id' => $this->baseLabId])->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
+ $this->sampleDetailModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'organization_id' => $this->baseOrganizationId])->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
$sampleDetails = collect($sampleCreateRequest->sample_details);
$sampleDetails->map(function ($item){
if(!empty($item['sample_description'])){
@@ -398,31 +398,31 @@ class SampleController extends Controller
'test_date' => date('Y-m-d'),
'lab_technician_id' => Auth::id(),
'sample_descr' => $item['sample_description'],
- 'lab_id' => $this->baseLabId
+ 'organization_id' => $this->baseOrganizationId
]);
}
});
//dd($sampleCreateRequest->sample_tests);
if(!empty($sampleCreateRequest->sample_tests)){
- $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'lab_id' => $this->baseLabId])
+ $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'organization_id' => $this->baseOrganizationId])
->whereNotIn('test_sample_id', $sampleCreateRequest->sample_tests)
->delete();
foreach ($sampleCreateRequest->sample_tests as $test){
$existingTestResult = $this->testResultModel::query()->where([
'test_sample_id' => $test,
- 'lab_id' => $this->baseLabId,
+ 'organization_id' => $this->baseOrganizationId,
'sample_id' => $sampleCreateRequest->sample_id
])->get()->toArray();
if(empty($existingTestResult)) {
$testResult = $this->testResultModel::query()->create([
'sample_id' => $sampleCreateRequest->sample_id,
'test_sample_id' => $test,
- 'lab_id' => $this->baseLabId
+ 'organization_id' => $this->baseOrganizationId
]);
}
}
}else{
- $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'lab_id' => $this->baseLabId])->delete();
+ $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'organization_id' => $this->baseOrganizationId])->delete();
}
@@ -456,7 +456,7 @@ class SampleController extends Controller
'bank_deposit' => 0,
'balance' => number_format($grossTotal * ($labSettings->currency==1 ? $labSettings->exchange_rate : 1),2, '.', ''),
'invoice_date' => date('Y-m-d', strtotime($sample->admission_date)),
- 'lab_id'=>$this->baseLabId,
+ 'organization_id'=>$this->baseOrganizationId,
'exchange_rate' => $labSettings->exchange_rate
]);
$invoice = $this->invoiceModel::query()->create($invoiceRequest->all());
@@ -524,7 +524,7 @@ class SampleController extends Controller
$ref_performed_by = collect($request->ref_test_sample_performer);
$ref_test_sample_comment = collect($request->ref_test_sample_comment);
$vars = $data->map(function ($val, $key) use($request, $ref_test_sample_id_value, $ref_test_date, $ref_performed_by, $ref_test_sample_comment){
- $this->testResultModel::query()->where(['lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val])->update([
+ $this->testResultModel::query()->where(['organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val])->update([
'test_result' => @$ref_test_sample_id_value[$key],
'test_date' => @$ref_test_date[$key],
'performed_by' => @$ref_performed_by[$key],
@@ -540,7 +540,7 @@ class SampleController extends Controller
//$ref_performed_by = collect($request->ref_test_sample_performer);
$ref_test_sample_comment_ = collect($request->ref_test_sample_comment___);
$vars = $datas->map(function ($val_, $key_) use($request, $ref_test_sample_comment_){
- $this->testResultModel::query()->where(['lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val_])->update([
+ $this->testResultModel::query()->where(['organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val_])->update([
//'test_date' => @$ref_test_date[$key],
//'performed_by' => @$ref_performed_by[$key],
'comment' => $ref_test_sample_comment_[$key_],
@@ -551,16 +551,16 @@ class SampleController extends Controller
// set hide test
if(isset($request->test_samples_to_hide)){
- $this->testResultModel::query()->where(['lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id])
+ $this->testResultModel::query()->where(['organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id])
->whereNotIn('test_sample_id', $request->test_samples_to_hide)->update(['is_show' => 1]);
foreach ($request->test_samples_to_hide as $val){
- $this->testResultModel::query()->where(['lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val])->update([
+ $this->testResultModel::query()->where(['organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id, 'test_sample_id' => $val])->update([
'is_show' => 0
]);
}
} else{
- $this->testResultModel::query()->where(['lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id])->update(['is_show' => 1]);
+ $this->testResultModel::query()->where(['organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id])->update(['is_show' => 1]);
}
// organism result
@@ -575,13 +575,13 @@ class SampleController extends Controller
// change on 08/Sep/2023 to fixed issue save result success but no data affect
//$testResult = $this->testResultModel::query()->where(['test_sample_id' => $org->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderByDesc('id')->limit(1)->first();
- $testResult = $this->testResultModel::query()->where(['test_sample_id' => $org->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId, 'sample_id' => $request->sample_id])->orderByDesc('id')->limit(1)->first();
+ $testResult = $this->testResultModel::query()->where(['test_sample_id' => $org->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId, 'sample_id' => $request->sample_id])->orderByDesc('id')->limit(1)->first();
if(count($organismIds)>0){
- $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'lab_id' => $this->baseLabId])->whereNotIn('organism_id', $organismIds)->update(['record_status_id' => 0]);
+ $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organization_id' => $this->baseOrganizationId])->whereNotIn('organism_id', $organismIds)->update(['record_status_id' => 0]);
}
- $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $org->organism_id, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->first();
+ $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $org->organism_id, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->first();
//$organismResultId = 0;
if(!empty($organismResult)){
@@ -597,7 +597,7 @@ class SampleController extends Controller
'organism_id' => $org->organism_id,
'quantity_id' => (int)$org->quantity_id,
'contaminant' => $org->contaminant,
- 'lab_id' => $this->baseLabId,
+ 'organization_id' => $this->baseOrganizationId,
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
BaseModel::CREATED_AT => date('Y-m-d H:i:s')
]);
@@ -678,10 +678,10 @@ class SampleController extends Controller
FROM samples s
INNER JOIN test_results tr
ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
+ AND s.`organization_id` = tr.`organization_id`
INNER JOIN test_samples ts
ON ts.id = tr.`test_sample_id`
- and ts.lab_id = tr.lab_id
+ and ts.organization_id = tr.organization_id
INNER JOIN tests t
ON t.`id` = ts.`test_id`
INNER JOIN sample_types st
@@ -692,7 +692,7 @@ class SampleController extends Controller
ON pct.`test_sample_id` = ts.`id`
AND pct.`physician_id` = s.`physician_id`
WHERE s.`id` = '.$sampleId.'
- AND s.`lab_id`= '.$this->baseLabId.'
+ AND s.`organization_id`= '.$this->baseOrganizationId.'
AND tr.`record_status_id` = '.BaseModel::RECORD_STATUS_ACTIVE.'
AND LENGTH(ts.group_result)>0
AND ts.usd_price>0
@@ -728,7 +728,7 @@ class SampleController extends Controller
function printRecorder(Request $request){
DB::beginTransaction();
try{
- $patientSample = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $request->uid, 'organization_id' => $this->baseOrganizationId])->first();
if($patientSample->is_printed==0) {
$patientSample->update(
[
@@ -748,7 +748,7 @@ class SampleController extends Controller
public function generateInvoiceId($invoiceDate){
$prefix = date('y',strtotime($invoiceDate));
- $invoiceCount = $this->invoiceModel::query()->where('lab_id', $this->baseLabId)->whereRaw('year(invoice_date) ="'. date('Y',strtotime($invoiceDate)).'"')->count();
+ $invoiceCount = $this->invoiceModel::query()->where('organization_id', $this->baseOrganizationId)->whereRaw('year(invoice_date) ="'. date('Y',strtotime($invoiceDate)).'"')->count();
return 'I-'.$this->base['short_name'].'-'.$prefix.'-'.(str_pad(($invoiceCount+1),5,'0',STR_PAD_LEFT));
}
@@ -758,8 +758,8 @@ class SampleController extends Controller
// if(Auth::user()->id==1){
DB::beginTransaction();
try{
- $testResult = $this->testResultModel::query()->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId, 'sample_id' => $sampleId])->orderByDesc('id')->limit(1)->first();
- $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->first();
+ $testResult = $this->testResultModel::query()->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId, 'sample_id' => $sampleId])->orderByDesc('id')->limit(1)->first();
+ $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->first();
if(empty($organismResult)){
$savedOrg = $this->organismResultModel::query()->create([
@@ -767,7 +767,7 @@ class SampleController extends Controller
'organism_id' => $organismId,
'quantity_id' => 0,
'contaminant' => 0,
- 'lab_id' => $this->baseLabId,
+ 'organization_id' => $this->baseOrganizationId,
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
BaseModel::CREATED_AT => date('Y-m-d H:i:s')
]);
@@ -787,10 +787,10 @@ class SampleController extends Controller
//if(Auth::user()->id==1){
DB::beginTransaction();
try{
- $testResult = $this->testResultModel::query()->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId, 'sample_id' => $sampleId])->orderByDesc('id')->limit(1)->first();
- $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->first();
+ $testResult = $this->testResultModel::query()->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId, 'sample_id' => $sampleId])->orderByDesc('id')->limit(1)->first();
+ $organismResult = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD =>RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->first();
if(!empty($organismResult)){
- $savedOrg = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
+ $savedOrg = $this->organismResultModel::query()->where(['test_result_id' => $testResult->id, 'organism_id' => $organismId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])
->update([
'quantity_id' => $qtyId
]);
@@ -865,7 +865,7 @@ class SampleController extends Controller
public function updateSampleResultTemplate(Request $request){
try{
- $patientSample = $this->model::query()->where(['id' => $request->uid, 'lab_id' => $this->baseLabId])->first();
+ $patientSample = $this->model::query()->where(['id' => $request->uid, 'organization_id' => $this->baseOrganizationId])->first();
$patientSample->update(['result_template_id' => $request->result_template_id]);
return response()->json(['success'=> true , 'message' => 'Sample result template already saved!']);
} catch (\Exception $e){
diff --git a/app/Http/Controllers/SampleSourceController.php b/app/Http/Controllers/SampleSourceController.php
deleted file mode 100644
index 97c6eef..0000000
--- a/app/Http/Controllers/SampleSourceController.php
+++ /dev/null
@@ -1,106 +0,0 @@
-sampleSourceModel = $sampleSourceModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_sample_source'])) return redirect(url('my-profile'));
- $sampleSources = $this->sampleSourceModel::with(['lab'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($sampleSources) use($request){
- $sampleSources->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
- })->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('sample_source', ['sampleSources' => $sampleSources, 'labs' => parent::getAccessAbleLabs()]);
- }
-
- public function save(Request $request){
- try {
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_sample_source'])) return false;
- $validator = \Validator::make($request->all(), [
- 'name_en' => 'required',
- 'name_kh' => 'nullable'
- ]);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('sample_source.create_fail'), 'errors' => $validator->errors()->all()]);
-
- $new = $this->sampleSourceModel::query()->firstOrNew(['name_en' => $request->name_en, 'lab_id' => $this->baseLabId]);
- $new->name_en = $request->name_en;
- $new->is_default = $request->is_default;
- $new->lab_id = $this->baseLabId;
- $new->created_at = date('Y-m-d H:i:s');
- $new->created_by = Auth::id();
- $new->record_status_id = RecordStatusEnum::ACTIVE;
- $new->save();
-
- return response()->json(['success' => true, 'message' => __('sample_source.create_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_source.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_sample_source'])) return false;
- $validator = \Validator::make($request->all(), [ 'name_en' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('sample_source.update_fail'), 'errors' => $validator->errors()->all()]);
- $data = array(
- 'name_en' => $request->name_en,
- 'name_kh' => $request->name_kh,
- 'is_default' =>$request->is_default,
- 'updated_at' => date('Y-m-d H:i:s'),
- 'updated_by' => Auth::id()
- );
- $this->sampleSourceModel::query()->where('id', $request->uid)->update($data);
- return response()->json(['success' => true, 'message' => __('sample_source.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_source.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $sampleSource = $this->sampleSourceModel::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('sample_source.get_success'), 'data' => $sampleSource]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_source.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_sample_source'])) return false;
- $this->sampleSourceModel::query()->where('id', $request->uid)->update(array( BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('sample_source.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_source.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->sampleSourceModel::query()->where('id', $request->uid)->update(array( BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('sample_source.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_source.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/SampleTypeController.php b/app/Http/Controllers/SampleTypeController.php
deleted file mode 100644
index ee09664..0000000
--- a/app/Http/Controllers/SampleTypeController.php
+++ /dev/null
@@ -1,133 +0,0 @@
-departmentModel = $departmentModel;
- $this->sampleTypeModel = $sampleTypeModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_sample_type'])) return redirect(url('my-profile'));
- $standardSampleTypes = $this->sampleTypeModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'is_standard' => 1])->get(['id','name_en'])->unique('name_en');
- $departments = $this->departmentModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->where('lab_id', $this->baseLabId)->get();
- $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
- $sampleTypes = $this->sampleTypeModel::with(['department'=>function($query) {return $query->orderBy('id','ASC');}])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
- ->where('lab_id', $this->baseLabId)
- ->when(!empty($request->kword), function ($sampleTypes) use($request, $recordStatusCondition){
- $sampleTypes->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
- ->orWhereIn('department_id', $this->departmentModel::query()
- ->where('lab_id', $this->baseLabId)
- ->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")->pluck('id')->toArray()
- )->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition);;
- })->orderBy('weight','ASC')->paginate(config('labis.pagination.perpage', 10));
- return view('sample-type', ['sampleTypes' => $sampleTypes, 'departments' => $departments, 'standardSampleTypes' => $standardSampleTypes]);
- }
-
- public function save(Request $request){
- try {
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_sample_type'])) return false;
- $validator = \Validator::make($request->all(), ['name_en' => 'required', 'department_id' => 'required']);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('sample_type.create_fail'), 'errors' => $validator->errors()->all()]);
- $new = $this->sampleTypeModel::query()->firstOrNew(['name_en' => $request->name_en, 'department_id' => $request->department_id]);
- $new->name_en = $request->name_en;
- $new->weight = $request->weight;
- $new->tube = $request->tube;
- $new->bg_color = $request->bg_color;
- $new->color = $request->color;
- $new->lab_id = $this->baseLabId;
- $new->department_id = $request->department_id;
- $new->enter_form_id = $request->enter_form_id;
- $new->preview_form_id = $request->preview_form_id;
- $new->description = is_array($request->description) ? json_encode($request->description) : NULL;
- $new->save();
-
- return response()->json(['success' => true, 'message' => __('sample_type.create_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.create_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function update(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_sample_type'])) return false;
- $validator = \Validator::make($request->all(), ['uid' => 'required', 'name_en' => 'required' /*,'department_ids' => 'required'*/]);
- if ($validator->fails()) return response()->json(['success' => false, 'message' => __('sample_type.update_fail'), 'errors' => $validator->errors()->all()]);
- $data = array(
- 'name_en' => $request->name_en,
- 'weight' => $request->weight,
- 'tube' => $request->tube,
- 'bg_color' => $request->bg_color,
- 'color' => $request->color,
- 'department_id' =>$request->department_id,
- 'enter_form_id' => $request->enter_form_id,
- 'preview_form_id' => $request->preview_form_id,
- 'description' => is_array($request->description) ? json_encode($request->description) : NULL
- );
- $this->sampleTypeModel::query()->where('id', $request->uid)->update($data);
- return response()->json(['success' => true, 'message' => __('sample_type.update_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function get(Request $request){
- try{
- $sampleType = $this->sampleTypeModel::query()->find($request->uid);
- return response()->json(['success' => true, 'message' => __('sample_type.get_success'), 'data' => $sampleType]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_sample_type'])) return false;
- $this->sampleTypeModel::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::DELETE));
- return response()->json(['success' => true, 'message' => __('sample_type.delete_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.delete_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function restore(Request $request){
- try{
- $this->sampleTypeModel::query()->where('id', $request->uid)->update(array('record_status_id'=> RecordStatusEnum::ACTIVE));
- return response()->json(['success' => true, 'message' => __('sample_type.restore_success')]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.restore_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function getById($id){
- try{
- $sampleType = $this->sampleTypeModel::query()->find($id);
- return response()->json(['success' => true, 'message' => __('sample_type.get_success'), 'data' => $sampleType]);
- } catch (\Exception $e){
- return response()->json(['success' => false, 'message' => __('sample_type.get_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
-
-}
diff --git a/app/Http/Controllers/ShareController.php b/app/Http/Controllers/ShareController.php
index cc6f513..ec1543d 100644
--- a/app/Http/Controllers/ShareController.php
+++ b/app/Http/Controllers/ShareController.php
@@ -7,7 +7,7 @@ use App\Models\BaseModel;
use App\Models\Comment;
use App\Models\Department;
use App\Models\LabConfigure;
-use App\Models\Laboratory;
+use App\Models\Organization;
use App\Models\Patient;
use App\Models\Physician;
use App\Models\SampleSource;
@@ -50,9 +50,9 @@ class ShareController extends Controller
public function index($id){
$sample = Sample::with(['patient','invoice'])->where(['id' => $id])->first();
- $labSettings = Laboratory::query()->find($sample->lab_id);
+ $labSettings = Organization::query()->find($sample->organization_id);
$samplePhysician = Physician::query()->where('id', $sample->physician_id)->first();
- $labConfigures = $this->laboratoryConfigures::query()->where(['lab_id' => $sample->lab_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get()->toArray();
+ $labConfigures = $this->laboratoryConfigures::query()->where(['organization_id' => $sample->organization_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get()->toArray();
$preview_form_id = ($labSettings->lab_category_id==0? 1:2);
@@ -126,23 +126,23 @@ class ShareController extends Controller
ifnull(pct.`partner_price`, 0.00) as partner_price,
ts.weight,
ts.is_bold,
- ts.lab_id,
+ ts.organization_id,
tr.test_date,
tr.comment,
sd.sample_descr
FROM samples s
INNER JOIN patients p
- ON p.id = s.patient_id AND p.lab_id = s.lab_id
+ ON p.id = s.patient_id AND p.organization_id = s.organization_id
INNER JOIN test_results tr
ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
+ AND s.`organization_id` = tr.`organization_id`
INNER JOIN test_samples ts
ON ts.id = tr.`test_sample_id`
- and ts.lab_id = tr.lab_id
+ and ts.organization_id = tr.organization_id
INNER JOIN tests t
ON t.`id` = ts.`test_id`
- /*AND t.`lab_id` = ts.`lab_id`*/
+ /*AND t.`organization_id` = ts.`organization_id`*/
INNER JOIN sample_types st
ON st.`id` = ts.`sample_type_id`
INNER JOIN departments d
@@ -226,7 +226,7 @@ class ShareController extends Controller
'str_comment' => (string) $row->comment,
'is_bold' => (int) $row->is_bold,
'ts' => $row->test_result,
- 'lab_id' => $row->lab_id,
+ 'organization_id' => $row->organization_id,
'format' => (int)$row->format
);
//dd($testItemArray);
@@ -375,7 +375,7 @@ class ShareController extends Controller
*/
public function startAnonymousSession($hashLabId){
- $this->base = Laboratory::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
+ $this->base = Organization::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
->where('allow_external_request', 1)
->whereRaw('MD5(id)="'.$hashLabId.'"')->first();
$provinces = Province::where('id','<>', 25)->orderBy('name_kh')->get();
@@ -387,8 +387,8 @@ class ShareController extends Controller
$patients = [];
if(!empty(trim($request->term))){
$patients = $this->patientModel::query()
- ->where(['record_status_id' => 1, 'lab_id' => $labId])
- //->whereRaw('MD5(lab_id)="'.$hashLabId.'"')
+ ->where(['record_status_id' => 1, 'organization_id' => $labId])
+ //->whereRaw('MD5(organization_id)="'.$hashLabId.'"')
->when(!empty(trim($request->term)), function ($patients) use($request){
$patients->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->term)."%'");
//->orWhereRaw("replace(phone_number, ' ','') like '%".str_replace(" ","",$request->term)."%'");
@@ -404,7 +404,7 @@ class ShareController extends Controller
$patients = [];
if(!empty(trim($request->term))){
$patients = $this->patientModel::query()
- ->where(['record_status_id' => 1, 'lab_id' => $labId])
+ ->where(['record_status_id' => 1, 'organization_id' => $labId])
->when(!empty(trim($request->term)), function ($patients) use($request){
$patients->whereRaw("replace(phone_number, ' ','') like '%".str_replace(" ","",$request->term)."%'");
})->limit(3)->orderBy('phone_number', 'asc')->get();
@@ -438,13 +438,13 @@ class ShareController extends Controller
'name_en'=> $patient_name
]);
- $patientNumber = $this->generateAutoId(date('Y-m-d'), $request->short_name, $request->lab_id);
+ $patientNumber = $this->generateAutoId(date('Y-m-d'), $request->short_name, $request->organization_id);
$requests = $requests->merge(['patient_uuid' => $patientNumber]);
$patient = $this->patientModel::query()->create($requests->all());
DB::commit();
$request->session()->put('anonymous_id', $patient->id);
- $request->session()->put('base_lab_id', $patient->lab_id);
+ $request->session()->put('base_organization_id', $patient->organization_id);
if ($request->session()->has('anonymous_id')) {
return redirect(url('customer/'.$hashLabId.'?request-test'));
}
@@ -459,7 +459,7 @@ class ShareController extends Controller
public function generateAutoId($admissionDate, $labShortName, $labId){
$prefix = date('y',strtotime($admissionDate));
- $patientCount = $this->patientModel::query()->where('lab_id', $labId)->whereRaw('year(created_at) ="'. date('Y',strtotime($admissionDate)).'"')->count();
+ $patientCount = $this->patientModel::query()->where('organization_id', $labId)->whereRaw('year(created_at) ="'. date('Y',strtotime($admissionDate)).'"')->count();
if($labId==34) $patientCount = $patientCount+5; // solve problem when delete patient
return 'P-'.$labShortName.'-'.$prefix.'-'.(str_pad(($patientCount+1),5,'0',STR_PAD_LEFT));
}
@@ -472,7 +472,7 @@ class ShareController extends Controller
$pattern = '/ /i';
$phoneNumber = $request->phone_number;// preg_replace($pattern, '', trim($request->phone_number));
$patient = $this->patientModel::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'"')
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'"')
->when(!empty($request->phone_number) && empty($request->patient_id), function($patient) use($request){
$patient->whereRaw("replace(phone_number, ' ','') = '".str_replace(" ","",$request->phone_number)."'");
})->when(!empty($request->patient_id), function($patient) use($request){
@@ -485,7 +485,7 @@ class ShareController extends Controller
}
else{
$request->session()->put('anonymous_id', $patient->id);
- $request->session()->put('base_lab_id', $patient->lab_id);
+ $request->session()->put('base_organization_id', $patient->organization_id);
if ($request->session()->has('anonymous_id')) {
return redirect(url('customer/'.$hashLabId));
}
@@ -495,7 +495,7 @@ class ShareController extends Controller
public function anonymousLogOut(Request $request, $hashLabId){
if ($request->session()->has('anonymous_id')) {
$request->session()->forget('anonymous_id');
- $request->session()->forget('base_lab_id');
+ $request->session()->forget('base_organization_id');
return redirect(url('anonymous/'.$hashLabId));
}
}
@@ -507,16 +507,16 @@ class ShareController extends Controller
}
$patient = $this->patientModel::query()
->where(['id' => $request->session()->get('anonymous_id'), BaseModel::RECORD_STATUS_FIELD => BaseModel::RECORD_STATUS_ACTIVE])
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'"')->first();
- $this->base = Laboratory::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'"')->first();
+ $this->base = Organization::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
->whereRaw('MD5(id)="'.$hashLabId.'"')->first();
$samples = $this->sampleModel::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
->where('patient_id', $request->session()->get('anonymous_id'))
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'"')->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(5);
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'"')->orderBy(BaseModel::CREATED_AT_FIELD,'desc')->paginate(5);
$testGroups = $this->testGroupModel::with(['testGroupDetails'])->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'"')->orderBy('created_at')->get();
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'"')->orderBy('created_at')->get();
$physicians = $this->physicianModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'"')->orderBy('name_en')->get();
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'"')->orderBy('name_en')->get();
return view('shared.patient_profile',
[
'patient' => $patient,
@@ -537,8 +537,8 @@ class ShareController extends Controller
return redirect(url('anonymous/'.$hashLabId));
}
$sample = $this->sampleModel::with(['patient','invoice'])->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'" AND MD5(id)="'.$hashSampleId.'"')->first();
- $this->base = Laboratory::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'" AND MD5(id)="'.$hashSampleId.'"')->first();
+ $this->base = Organization::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
->whereRaw('MD5(id)="'.$hashLabId.'"')->first();
$labConfigures = $this->laboratoryConfigures::query()
->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
@@ -564,20 +564,20 @@ class ShareController extends Controller
DB::beginTransaction();
try{
$sample = $this->sampleModel::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
- ->whereRaw('MD5(lab_id)="'.$hashLabId.'" AND MD5(id)="'.$hashSampleId.'"')->first();
+ ->whereRaw('MD5(organization_id)="'.$hashLabId.'" AND MD5(id)="'.$hashSampleId.'"')->first();
$requestedSample = [];
if(!empty($sample)){
$reSampleArray = array(
'patient_id' => $sample->patient_id,
- 'sample_number' => $this->generateSampleNumber($sample->lab_id, date('Y-m-d H:i:s')),
+ 'sample_number' => $this->generateSampleNumber($sample->organization_id, date('Y-m-d H:i:s')),
'admission_date' => date('Y-m-d H:i:s'),
'sample_source_id' => $sample->sample_source_id,
'physician_id' => $sample->physician_id,
'requested_date' => date('Y-m-d H:i:s'),
'collected_date' => date('Y-m-d H:i:s'),
'is_accept_request' => 0,
- 'lab_id' => $sample->lab_id,
+ 'organization_id' => $sample->organization_id,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $sample->patient_id,
);
@@ -586,7 +586,7 @@ class ShareController extends Controller
$previousTests = $this->testResultModel::query()->where([
BaseModel::RECORD_STATUS_FIELD => BaseModel::RECORD_STATUS_ACTIVE,
'sample_id' => $sample->id,
- 'lab_id' => $sample->lab_id
+ 'organization_id' => $sample->organization_id
])->get();
if(!empty($requestedSample) && !empty($previousTests)){
$items = [];
@@ -597,7 +597,7 @@ class ShareController extends Controller
'test_result' => NULL,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $sample->patient_id,
- 'lab_id' => $previousItem->lab_id
+ 'organization_id' => $previousItem->organization_id
);
}
$this->testResultModel::query()->insert($items);
@@ -612,11 +612,11 @@ class ShareController extends Controller
}
public function generateSampleNumber($labId, $admissionDate){
- $this->base = Laboratory::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
+ $this->base = Organization::query()->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE)
->where('id', $labId)->first();
$prefix = date('ymd',strtotime($admissionDate));
$sample = Sample::query();
- $sampleCount = $sample->where('lab_id', $labId)->whereRaw('date(admission_date) ="'. date('Y-m-d',strtotime($admissionDate)).'"')->count();
+ $sampleCount = $sample->where('organization_id', $labId)->whereRaw('date(admission_date) ="'. date('Y-m-d',strtotime($admissionDate)).'"')->count();
return 'S-'.$this->base['short_name'].'-'.$prefix.'-'.(str_pad(($sampleCount+1),3,'0',STR_PAD_LEFT));
}
@@ -624,7 +624,7 @@ class ShareController extends Controller
function getTestItem(Request $request){
try{
$departments = $this->departmentModel::with(['samples','samples.testSamples.test','samples.testSamples.childTest'])
- ->where(['lab_id' => $request->session()->get('base_lab_id'), BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ ->where(['organization_id' => $request->session()->get('base_organization_id'), BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->orderBy('weight', 'asc')->get();
return response()->json(['success'=> true , 'data' => SampleTestResource::collection($departments)]);
} catch (\Exception $e){
@@ -641,11 +641,11 @@ class ShareController extends Controller
DB::beginTransaction();
try{
- $labId = $sampleCreateRequest->session()->get('base_lab_id');
+ $labId = $sampleCreateRequest->session()->get('base_organization_id');
$patientId = $sampleCreateRequest->session()->get('anonymous_id');
- $sampleSourceId = SampleSource::where(['lab_id' => $labId, 'is_default' => 1, 'record_status_id' => 1])->get()->first();
- //$physicianId = Physician::where(['lab_id' => $labId, 'is_default' => 1, 'record_status_id' => 1])->get()->first();
+ $sampleSourceId = SampleSource::where(['organization_id' => $labId, 'is_default' => 1, 'record_status_id' => 1])->get()->first();
+ //$physicianId = Physician::where(['organization_id' => $labId, 'is_default' => 1, 'record_status_id' => 1])->get()->first();
// create sample first
$sampleRequest = array(
@@ -658,17 +658,17 @@ class ShareController extends Controller
'received_date' => date('Y-m-d H:i:s'),
'collected_date' => date('Y-m-d H:i:s'),
'is_accept_request' => 0,
- 'lab_id' => $labId,
+ 'organization_id' => $labId,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $patientId,
);
$requestedSample = $this->sampleModel::query()->create($sampleRequest);
- //$this->sampleDetailModel::query()->where(['sample_id' => $requestedSample->id, 'lab_id' => $labId])->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
+ //$this->sampleDetailModel::query()->where(['sample_id' => $requestedSample->id, 'organization_id' => $labId])->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
if(!empty($requestedSample)) {
if (!empty($sampleCreateRequest->sample_tests)) {
- /*$this->testResultModel::query()->where(['sample_id' => $requestedSample->id, 'lab_id' => $labId])
+ /*$this->testResultModel::query()->where(['sample_id' => $requestedSample->id, 'organization_id' => $labId])
->whereNotIn('test_sample_id', $sampleCreateRequest->sample_tests)
->delete();*/
foreach ($sampleCreateRequest->sample_tests as $test) {
@@ -677,12 +677,12 @@ class ShareController extends Controller
'test_sample_id' => $test,
'created_at' => date('Y-m-d H:i:s'),
'created_by' => $patientId,
- 'lab_id' => $labId,
+ 'organization_id' => $labId,
]);
}
}
/*else {
- $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'lab_id' => $this->baseLabId])->delete();
+ $this->testResultModel::query()->where(['sample_id' => $sampleCreateRequest->sample_id, 'organization_id' => $this->baseOrganizationId])->delete();
}*/
}
@@ -697,7 +697,7 @@ class ShareController extends Controller
public function getTestGroup($id, $labId){
try{
- $testGroupItems = $this->testGroupDetailModel::query()->where(['test_group_id' => $id, 'lab_id' => $labId, 'record_status_id'=> 1])->get()->pluck('test_sample_id')->toArray();
+ $testGroupItems = $this->testGroupDetailModel::query()->where(['test_group_id' => $id, 'organization_id' => $labId, 'record_status_id'=> 1])->get()->pluck('test_sample_id')->toArray();
return response()->json(['success' => true, 'data' => $testGroupItems]);
} catch (\Exception $e)
{
diff --git a/app/Http/Controllers/TelegramController.php b/app/Http/Controllers/TelegramController.php
deleted file mode 100644
index d99df78..0000000
--- a/app/Http/Controllers/TelegramController.php
+++ /dev/null
@@ -1,88 +0,0 @@
-getWebhookUpdate();
-
- if ($update->getMessage()) {
- $chatId = $update->getMessage()->getChat()->getId();
- $text = $update->getMessage()->getText();
- $patientId = null;
- $sampleSourceId = null;
- if ($text && str_starts_with($text, "/start")) {
- $parts = explode(" ", $text);
- $individualType = 'patient';
- if (count($parts) > 1) {
- $fullText = explode("_", $parts[1]);
- if(count($fullText) > 1){
- $sampleSourceId = trim($fullText[1]);
- }
- else{
- $patientId = trim($parts[1]);
- }
- }
-
- if ($patientId) {
- // Check if patient already registered
- $exists = DB::table('patient_telegram')
- ->where('patient_id', $patientId)
- ->exists();
-
- if (!$exists) {
- DB::table('patient_telegram')->updateOrInsert(
- ['patient_id' => $patientId],
- ['chat_id' => $chatId]
- );
-
- $telegram->sendMessage([
- 'chat_id' => $chatId,
- 'text' => "✅ Thank you for joining our bot. You will receive future laboratory results here."
- ]);
- }
- }
- // for sample source
- if ($sampleSourceId)
- {
- // Check if patient already registered
- $exist_sample_source = DB::table('sample_source_telegram')
- ->where('sample_source_id', $sampleSourceId)
- ->exists();
-
- if (!$exist_sample_source) {
- DB::table('sample_source_telegram')->updateOrInsert(
- ['sample_source_id' => $sampleSourceId],
- ['chat_id' => $chatId]
- );
-
- $telegram->sendMessage([
- 'chat_id' => $chatId,
- 'text' => "✅ Thank you for joining our bot. You will receive future laboratory results here."
- ]);
- }
- }
- }
- }
-
- return response()->json(['status' => 'ok'], 200);
- }
- catch(\Exception $e){
-
- }
-}
-
-}
-
-
diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php
deleted file mode 100644
index 208b092..0000000
--- a/app/Http/Controllers/TestController.php
+++ /dev/null
@@ -1,487 +0,0 @@
-model = $testSample;
- $this->departmentModel = $departmentModel;
- $this->sampleTypeModel = $sampleTypeModel;
- $this->patientTypeModel = $patientTypeModel;
- $this->testModel = $testModel;
- $this->organismModel = $organismModel;
- $this->antibioticModel = $antibioticModel;
- $this->testSampleOrganismModel = $testSampleOrganismModel;
- $this->testNormalValueModel = $testNormalValueModel;
- $this->physicianModel = $physicianModel;
- $this->physicianCommissionModel = $physicianCommissionModel;
- $this->labModel = $labModel;
- $this->testCategoryModel = new TestCategory();
-
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- return null;
- }
-
- public function save(Request $request){
- try{
- $validator = \Validator::make($request->all(), ['name_en' => 'required']);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
- $test = $this->testModel::query()->create([
- 'name_en' => $request->name_en,
- 'lab_id' => $this->baseLabId,
- ]);
- return response()->json(['success'=> true , 'data' => [$test]]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function update(Request $request){
- try{
- $validator = \Validator::make($request->all(), ['uid' => 'required', 'name_en' => 'required']);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
- $test = $this->testModel::query()->where(['id' => $request->uid])->first();
- $test->update(array('name_en' => $request->name_en));
- return response()->json(['success'=> true , 'data' => [$test]]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function get(Request $request){
- try{
- $test = Test::query()->find($request->uid);
- return response()->json(['data' => $test]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function delete(Request $request){
- $status = $this->testModel::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- return response()->json(['status'=> $status , 'msg' => 'Delete successful']);
- }
-
- public function restore(Request $request){
- $status = $this->testModel::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- return response()->json(['status'=> $status , 'msg' => 'Activate successful']);
- }
-
- /** TEST SAMPLES
- * @param Request $request
- * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
- */
-
- public function testSamples(Request $request){
- if(!GlobalController::user_can(Auth::user()->role_id, ['view_test_sample'])) return redirect(url('my-profile'));
- $physicians = $this->physicianModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
- $department = $this->departmentModel::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->orderBy('weight','asc')->get();
- $patientTypes = $this->patientTypeModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->get();
- $testItems = $this->testModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->get();
- $testSampleTable = $this->model::getTableNameByScheme();
- $sampleTypeTable = $this->sampleTypeModel::getTableNameByScheme();
- $departmentTable = $this->departmentModel::getTableNameByScheme();
- $testTable = $this->testModel::getTableNameByScheme();
- $testSamples = $this->model::query()->select([
- $departmentTable.'.name_en as department_name',
- $sampleTypeTable.'.name_en as sample_type_name',
- $testTable.'.name_en as test_name',
- $testSampleTable.'.*'
- ])
- ->join($sampleTypeTable, $testSampleTable.'.sample_type_id', '=', $sampleTypeTable.'.id')
- ->join($departmentTable, $sampleTypeTable.'.department_id', '=', $departmentTable.'.id')
- ->join($testTable, $testSampleTable.'.test_id', '=', $testTable.'.id')
- ->where($testSampleTable.'.'.BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where($testSampleTable.'.lab_id', $this->baseLabId)
- ->where($sampleTypeTable.'.'.BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->when(!empty($request->sample_type), function ($query) use($sampleTypeTable, $request){
- $query->where($sampleTypeTable.'.id', $request->sample_type);
- })->when(!empty($request->department), function ($query) use($departmentTable, $request) {
- $query->where($departmentTable.'.id', $request->department);
- })->when(!empty($request->kword), function ($query) use($testTable, $testSampleTable, $request){
- $query->whereRaw( $testTable.".name_en like '%".addslashes($request->kword)."%'")
- ->orWhereRaw($testSampleTable.".code like '%".addslashes($request->kword)."%'");
- })->when(Auth::id()==1, function ($query) use ($testSampleTable){
- $query->whereIn($testSampleTable.'.'.BaseModel::RECORD_STATUS_FIELD , [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE]);
- })->orderBy($departmentTable.'.weight')
- ->orderBy($sampleTypeTable.'.weight')
- ->orderBy($testSampleTable.'.weight')
- ->paginate(20);
- return view('test', ['testSamples' => $testSamples, 'departments' => $department,
- 'testItems' => $testItems, 'patientTypes' => $patientTypes, 'labSetting' => (object) $this->base,
- 'physicians' => $physicians
- ]);
- }
-
- public function saveTestSample(TestSampleCreateRequest $request){
- set_time_limit(6000);
- ini_set('memory_limit', '10240M');
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_test_sample'])) return false;
- $testSample = $this->model::query()->create([
- 'sample_type_id' => $request->sample_type_id,
- 'test_id' => $request->test_id,
- 'group_result' => $request->group_result,
- 'category' => NULL,
- 'unit_sign' => $request->unit_sign,
- 'code' => $request->code,
- 'heading_id' => $request->heading_id,
- 'usd_price' => $request->usd_price,
- 'weight' => $request->weight,
- 'field_type' => $request->filed_type_id,
- 'formula' => $request->formula,
- 'format' => $request->format_value,
- 'description' => $request->description,
- 'lab_id' => $this->baseLabId,
- 'is_bold' => $request->is_bold,
- 'autocomplete_bind' => $request->autocomplete_bind
- ]);
- // reference range
- if(in_array($request->filed_type_id,[1,4,6])){
- $data = collect($request->patient_type_ids);
- $items = $data->map(function ($row, $key) use ($request, $testSample) {
- if(!empty($request->patient_type_ids[$key]['value'])) {
- $testNormalValue = $this->testNormalValueModel::query()->create([
- 'test_sample_id' => $testSample->id,
- 'patient_type_id' => $request->patient_type_ids[$key]['value'],
- 'sign' => $request->signs[$key]['value'],
- 'minimum' => is_numeric($request->min_values[$key]['value']) ? $request->min_values[$key]['value'] : null,
- 'maximum' => is_numeric($request->max_values[$key]['value']) ? $request->max_values[$key]['value'] : null,
- ]);
- }
- return [];
- });
- }
- // organism and antibiotics
- if(in_array($request->filed_type_id,[2,3]) ){
- $organismsCollection = collect($request->organisms);
- foreach ($organismsCollection as $org){
- $this->testSampleOrganismModel::query()->create([
- 'test_sample_id' => $testSample->id,
- 'is_default' => $org['is_default'],
- 'organism_id' => $org['id'],
- 'lab_id' => $this->baseLabId
- ]);
- }
- }
- DB::commit();
- return response()->json(['success' => true, 'message' => __('test_sample.create_success'), 'data' => [$testSample]]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success'=> false, 'message' => __('test_sample.create_fail'), 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function getTestSample(Request $request){
- $testSample = $this->model::with([
- 'sample',
- 'organisms.organism',
- 'testValues'
- ])->find($request->uid);
- return response()->json(['success'=> true , 'message' => __('test_sample.get_success'), 'data' => new TestSampleResource($testSample)]);
- }
-
- public function updateTestSample(TestSampleUpdateRequest $request){
-
- set_time_limit(6000);
- ini_set('memory_limit', '10240M');
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_test_sample'])) return false;
- $testSample = $this->model::query()->where('id',$request->uid)->first();
- $testSample->update([
- 'sample_type_id' => $request->sample_type_id,
- 'test_id' => $request->test_id,
- 'group_result' => $request->group_result,
- 'category' => @$request->category,
- 'unit_sign' => $request->unit_sign,
- 'code' => $request->code,
- 'heading_id' => $request->heading_id,
- 'usd_price' => $request->usd_price,
- 'weight' => $request->weight,
- 'field_type' => $request->filed_type_id,
- 'formula' => $request->formula,
- 'format' => $request->format_value,
- 'description' => $request->description,
- 'is_bold' => $request->is_bold,
- 'autocomplete_bind' => $request->autocomplete_bind
- ]);
-
- $this->testNormalValueModel::query()->where('test_sample_id', $testSample->id)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
- $this->testSampleOrganismModel::query()->where('test_sample_id', $testSample->id)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
-
- // reference range
- if(in_array($request->filed_type_id,[1,4,6])){
- $data = collect($request->patient_type_ids);
- $items = $data->map(function ($row, $key) use ($request, $testSample) {
- if(!empty($request->patient_type_ids[$key]['value'])) {
- $testNormalValue = $this->testNormalValueModel::query()->create([
- 'test_sample_id' => $testSample->id,
- 'patient_type_id' => $request->patient_type_ids[$key]['value'],
- 'sign' => $request->signs[$key]['value'],
- 'minimum' => is_numeric($request->min_values[$key]['value']) ? $request->min_values[$key]['value'] : null,
- 'maximum' => is_numeric($request->max_values[$key]['value']) ? $request->max_values[$key]['value'] : null,
- ]);
- }
- return [];
- });
- }
- // organism and antibiotics
- if(in_array($request->filed_type_id,[2,3]) ){
- $organismsCollection = collect($request->organisms);
- $organisms = $organismsCollection->pluck('id')->unique()->toArray();
- $this->testSampleOrganismModel::query()->where(['test_sample_id' => $testSample->id])
- ->whereNotIn('organism_id', $organisms)
- ->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
-
- foreach ($organismsCollection as $org){
- $testSampleOrganism = $this->testSampleOrganismModel::query()->create([
- 'test_sample_id' => $testSample->id,
- 'is_default' => $org['is_default'],
- 'organism_id' => $org['id'],
- 'lab_id' => $this->baseLabId
- ]);
- }
-
- }
- DB::commit();
- return response()->json(['success' => true, 'message' => __('test_sample.update_success'), 'data' => [$testSample]]);
- } catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('test_sample.update_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
- public function editTestSampleOrder(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['update_test_sample'])) return false;
- $validator = \Validator::make($request->all(), ['id' => 'required', 'order_number' => 'required']);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
-
- $testSample = $this->model::query()->where([
- 'id' => $request->id,
- 'lab_id' => $this->baseLabId
- ])->first();
- $testSample->update(['weight' => $request->order_number]);
- $batchUpdates = $this->model::query()->where([
- 'sample_type_id' => $testSample->sample_type_id,
- 'lab_id' => $this->baseLabId,
- ])->where('weight','>=', $request->order_number)->where('id','<>', $request->id)->update([
- 'weight' => DB::raw('weight + 1')
- ]);
- DB::commit();
- return redirect()->back();
- } catch (\Exception $e){
- DB::rollBack();
- return redirect()->back();
- }
- }
-
- public function deleteTestSample(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_test_sample'])) return false;
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE));
- $this->testNormalValueModel::query()->where('test_sample_id', $request->uid)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
- $this->testSampleOrganismModel::query()->where('test_sample_id', $request->uid)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
- DB::commit();
- return response()->json(['success' => true, 'message' => __('test_sample.delete_success')]);
- }
- catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('test_sample.delete_fail')]);
- }
-
- }
-
- public function restoreTestSample(Request $request){
- DB::beginTransaction();
- try{
- $this->model::query()->where('id', $request->uid)->update(array(BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE));
- $this->testNormalValueModel::query()->where('test_sample_id', $request->uid)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE]);
- $this->testSampleOrganismModel::query()->where('test_sample_id', $request->uid)->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE]);
- DB::commit();
- return response()->json(['success' => true, 'message' => __('test_sample.restore_success')]);
- }
- catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success' => false, 'message' => __('test_sample.restore_fail')]);
- }
- }
-
- public function storePhysicianCommission(Request $request){
- DB::beginTransaction();
- try{
- foreach ($request->physician as $k=>$val){
- $this->physicianCommissionModel::query()->updateOrCreate([
- 'physician_id' => $request->physician[$k],
- 'test_sample_id' => $request->test_sample_id
- ],[
- 'physician_id' => $request->physician[$k],
- 'test_sample_id' => $request->test_sample_id,
- 'commission_rate' => $request->commission_rate[$k],
- 'partner_price' => $request->pc_price[$k],
- 'commission_type' => $request->commission_type[$k],
- 'lab_id' => $this->baseLabId,
- BaseModel::CREATED_AT_FIELD => date('Y-m-d H:i:s'),
- BaseModel::CREATED_BY_FIELD => Auth::id(),
- BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE
- ]);
- }
- DB::commit();
- return redirect()->back();
- }
- catch (\Exception $e){
- DB::rollBack();
- return redirect()->back();
- }
- }
-
- public function setCommissionToAllTest(Request $request){
- DB::beginTransaction();
- try{
- $testSamples = $this->model::query()->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
- foreach ($testSamples as $testSample){
- $this->physicianCommissionModel::query()->updateOrCreate([
- 'physician_id' => $request->physician_id,
- 'test_sample_id' => $testSample->id
- ],[
- 'physician_id' => $request->physician_id,
- 'test_sample_id' => $testSample->id,
- 'commission_rate' => $request->commission_rate,
- 'commission_type' => $request->commission_type,
- 'lab_id' => $this->baseLabId,
- BaseModel::CREATED_AT_FIELD => date('Y-m-d H:i:s'),
- BaseModel::CREATED_BY_FIELD => Auth::id(),
- BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE
- ]);
- }
- DB::commit();
- return response()->json(['success'=> true , 'message' => __('test_sample.add_commission_success')]);
- }
- catch (\Exception $e){
- DB::rollBack();
- return response()->json(['success'=> false , 'message' => __('test_sample.add_commission_fail'), 'errors' => $e->getMessage()]);
- }
- }
-
-
- /*public function cloneTestSampleProperties(Request $request){
- try {
-
- $test_sample_id = $request->test_sample_id;
- $target_lab_id = $request->target_lab_id;
- $target_sample_type_id = $request->target_sample_type_id;
- $target_test_sample_id = $request->target_test_sample_id;
-
- $testSamples = $this->model::with(['testValues','organisms','organisms.antibiotics'])->where('id', $test_sample_id)->get();
-
- $this->testNormalValueModel::query()->where(['test_sample_id' => $target_test_sample_id])->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
- $this->testSampleOrganismModel::query()->where(['test_sample_id' => $target_test_sample_id, 'lab_id' => $target_lab_id])->update([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE]);
-
- foreach ($testSamples as $testSample) {
- $testValues = isset($testSample->testValues) ? $testSample->testValues : [];
-
- foreach ($testValues as $testValue) {
- $testValueData = [
- 'test_sample_id' => $target_test_sample_id,
- 'patient_type_id' => $testValue->patient_type_id,
- 'sign' => $testValue->sign,
- 'minimum' => $testValue->minimum,
- 'maximum' => $testValue->maximum,
- 'created_at' => date('Y-m-d H:i:s'),
- 'created_by' => 1
- ];
- $insertTestValue = $this->testNormalValueModel::query()->create($testValueData);
- }
- $testOrganisms = isset($testSample->organisms) ? $testSample->organisms : [];
- foreach ($testOrganisms as $testOrganism) {
- $testOrganismData = [
- 'test_sample_id' => $target_test_sample_id,
- 'organism_id' => $testOrganism->organism_id,
- 'lab_id' => $target_lab_id,
- 'created_at' => date('Y-m-d H:i:s'),
- 'created_by' => 1
- ];
- $insertTestSampleOrganism = $this->testSampleOrganismModel::query()->create($testOrganismData);
- $antibiotics = isset($testOrganism->antibiotics) ? $testOrganism->antibiotics : [];
- foreach ($antibiotics as $antibiotic) {
- $testOrganismAntibioticData = [
- 'test_sample_organism_id' => $insertTestSampleOrganism->id,
- 'antibiotic_id' => $antibiotic->antibiotic_id,
- 'created_at' => date('Y-m-d H:i:s'),
- 'created_by' => 1
- ];
- $insertTestOrganismAntibiotic = $this->testSampleOrganismAntibioticModel::query()->create($testOrganismAntibioticData);
- }
- }
- }
- }
- catch (\Exception $e){
- Log::error($e->getMessage());
- }
- return redirect()->back();
- }*/
-
-
-}
diff --git a/app/Http/Controllers/TestGroupController.php b/app/Http/Controllers/TestGroupController.php
deleted file mode 100644
index 0f0deae..0000000
--- a/app/Http/Controllers/TestGroupController.php
+++ /dev/null
@@ -1,81 +0,0 @@
-model = $model;
- $this->testGroupDetailModel = $testGroupDetailModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
- }
-
- public function index(Request $request){
- return null;
- }
-
- public function save(Request $request){
- DB::beginTransaction();
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['create_test_group'])) return false;
- $validator = \Validator::make($request->all(), ['name_en' => 'required','test_sample_ids' => 'required']);
- if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
- $testGroup = $this->model::query()->create(['group_name' => $request->name_en, 'lab_id' => $this->baseLabId]);
- foreach ($request->test_sample_ids as $v){
- $this->testGroupDetailModel::query()->create([
- 'test_group_id' => $testGroup->id,
- 'test_sample_id' => $v,
- 'lab_id' => $this->baseLabId
- ]);
- }
- DB::commit();
- return response()->json(['success'=> true , 'data' => [$testGroup]]);
- } catch (\Exception $e)
- {
- DB::rollBack();
- return response()->json(['success'=> false , 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function get($id){
- try{
- $testGroupItems = $this->testGroupDetailModel::query()->where(['test_group_id' => $id, 'lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD=>RecordStatusEnum::ACTIVE])->get()->pluck('test_sample_id')->toArray();
- return response()->json(['success' => true, 'data' => $testGroupItems]);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'errors' => [$e->getMessage()]]);
- }
- }
-
- public function delete(Request $request){
- try{
- if(!GlobalController::user_can(Auth::user()->role_id, ['delete_test_group'])) return false;
- $this->model::query()->where(['id' => $request->id, 'lab_id' => $this->baseLabId])->update([BaseModel::RECORD_STATUS_FIELD=>RecordStatusEnum::DELETE]);
- return response()->json(['success' => true, 'message' => 'Test group successfully deleted']);
- } catch (\Exception $e)
- {
- return response()->json(['success'=> false , 'message' => 'Failed while deleting test group. Please try again.', 'errors' => [$e->getMessage()]]);
- }
- }
-
-
-}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 5966e5e..9a08e98 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -4,21 +4,13 @@ namespace App\Http\Controllers;
use App\Enums\RecordStatusEnum;
use App\Enums\UtilEnum;
use App\Http\Controllers\Helper\GlobalController;
-use App\Models\AgeGroup;
use App\Models\BaseModel;
-use App\Models\Department;
-use App\Models\PatientType;
use App\Models\Role;
-use App\Models\SampleSource;
use App\Models\User;
-use App\Models\UserLabCover;
-use App\Models\WardTransaction;
-use Carbon\Carbon;
+use App\Models\UserOrganization;
use Illuminate\Http\Request;
-use App\Models\Laboratory;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Log;
@@ -27,39 +19,33 @@ class UserController extends Controller
protected $userModel;
protected $roleModel;
- protected $userLabCover;
- protected $sampleSourceModel;
- protected $baseLabId;
- protected $labs;
+ protected $userOrganizations;
+ protected $baseOrganizationId;
+ protected $organizations;
protected $base;
- public function __construct(User $userModel, Role $roleModel, UserLabCover $userLabCover, SampleSource $sampleSourceModel){
+ public function __construct(User $userModel, Role $roleModel, UserOrganization $userOrganizations){
$this->userModel = $userModel;
$this->roleModel = $roleModel;
- $this->userLabCover = $userLabCover;
- $this->sampleSourceModel = $sampleSourceModel;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->userOrganizations = $userOrganizations;
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
public function index(Request $request){
if(!GlobalController::user_can(Auth::user()->role_id, ['view_user_account'])) return redirect(url('my-profile'));
- $this->labs = parent::getAccessAbleLabs();
+ $this->organizations = parent::getAccessAbleLabs();
$recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
$roles = $this->roleModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
->when(Auth::user()->role_id != UtilEnum::ADMINISTRATOR_ROLE , function ($roles){
$roles->whereNotIn('id', [UtilEnum::ADMINISTRATOR_ROLE]);
})->get();
- $sample_sources = $this->sampleSourceModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->when(Auth::user()->role_id != UtilEnum::PHYSICIAN_ROLE && Auth::id()!=1 , function ($sampleSource){
- $sampleSource->where('lab_id', Session::get('base_lab_id'));
- })->get();
- $users = $this->userModel::with(['role','lab_covers'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
+ $users = $this->userModel::with(['role','userOrganizations'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
->when(Auth::id()!=1, function ($users){
$users->whereNotIn('id', [UtilEnum::ADMINISTRATOR_USER])
- ->whereIn('id', $this->labs->pluck('userLabCovers')->flatten()->pluck('user_id')->toArray());
+ ->whereIn('id', $this->organizations->pluck('organizations')->flatten()->pluck('user_id')->toArray());
})->when(!empty($request->kword), function($users) use ($request) {
$keyword = '%' . str_replace(' ', '', $request->kword) . '%';
$users->where(function ($q) use ($keyword) {
@@ -68,7 +54,7 @@ class UserController extends Controller
})->where('id', '!=', UtilEnum::ADMINISTRATOR_USER);
})
->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('labis.pagination.perpage', 10));
- return view('user_account', ['users' => $users, 'roles' => $roles, 'labs' => $this->labs, 'sample_sources' => $sample_sources]);
+ return view('user_account', ['users' => $users, 'roles' => $roles, 'organizations' => $this->organizations]);
}
public function labUsers(Request $request){
@@ -77,7 +63,7 @@ class UserController extends Controller
$roles = $this->roleModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
->whereNotIn('id', [UtilEnum::ADMINISTRATOR_ROLE])->get();
$sample_sources = $this->sampleSourceModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
- ->where('lab_id', Session::get('base_lab_id'))->get();
+ ->where('organization_id', Session::get('base_organization_id'))->get();
$users = $this->userModel::with(['role','lab_covers'])->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
->whereIn('id', $this->labs->pluck('labUsers')->flatten()->pluck('user_id')->toArray())
@@ -112,7 +98,7 @@ class UserController extends Controller
);
$user = $this->userModel::query()->create($data);
Log::channel('account_creation')->info(array('action' => 'create', 'raw' => $request->all(), 'prepared' => $data));
- $requests = new Request(array('uid' => $user->id, 'lab_ids' => [Session::get('base_lab_id')]));
+ $requests = new Request(array('uid' => $user->id, 'organization_ids' => [Session::get('base_organization_id')]));
$this->assignLabs($requests);
return response()->json(['success' => true, 'message' => __('user_account.create_success')]);
} catch (\Exception $e){
@@ -203,10 +189,10 @@ class UserController extends Controller
$this->userLabCover::query()->where('user_id', $request->uid)
->update(['end_date' => date('Y-m-d'), BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE, BaseModel::UPDATED_AT_FIELD => date('Y-m-d H:i:s'), BaseModel::UPDATED_BY_FIELD =>Auth::id()]);
$data = array();
- foreach ($request->lab_ids as $lab_id){
+ foreach ($request->organization_ids as $organization_id){
$data[] = array(
'user_id' => $request->uid,
- 'lab_id' => $lab_id,
+ 'organization_id' => $organization_id,
'start_date' => date('Y-m-d'),
'created_at' => date('Y-m-d H:i:s'),
'created_by' => Auth::id()
@@ -252,64 +238,47 @@ class UserController extends Controller
public function changePassword(Request $request)
{
- try {
+ try {
- $request->validate([
- 'current_password' => 'required|string',
- 'new_password' => 'required|confirmed|min:8|string'
- ]);
+ $request->validate([
+ 'current_password' => 'required|string',
+ 'new_password' => 'required|confirmed|min:8|string'
+ ]);
- $auth = Auth::user();
+ $auth = Auth::user();
+
+ // Check current password
+ if (!Hash::check($request->current_password, $auth->password)) {
+ return redirect()->back()->withErrors(['current_password' => __('user_account.invalid_current_password')]);
+ }
+
+ // Check new password not same as old
+ if ($request->current_password === $request->new_password) {
+ return redirect()->back()->withErrors(['new_password' => __('user_account.new_password_same_old_password')]);
+ }
+
+ // Update password
+ $user = User::where('id', $auth->id)->update([
+ 'password' => Hash::make($request->new_password)
+ ]);
+
+ Log::channel('account_creation')->info([
+ 'action' => 'change-password',
+ 'user_id' => $auth->id
+ ]);
+
+ return redirect()->back()->with('success', __('user_account.change_password_success'));
- // Check current password
- if (!Hash::check($request->current_password, $auth->password)) {
- // return response()->json([
- // 'success' => false,
- // 'message' => __('user_account.invalid_current_password')
- // ]);
- return redirect()->back()->withErrors(['current_password' => __('user_account.invalid_current_password')]);
}
-
- // Check new password not same as old
- if ($request->current_password === $request->new_password) {
- return redirect()->back()->withErrors(['new_password' => __('user_account.new_password_same_old_password')]);
+ catch (\Exception $e) {
+ return redirect()->back()->withErrors(['error' => __('user_account.change_password_fail') . ': ' . $e->getMessage()]);
}
-
- // Update password
- $user = User::where('id', $auth->id)->update([
- 'password' => Hash::make($request->new_password)
- ]);
-
- Log::channel('account_creation')->info([
- 'action' => 'change-password',
- 'user_id' => $auth->id
- ]);
-
- // return response()->json([
- // 'success' => true,
- // 'message' => __('user_account.change_password_success')
- // //'data' => $user
- // ]);
- return redirect()->back()->with('success', __('user_account.change_password_success'));
-
- } catch (\Exception $e) {
-
- // return response()->json([
- // 'success' => false,
- // 'message' => __('user_account.change_password_fail'),
- // 'errors' => $e->getMessage()
- // ]);
- return redirect()->back()->withErrors(['error' => __('user_account.change_password_fail') . ': ' . $e->getMessage()]);
-
- }
}
function my_profile()
{
- $user = $this->userModel::query()->with(['role','lab_covers'])->find(Auth::id());
- //return response()->json(['success' => true, 'message' => __('user_account.get_success'), 'data' => $user]);
+ $user = $this->userModel::query()->with(['role','userOrganizations'])->find(Auth::id());
return view('my_profiles',[
- // 'labSettings' => (object) $this->base,
'users' => $user
]);
diff --git a/app/Http/Controllers/UtilController.php b/app/Http/Controllers/UtilController.php
index 3b411a2..89d00a3 100644
--- a/app/Http/Controllers/UtilController.php
+++ b/app/Http/Controllers/UtilController.php
@@ -20,7 +20,7 @@ use App\Models\Sample;
use App\Models\SampleType;
use App\Models\TestSample;
use App\Models\TestSampleOrganism;
-use App\Models\UserLabCover;
+use App\Models\UserOrganization;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
@@ -41,11 +41,11 @@ class UtilController extends Controller
protected $testSampleOrganismModel;
- private $baseLabId;
+ private $baseOrganizationId;
protected $base;
public function __construct(
- Organism $organismModel, Antibiotic $antibioticModel, RejectComment $rejectCommentModel, UserLabCover $labUserModel,
+ Organism $organismModel, Antibiotic $antibioticModel, RejectComment $rejectCommentModel, UserOrganization $labUserModel,
SampleType $sampleTypeModel, Department $departmentModel, TestSample $testSampleModel, Sample $sampleModel,
PatientType $patientTypeModel, TestSampleOrganism $testSampleOrganism
){
@@ -61,8 +61,8 @@ class UtilController extends Controller
$this->testSampleOrganismModel = $testSampleOrganism;
- $this->baseLabId = Session::get('base_lab_id');
- $this->base = Session::get('base_lab');
+ $this->baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
}
function province($responseType = 'object')
@@ -118,7 +118,7 @@ class UtilController extends Controller
public function getDepartment(){
try{
- $department = $this->departmentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])->orderBy('weight','asc')->get();
+ $department = $this->departmentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])->orderBy('weight','asc')->get();
return response()->json(['success'=> true , 'data' => $department]);
} catch (\Exception $e)
{
@@ -128,7 +128,7 @@ class UtilController extends Controller
public function getDepartmentByLabId($labId){
try{
- $department = $this->departmentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $labId])->orderBy('weight','asc')->get();
+ $department = $this->departmentModel::query()->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $labId])->orderBy('weight','asc')->get();
return response()->json(['success'=> true , 'data' => $department]);
} catch (\Exception $e)
{
@@ -172,7 +172,7 @@ class UtilController extends Controller
$rejectComment = $this->rejectCommentModel::query()->create([
'sample_condition_id' => 3,
'reject_comment' => $request->name_en,
- 'lab_id' => $this->baseLabId
+ 'organization_id' => $this->baseOrganizationId
]);
return response()->json(['success'=> true , 'data' => [$rejectComment]]);
} catch (\Exception $e)
@@ -184,7 +184,7 @@ class UtilController extends Controller
function getTestItem(){
try{
$departments = $this->departmentModel::with(['samples','samples.testSamples.test','samples.testSamples.childTest'])
- ->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
+ ->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
->orderBy('weight', 'asc')->get();
return response()->json(['success'=> true , 'data' => SampleTestResource::collection($departments)]);
} catch (\Exception $e){
@@ -193,13 +193,13 @@ class UtilController extends Controller
}
function getLabUsers(){
- return $this->labUserModel::with('user')->where(['lab_id' => $this->baseLabId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
+ return $this->labUserModel::with('user')->where(['organization_id' => $this->baseOrganizationId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])->get();
}
function getTestItemBySampleId($sampleId, $previousId = 0){
try{
- $data = $this->sampleModel::with(['entryBy','modifiedBy','sample_tests', 'physician', 'patient','sample_source'])->where(['id' => $sampleId, 'lab_id' => $this->baseLabId])->get()->first();
+ $data = $this->sampleModel::with(['entryBy','modifiedBy','sample_tests', 'physician', 'patient','sample_source'])->where(['id' => $sampleId, 'organization_id' => $this->baseOrganizationId])->get()->first();
$arrData = array();
$arrData['result_comment'] = [];
$arrData['sample'] = array(
@@ -251,17 +251,17 @@ class UtilController extends Controller
ifnull(prev_r.test_result,"") as prev_result,
ts.is_bold,
ts.autocomplete_bind,
- ts.lab_id,
+ ts.organization_id,
sd.sample_descr
FROM samples s
INNER JOIN patients p
- ON p.id = s.patient_id AND p.lab_id = s.lab_id
+ ON p.id = s.patient_id AND p.organization_id = s.organization_id
INNER JOIN test_results tr
ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
+ AND s.`organization_id` = tr.`organization_id`
INNER JOIN test_samples ts
ON ts.id = tr.`test_sample_id`
- and ts.lab_id = tr.lab_id
+ and ts.organization_id = tr.organization_id
INNER JOIN tests t
ON t.`id` = ts.`test_id`
INNER JOIN sample_types st
@@ -282,14 +282,14 @@ class UtilController extends Controller
INNER JOIN test_results tr
ON tr.`sample_id` = s.`id`
WHERE s.id = '.$previousId.'
- AND s.`lab_id` = '.$this->baseLabId.'
+ AND s.`organization_id` = '.$this->baseOrganizationId.'
AND tr.record_status_id = 1
) prev_r
ON prev_r.test_sample_id = tr.`test_sample_id`
WHERE s.`id` = '.$sampleId.'
- AND s.`lab_id`= '.$this->baseLabId.'
- and ts.lab_id = '.$this->baseLabId.'
+ AND s.`organization_id`= '.$this->baseOrganizationId.'
+ and ts.organization_id = '.$this->baseOrganizationId.'
AND tr.`record_status_id` = '.BaseModel::RECORD_STATUS_ACTIVE.'
ORDER BY
@@ -381,7 +381,7 @@ class UtilController extends Controller
'is_bold' => (int) $row->is_bold,
'autocomplete_bind' => (int) $row->autocomplete_bind,
'ts' => $row->test_result,
- 'lab_id' => $row->lab_id,
+ 'organization_id' => $row->organization_id,
'format' => (int)$row->format
);
$departmentArray[$row->dweight]['samples'][$row->sweight]['tests'][] = $testItemArray;
@@ -400,7 +400,7 @@ class UtilController extends Controller
return Comment::query()->select('sample_type_id', 'comment_desc as name')->where(
[
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
- 'lab_id' => $this->baseLabId
+ 'organization_id' => $this->baseOrganizationId
])->whereIn('sample_type_id', $sampleTypeIds)->get()->toArray();
}
@@ -438,7 +438,7 @@ class UtilController extends Controller
ogr.id
FROM `organism_results` AS ogr
INNER JOIN test_results trs
- ON trs.id = ogr.test_result_id and ogr.lab_id = trs.lab_id
+ ON trs.id = ogr.test_result_id and ogr.organization_id = trs.organization_id
INNER JOIN `test_sample_organisms` tsr
ON tsr.test_sample_id = trs.test_sample_id
AND tsr.`organism_id` = ogr.`organism_id`
@@ -468,7 +468,7 @@ class UtilController extends Controller
ogr.id
FROM `organism_results` AS ogr
INNER JOIN test_results trs
- ON trs.id = ogr.test_result_id and ogr.lab_id = trs.lab_id
+ ON trs.id = ogr.test_result_id and ogr.organization_id = trs.organization_id
INNER JOIN samples s
ON s.id = trs.sample_id
INNER JOIN `test_sample_organisms` tsr
@@ -479,7 +479,7 @@ class UtilController extends Controller
LEFT JOIN `quantities` qt
ON qt.id = ogr.`quantity_id`
WHERE s.id = '.$previousSampleId.'
- AND s.`lab_id` = '.$this->baseLabId.'
+ AND s.`organization_id` = '.$this->baseOrganizationId.'
AND ogr.record_status_id = 1
AND trs.record_status_id = 1
AND tsr.record_status_id = 1');
@@ -490,7 +490,7 @@ class UtilController extends Controller
return Comment::query()->select('comment_desc as name')->where(
[
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
- 'lab_id' => $this->baseLabId,
+ 'organization_id' => $this->baseOrganizationId,
'sample_type_id' => $sampleTypeId
])->get();
}
@@ -586,7 +586,7 @@ class UtilController extends Controller
ogr.id
FROM `organism_results` AS ogr
INNER JOIN test_results trs
- ON trs.id = ogr.test_result_id and ogr.lab_id = trs.lab_id
+ ON trs.id = ogr.test_result_id and ogr.organization_id = trs.organization_id
INNER JOIN `test_sample_organisms` tsr
ON tsr.test_sample_id = trs.test_sample_id
AND tsr.`organism_id` = ogr.`organism_id`
@@ -637,7 +637,7 @@ class UtilController extends Controller
try{
$headingItems = $this->testSampleModel::with(['test'])
->where([
- 'lab_id' => $this->baseLabId,
+ 'organization_id' => $this->baseOrganizationId,
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE
])->when(!empty($sampleTypeId), function ($headingItems) use($sampleTypeId) {
$headingItems->where('sample_type_id', $sampleTypeId);
@@ -694,13 +694,13 @@ class UtilController extends Controller
FROM `physician_commisssion` pc
INNER JOIN physicians p
ON p.`id` = pc.`physician_id`
- WHERE p.`lab_id` = '.$this->baseLabId.'
+ WHERE p.`organization_id` = '.$this->baseOrganizationId.'
AND p.`record_status_id` = 1
AND pc.test_sample_id = '.$testSampleId.'
AND pc.`record_status_id` = 1
) comm
ON comm.physician_id = p.`id`
- WHERE p.`lab_id` = '.$this->baseLabId.'
+ WHERE p.`organization_id` = '.$this->baseOrganizationId.'
AND p.`record_status_id` = 1
');
$data = array('test_name' => $test->test->name_en, 'physicians' => $testCommissions);
@@ -794,7 +794,7 @@ class UtilController extends Controller
$test = $this->testSampleModel::with('test')->find($testSampleId);
$defVal = count($this->getSelectedOrganismResult($sampleId, $testSampleId)) ==0 ? [-1] : $this->getSelectedOrganismResult($sampleId, $testSampleId);
$testSampleOrganisms = $this->testSampleOrganismModel::with(['organism'])
- ->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
+ ->where(['test_sample_id' => $testSampleId, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])
->limit(10)->get()->map(function ($data) use ($defVal) {
$data['selected'] = in_array($data['id'], $defVal) ? 1: 0;
return $data;
@@ -810,7 +810,7 @@ class UtilController extends Controller
'id' => $item['id'],
'test_sample_id' => $item['test_sample_id'],
'organism_id' => $item['organism_id'],
- 'lab_id' => $item['lab_id'],
+ 'organization_id' => $item['organization_id'],
'record_status_id' => $item['record_status_id'],
'selected' => $item['selected'],
'organism' => $item['organism'],
@@ -842,14 +842,14 @@ class UtilController extends Controller
$test = $this->testSampleModel::with('test')->find($request->test_sample_id);
$defVal = count($this->getSelectedOrganismResult($request->sample_id, $request->test_sample_id)) ==0 ? [-1] : $this->getSelectedOrganismResult($request->sample_id, $request->test_sample_id);
$selectedOrganisms = $this->testSampleOrganismModel::with(['organism','antibiotics.antibioticResult','antibiotics.antibioticItem'])
- ->where(['test_sample_id' => $request->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
+ ->where(['test_sample_id' => $request->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])
->whereIn('id', $defVal)->get()->map(function ($data) {
$data['selected'] = 1;
return $data;
})->toArray();
$testSampleOrganisms = $this->testSampleOrganismModel::with(['organism','antibiotics.antibioticResult','antibiotics.antibioticItem'])
- ->where(['test_sample_id' => $request->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => $this->baseLabId])
+ ->where(['test_sample_id' => $request->test_sample_id, BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'organization_id' => $this->baseOrganizationId])
->when(!empty(trim($request->name)), function ($testSampleOrganisms) use($request){
$testSampleOrganisms->whereIn('organism_id', $this->organismModel::query()->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->name)."%'")->pluck('id')->toArray());
})->whereNotIn('id', $defVal)
diff --git a/app/Http/Middleware/VerifyBaseLab.php b/app/Http/Middleware/VerifyBaseLab.php
index b45d937..529f1f6 100644
--- a/app/Http/Middleware/VerifyBaseLab.php
+++ b/app/Http/Middleware/VerifyBaseLab.php
@@ -21,7 +21,7 @@ class VerifyBaseLab
public function handle(Request $request, Closure $next)
{
try{
- if (!$request->session()->exists('base_lab_id')) {
+ if (!$request->session()->exists('base_organization_id')) {
return redirect('/base');
}
} catch (\Exception $e){
diff --git a/app/Http/Resources/AntibioticResource.php b/app/Http/Resources/AntibioticResource.php
index 3d1b88e..2bdba5b 100644
--- a/app/Http/Resources/AntibioticResource.php
+++ b/app/Http/Resources/AntibioticResource.php
@@ -18,7 +18,7 @@ class AntibioticResource extends JsonResource
'id' => $this->id,
'name_en' => $this->name_en,
'weight' => $this->weight,
- 'lab_id' => $this->lab_id,
+ 'organization_id' => $this->organization_id,
// 'lab' => LaboratoryResource::collection($this->lab),
'record_status_id' => $this->record_status_id
];
diff --git a/app/Http/Resources/TestSampleResource.php b/app/Http/Resources/TestSampleResource.php
index b3fdb9c..ee22873 100644
--- a/app/Http/Resources/TestSampleResource.php
+++ b/app/Http/Resources/TestSampleResource.php
@@ -50,7 +50,7 @@ class TestSampleResource extends JsonResource
'format' => $this->format,
'formula' => $this->formula,
'description' => $this->description,
- 'lab_id' => $this->lab_id,
+ 'organization_id' => $this->organization_id,
'code' => $this->code,
'is_bold' => (int) $this->is_bold,
'autocomplete_bind' => (int) $this->autocomplete_bind
diff --git a/app/Models/Antibiotic.php b/app/Models/Antibiotic.php
deleted file mode 100644
index b6f007e..0000000
--- a/app/Models/Antibiotic.php
+++ /dev/null
@@ -1,29 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
-}
diff --git a/app/Models/AntibioticResult.php b/app/Models/AntibioticResult.php
deleted file mode 100644
index f0c4cd7..0000000
--- a/app/Models/AntibioticResult.php
+++ /dev/null
@@ -1,25 +0,0 @@
-belongsTo(Patient::class, 'patient_id', 'id');
- }
-
- public function doctor(){
- return $this->belongsTo(Physician::class, 'doctor_id','id');
- }
-
-
-}
diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php
index 52f7440..3d069ed 100644
--- a/app/Models/BaseModel.php
+++ b/app/Models/BaseModel.php
@@ -23,6 +23,8 @@ class BaseModel extends Model
const CREATED_BY_FIELD = 'created_by';
const UPDATED_AT_FIELD = 'updated_at';
const UPDATED_BY_FIELD = 'updated_by';
+ const DELETED_AT_FIELD = 'deleted_at';
+ const DELETED_BY_FIELD = 'deleted_by';
protected static function boot(){
parent::boot();
diff --git a/app/Models/Comment.php b/app/Models/Comment.php
deleted file mode 100644
index f7d97b0..0000000
--- a/app/Models/Comment.php
+++ /dev/null
@@ -1,26 +0,0 @@
-belongsTo('App\Models\SampleType','sample_type_id', 'id');
- }
-
-}
diff --git a/app/Models/Department.php b/app/Models/Department.php
deleted file mode 100644
index 221d9c0..0000000
--- a/app/Models/Department.php
+++ /dev/null
@@ -1,43 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
- public function samples(){
- return $this->hasMany(SampleType::class, 'department_id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->where('lab_id', Session::get('base_lab_id'))
- ->orderBy('weight');
- }
-
-}
diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php
deleted file mode 100644
index d2386cf..0000000
--- a/app/Models/Invoice.php
+++ /dev/null
@@ -1,57 +0,0 @@
-belongsTo(Laboratory::class, 'lab_id','id');
- }
-
- public function sample(){
- return $this->belongsTo(Sample::class, 'sample_id','id');
- }
-
- public function invoiceDetail(){
- return $this->hasMany(InvoiceDetail::class, 'invoice_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
- public function repayments(){
- return $this->hasMany(Repayment::class, 'invoice_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
- public function creator()
- {
- return $this->belongsTo(User::class, 'created_by');
- }
-
- public function modifier()
- {
- return $this->belongsTo(User::class, 'updated_by');
- }
-
-
-}
diff --git a/app/Models/InvoiceDetail.php b/app/Models/InvoiceDetail.php
deleted file mode 100644
index 45ef4bb..0000000
--- a/app/Models/InvoiceDetail.php
+++ /dev/null
@@ -1,33 +0,0 @@
-belongsTo(TestSample::class, 'test_sample_id', 'id');
- }
-
-
-}
diff --git a/app/Models/Laboratory.php b/app/Models/Laboratory.php
deleted file mode 100644
index 41eb576..0000000
--- a/app/Models/Laboratory.php
+++ /dev/null
@@ -1,50 +0,0 @@
-hasMany('App\Models\UserLabCover', 'lab_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE);
- }
-
- public function labUsers(){
- return $this->hasMany('App\Models\UserLabCover', 'lab_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE)->where('lab_id', Session::get('base_lab_id'));
- }
-
-}
diff --git a/app/Models/Organism.php b/app/Models/Organism.php
index a992e0c..c9d2cd8 100644
--- a/app/Models/Organism.php
+++ b/app/Models/Organism.php
@@ -13,7 +13,7 @@ class Organism extends BaseModel
*
* @var string
*/
- protected $fillable = ['name_en', 'weight', 'is_bold', 'lab_id'];
+ protected $fillable = ['name_en', 'weight', 'is_bold', 'organization_id'];
public static function boot()
{
@@ -21,7 +21,7 @@ class Organism extends BaseModel
}
public function lab(){
- return $this->belongsTo('App\Models\Laboratory', 'lab_id','id');
+ return $this->belongsTo('App\Models\Organization', 'organization_id','id');
}
}
diff --git a/app/Models/OrganismResult.php b/app/Models/OrganismResult.php
deleted file mode 100644
index 4900590..0000000
--- a/app/Models/OrganismResult.php
+++ /dev/null
@@ -1,24 +0,0 @@
-hasMany('App\Models\UserOrganization', 'organization_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE);
+// }
+//
+// public function labUsers(){
+// return $this->hasMany('App\Models\UserOrganization', 'organization_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE)->where('organization_id', Session::get('base_organization_id'));
+// }
+
+}
diff --git a/app/Models/Patient.php b/app/Models/Patient.php
deleted file mode 100644
index 594a3b6..0000000
--- a/app/Models/Patient.php
+++ /dev/null
@@ -1,74 +0,0 @@
-belongsTo(Province::class,'province_id','id');
- }
-
- public function district(){
- return $this->belongsTo(District::class,'district_id','id');
- }
-
- public function commune(){
- return $this->belongsTo(Commune::class,'commune_id','id');
- }
-
- public function village(){
- return $this->belongsTo(Village::class,'village_id','id');
- }
-
- public function samples(){
- return $this->hasMany(Sample::class,'patient_id','id')
- ->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => Session::get('base_lab_id')]);
- }
-
- public function telegramChatId(){
- return $this->belongsTo(PatientTelegram::class,'id', 'patient_id');
- }
-
-}
diff --git a/app/Models/PatientTelegram.php b/app/Models/PatientTelegram.php
deleted file mode 100644
index 3ab5697..0000000
--- a/app/Models/PatientTelegram.php
+++ /dev/null
@@ -1,37 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
+ return $this->belongsTo('App\Models\Organization', 'organization_id','id');
}
}
diff --git a/app/Models/PhysicianCommission.php b/app/Models/PhysicianCommission.php
deleted file mode 100644
index aa3299c..0000000
--- a/app/Models/PhysicianCommission.php
+++ /dev/null
@@ -1,32 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
-}
diff --git a/app/Models/PublicationReceiver.php b/app/Models/PublicationReceiver.php
index e416717..10aba34 100644
--- a/app/Models/PublicationReceiver.php
+++ b/app/Models/PublicationReceiver.php
@@ -14,7 +14,7 @@ class PublicationReceiver extends BaseModel
*/
protected $table = 'publication_receivers';
protected $primaryKey = 'id';
- protected $fillable = ['lab_id','publication_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD];
+ protected $fillable = ['organization_id','publication_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD];
public static function boot()
{
diff --git a/app/Models/Quantity.php b/app/Models/Quantity.php
deleted file mode 100644
index c367a74..0000000
--- a/app/Models/Quantity.php
+++ /dev/null
@@ -1,26 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
-}
diff --git a/app/Models/RejectComment.php b/app/Models/RejectComment.php
deleted file mode 100644
index d78bf8b..0000000
--- a/app/Models/RejectComment.php
+++ /dev/null
@@ -1,29 +0,0 @@
-belongsTo(Invoice::class, 'invoice_id','id');
- }
-
-}
diff --git a/app/Models/Role.php b/app/Models/Role.php
index 753a45a..1aa614b 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -18,10 +18,10 @@ class Role extends BaseModel
parent::boot();
}
- protected $fillable = ['name_en', 'lab_id'];
+ protected $fillable = ['name_en', 'organization_id'];
public function lab(){
- return $this->belongsTo(Laboratory::class, 'lab_id');
+ return $this->belongsTo(Organization::class, 'organization_id');
}
}
diff --git a/app/Models/Sample.php b/app/Models/Sample.php
index 1e6dd52..592356e 100644
--- a/app/Models/Sample.php
+++ b/app/Models/Sample.php
@@ -19,7 +19,7 @@ class Sample extends BaseModel
protected $fillable = ['patient_id','admission_date','sample_number','sample_source_id','physician_id',
'sample_condition','reject_comment_id','collected_date','received_date','diagnosis','is_urgent', 'is_printed', 'printed_by','printed_at',
- 'approved_by','approved_date', 'requested_date','is_accept_request','lab_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD,
+ 'approved_by','approved_date', 'requested_date','is_accept_request','organization_id', BaseModel::CREATED_AT_FIELD, BaseModel::CREATED_BY_FIELD,
BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD,
'result_template_id'
];
@@ -33,27 +33,13 @@ class Sample extends BaseModel
}
public function lab(){
- return $this->belongsTo(Laboratory::class, 'lab_id','id');
+ return $this->belongsTo(Organization::class, 'organization_id','id');
}
public function patient(){
return $this->belongsTo(Patient::class, 'patient_id','id');
}
- public function sample_source(){
- return $this->belongsTo(SampleSource::class, 'sample_source_id','id');
- }
-
- public function sample_details(){
- return $this->hasMany(SampleDetail::class, 'sample_id', 'id')
- ->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => Session::get('base_lab_id')]);
- }
-
- public function sample_tests(){
- return $this->hasMany(TestResult::class, 'sample_id', 'id')
- ->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => Session::get('base_lab_id')]);
- }
-
public function entryBy(){
return $this->belongsTo(User::class, 'created_by', 'id');
}
@@ -66,149 +52,5 @@ class Sample extends BaseModel
return $this->belongsTo(Physician::class, 'physician_id', 'id');
}
- public function invoice(){
- return $this->belongsTo(Invoice::class, 'id', 'sample_id')->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE, 'lab_id' => Session::get('base_lab_id')]);
- }
-
- function getStateAttribute(){
- $state = '#FF0000';
- $sampleCondition = $this->sample_condition;
- $samplePrinted = $this->is_printed;
- $sampleId = $this->id;
-
- $resultItemsData = DB::select('
- SELECT
- s.id,
- s.`sample_number`,
- SUM(IF(ts.`field_type`>0, 1,0)) AS non_heading_tests,
- SUM(IF(ts.`field_type` IN(1,4) AND tr.test_result IS NOT NULL, 1, 0)) AS done_numeric_tests,
- SUM(IF(ts.`field_type` IN(2,3) AND org_result.total_org_result>0, 1, 0)) AS done_org_test
- FROM samples s
- LEFT JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- LEFT JOIN test_samples ts
- ON ts.id = tr.`test_sample_id`
- AND ts.lab_id = tr.lab_id
- LEFT JOIN sample_types st
- ON st.id = ts.`sample_type_id`
- LEFT JOIN(
- SELECT
- tr.`id`,
- COUNT(*) AS total_org_result
- FROM samples s
- INNER JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- INNER JOIN organism_results orgr
- ON orgr.`test_result_id` = tr.`id`
- WHERE s.id = '.$sampleId.'
- AND tr.`record_status_id` = 1
- AND orgr.`record_status_id` = 1
- group by tr.id
- ) AS org_result
- ON org_result.id = tr.`id`
- WHERE s.`id` = '.$sampleId.'
- AND (tr.`record_status_id` = 1 OR tr.`record_status_id` IS NULL)
- AND (st.`record_status_id` = 1 OR st.`record_status_id` IS NULL)
- GROUP BY s.`sample_number`, s.id');
-
- $non_heading_tests = 0;
- $done_numeric_tests = 0;
- $done_org_test = 0;
- foreach ($resultItemsData as $v){
- $non_heading_tests = $v->non_heading_tests;
- $done_numeric_tests = $v->done_numeric_tests;
- $done_org_test = $v->done_org_test;
- }
-
- if(!is_null($sampleCondition) && $sampleCondition==0) $state = '#FFA500'; // orange for rejected
- elseif(($sampleCondition!=0 || is_null($sampleCondition)) && $samplePrinted) $state = '#3b86d1'; // blue for printed
- else {
- if($non_heading_tests==0) $state = '#FF0000';
- else if($non_heading_tests>0 && $non_heading_tests == ($done_numeric_tests+$done_org_test)){
- $state = '#008000'; // Green for fully completed
- }
- elseif($non_heading_tests>0 && ($done_numeric_tests+$done_org_test)==0){
- $state = '#FF0000'; // Red for No result at all
- }
- elseif(($done_numeric_tests+$done_org_test)>0 && $non_heading_tests >($done_numeric_tests+$done_org_test)){
- $state = '#FFFF00'; // Yellow for complete some
- }
- else $state = '#FF0000'; //Silver for known state
- }
- return $state;
- }
-
- function getProgressAttribute(){
- $state = '#FF0000';
- $sampleCondition = $this->sample_condition;
- $samplePrinted = $this->is_printed;
- $sampleId = $this->id;
-
- $resultItemsData = DB::select('
- SELECT
- s.id,
- s.`sample_number`,
- SUM(IF(ts.`field_type`>0, 1,0)) AS non_heading_tests,
- SUM(IF(ts.`field_type` IN(1,4) AND tr.test_result IS NOT NULL, 1, 0)) AS done_numeric_tests,
- SUM(IF(ts.`field_type` IN(2,3) AND org_result.total_org_result>0, 1, 0)) AS done_org_test
- FROM samples s
- LEFT JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- LEFT JOIN test_samples ts
- ON ts.id = tr.`test_sample_id`
- AND ts.lab_id = tr.lab_id
- LEFT JOIN sample_types st
- ON st.id = ts.`sample_type_id`
- LEFT JOIN(
- SELECT
- tr.`id`,
- COUNT(*) AS total_org_result
- FROM samples s
- INNER JOIN test_results tr
- ON tr.`sample_id` = s.`id`
- AND s.`lab_id` = tr.`lab_id`
- INNER JOIN organism_results orgr
- ON orgr.`test_result_id` = tr.`id`
- WHERE s.id = '.$sampleId.'
- AND tr.`record_status_id` = 1
- AND orgr.`record_status_id` = 1
- group by tr.id
- ) AS org_result
- ON org_result.id = tr.`id`
- WHERE s.`id` = '.$sampleId.'
- AND (tr.`record_status_id` = 1 OR tr.`record_status_id` IS NULL)
- AND (st.`record_status_id` = 1 OR st.`record_status_id` IS NULL)
- GROUP BY s.`sample_number`, s.id');
-
- $non_heading_tests = 0;
- $done_numeric_tests = 0;
- $done_org_test = 0;
- foreach ($resultItemsData as $v){
- $non_heading_tests = $v->non_heading_tests;
- $done_numeric_tests = $v->done_numeric_tests;
- $done_org_test = $v->done_org_test;
- }
-
- if(!is_null($sampleCondition) && $sampleCondition==0) $state = __('sample.filter_rejected'); // '#FFA500'; // orange for rejected
- elseif(($sampleCondition!=0 || is_null($sampleCondition)) && $samplePrinted) $state = __('sample.filter_printed'); // '#3b86d1'; // blue for printed
- else {
- if($non_heading_tests==0) $state = __('sample.filter_pending');
- else if($non_heading_tests>0 && $non_heading_tests == ($done_numeric_tests+$done_org_test)){
- $state = __('sample.filter_completed'); // '#008000'; // Green for fully completed
- }
- elseif($non_heading_tests>0 && ($done_numeric_tests+$done_org_test)==0){
- $state = __('sample.filter_pending'); //'#FF0000'; // Red for No result at all
- }
- elseif(($done_numeric_tests+$done_org_test)>0 && $non_heading_tests >($done_numeric_tests+$done_org_test)){
- $state = __('sample.filter_processing'); // '#FFFF00'; // Yellow for complete some
- }
- else $state = __('sample.filter_pending'); //Silver for known state
- }
- return $state;
- }
-
}
diff --git a/app/Models/SampleDetail.php b/app/Models/SampleDetail.php
deleted file mode 100644
index df8d3f3..0000000
--- a/app/Models/SampleDetail.php
+++ /dev/null
@@ -1,35 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
- public function telegramChatId(){
- return $this->belongsTo(SampleSourceTelegram::class,'id', 'sample_source_id');
- }
-
-}
diff --git a/app/Models/SampleSourceTelegram.php b/app/Models/SampleSourceTelegram.php
deleted file mode 100644
index 30036ee..0000000
--- a/app/Models/SampleSourceTelegram.php
+++ /dev/null
@@ -1,37 +0,0 @@
-hasMany(TestSample::class, 'sample_type_id')
->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE])
- //->where('lab_id', Session::get('base_lab_id'))
+ //->where('organization_id', Session::get('base_organization_id'))
->orderBy('weight');
}
diff --git a/app/Models/Supplier.php b/app/Models/Supplier.php
deleted file mode 100644
index e6f5b93..0000000
--- a/app/Models/Supplier.php
+++ /dev/null
@@ -1,43 +0,0 @@
-belongsTo('App\Models\Laboratory', 'lab_id','id');
- }
-
-}
diff --git a/app/Models/TestCategory.php b/app/Models/TestCategory.php
deleted file mode 100644
index 724cc3a..0000000
--- a/app/Models/TestCategory.php
+++ /dev/null
@@ -1,27 +0,0 @@
-hasMany(TestGroupDetail::class, 'test_group_id', 'id')->where([BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE]);
- }
-
-}
diff --git a/app/Models/TestGroupDetail.php b/app/Models/TestGroupDetail.php
deleted file mode 100644
index 114ba89..0000000
--- a/app/Models/TestGroupDetail.php
+++ /dev/null
@@ -1,26 +0,0 @@
-belongsTo(TestSample::class,'test_sample_id','id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
-// function organismResults(){
-// return $this->hasMany(OrganismResult::class,'test_result_id','id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
-// }
-
-// function getUsdPriceAttribute(){
-// return TestSample::query()->find($this->test_sample_id)->first()->usd_price;
-// }
-
-
-}
diff --git a/app/Models/TestSample.php b/app/Models/TestSample.php
deleted file mode 100644
index e43b37a..0000000
--- a/app/Models/TestSample.php
+++ /dev/null
@@ -1,63 +0,0 @@
-belongsTo(Test::class, 'test_id','id');
- }
-
- public function sample(){
- return $this->belongsTo(SampleType::class, 'sample_type_id','id');
- }
-
- public function lab(){
- return $this->belongsTo(Laboratory::class, 'lab_id','id');
- }
-
- public function organisms(){
- return $this->hasMany(TestSampleOrganism::class, 'test_sample_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
- public function tests(){
- return $this->hasMany(self::class, 'heading_id','id')->where([
- BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
- 'lab_id' => Session::get('base_lab_id')
- ]);
- }
-
- public function childTest(){
- return $this->hasMany(self::class, 'heading_id','id')->where([
- BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::ACTIVE,
- 'lab_id' => Session::get('base_lab_id')
- ]);
- }
-
- public function testValues(){
- return $this->hasMany(TestNormalValue::class, 'test_sample_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
-}
diff --git a/app/Models/TestSampleOrganism.php b/app/Models/TestSampleOrganism.php
deleted file mode 100644
index b6d7164..0000000
--- a/app/Models/TestSampleOrganism.php
+++ /dev/null
@@ -1,31 +0,0 @@
-belongsTo('App\Models\Organism', 'organism_id', 'id')->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE);
- }
-
-
-}
diff --git a/app/Models/User.php b/app/Models/User.php
index 5e9bbbc..3cba888 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -47,8 +47,8 @@ class User extends Authenticatable
return $this->belongsTo('App\Models\Role', 'role_id','id');
}
- public function lab_covers(){
- return $this->hasMany('App\Models\UserLabCover', 'user_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE );
+ public function userOrganizations(){
+ return $this->hasMany('App\Models\UserOrganization', 'user_id','id')->where('record_status_id', RecordStatusEnum::ACTIVE );
}
}
diff --git a/app/Models/UserLabCover.php b/app/Models/UserOrganization.php
similarity index 61%
rename from app/Models/UserLabCover.php
rename to app/Models/UserOrganization.php
index acf306c..69789c1 100644
--- a/app/Models/UserLabCover.php
+++ b/app/Models/UserOrganization.php
@@ -7,11 +7,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
-class UserLabCover extends Authenticatable
+class UserOrganization extends Authenticatable
{
+ protected $table = 'user_organizations';
- public function lab(){
- return $this->belongsTo('App\Models\Laboratory', 'lab_id','id');
+ public function organization(){
+ return $this->belongsTo('App\Models\Organization', 'organization_id','id');
}
public function user(){
diff --git a/lang/en/antibiotic.php b/lang/en/antibiotic.php
deleted file mode 100644
index fc9fef0..0000000
--- a/lang/en/antibiotic.php
+++ /dev/null
@@ -1,26 +0,0 @@
- 'Antibiotics',
- 'search_placeholder' => 'Antibiotic name...',
- 'table_no' => 'No.',
- 'table_name' => 'Name',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Antibiotic',
- 'form_name' => 'Antibiotic',
- 'form_sort' => 'Sort-Order',
- 'form_edit_tittle' => 'Edit Antibiotic',
-
- 'create_success' => 'Antibiotic has been created!',
- 'create_fail' => 'An error occur while trying to create antibiotic record. Please try again.',
- 'update_success' => 'Antibiotic record has been updated!',
- 'update_fail' => 'An error occur while trying to update antibiotic record. Please try again.',
- 'delete_success' => 'Antibiotic record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete antibiotic record. Please try again.',
- 'restore_success' => 'Antibiotic record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore antibiotic record. Please try again.',
- 'get_success' => 'Antibiotic record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve antibiotic record. Please try again.'
-
-];
diff --git a/lang/en/appointment.php b/lang/en/appointment.php
deleted file mode 100644
index 3c86b71..0000000
--- a/lang/en/appointment.php
+++ /dev/null
@@ -1,16 +0,0 @@
- 'Appointment Type',
- 'date' => 'Appointment Date',
- 'duration' => 'Duration (days)',
- 'patient' => 'Patient',
- 'description' => 'Description',
- 'doctor' => 'Doctor',
- 'create_success' =>'Appointment record has been saved.',
- 'create_fail' =>'Failed while saving Appointment record.',
- 'update_success' =>'Appointment record has been updated.',
- 'update_fail' =>'Failed while updating Appointment record.',
- 'delete_success' =>'Appointment record has been deleted.',
- 'delete_fail' =>'Failed while deleting Appointment record.',
-];
diff --git a/lang/en/comment.php b/lang/en/comment.php
deleted file mode 100644
index f24b9c2..0000000
--- a/lang/en/comment.php
+++ /dev/null
@@ -1,29 +0,0 @@
- 'Comments',
- 'search_placeholder' => 'Comment name..',
- 'table_no' => 'No.',
- 'table_name' => 'Comment',
- 'table_department' => 'Ward',
- 'table_sample_type' => 'Sample Type',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Comment',
- 'form_name' => 'Comment',
- 'form_sample_type' => 'Sample Type',
- 'form_department' => 'Ward',
- 'form_edit_tittle' => 'Edit Comment',
-
- 'create_success' => 'Comment has been created!',
- 'create_fail' => 'An error occur while trying to create comment record. Please try again.',
- 'update_success' => 'Comment record has been updated!',
- 'update_fail' => 'An error occur while trying to update comment record. Please try again.',
- 'delete_success' => 'Comment record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete comment record. Please try again.',
- 'restore_success' => 'Comment record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore comment record. Please try again.',
- 'get_success' => 'Comment record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve comment record. Please try again.'
-
-];
diff --git a/lang/en/department.php b/lang/en/department.php
deleted file mode 100644
index e8a2542..0000000
--- a/lang/en/department.php
+++ /dev/null
@@ -1,29 +0,0 @@
- 'Departments',
- 'search_placeholder' => 'Department name...',
- 'table_no' => 'No',
- 'table_name' => 'Department Name',
- 'table_sample_type' => 'Sample Type',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Department',
- 'form_name' => 'Name',
- 'form_sort' => 'Sort-Order',
- 'form_laboratory' => 'Laboratory',
- 'form_select_all_lab' => 'Select All Labs',
- 'form_edit_tittle' => 'Edit Department',
-
- 'create_success' => 'Department has been created!',
- 'create_fail' => 'An error occur while trying to create department record. Please try again.',
- 'update_success' => 'Department record has been updated!',
- 'update_fail' => 'An error occur while trying to update department record. Please try again.',
- 'delete_success' => 'Department record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete department record. Please try again.',
- 'restore_success' => 'Department record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore department record. Please try again.',
- 'get_success' => 'Department record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve department record. Please try again.'
-
-];
diff --git a/lang/en/general.php b/lang/en/general.php
index 3641c5b..be3cf0c 100644
--- a/lang/en/general.php
+++ b/lang/en/general.php
@@ -65,9 +65,7 @@ return [
'manage_user_accounts' => 'Manage User Accounts',
'manage_user_roles' => 'Manage User Roles',
- 'manage_user_accounts' => 'Manage User Accounts',
- 'manage_user_roles' => 'Manage User Roles',
- 'laboratory_settings' => 'System Settings',
+ 'laboratory_settings' => 'Manage Laboratories',
'activity_logs' => 'Activity Logs',
'appointment' => 'Appointment',
'billing' => 'Billing & Payments',
diff --git a/lang/en/inventory.php b/lang/en/inventory.php
deleted file mode 100644
index a26884d..0000000
--- a/lang/en/inventory.php
+++ /dev/null
@@ -1,18 +0,0 @@
- 'Supplier',
- 'sp_create_success' => 'Supplier has been created!',
- 'sp_create_fail' => 'An error occur while trying to create supplier record. Please try again.',
- 'sp_update_success' => 'Supplier record has been updated!',
- 'sp_update_fail' => 'An error occur while trying to update supplier record. Please try again.',
- 'sp_delete_success' => 'Supplier record has been deleted!',
- 'sp_delete_fail' => 'An error occur while trying to delete supplier record. Please try again.',
- 'sp_restore_success' => 'Supplier record has been restored!',
- 'sp_restore_fail' => 'An error occur while trying to restore supplier record. Please try again.',
- 'sp_get_success' => 'Supplier record has been retrieved!',
- 'sp_get_fail' => 'An error occur while trying to retrieve supplier record. Please try again.',
-
-];
diff --git a/lang/en/invoice.php b/lang/en/invoice.php
deleted file mode 100644
index 7ec2a18..0000000
--- a/lang/en/invoice.php
+++ /dev/null
@@ -1,85 +0,0 @@
- 'Invoices',
- 'table_date_filter' => 'Invoice Date Between',
- 'table_textable_filter' => 'Or Search by',
- 'table_textable_filter_placeholder' => 'Inovice code, sample number, patient code, or phone number',
- 'btn_quick_report' => 'Quick Invoice Report',
- 'dialy_report' => 'Daily Invoice Report',
- 'monthly_invoice_report' => 'Monthly Invoice Report',
- 'yearly_invoice_report' => 'Yearly Invoice Report',
- 'table_no' => 'No.',
- 'table_invoice_code' => 'Invoice No.',
- 'table_sample_number' => 'Sample No',
- 'table_patient_name' => 'Patient Name',
- 'table_invoice_date' => 'Invoice Date',
- 'table_total_cost' => 'Sub Total',
- 'table_discount' => 'Discount',
- 'table_net_cost' => 'Total ($)',
- 'table_net_cost_riel' => 'Total (Riel)',
- 'table_paid' => 'Paid Amount',
- 'table_owe' => 'Owe Amount',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_new_title' => 'New Invoice',
- 'form_edit_title'=> 'Edit Invoice',
- 'form_patient' => 'Patient',
- 'form_invoice_number' => 'Invoice No',
- 'form_invoice_date' => 'Invoice Date',
- 'form_description' => 'Description',
- 'form_qty' => 'Qty',
- 'form_unit_price' => 'Unit Price',
- 'form_total_amount' => 'Total Amount',
- 'form_discount' => 'Discount',
- 'form_net_amount' => 'Net Amount',
- 'form_paid_amount' => 'Paid Amount',
- 'form_paid_date' => 'Paid Date',
- 'form_owe_amount' => 'Owe Amount',
- 'form_btn_save' => 'Save Invoice',
- 'form_btn_generate_invoice' => 'Generate Invoice',
-
- 'invoice_report_filter' => 'Invoice Report Filters',
- 'report_type' => 'Report Type',
- 'report_filter' => 'Report Filter',
- 'view_report' => 'View Report',
- 'daily' => 'Daily',
- 'monthly' => 'Monthly',
- 'yearly' => 'Yearly',
-
- 'received_date' => 'Received Date',
-
- 'paid_by' => 'Customer',
-
- 'received_by' => 'Cashier',
-
- 'tittle' => 'Laboratory Invoice',
-
- 'print' => 'Print',
-
- 'create_success' => 'Invoice has been created!',
- 'create_fail' => 'An error occur while trying to create invoice record. Please try again.',
- 'update_success' => 'Invoice record has been updated!',
- 'update_fail' => 'An error occur while trying to update invoice record. Please try again.',
- 'delete_success' => 'Invoice record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete invoice record. Please try again.',
- 'restore_success' => 'Invoice record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore invoice record. Please try again.',
- 'get_success' => 'Invoice record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve invoice record. Please try again.',
- 'form_btn_save_preview' => 'Save & Preview Invoice',
-
- 'pay_type' => 'Pay Type',
- 'bank_name' => 'Bank Name',
- 'transaction_no' => 'Transaction No',
- 'cash_paid' => 'Cash Pay',
- 'bank_paid' => 'Bank Pay',
-
- 'exchange_rate' => 'Exchange Rate',
- 'hide_discount' => 'Hide Discount',
- 'refresh_item' => 'Check for items update',
- 'repayment' => 'Repayment',
- 'repayment_date' => 'Repayment Date'
-
-
-];
diff --git a/lang/en/laboratory.php b/lang/en/laboratory.php
index 1f55b31..5ddc7c3 100644
--- a/lang/en/laboratory.php
+++ b/lang/en/laboratory.php
@@ -1,8 +1,8 @@
'Laboratory',
- 'search_placeholder' => 'Laboratory name, address...',
+ 'table_title' => 'Organization',
+ 'search_placeholder' => 'Organization name, address...',
'table_no' => 'No.',
'table_name_kh' => 'Name Khmer',
'table_name_en' => 'Name Latin',
@@ -11,41 +11,41 @@ return [
'table_labs' => 'Labs',
'table_status' => 'Status',
'table_action' => 'Actions',
- 'form_add_tittle' => 'New Laboratory',
+ 'form_add_tittle' => 'New Organization',
'form_name' => 'Full-Name',
'form_login_email' => 'Login-Email',
'form_ismnager' => 'Lab Manager',
- 'form_edit_tittle' => 'Edit Laboratory Information',
+ 'form_edit_tittle' => 'Edit Organization Information',
'form_system_role' => 'System-Role',
- 'form_lab_cover' => 'Laboratory Coverage',
- 'form_laboratory' => 'Laboratory',
+ 'form_lab_cover' => 'Organization Coverage',
+ 'form_laboratory' => 'Organization',
'form_select_all_lab' => 'Select All Labs',
'form_password' => 'Password',
'form_address_en' => 'Address-En',
'form_address_kh' => 'Address-KH',
- 'create_success' => 'Laboratory has been created!',
+ 'create_success' => 'Organization has been created!',
'create_fail' => 'An error occur while trying to create laboratory record. Please try again.',
- 'update_success' => 'Laboratory record has been updated!',
+ 'update_success' => 'Organization record has been updated!',
'update_fail' => 'An error occur while trying to update laboratory record. Please try again.',
- 'delete_success' => 'Laboratory record has been deleted!',
+ 'delete_success' => 'Organization record has been deleted!',
'delete_fail' => 'An error occur while trying to delete laboratory record. Please try again.',
- 'restore_success' => 'Laboratory record has been restored!',
+ 'restore_success' => 'Organization record has been restored!',
'restore_fail' => 'An error occur while trying to restore laboratory record. Please try again.',
- 'get_success' => 'Laboratory record has been retrieved!',
+ 'get_success' => 'Organization record has been retrieved!',
'get_fail' => 'An error occur while trying to retrieve laboratory record. Please try again.',
- 'clone_lab' => 'Clone Laboratory',
- 'source_lab' => 'Source Laboratory',
- 'target_lab' => 'New Laboratory',
+ 'clone_lab' => 'Clone Organization',
+ 'source_lab' => 'Source Organization',
+ 'target_lab' => 'New Organization',
'start_clone' => 'Clone',
'phone' => 'Phone Number',
- 'info' => 'Laboratory Information',
+ 'info' => 'Organization Information',
'license' => 'License Agreement',
'start_date' => 'Start Date',
'expiry_date' => 'Date of Expiry',
- 'change_base' => 'Change Laboratory'
+ 'change_base' => 'Change Organization'
];
diff --git a/lang/en/lang.php b/lang/en/lang.php
index 6334462..ce97a93 100644
--- a/lang/en/lang.php
+++ b/lang/en/lang.php
@@ -1,6 +1,6 @@
"Laboratory",
+ "laboratory" => "Organization",
"forget_password" => "Forget password",
"sign_in" => "Sign in",
"keep_me_sign_in" => "Keep me signed in",
@@ -30,10 +30,10 @@
"result_config" => "Result Config",
"user_account" => "User Account",
"copyright" => "Copyright © 2022 LABONAK. All rights reserved.",
- "lis" => "Laboratory Information System",
- "new_laboratory" => "New Laboratory",
- "lab_name_en" => "Laboratory Name (English)",
- "lab_name_kh" => "Laboratory Name (Khmer)",
+ "lis" => "Organization Information System",
+ "new_laboratory" => "New Organization",
+ "lab_name_en" => "Organization Name (English)",
+ "lab_name_kh" => "Organization Name (Khmer)",
"lab_short_name" => "Short name",
"address_en" => "Address (English)",
"address_kh" => "Address (Khmer)",
diff --git a/lang/en/opd_visit.php b/lang/en/opd_visit.php
deleted file mode 100644
index ac9dfe0..0000000
--- a/lang/en/opd_visit.php
+++ /dev/null
@@ -1,230 +0,0 @@
-'New Consultation',
- 'admission_date'=>'Admission Date',
- 'admission_ward'=>'Admission Ward',
- 'doctor'=>'Doctor',
- 'physical_examinations'=>'Physical Examinations',
- 'histories'=>'Histories',
- 'investigations_&_procedures'=>'Investigations & Procedures',
- 'medications'=>'Medications',
- 'documents'=>'Documents',
- 'bills'=>'Bills',
- 'chief_complaint'=>'Chief Complaint',
- 'vital_sign'=>'Vital Sign',
- 'body_temperature(celsius)'=>'Body Temperature(Celsius)',
- 'temperature'=>'Temperature',
- 'pulse'=>'Pulse',
- 'spo2'=>'SpO2',
- 'respiration_rate'=>'Respiration Rate',
- 'biometrics'=>'Biometrics',
- 'weight(kg)'=>'weight(Kg)',
- 'height(cm)'=>'Height(cm)',
- 'bmi(clac)'=>'BMI(Clac)',
- 'diagnosis'=>'Diagnosis',
- 'initial_diagnosis'=>'Initial Diagnosis',
- 'final_diagnosis'=>'Final Diagnosis',
- 'save'=>'Save',
- 'vaccination_history'=>'Vaccination History',
- 'allergies'=>'Allergies',
- 'allergen_category'=>'Allergen Category',
- 'allergen'=>'Allergen',
- 'drug_allergy'=>'Drug Allergy',
- 'food_allergy'=>'Food Allergy',
- 'insect_allergy'=>'Insect Allergy',
- 'environment_allergy'=>'Environment Allergy',
- 'others'=>'Others',
- 'current_medication'=>'Current Medication',
- 'past_medical_surgical_history'=>'Past Medical Surgical',
- 'family_history'=>'Family History',
- 'laboratory'=>'Laboratory',
- 'request_for_laboratory_test'=>'Request for Laboratory Test',
- 'request_imagery'=>'Request Imagery',
- 'imagery_type'=>'Imagery Type',
- 'imagery_service'=>'Imagery Service',
- 'medical_item_group'=>'Medical Item Group',
- 'medical_item'=>'Medical Item',
- 'route'=>'Route',
- 'form'=>'Form',
- 'morning'=>'Morning',
- 'noon'=>'Noon',
- 'afternoon'=>'Afternoon',
- 'evening'=>'Evening',
- 'midnight'=>'Midnight',
- 'duration'=>'Duration',
- 'instruction'=>'Instruction',
- 'view_all'=>'View All',
- 'pending'=>'Pending',
- 'discharged'=>'Discharged',
- 'visit_number'=>'Visit Number',
- 'save_&_generate_invoice'=>'Save & Generate Invoice',
- 'hid'=>'HID',
- 'patient_name'=>'Patient Name',
- 'gender'=>'Gender',
- 'age'=>'Age',
- 'date_of_birth'=>'Date of Birth',
- 'visit_date'=>'Visit Date',
- 'visit_no.'=>'Visit No.',
- 'refer_from'=>'Refer From',
- 'refer_to'=>'Refer To',
- 'visit_histories'=>'Visit Histories',
- 'life_styles'=>'Life Styles',
- 'alcohol'=>'Alcohol',
- 'smoking'=>'Smoking',
- 'drug'=>'Drug',
- 'no'=>'No',
- 'yes'=>'Yes',
- 'new_invoice'=>'New Invoice',
- 'upload_document'=>'Upload Document',
- 'consultation' => 'Consultations',
- 'medicine_name' => 'Medicine Name',
- 'view_requested' => 'View Requests',
- 'consultations' => 'Consultations',
- 'imagery' => 'Imagery',
- 'possible_result' => 'Possible Result',
- 'imagery_list' => 'Imagery List',
- 'pharmacy' => 'Pharmacy',
- 'prescriptions' => 'Medication',
- 'medicine_instruction' => 'Medicine Instruction',
- 'exam_date' => 'Exam Date',
- 'technique' => 'Technique',
- 'id' => 'ID',
- 'add_result_of' => 'Add Result of ',
- 'attach_photo' => 'Attach Photo ',
- 'short_name' => 'Code',
- 'name' => 'Name in English',
- 'name_kh' => 'Name in Khmer',
- 'standard_result' => 'Standard Result',
- 'default_select' => 'Default Select',
- 'wards' => 'Wards',
- 'ward' => 'Ward',
- 'doctors' => 'Doctors',
- 'base_manager' => 'Base Manager',
- 'hospital_services' => 'Hospital Services',
- 'hospital_service' => 'Hospital Service',
- 'service_type' => 'Service Type',
- 'name_latin' => 'Name-Latin',
- 'name_local' => 'Name-Local',
-
- 'visit' => 'Patient',
- 'type_service_code_or_name' => 'Type service code or name...',
- 'total' => 'Total',
- 'action' => 'Action',
- 'stock_in' => 'Stock In',
- 'stock_out' => 'Stock Out',
- 'inventory_report' => 'Inventory Report',
- 'item' => 'item',
- 'supplier' => 'Supplier',
- 'item_group' => 'Item Group',
- 'item_unit' => 'Item Unit',
- 'grn_number' => 'GRN-Number',
- 'po_number' => 'PO-Number',
- 'received_date' => 'Received Date',
- 'total_amount' => 'Total Amount',
- 'grn_num_or_supplier' => 'GRN-Number or supplier name...',
- 'unit_price' => 'Unit Price',
- 'quantity' => 'Quantity',
- 'expiry_date' => 'Expiry Date',
-
- 'gin_number' => 'GIN-Number',
- 'issued_date' => 'Issued Date',
- 'report_type' => 'Report Type',
- 'inventory_on_hand' => 'Inventory on hand',
- 'expire_report' => 'Inventory on hand',
- 'report_date' => 'Report Date',
-
- 'item_name' => 'Item Name',
- 'on_hand' => 'On Hand',
- 'last_stock_in' => 'Last Stock In',
- 'last_stock_out' => 'Last Stock Out',
- 'stock_in_date' => 'Stock In Date',
- 'expire_date' => 'Expire Date',
- '_month' => '# Month',
-
- 'code' => 'Code',
- 'sale_price' => 'Sale Price',
- 'description' => 'Description',
- 'is_vaccination' => 'Is Vaccination',
- 'vat_number' => 'VAT Number',
- 'supplier_name' => 'Supplier Name',
- 'contact_person' => 'Contact Person',
- 'position' => 'Position',
- 'phone' => 'Phone Number',
- 'email' => 'Email',
- 'address' => 'Address',
- 'packaged_item' => 'Packaged Item',
-
- 'medical_record' => 'Medical Record',
-
- 'concept_code' => 'Concept Code',
-
- 'class' => 'Class',
- 'sub_class' => 'Sub Class',
- 'create_success' => 'Record has been created',
- 'create_fail' => 'Failed while creating a record',
- 'update_success' => 'Record has been updated',
- 'update_fail' => 'Failed while updating a record',
- 'get_success' => 'Record has been fetched',
- 'get_fail' => 'Failed while fetching a record',
- 'delete_success' => 'Record has been deleted',
- 'delete_fail' => 'Failed while deleting a record',
- 'restore_success' => 'Record has been restored',
- 'restore_fail' => 'Failed while restoring a record',
- 'evaluation' => 'Evaluation',
- 'evaluation_summary' => 'Evaluation Summary',
- 'queues' => 'Queues',
- 'queue_no' => 'Queue-No',
- 'save_to_queue' => 'Add Queue',
- 'systolic' => 'Systolic',
- 'diastolic' => 'Diastolic',
- 'glucose' => 'Glucose',
-
- 'onset_date' => 'Onset Date',
- 'clinical_feature' => 'Clinical Feature',
- 'sign' => 'Sign',
- 'general_appearance' => 'General Appearance',
- 'status' => 'Status',
- 'other' => 'Other',
- 'ent' => 'ENT (ORL)',
- 'ears' => 'Ears',
- 'nose' => 'Noses',
- 'throat' => 'Throat',
- 'cardio_system' => 'Cardiovascular System',
- 'heart_sound' => 'Heart Sound',
- 'cardio_refill_time' => 'Capillary Refill Time',
- 'resp_system' => 'Respiratory System',
- 'inspection' => 'Inspection',
- 'percussion' => 'Percussion',
- 'auscultation' => 'Auscultation',
- 'palpation' => 'Palpation',
- 'uro_system' => 'Urogenital System',
- 'skin' => 'Skin & Extremities',
- 'edema' => 'Edema',
- 'wounds' => 'Wounds',
- 'rash' => 'Rash',
- 'nervous_system' => 'Central Nervous System',
- 'neurological' => 'Neurological',
- 'mental_status' => 'Mental Status',
- 'eyes' => 'Eyes',
- 'verbal' => 'Verbal',
- 'motion' => 'Motion',
- 'mental_total' => 'Total',
- 'specify' => 'Specify',
- 'gastro_system' => 'Gastro-Intestinal System',
- 'speech' => 'Speech',
- 'mood' => 'Mood and affect',
- 'thought' => 'Thought',
- 'insight' => 'Insight & Judgement',
- 'consciousness' => 'Consciousness',
- 'abdomen' => 'Abdomen',
- 'perception' => 'Perception',
- 'coma' => 'Glasgow coma scale',
- 'print_consult_form' => 'Print Consultation Form',
- 'document_title' => 'Document Title',
- 'file_name' => 'File name',
- 'file_type' => 'File type',
- 'past_medical_history' => 'Past Medical History'
-
-
-];
diff --git a/lang/en/patient.php b/lang/en/patient.php
deleted file mode 100644
index 49fc7db..0000000
--- a/lang/en/patient.php
+++ /dev/null
@@ -1,77 +0,0 @@
- 'Patients',
- 'search_placeholdolder' => 'Patient name, phone ..',
- 'table_no' => 'No',
- 'table_code' => 'Code',
- 'table_name' => 'Name',
- 'table_sex' => 'Sex',
- 'table_phon' => 'Phone',
- 'table_have_sample' => 'Have Sample',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_title' => 'New Patient',
- 'form_edit_title' => 'Edit Patient',
- 'form_code' => 'Patient Code',
- 'form_name' => 'Patient Name',
- 'form_dob' => 'Dob or Age',
- 'form_age' => 'Age',
- 'form_gender' => 'Gender',
- 'form_sex_male' => 'Male',
- 'form_sex_female' => 'Female',
- 'form_sex_other' => 'Other',
- 'form_khid' => 'KH-ID Number',
- 'form_phone' => 'Phone Number',
- 'form_house' => 'House Number',
- 'form_street' => 'Street Number',
- 'form_province' => 'Province',
- 'form_district' => 'District',
- 'form_commune' => 'Commune',
- 'form_village' => 'Village',
- 'form_alt_generate_puuid' => 'Auto Generate Patient Code',
-
- 'create_success' => 'Patient has been created!',
- 'create_fail' => 'An error occur while trying to create patient record. Please try again.',
- 'update_success' => 'Patient record has been updated!',
- 'update_fail' => 'An error occur while trying to update patient record. Please try again.',
- 'delete_success' => 'Patient record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete patient record. Please try again.',
- 'restore_success' => 'Patient record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore patient record. Please try again.',
- 'get_success' => 'Patient record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve patient record. Please try again.',
-
- 'basic_information' => 'Basic Information',
- 'identifiers' => 'Identifiers',
- 'contact_detail' => 'Contact Details',
- 'medical_history' => 'Medical Histories',
- 'first_name' => 'Surname',
- 'last_name' => 'Given Name',
- 'dob' => 'Date of Birth',
- 'marital_status' => 'Marital Status',
- 'single' => 'Single',
- 'married' => 'Married',
- 'other' => 'Others',
- 'are_in_num' => 'Or Age in year, month, and day.',
- 'blood_group' => 'Blood Group',
- 'khid' => 'Khmer ID Card',
- 'passport' => 'Passport',
- 'nhid' => 'National Health ID',
- 'create_new' => 'Create New Patient',
- 'street' => 'Street',
- 'house_no' => 'House Number',
- 'email' => 'E-mail',
- 'allergy' => 'Allergies',
- 'chronic_disease' => 'Chronic Diseases',
- 'past_surgery' => 'Past Surgeries',
- 'family_history' => 'Family Medical History',
- 'vaccination_history' => 'Vaccination Histories',
- 'save_patient' => 'Save Patient',
- 'save_consult' => 'Consultation',
- 'save_queue' => 'Add Queue',
- 'cancel' => 'Cancel',
- 'sample' => 'Samples'
-
-
-];
diff --git a/lang/en/patient_type.php b/lang/en/patient_type.php
deleted file mode 100644
index 86c5235..0000000
--- a/lang/en/patient_type.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'Patient Type',
- 'search_placeholder' => 'Patient type name...',
- 'table_no' => 'No',
- 'table_name' => 'Name',
- 'table_gender' => 'Gender',
- 'table_age_from' => 'Age From',
- 'table_age_to' => 'Age To',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Patient Type',
- 'form_name' => 'Name',
- 'form_max_age' => 'Max-Age',
- 'form_min_age' => 'Min-Age',
- 'form_edit_tittle' => 'Edit Patient Type',
- 'form_input_day' => 'days',
- 'form_input_month' => 'months',
- 'form_input_year' => 'years',
-
- 'create_success' => 'Patient Type has been created!',
- 'create_fail' => 'An error occur while trying to create patient type record. Please try again.',
- 'update_success' => 'Patient Type record has been updated!',
- 'update_fail' => 'An error occur while trying to update patient type record. Please try again.',
- 'delete_success' => 'Patient Type record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete patient type record. Please try again.',
- 'restore_success' => 'Patient Type record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore patient type record. Please try again.',
- 'get_success' => 'Patient Type record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve patient type record. Please try again.'
-
-];
diff --git a/lang/en/permission.php b/lang/en/permission.php
index 3fa64d0..c789681 100644
--- a/lang/en/permission.php
+++ b/lang/en/permission.php
@@ -22,7 +22,7 @@ return [
'generate_doctor_report' => 'Generate Doctor Report',
'generate_summary_report' => 'Generate Summary Report',
'view_dashboard' => 'View Dashboard',
- 'update_laboratory_information' => 'Update Laboratory Information',
+ 'update_laboratory_information' => 'Update Organization Information',
'view_department' => 'View Department',
'create_department' => 'Create Department',
'update_department' => 'Update Department',
diff --git a/lang/en/physician.php b/lang/en/physician.php
deleted file mode 100644
index 4eb66d7..0000000
--- a/lang/en/physician.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'Physicians',
- 'search_placeholder' => 'Physician name...',
- 'table_no' => 'No',
- 'table_name' => 'Name',
- 'table_logo' => 'Logo',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Physician',
- 'form_name' => 'Name',
- 'form_logo_upload' => 'Upload',
- 'form_logo' => 'Header',
- 'form_edit_tittle' => 'Edit Physician',
- 'confirm_delete_photo' => 'Are you sure want to delete physician logo?',
- 'ok_delete' => 'Yes, Delete',
- 'cancel_delete' => 'No, Cancel',
- 'confirm_delete' => 'Are you sure want to delete physician data?',
- 'delete_photo_success' => 'Physician photo deleted successful',
- 'delete_photo_failed' => 'Physician photo delete failed',
-
- 'delete_success' => 'Physician record has been deleted!',
- 'delete_failed' => 'An error occur while trying to delete physician record. Please try again.',
-
- 'restore_success' => 'Physician record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore physician record. Please try again.',
-
- 'form_footer' => 'Footer',
- 'default_select' => 'Make default'
-
-
-];
diff --git a/lang/en/quantity.php b/lang/en/quantity.php
deleted file mode 100644
index 213d464..0000000
--- a/lang/en/quantity.php
+++ /dev/null
@@ -1,26 +0,0 @@
- 'Quantities',
- 'search_placeholder' => 'Quantity name...',
- 'table_no' => 'No.',
- 'table_name' => 'Name',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Quantity',
- 'form_name' => 'Quantity',
- 'form_sort' => 'Sort-Order',
- 'form_edit_tittle' => 'Edit Quantity',
-
- 'create_success' => 'Quantity has been created!',
- 'create_fail' => 'An error occur while trying to create quantity record. Please try again.',
- 'update_success' => 'Quantity record has been updated!',
- 'update_fail' => 'An error occur while trying to update quantity record. Please try again.',
- 'delete_success' => 'Quantity record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete quantity record. Please try again.',
- 'restore_success' => 'Quantity record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore quantity record. Please try again.',
- 'get_success' => 'Quantity record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve quantity record. Please try again.'
-
-];
diff --git a/lang/en/report.php b/lang/en/report.php
deleted file mode 100644
index e8cc61f..0000000
--- a/lang/en/report.php
+++ /dev/null
@@ -1,30 +0,0 @@
- 'Summary Report',
- 'summary_rpt_fd_filter' => 'Invoice Date From',
- 'summary_rpt_td_filter' => 'Invoice Date End',
- 'btn_view' => 'View Report',
- 'btn_action' => 'Actions',
- 'btn_action_print' => 'Print',
- 'btn_action_export' => 'Download Excel',
- 'summary_report_section_by_test' => 'Summary Report by Test Type',
- 'summary_report_section_by_sample_source' => 'Summary Report by Sample Source',
- 'summary_rpt_test_type' => 'Test Type',
- 'summary_male_patient' => 'Male Patient',
- 'summary_female_patient' => 'Female Patient',
- 'summary_total_patient' => 'Total Patient',
- 'summary_clinic_name' => 'Sample Source',
- 'doctor_date_range_filter' => 'Invoice Date Range',
- 'doctor_sample_source_filter' => 'Sample Source',
- 'doctor_physician_filter' => 'Provider',
- 'doctor_exam' => 'Exam',
- 'doctor_net_amount' => 'Net Amount',
- 'summary_total_sample'=>'Total Sample',
- 'summary_report_section_by_category'=>'Summary Report by Category',
- 'summary_report_section_by_date'=>'Summary Report by Date',
- 'summary_report_section_by_labtech'=>'Summary Report By Lab',
- 'financial_report'=>'Financial Report',
- 'summary_category_name'=>'Category',
- 'total' => 'Total'
-
-];
diff --git a/lang/en/sample.php b/lang/en/sample.php
deleted file mode 100644
index ef574d4..0000000
--- a/lang/en/sample.php
+++ /dev/null
@@ -1,113 +0,0 @@
- 'Samples',
- 'table_no' => 'No',
- 'table_patient_code' => 'Patient Code',
- 'table_patient_name' => 'Patient Name',
- 'table_sample_number' => 'Sample No',
- 'table_collected_date' => 'Request Date',
- 'table_received_date' => 'Received Date',
- 'table_sample_source' => 'Sample Source',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_title' => 'New Sample',
- 'form_patient' => 'Patient',
- 'form_sample_number' => 'Sample No',
- 'form_sample_source' => 'Sample Source',
- 'form_requester' => 'Requested By',
- 'form_collected_date' => 'Request Date',
- 'form_received_date' => 'Received Date',
- 'form_admission_date' => 'Admission Date',
- 'form_diagnisis' => 'Diagnosis',
- 'form_sample_condition' => 'Sample Condition',
- 'form_reject_reason' => 'Reject Reason',
- 'form_is_urgent' => 'Is Urgent',
- 'form_btn_save_assign_test' => 'Save & Assign Test',
- 'form_patient_info_title' => 'Patient Information',
- 'form_patient_code' => 'Code',
- 'form_patient_name' => 'Name',
- 'form_patient_gender' => 'Sex',
- 'form_patient_age' => 'Age',
- 'form_patient_mobile' => 'Mobile',
- 'form_patient_address' => 'Address',
- 'form_edit_title' => 'Edit Sample',
- 'form_btn_update' => 'Update',
- 'form_btn_assign_test' => 'Assign Test',
- 'form_btn_add_result' => 'Add Result',
- 'form_btn_preview_result' => 'Preview Result',
- 'from_btn_remove' => 'Remove',
- 'form_btn_new_sample' => 'New Sample',
- 'assign_test_modal_title' => 'Assign Test',
- 'assign_test_save_template' => 'Save Template',
- 'assign_test_make_invoice' => 'Make Invoice',
- 'assign_test_total_fee_text' => 'Total Payment',
- 'assign_test_total_test' => 'Total Tests',
- 'assign_test_btn_save' => 'Save',
- 'assign_test_btn_save_add_result' => 'Save & Add Result',
- 'assign_test_btn_cancel' => 'Cancel',
- 'add_result_title' => 'Add Result',
- 'sample_entry_by' => 'Sample Entry By',
- 'sample_modify_by' => 'Modified By',
- 'add_result_test' => 'Test Name',
- 'add_result_result' => 'Result',
- 'add_result_unit_sign' => 'Unit Sign',
- 'add_result_ref_range' => 'Ref. Range',
- 'add_result_test_date' => 'Test Date',
- 'add_result_performed_by' => 'Performed By',
- 'add_result_hide' => 'Hide',
- 'add_result_btn_edit_test' => 'Edit Test',
- 'add_result_btn_save' => 'Save',
- 'add_result_btn_save_preview' => 'Save & Preview',
- 'add_result_btn_cancel' => 'Cancel',
- 'print_title' => 'Laboratory Result',
- 'btn_print' => 'Print',
- 'btn_approve' => 'Approve',
- 'last_test_date' => 'Last test date',
- 'verify_by' => 'Verify by',
- 'report_date' => 'Report date',
- 'lab_technician' => 'Lab. Technician',
-
- 'search_placeholder' => 'Patient name or phone..',
-
- 'condition_good' => 'Good',
- 'condition_reject' => 'Rejected',
- 'condition_acceptable' => 'Acceptable',
-
- 'requested_date' => 'Request Date',
-
- 'year' => ' y',
- 'month' => ' m',
- 'day' => ' d',
- 'sex_m' => ' M',
- 'sex_f' => ' F',
- 'physician_name' => 'Provider Name',
-
- 'create_success' => 'Sample has been created!',
- 'create_fail' => 'An error occur while trying to create sample record. Please try again.',
- 'update_success' => 'Sample record has been updated!',
- 'update_fail' => 'An error occur while trying to update sample record. Please try again.',
- 'delete_success' => 'Sample record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete sample record. Please try again.',
- 'restore_success' => 'Sample record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore sample record. Please try again.',
- 'get_success' => 'Sample record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve sample record. Please try again.',
-
- 'approve_success' => 'Sample has been approved!',
- 'approve_fail' => 'An error occur while trying to approve the sample. Please try again.',
-
-
- 'filter_all' => 'Show All',
- 'filter_rejected' => 'Rejected',
- 'filter_pending' => 'Pending',
- 'filter_processing' => 'Processing',
- 'filter_completed' => 'Completed',
- 'filter_printed' => 'Printed',
- 'clear_selection' => 'Uncheck all tests',
- 'print_label' => 'Print Label',
- 'previous_result' => 'Previous Result',
- 'sample_status' => ' Status '
-
-];
diff --git a/lang/en/sample_source.php b/lang/en/sample_source.php
deleted file mode 100644
index 6ea9fe7..0000000
--- a/lang/en/sample_source.php
+++ /dev/null
@@ -1,27 +0,0 @@
- 'Sample Sources',
- 'search_placeholder' => 'Sample source name...',
- 'table_no' => 'No',
- 'table_name_latin' => 'Name-Latin',
- 'table_name_khmer' => 'Name-Khmer',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Sample Source',
- 'form_name' => 'Name',
- 'form_sort' => 'Sort-Order',
- 'form_edit_tittle' => 'Edit Sample Source',
-
- 'create_success' => 'Sample source has been created!',
- 'create_fail' => 'An error occur while trying to create sample source record. Please try again.',
- 'update_success' => 'Sample source record has been updated!',
- 'update_fail' => 'An error occur while trying to update sample source record. Please try again.',
- 'delete_success' => 'Sample source record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete sample source record. Please try again.',
- 'restore_success' => 'Sample source record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore sample source record. Please try again.',
- 'get_success' => 'Sample source record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve sample source record. Please try again.'
-
-];
diff --git a/lang/en/sample_type.php b/lang/en/sample_type.php
deleted file mode 100644
index 8de8c04..0000000
--- a/lang/en/sample_type.php
+++ /dev/null
@@ -1,34 +0,0 @@
- 'Sample Types',
- 'search_placeholder' => 'Sample type name...',
- 'table_no' => 'No',
- 'table_name' => 'Name',
- 'table_department' => 'Department Name',
- 'table_sample_type' => 'Sample Type',
- 'table_description' => 'Description',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Sample Type',
- 'form_name' => 'Name',
- 'form_sort' => 'Sort-Order',
- 'form_department' => 'Ward',
- 'form_select_all_department' => 'Select All Departments',
- 'form_edit_tittle' => 'Edit Sample Type',
- 'form_sample_description' => 'Sample Type',
-
- 'tube' => 'Type of Tube',
-
- 'create_success' => 'Sample type has been created!',
- 'create_fail' => 'An error occur while trying to create sample type record. Please try again.',
- 'update_success' => 'Sample type record has been updated!',
- 'update_fail' => 'An error occur while trying to update sample type record. Please try again.',
- 'delete_success' => 'Sample type record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete sample type record. Please try again.',
- 'restore_success' => 'Sample type record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore sample type record. Please try again.',
- 'get_success' => 'Sample type record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve sample type record. Please try again.'
-
-];
diff --git a/lang/en/sidebar.php b/lang/en/sidebar.php
index cdc0762..e602d95 100644
--- a/lang/en/sidebar.php
+++ b/lang/en/sidebar.php
@@ -28,7 +28,7 @@ return [
'system_role' => 'System Roles',
'change_lab' => 'Change Lab',
'logout' => 'Logout',
- 'clone_lab' => 'Clone Laboratory',
+ 'clone_lab' => 'Clone Organization',
'medicines' => 'Logistics',
'supplier' => 'Supplier',
'medicine_group' => 'Item Group',
diff --git a/lang/en/test_sample.php b/lang/en/test_sample.php
deleted file mode 100644
index de8b270..0000000
--- a/lang/en/test_sample.php
+++ /dev/null
@@ -1,68 +0,0 @@
- 'Tests',
- 'search_placeholder' => 'Department, sample type, or test name...',
- 'table_no' => 'No',
- 'table_name' => 'Test Name',
- 'table_department' => 'Ward',
- 'table_sample_type' => 'Sample Type',
- 'table_sign' => 'Sign',
- 'table_group_result' => 'Group Result',
- 'table_field_type' => 'Field Type',
- 'table_price' => 'Price',
- 'table_sort' => 'Sort-Order',
- 'table_btn_pc' => 'Provider Commission',
- 'pc_physician' => 'Provider',
- 'pc_rate' => 'Commission Rate',
- 'pc_btn_apply_all_test' => 'Apply to all tests',
- 'table_status' => 'Status',
- 'table_action' => 'Actions',
- 'form_add_tittle' => 'New Test Sample',
- 'form_test_name' => 'Test Name',
- 'form_unit_sign' => 'Unit Sign',
- 'form_field_type' => 'Field Type',
- 'form_edit_tittle' => 'Edit Test Sample',
- 'form_description' => 'Description',
- 'form_format' => 'Format',
- 'form_ref_range' => 'Reference Range',
- 'form_ref_min' => 'Min-Value',
- 'form_ref_sign' => 'Sign',
- 'form_ref_max' => 'Max-Value',
- 'form_ref_patient_type' => 'Patient Type',
- 'form_organism' => 'Organisim & Antibiotic',
- 'organism_input_placeholder' => 'Organism name',
- 'antibiotic_inut_placeholder' => 'Antibiotic name',
- 'form_organism_selected' => 'Selected',
- 'form_formula' => 'Formula',
- 'formula_equation' => 'Equation',
-
- 'btn_apply_to_all_tests' => 'Apply to all tests',
- 'code' => 'Code',
-
- 'create_success' => 'Test sample has been created!',
- 'create_fail' => 'An error occur while trying to create test sample record. Please try again.',
- 'update_success' => 'Test sample record has been updated!',
- 'update_fail' => 'An error occur while trying to update test sample record. Please try again.',
- 'delete_success' => 'Test sample record has been deleted!',
- 'delete_fail' => 'An error occur while trying to delete test sample record. Please try again.',
- 'restore_success' => 'Test sample record has been restored!',
- 'restore_fail' => 'An error occur while trying to restore test sample record. Please try again.',
- 'get_success' => 'Test sample record has been retrieved!',
- 'get_fail' => 'An error occur while trying to retrieve test sample record. Please try again.',
-
- 'add_commission_success' => 'Commission record has been added!',
- 'add_commission_fail' => 'An error occur while trying to add commission record. Please try again.',
- 'select_organism' => 'Selected Organisms',
- 'result_highlight_with_bold_text' => 'Highlight with Bold Text on Result Page',
- 'auto_suggest_results' => 'Auto Suggest Result',
-
- 'numeric' => 'Numeric',
- 'calculate' => 'Calculate',
- 'single' => 'Single Selection',
- 'multiple' => 'Multiple Selection',
- 'text' => 'Long Text',
- 'attachment' => 'Attachment',
- 'heading' => 'Heading'
-
-];
diff --git a/lang/en/user_account.php b/lang/en/user_account.php
index e24d632..d118d6e 100644
--- a/lang/en/user_account.php
+++ b/lang/en/user_account.php
@@ -18,8 +18,8 @@ return [
'non_of_above' => 'Others',
'form_edit_tittle' => 'Edit User Account',
'form_system_role' => 'System-Role',
- 'form_lab_cover' => 'Laboratory Coverage',
- 'form_laboratory' => 'Laboratory',
+ 'form_lab_cover' => 'Organization Coverage',
+ 'form_laboratory' => 'Organization',
'form_select_all_lab' => 'Select All Labs',
'form_password' => 'Password',
'form_character' => 'characters',
diff --git a/lang/en/vaccination.php b/lang/en/vaccination.php
deleted file mode 100644
index 3e1e130..0000000
--- a/lang/en/vaccination.php
+++ /dev/null
@@ -1,26 +0,0 @@
-'Date',
- 'next_visit' =>'Next Visit',
- 'name' =>'Vaccine Name',
- 'unit_price' =>'Unit Price',
- 'qty' =>'Quantity',
- 'subtotal' =>'Sub Total',
- 'new_title' =>'New Vaccination',
- 'btn_save' =>'Save',
- 'create_success' =>'Vaccination record has been saved.',
- 'create_fail' =>'Failed while saving vaccination record.',
- 'update_success' =>'Vaccination record has been updated.',
- 'update_fail' =>'Failed while updating vaccination record.',
- 'delete_success' =>'Vaccination record has been deleted.',
- 'delete_fail' =>'Failed while deleting vaccination record.',
- 'restore_success' =>'Vaccination record has been restored.',
- 'restore_fail' =>'Failed while restoring vaccination record.',
- 'list_title' =>'Vaccinations',
- 'invoice_title' =>'Vaccination Invoice',
- 'edit_title' =>'Edit Vaccination',
-
-
-];
diff --git a/lang/kh/antibiotic.php b/lang/kh/antibiotic.php
deleted file mode 100644
index 0b92d2e..0000000
--- a/lang/kh/antibiotic.php
+++ /dev/null
@@ -1,26 +0,0 @@
- 'តារាងឱសថប្រឆាំងមេរោគ',
- 'search_placeholder' => 'ឈ្មោះឱសថប្រឆាំងមេរោគ',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'បង្កើតអង់ទីប៊ីយោទិកថ្មី',
- 'form_name' => 'ឱសថប្រឆាំងមេរោគ',
- 'form_sort' => 'លេខរៀង',
- 'form_edit_tittle' => 'កែប្រែព័ត៌មានឱសថប្រឆាំងមេរោគ',
-
- 'create_success' => 'ឈ្មោះឱសថប្រឆាំងមេរោគថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតឈ្មោះឱសថប្រឆាំងមេរោគថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានឈ្មោះឱសថប្រឆាំងមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/appointment.php b/lang/kh/appointment.php
deleted file mode 100644
index c39a146..0000000
--- a/lang/kh/appointment.php
+++ /dev/null
@@ -1,20 +0,0 @@
- 'ប្រភេទណាត់ជួប',
- 'date' => 'ថ្ងៃណាត់ជួប',
- 'duration' => 'រយៈពេលជាថ្ងៃ',
- 'patient' => 'អ្នកជំងឺ',
- 'description' => 'បរិយាយ',
- 'doctor' => 'គ្រូពេទ្យ',
- 'create_success' => 'ការណាត់ជួបថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតការណាត់ជួបថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានការណាត់ជួបកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានការណាត់ជួបបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានការណាត់ជួបលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានការណាត់ជួបចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានការណាត់ជួបស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានការណាត់ជួបបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានការណាត់ជួបទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានការណាត់ជួបបានទេ។ សូមសាកល្បងម្តងទៀត'
-];
diff --git a/lang/kh/comment.php b/lang/kh/comment.php
deleted file mode 100644
index 40cda81..0000000
--- a/lang/kh/comment.php
+++ /dev/null
@@ -1,29 +0,0 @@
- 'តារាងមតិយោបល់',
- 'search_placeholder' => 'ឈ្មោះមតិយោបល់..',
- 'table_no' => 'ល.រ',
- 'table_name' => 'មតិយោបល់',
- 'table_department' => 'ផ្នែកមន្ទីរពិសោធន៌',
- 'table_sample_type' => 'ប្រភេទសំណាក',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'យោបល់ថ្មី',
- 'form_name' => 'ទម្រង់មតិយោបល់',
- 'form_sample_type' => 'ប្រភេទសំណាក',
- 'form_department' => 'ផ្នែកមន្ទីរពិសោធន៌',
- 'form_edit_tittle' => 'កែប្រែយោបល់',
-
- 'create_success' => 'មតិយោបល់ថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតមតិយោបល់ថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានមតិយោបល់កែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានមតិយោបល់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានមតិយោបល់លុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានមតិយោបល់ចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានមតិយោបល់ស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានមតិយោបល់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានមតិយោបល់ទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានមតិយោបល់បានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/department.php b/lang/kh/department.php
deleted file mode 100644
index e854cd2..0000000
--- a/lang/kh/department.php
+++ /dev/null
@@ -1,29 +0,0 @@
- 'តារាងផ្នែកមន្ទីរពិសោធន៌',
- 'search_placeholder' => 'ឈ្មោះផ្នែកមន្ទីរពិសោធន៌...',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះផ្នែកមន្ទីរពិសោធន៌',
- 'table_sample_type' => 'ប្រភេទសំណាក',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'បង្កើតផ្នែកមន្ទីរពិសោធន៌ថ្មី',
- 'form_name' => 'ឈ្មោះ',
- 'form_sort' => 'លេខរៀង',
- 'form_laboratory' => 'មន្ទីរពិសោធន៌',
- 'form_select_all_lab' => 'ជ្រើសរើសមន្ទីរពិសោធន៌ទាំងអស់',
- 'form_edit_tittle' => 'កែប្រែផ្នែកមន្ទីរពិសោធន៌',
-
- 'create_success' => 'ផ្នែកមន្ទីរពិសោធន៍ថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតផ្នែកមន្ទីរពិសោធន៍ថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានផ្នែកមន្ទីរពិសោធន៍កែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានផ្នែកមន្ទីរពិសោធន៍បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានផ្នែកមន្ទីរពិសោធន៍លុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានផ្នែកមន្ទីរពិសោធន៍ចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានផ្នែកមន្ទីរពិសោធន៍ស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានផ្នែកមន្ទីរពិសោធន៍បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានផ្នែកមន្ទីរពិសោធន៍ទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានផ្នែកមន្ទីរពិសោធន៍បានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/general.php b/lang/kh/general.php
index 0bbe9e0..8d2e3d7 100644
--- a/lang/kh/general.php
+++ b/lang/kh/general.php
@@ -64,7 +64,7 @@ return [
'manage_user_accounts' => 'គ្រប់គ្រងគណនីប្រើប្រាស់',
'manage_user_roles' => 'គ្រប់គ្រងតួនាទីអ្នកប្រើប្រាស់',
- 'laboratory_settings' => 'កំណត់ប្រព័ន្ធ',
+ 'laboratory_settings' => 'គ្រប់គ្រងមន្ទីរពិសោធន៍',
'activity_logs' => 'កំណត់ហេតុប្រតិបត្តិការណ៍',
'btn_save_patient_add_new_sample' => 'រក្សាទុក និងបង្កើតសំណាកថ្មី',
diff --git a/lang/kh/inventory.php b/lang/kh/inventory.php
deleted file mode 100644
index fef3b36..0000000
--- a/lang/kh/inventory.php
+++ /dev/null
@@ -1,19 +0,0 @@
- 'អ្នកផ្គត់ផ្គង់',
- 'sp_create_success' => 'មីបង្កើតបានសម្រេច។',
- 'sp_create_fail' => 'មិនអាចបង្កើតអ្នកផ្គត់ផ្គង់ថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'sp_update_success' => 'ព័ត៌មានអ្នកផ្គត់ផ្គង់កែប្រែបានសម្រេច។ ',
- 'sp_update_fail' => 'មិនអាចកែប្រែព័ត៌មានអ្នកផ្គត់ផ្គង់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'sp_delete_success' => 'ព័ត៌មានអ្នកផ្គត់ផ្គង់លុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'sp_delete_fail' => 'មិនអាចលុបព័ត៌មានអ្នកផ្គត់ផ្គង់ចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'sp_restore_success' => 'ព័ត៌មានអ្នកផ្គត់ផ្គង់ស្តារបានសម្រេច។',
- 'sp_restore_fail' => 'មិនអាចស្តារព័ត៌មានអ្នកផ្គត់ផ្គង់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'sp_get_success' => 'ព័ត៌មានអ្នកផ្គត់ផ្គង់ទាញយកបានសម្រេច។',
- 'sp_get_fail' => 'មិនអាចទាញយកព័ត៌មានអ្នកផ្គត់ផ្គង់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'supplier_name' => 'ឈ្មោះអ្នកផ្គត់ផ្គង់'
-
-];
diff --git a/lang/kh/invoice.php b/lang/kh/invoice.php
deleted file mode 100644
index 3094a43..0000000
--- a/lang/kh/invoice.php
+++ /dev/null
@@ -1,85 +0,0 @@
- 'តារាងវិក័យប័ត្រ',
- 'table_date_filter' => 'ចន្លោះកាលបរិច្ឆេទ',
- 'table_textable_filter' => 'ឬ ស្វែងរកតាម',
- 'table_textable_filter_placeholder' => 'លេខវិក័យប័ត្រ លេខសំណាក លេខសំគាល់អ្នកជំងឺ ឬ លេខទូរស័ព្ទ',
- 'btn_quick_report' => 'របាយការណ៍ចំណូលខ្លី',
- 'dialy_report' => 'របាយការណ៍ចំណូលប្រចាំថ្ងៃ',
- 'monthly_invoice_report' => 'របាយការណ៍ចំណូលប្រចាំខែ',
- 'yearly_invoice_report' => 'របាយការណ៍ចំណូលប្រចាំឆ្នាំ',
- 'table_no' => 'ល.រ',
- 'table_invoice_code' => 'លេខវិក័យប័ត្រ',
- 'table_sample_number' => 'លេខសំណាក',
- 'table_patient_name' => 'ឈ្មោះអ្នកជំងឺ',
- 'table_invoice_date' => 'ថ្ងៃធ្វើវិក័យប័ត្រ',
- 'table_total_cost' => 'តម្លៃសរុប',
- 'table_discount' => 'បញ្ចុះតម្លៃ',
- 'table_net_cost' => 'តម្លៃត្រូវបង់ ($)',
- 'table_net_cost_riel' => 'តម្លៃត្រូវបង់ (៛)',
- 'table_paid' => 'តម្លៃដែលបានបង់',
- 'table_owe' => 'នៅខ្វះ',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_new_title' => 'ធ្វើវិក័យប័ត្រថ្មី',
- 'form_edit_title'=> 'កែប្រែវិក័យប័ត្រ',
- 'form_patient' => 'អ្នកជំងឺ',
- 'form_invoice_number' => 'លេខវិក័យប័ត្រ',
- 'form_invoice_date' => 'ថ្ងៃធ្វើវិក័យប័ត្រ',
- 'form_description' => 'ពិពណ័នា',
- 'form_qty' => 'ចំនួន',
- 'form_unit_price' => 'តម្លៃឯកត្តា',
- 'form_total_amount' => 'តម្លៃសរុប',
- 'form_discount' => 'បញ្ចុះតម្លៃ',
- 'form_net_amount' => 'តម្លៃត្រូវបង់',
- 'form_paid_amount' => 'តម្លៃដែលបានបង់',
- 'form_paid_date' => 'ថ្ងៃបង់ប្រាក់',
- 'form_owe_amount' => 'នៅខ្វះ',
- 'form_btn_save' => 'រក្សាទុកវិក័យប័ត្រ',
- 'form_btn_generate_invoice' => 'បង្កើតវិក័យប័ត្រ',
-
- 'invoice_report_filter' => 'ច្រោះរបាយការណ៍វិក័យប័ត្រ',
- 'report_type' => 'ប្រភេទរបាយការណ៍',
- 'report_filter' => 'ជ្រើសរើសរយៈពេល',
- 'view_report' => 'បង្ហាញរបាយការណ៍',
- 'daily' => 'ប្រចាំថ្ងៃ',
- 'monthly' => 'ប្រចាំខែ',
- 'yearly' => 'ប្រចាំឆ្នាំ',
-
- 'received_date' => 'ថ្ងៃទទួលប្រាក់',
-
- 'paid_by' => 'អតិថិជន',
-
- 'received_by' => 'បេឡាករ',
-
- 'tittle' => 'វិក័យប័ត្រមន្ទីរពិសោធន៍',
- 'print' => 'បោះពុម្ពវិកយប័ត្រ',
-
- 'create_success' => 'វិក័យបត្រថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតវិក័យបត្រថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានវិក័យបត្រកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានវិក័យបត្របានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានវិក័យបត្រលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានវិក័យបត្រចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានវិក័យបត្រស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានវិក័យបត្របានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានវិក័យបត្រទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានវិក័យបត្របានទេ។ សូមសាកល្បងម្តងទៀត',
-
- 'form_btn_save_preview' => 'រក្សាទុក និងបោះពុម្ពវិកយប័ត្រ',
-
- 'pay_type' => 'ប្រភេទបង់ប្រាក់',
- 'bank_name' => 'ឈ្មោះធនាគារ',
- 'transaction_no' => 'លេខកូដប្រតិបត្តិការ',
- 'cash_paid' => 'បង់ប្រាក់សុទ្ធ',
- 'bank_paid' => 'បង់តាមធនាគារ',
-
- 'exchange_rate' => 'អត្រាប្តូរប្រាក់',
- 'hide_discount' => 'មិនបង្ហាញព័ត៌មានបញ្ចុះតម្លៃ',
- 'refresh_item' => 'ធ្វើបច្ចុប្បន្នភាពវិក្កយបត្រ',
-
- 'repayment' => 'ការបង់ប្រាក់',
- 'repayment_date' => 'ថ្ងៃបង់ប្រាក់'
-
-];
diff --git a/lang/kh/medicine_vacc.php b/lang/kh/medicine_vacc.php
deleted file mode 100644
index c3091ed..0000000
--- a/lang/kh/medicine_vacc.php
+++ /dev/null
@@ -1,23 +0,0 @@
- 'អ្នកផ្គត់ផ្គង់',
- 'supplier_search_placeholder' => 'ឈ្មោះគណនី អាស័យដ្ឋានអ៊ីមែល',
- 'supplier_table_no' => 'ល.រ',
- 'supplier_table_name' => 'ឈ្មោះ',
- 'supplier_table_action' => 'ប្រតិបត្តិការ',
- 'supplier_form_add_tittle' => 'បង្កើតគណនីអ្នកប្រើប្រាស់',
- 'supplier_form_name' => 'ឈ្មោះពេញ',
- 'supplier_form_edit_tittle' => 'កែប្រែគណនីអ្នកប្រើប្រាស់',
- 'supplier_create_success' => 'គណនីអ្នកប្រើប្រាស់ថ្មីបង្កើតបានសម្រេច។',
- 'supplier_create_fail' => 'មិនអាចបង្កើតគណនីអ្នកប្រើប្រាស់ថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'supplier_update_success' => 'ព័ត៌មានគណនីអ្នកប្រើប្រាស់កែប្រែបានសម្រេច។ ',
- 'supplier_update_fail' => 'មិនអាចកែប្រែព័ត៌មានគណនីអ្នកប្រើប្រាស់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'supplier_delete_success' => 'ព័ត៌មានគណនីអ្នកប្រើប្រាស់លុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'supplier_delete_fail' => 'មិនអាចលុបព័ត៌មានគណនីអ្នកប្រើប្រាស់ចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'supplier_restore_success' => 'ព័ត៌មានគណនីអ្នកប្រើប្រាស់ស្តារបានសម្រេច។',
- 'supplier_restore_fail' => 'មិនអាចស្តារព័ត៌មានគណនីអ្នកប្រើប្រាស់បានទេ។ សូមសាកល្បងម្តងទៀត',
- 'supplier_get_success' => 'ព័ត៌មានគណនីអ្នកប្រើប្រាស់ទាញយកបានសម្រេច។',
- 'supplier_get_fail' => 'មិនអាចទាញយកព័ត៌មានគណនីអ្នកប្រើប្រាស់បានទេ។ សូមសាកល្បងម្តងទៀត',
-
-];
diff --git a/lang/kh/opd_visit.php b/lang/kh/opd_visit.php
deleted file mode 100644
index a6368db..0000000
--- a/lang/kh/opd_visit.php
+++ /dev/null
@@ -1,231 +0,0 @@
-'ពិគ្រោះជំងឺថ្មី',
- 'admission_date'=>'ថ្ងៃចុះឈ្មោះ',
- 'admission_ward'=>'ដាក់ចូលផ្នែក',
- 'doctor'=>'វេជ្ជបណ្ឌិត',
- 'physical_examinations'=>'ការត្រួតពិនិត្យរាងកាយ',
- 'histories'=>'ប្រវត្តិអ្នកជំងឺ',
- 'investigations_&_procedures'=>'ការអង្កេត និង និតិវិធី',
- 'medications'=>'ការផ្តល់ថ្នាំ',
- 'documents'=>'ឯកសារ',
- 'bills'=>'វិក្កយបត្រ',
- 'chief_complaint'=>'សញ្ញាតម្អូន',
- 'vital_sign'=>'សញ្ញាគ្រោះថ្នាក់',
- 'temperature'=>'សីតុណ្ហភាព',
- 'blood_presure(mmhg)'=>'សំពាធឈាម',
- 'pulse'=>'ជីពចរ',
- 'spo2'=>'អុកស៊ីសែន',
- 'respiration_rate'=>'ចង្វាក់ដង្ហើម',
- 'biometrics'=>'ជីវមាឌ',
- 'weight(kg)'=>'ទម្ងន់',
- 'height(cm)'=>'កម្ពស់',
- 'bmi(clac)'=>'សន្ទស្សន៍ម៉ាសរាងកាយ',
- 'diagnosis'=>'រោគវិនិច្ឆ័យ',
- 'initial_diagnosis'=>'រោគវិនិច្ឆ័យដំបូង',
- 'final_diagnosis'=>'រោគវិនិច្ឆ័យចុងក្រោយ',
- 'save'=>'រក្សាទុក',
- 'vaccination_history'=>'ប្រវត្តិនៃការចាក់វ៉ាក់ស៊ាំង',
- 'allergies'=>'ប្រតិកម្ម',
- 'allergen_category'=>'ប្រភេទប្រតិកម្ម',
- 'allergen'=>'ប្រតិកម្ម',
- 'drug_allergy'=>'ប្រតិកម្មថ្នាំ',
- 'food_allergy'=>'ប្រតិកម្មអាហារ',
- 'insect_allergy'=>'ប្រតិកម្មសត្វល្អិត',
- 'environment_allergy'=>'ប្រតិកម្មបរិស្ថាន',
- 'others'=>'ផ្សេងៗ',
- 'current_medication'=>'ឪសថកំពុងប្រើ',
- 'past_medical_surgical_history'=>'ប្រវត្តិនៃការវះកាត់',
- 'family_history'=>'ប្រវត្តិគ្រួសារ',
- 'laboratory'=>'ផ្នែកមន្ទីរពិសោធន៏',
- 'request_for_laboratory_test'=>'ការស្នើសុំមន្ទីរពិសោធន៏',
- 'request_imagery'=>'ការស្នើសុំថត រឺ អេកូ',
- 'imagery_type'=>'ប្រភេទថត រឺ អេកូ',
- 'imagery_service'=>'សេវាថត រឺ អេកូ',
- 'medical_item_group'=>'ក្រុមសំភារៈវេជ្ជសាស្រ្ត',
- 'medical_item'=>'សំភារៈវេជ្ជសាស្រ្ត',
- 'route'=>'ផ្លូវ',
- 'form'=>'ទម្រង់',
- 'morning'=>'ពេលព្រឹក',
- 'noon'=>'ពេលថ្ងៃ',
- 'afternoon'=>'ពេលរសៀល',
- 'evening'=>'ពេលល្ងាច',
- 'midnight'=>'កណ្តាលយប់',
- 'duration'=>'រយៈពេល',
- 'instruction'=>'របៀបប្រើ',
- 'view_all'=>'មើលទាំងអស់',
- 'pending'=>'រង់ចាំ',
- 'discharged'=>'ចេញពីមន្ទីរពេទ្យ',
- 'visit_number'=>'លេខរៀងចូលពិនិត្យ',
- 'save_&_generate_invoice'=>'រក្សាទុក និង បង្កើតវិក្កយបត្រ',
- 'hid'=>'លេខសំគាល់អ្នកជំងឺ',
- 'patient_name'=>'ឈ្មោះអ្នកជំងឺ',
- 'gender'=>'ភេទ',
- 'age'=>'អាយុ',
- 'date_of_birth'=>'ថ្ងៃខែឆ្នាំកំណើត',
- 'visit_date'=>'ថ្ងៃចូលពិនិត្យ',
- 'visit_no.'=>'លេខរៀងពិនិត្យ',
- 'refer_from'=>'បញ្ជូនមកពី',
- 'refer_to'=>'បញ្ជូនទៅ',
- 'visit_histories'=>'ប្រវត្តិពិនិត្យជំងឺ',
- 'life_styles'=>'របៀបរស់នៅ',
- 'alcohol'=>'គ្រឿងស្រវឹង',
- 'smoking'=>'ជក់',
- 'drug'=>'ថ្នាំញៀន',
- 'no'=>'ល.រ',
- 'yes'=>'បាទ/ចាស',
- 'new_invoice'=>'វិក្កយបត្រថ្មី',
- 'upload_document'=>'បញ្ចូលឯកសារ',
- 'consultation' => 'តារាងពិគ្រោះជំងឺ',
- 'medicine_name' => 'ឈ្មោះថ្នាំ',
- 'view_requested' => 'មើលការស្នើសុំ',
- 'consultations' => 'ពិគ្រោះជំងឺ',
- 'imagery' => 'ផ្នែកថត ស្កេន',
- 'possible_result' => 'កំណត់លទ្ធផលស្តង់ដារ',
- 'imagery_list' => 'តារាងអ្នកជំងឺថត ស្កេន',
- 'pharmacy' => 'ផ្នែកឳសថស្ថាន',
- 'prescriptions' => 'តារាងស្នើសុំឪសថ',
- 'medicine_instruction' => 'ការណែនាំប្រើប្រាស់ឪសថ',
- 'exam_date' => 'ថ្ងៃធ្វើតេស្ត',
- 'technique' => 'បច្ចេកទេស',
- 'id' => 'ID',
- 'add_result_of' => 'បញ្ចូលលទ្ធផលរបស់ ',
- 'attach_photo' => 'បញ្ចូលរូបភាពទី ',
- 'short_name' => 'លេខកូដ',
- 'name' => 'ឈ្មោះជាភាសាអង់គ្លេស',
- 'name_kh' => 'ឈ្មោះជាភាសាខ្មែរ',
- 'standard_result' => 'លទ្ធផលស្តង់ដារ',
- 'default_select' => 'ជ្រើសរើសស្វ័យប្រវត្ត',
- 'wards' => 'ផ្នែក',
- 'ward' => 'ផ្នែក',
- 'doctors' => 'វេជ្ជបណ្ឌិត',
- 'base_manager' => 'គ្រប់គ្រងទូទៅ',
- 'hospital_services' => 'សេវាកម្មមន្ទីរពេទ្យ',
- 'hospital_service' => 'សេវាកម្មមន្ទីរពេទ្យ',
- 'service_type' => 'ប្រភេទសេវា',
- 'name_latin' => 'ឈ្មោះឡាតាំង',
- 'name_local' => 'ឈ្មោះជាភាសាខ្មែរ',
-
- 'visit' => 'អ្នកជំងឺ',
- 'type_service_code_or_name' => 'បញ្ចូលលេខកូដ ឬ ឈ្មោះសេវាកម្ម',
- 'unit_price' => 'តម្លៃរាយ',
- 'total' => 'សរុប',
- 'action' => 'ប្រតិបត្តការ',
- 'stock_in' => 'ទំនិញចូលឃ្លាំង',
- 'stock_out' => 'ទំនិញចេញពីឃ្លាំង',
- 'inventory_report' => 'របាយការណ៍សារពើភ័ណ្ឌ',
- 'item' => 'សារពើភ័ណ្ឌ',
- 'supplier' => 'អ្នកផ្គត់ផ្គង់',
- 'item_group' => 'ក្រុមសារពើភ័ណ្ឌ',
- 'item_unit' => 'ឯកត្តារង្វាស់រង្វាល់',
- 'grn_number' => 'លេខកូដទទួលទំនិញ',
- 'po_number' => 'លេខបញ្ជាទិញ',
- 'received_date' => 'ថ្ងៃទទួលទំនិញ',
- 'total_amount' => 'ទឹកប្រាក់សរុប',
- 'grn_num_or_supplier' => 'លេខកូដទទួលទំនិញ ឬ ឈ្មោះអ្នកផ្គត់ផ្គង់',
- 'quantity' => 'បរិមាណ',
- 'expiry_date' => 'ថ្ងៃផុតកំណត់',
-
- 'gin_number' => 'លេខកូដបញ្ចេញទំនិញ',
- 'issued_date' => 'ថ្ងៃបញ្ចេញទំនិញ',
- 'description' => 'បរិយាយ',
- 'report_type' => 'ប្រភេទរបាយការណ៍',
- 'inventory_on_hand' => 'ទំនិញក្នុងឃ្លាំង',
- 'expire_report' => 'ទំនិញផុតកំណត់',
- 'report_date' => 'ថ្ងៃធ្វើរបាយការណ៍',
-
- 'item_name' => 'ឈ្មោះទំនិញ',
- 'on_hand' => 'ទំនិញក្នុងស្តុក',
- 'last_stock_in' => 'ថ្ងៃទំនិញចូលចុងក្រោយ',
- 'last_stock_out' => 'ថ្ងៃទំនិញចេញចុងក្រោយ',
- 'stock_in_date' => 'ថ្ងៃទំនិញចូល',
- 'expire_date' => 'ថ្ងៃផុតកំណត់',
- '_month' => 'ចំនួនខែ',
-
- 'code' => 'លេខសំគាល់',
- 'sale_price' => 'តម្លៃលក់',
- 'is_vaccination' => 'ជាប្រភេទថ្នាំបង្ការ',
- 'vat_number' => 'លេខពន្ធអាករ',
- 'supplier_name' => 'ឈ្មោះក្រុមហ៊ុនផ្គត់ផ្គង់',
- 'contact_person' => 'ឈ្មោះបុគ្គលិក',
- 'position' => 'មុខតំណែង',
- 'phone' => 'លេខទូរស័ព្ទ',
- 'email' => 'អ៊ីមែល',
- 'address' => 'អាស័យដ្ឋាន',
- 'packaged_item' => 'ទំនិញជាកញ្ចប់',
-
- 'medical_record' => 'កំណត់ត្រាវេជ្ជសាស្ត្រ',
-
- 'concept_code' => 'លេខកូដខន់សិប',
- 'class' => 'ក្រុម',
- 'sub_class' => 'ក្រុមរង',
- 'create_success' => 'បង្កើតបានសម្រេច',
- 'create_fail' => 'បង្កើតមិនបានសម្រេច',
- 'update_success' => 'កែប្រែបានសម្រេច',
- 'update_fail' => 'កែប្រែមិនបានសម្រេច',
- 'get_success' => 'ទាញបានសម្រេច',
- 'get_fail' => 'ទាញមិនបានសម្រេច',
- 'delete_success' => 'លុបបានសម្រេច',
- 'delete_fail' => 'លុបមិនបានសម្រេច',
- 'restore_success' => 'ស្តារបានសម្រេច',
- 'restore_fail' => 'ស្តារមិនបានសម្រេច',
-
- 'evaluation' => 'ការវាយតម្លៃ',
- 'evaluation_summary' => 'វាយតម្លៃសង្ខេប',
-
- 'queues' => 'តារាងរង់ចាំ',
- 'queue_no' => 'លេខរង់ចាំ',
- 'save_to_queue' => 'បញ្ចូលក្នុងតារាងរង់ចាំ',
-
- 'systolic' => 'ស៊ីស្តូលិក',
- 'diastolic' => 'យ៉ាស្តូលិក',
- 'glucose' => 'កម្រិតស្ករក្នុងឈាម',
-
- 'onset_date' => 'ថ្ងៃចាប់ផ្តើមចេញអាការៈ',
- 'clinical_feature' => 'សញ្ញាគ្លីនិក',
- 'sign' => 'សញ្ញា',
- 'general_appearance' => 'លក្ខណៈទូទៅ',
- 'status' => 'ស្ថានភាព',
- 'other' => 'ផ្សេងទៀត',
- 'ent' => 'ត្រចៀក ច្រមុះ បំពង់ក',
- 'ears' => 'ត្រចៀក',
- 'nose' => 'ច្រមុះ',
- 'throat' => 'បំពង់ក',
- 'cardio_system' => 'ប្រព័ន្ធសរសៃឈាមបេះដូង',
- 'heart_sound' => 'ចង្វាក់បេះដូង',
- 'cardio_refill_time' => 'ពេលវេលាបំពេញ Capillary',
- 'resp_system' => 'ប្រព័ន្ធផ្លូវដង្ហើម',
- 'inspection' => 'ការត្រួតពិនិត្យ',
- 'percussion' => 'ការគោះ',
- 'auscultation' => 'អាស្កាល់ថេសិន',
- 'palpation' => 'ផាល់ផេសិន',
- 'uro_system' => 'ប្រព័ន្ធ Urogenital',
- 'skin' => 'ស្បែក',
- 'edema' => 'ហើម',
- 'wounds' => 'របួស',
- 'rash' => 'កន្ទួល',
- 'nervous_system' => 'ប្រព័ន្ធសរសៃប្រសាទ',
- 'neurological' => 'សរសៃប្រសាទ',
- 'mental_status' => 'ស្ថានភាពផ្លូវចិត្ត',
- 'eyes' => 'ភ្នែក',
- 'verbal' => 'ពាក្យសំដី',
- 'motion' => 'ចលនា',
- 'mental_total' => 'សរុប',
- 'specify' => 'បញ្ជាក់',
- 'gastro_system' => 'ប្រព័ន្ធក្រពះ-ពោះវៀន',
- 'speech' => 'ការនិយាយស្តី',
- 'mood' => 'អារម្មណ៍និងការប៉ះពាល់',
- 'thought' => 'ការគិត',
- 'insight' => 'ការយល់ឃើញ និងការវិនិច្ឆ័យ',
- 'consciousness' => 'ឆន្ទៈ',
- 'abdomen' => 'ផ្នែកពោះ',
- 'perception' => 'ការយល់ឃើញ',
- 'coma' => 'ការវាស់វែងសភាពសន្លប់',
- 'print_consult_form' => 'បោះពុម្ពទម្រង់ពិគ្រោះ',
- 'document_title' => 'បរិយាយឯកសារ',
- 'file_name' => 'ឈ្មោះឯកសារ',
- 'file_type' => 'ប្រភេទ',
-
-
-];
diff --git a/lang/kh/organism.php b/lang/kh/organism.php
deleted file mode 100644
index 3c2f8ad..0000000
--- a/lang/kh/organism.php
+++ /dev/null
@@ -1,27 +0,0 @@
- 'តារាងមេរោគ',
- 'search_placeholder' => 'ឈ្មោះមេរោគ',
- 'table_no' => 'ទេ',
- 'table_name' => 'ឈ្មោះ',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'បន្ថែមមេរោគថ្មី',
- 'form_name' => 'ទម្រង់មេរោគ',
- 'form_sort' => 'លេខរៀង',
- 'form_edit_tittle' => 'កែប្រែឈ្មោះមេរោគ',
- 'is_bold' => 'អក្សរដិត',
-
- 'create_success' => 'ឈ្មោះមេរោគថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតឈ្មោះមេរោគថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានឈ្មោះមេរោគកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានឈ្មោះមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានឈ្មោះមេរោគលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានឈ្មោះមេរោគចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានឈ្មោះមេរោគស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានឈ្មោះមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានឈ្មោះមេរោគទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានឈ្មោះមេរោគបានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/patient.php b/lang/kh/patient.php
deleted file mode 100644
index 4656113..0000000
--- a/lang/kh/patient.php
+++ /dev/null
@@ -1,76 +0,0 @@
- 'តារាងអ្នកជំងឺ',
- 'search_placeholdolder' => 'ឈ្មោះអ្នកជំងឺ ឬលេខទូរស័ព្ទ…',
- 'table_no' => 'ល.រ',
- 'table_code' => 'លេខកូដ',
- 'table_name' => 'ឈ្មោះ',
- 'table_sex' => 'ភេទ',
- 'table_phon' => 'លេខទូរស័ព្ទ',
- 'table_have_sample' => 'មានសំណាក',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_title' => 'អ្នកជំងឺថ្មី',
- 'form_edit_title' => 'កែប្រែព័ត៌មានអ្នកជំងឺ',
- 'form_code' => 'លេខកូដអ្នកជំងឺ',
- 'form_name' => 'ឈ្មោះអ្នកជំងឺ',
- 'form_dob' => 'ថ្ងៃខែឆ្នាំកំណើត ឬអាយុ',
- 'form_age' => 'អាយុ',
- 'form_gender' => 'ភេទ',
- 'form_sex_male' => 'ប្រុស',
- 'form_sex_female' => 'ស្រី',
- 'form_sex_other' => 'ផ្សេងទៀត',
- 'form_khid' => 'លេខអត្តសញ្ញាណប័ណ្ណ',
- 'form_phone' => 'លេខទូរស័ព្ទ',
- 'form_house' => 'លេខផ្ទះ',
- 'form_street' => 'លេខផ្លូវ',
- 'form_province' => 'ខេត្ត/រាជធានី',
- 'form_district' => 'ស្រុក',
- 'form_commune' => 'ឃុំ',
- 'form_village' => 'ភូមិ',
- 'form_alt_generate_puuid' => 'បង្កើតលេខកូដអ្នកជំងឺ',
-
- 'create_success' => 'អ្នកជំងឺថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតអ្នកជំងឺថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានអ្នកជំងឺកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានអ្នកជំងឺលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានអ្នកជំងឺចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានអ្នកជំងឺស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានអ្នកជំងឺទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត',
-
- 'basic_information' => 'ព័ត៌មានមូលដ្នាន',
- 'identifiers' => 'អត្តសញ្ញាណឯកតជន',
- 'contact_detail' => 'ព័ត៌មានទំនាក់ទំនង',
- 'medical_history' => 'ប្រវត្តិវេជ្ជសាស្ត្រ',
- 'first_name' => 'នាមត្រកូល',
- 'last_name' => 'នាមខ្លូន',
- 'dob' => 'ថ្ងៃខែឆ្នាំកំណើត',
- 'marital_status' => 'ស្ថានភាពគ្រួសារ',
- 'single' => 'នៅលីវ',
- 'married' => 'មានគ្រួសារ',
- 'other' => 'ផ្សេងៗ',
- 'are_in_num' => 'ឬ អាយុគិតជាឆ្នាំ ខែ និងថ្ងៃ',
- 'blood_group' => 'ក្រុមឈាម',
- 'khid' => 'លេខអត្តសញ្ញាណប័ណ្ណ',
- 'passport' => 'លេខលិខិតឆ្លងដែន',
- 'nhid' => 'លេខប័ណ្ណសុខភាព',
- 'create_new' => 'ចុះឈ្មោះអ្នកជំងឺថ្មី',
- 'street' => 'លេខផ្លូវ',
- 'house_no' => 'លេខផ្ទះ',
- 'email' => 'សារអេឡិចត្រូនិច',
- 'allergy' => 'អាលែកហ្ស៊ី',
- 'chronic_disease' => 'ជំងឺរាំរ៉ៃ',
- 'past_surgery' => 'ប្រវត្តិវះកាត់',
- 'family_history' => 'ប្រវត្តិសុខភាពគ្រួសារ',
- 'vaccination_history' => 'ប្រវត្តិចាក់ថ្នាំបង្ការ',
- 'save_patient' => 'រក្សាទុកព័ត៌មានអ្នកជំងឺ',
- 'save_consult' => 'ពិគ្រោះ',
- 'save_queue' => 'បញ្ជូនទៅកន្លែងរង់ចាំ',
- 'cancel' => 'បោះបង់',
- 'sample' => 'សំណាក'
-
-];
diff --git a/lang/kh/patient_type.php b/lang/kh/patient_type.php
deleted file mode 100644
index df44979..0000000
--- a/lang/kh/patient_type.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'តារាងប្រភេទអ្នកជំងឺ',
- 'search_placeholder' => 'ឈ្មោះប្រភេទអ្មកជំងឺ',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_gender' => 'ភេទ',
- 'table_age_from' => 'អាយុចាប់ពី',
- 'table_age_to' => 'អាយុដល់',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'ប្រភេទអ្នកជំងឺថ្មី',
- 'form_name' => 'ឈ្មោះ',
- 'form_max_age' => 'អាយុច្រើនបំផុត',
- 'form_min_age' => 'អាយុតិចបំផុត',
- 'form_edit_tittle' => 'កែប្រែប្រភេទអ្នកជំងឺ',
- 'form_input_day' => 'ថ្ងៃ',
- 'form_input_month' => 'ខែ',
- 'form_input_year' => 'ឆ្នាំ',
-
- 'create_success' => 'ប្រភេទអ្នកជំងឺថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតប្រភេទអ្នកជំងឺថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានប្រភេទអ្នកជំងឺកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានប្រភេទអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានប្រភេទអ្នកជំងឺលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានប្រភេទអ្នកជំងឺចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានប្រភេទអ្នកជំងឺស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានប្រភេទអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានប្រភេទអ្នកជំងឺទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានប្រភេទអ្នកជំងឺបានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/physician.php b/lang/kh/physician.php
deleted file mode 100644
index 16208e9..0000000
--- a/lang/kh/physician.php
+++ /dev/null
@@ -1,31 +0,0 @@
- 'តារាងបញ្ជីគ្រូពេទ្យ',
- 'search_placeholder' => 'ឈ្មោះគ្រូពេទ្យ',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_logo' => 'រូបតំណាង',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'បន្ថែមគ្រូពេទ្យថ្មី',
- 'form_name' => 'ឈ្មោះ',
- 'form_logo_upload' => 'បញ្ចូល',
- 'form_logo' => 'គម្រូក្បាលទំព័រ',
- 'form_edit_tittle' => 'កែប្រែគ្រូពេទ្យ',
- 'confirm_delete_photo' => 'តើអ្នកពិតជាចង់លុបរូបតំណាងរបស់គ្រូពេទ្យនេះមែនឬទេ?',
- 'ok_delete' => 'បាទ/ចាស, លុប',
- 'cancel_delete' => 'ទេ, បោះបង់',
- 'confirm_delete' => 'តើអ្នកពិតជាចង់លុបគ្រូពេទ្យនេះមែនឬទេ?',
- 'delete_photo_success' => 'រូបតំណាងរបស់គ្រូពេទ្យលុបបានសម្រេច',
- 'delete_photo_failed' => 'រូបតំណាងរបស់គ្រូពេទ្យមិនអាចលុបបានទេ',
-
- 'delete_success' => 'ព័ត៌មានគ្រូពេទ្យលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានគ្រូពេទ្យចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានគ្រូពេទ្យស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានគ្រូពេទ្យបានទេ។ សូមសាកល្បងម្តងទៀត',
-
- 'form_footer' => 'គម្រូជើងទំព័រ',
- 'default_select' => 'បុរេសកម្ម'
-
-];
diff --git a/lang/kh/quantity.php b/lang/kh/quantity.php
deleted file mode 100644
index fdec084..0000000
--- a/lang/kh/quantity.php
+++ /dev/null
@@ -1,26 +0,0 @@
- 'តារាងបរិមាណ',
- 'search_placeholder' => 'ឈ្មោះបរិមាណ...',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'បរិមាណថ្មី',
- 'form_name' => 'បរិមាណ',
- 'form_sort' => 'លេខរៀង',
- 'form_edit_tittle' => 'កែប្រែបរិមាណ',
-
- 'create_success' => 'បរិមាណថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតបរិមាណថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានបរិមាណកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានបរិមាណបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានបរិមាណលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានបរិមាណចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានបរិមាណស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានបរិមាណបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានបរិមាណទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានបរិមាណបានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/report.php b/lang/kh/report.php
deleted file mode 100644
index 66f8ca5..0000000
--- a/lang/kh/report.php
+++ /dev/null
@@ -1,26 +0,0 @@
- 'របាយការណ៍សរុបរួម',
- 'summary_rpt_fd_filter' => 'ចាប់ពីថ្ងៃ',
- 'summary_rpt_td_filter' => 'រហូតដល់ថ្ងៃ',
- 'btn_view' => 'បង្ហាញរបាយការណ៍',
- 'btn_action' => 'ប្រតិបត្តិការ',
- 'btn_action_print' => 'បោះពុម្ភ',
- 'btn_action_export' => 'ទាញជា Excel',
- 'summary_report_section_by_test' => 'របាយការណ៍សរុបតាមតេស្ត',
- 'summary_report_section_by_sample_source' => 'របាយការណ៍សរុបតាមប្រភពសំណាក',
- 'summary_rpt_test_type' => 'ប្រភេទតេស្ត',
- 'summary_male_patient' => 'អ្នកជំងឺប្រុស',
- 'summary_female_patient' => 'អ្នកជំងឺស្រី',
- 'summary_total_patient' => 'អ្នកជំងឺសរុប',
- 'summary_clinic_name' => 'ប្រភពសំណាក',
- 'doctor_date_range_filter' => 'កាលបរិច្ឆេទ',
- 'doctor_sample_source_filter' => 'ប្រភពសំណាក',
- 'doctor_physician_filter' => 'គ្រូពេទ្យ',
- 'doctor_exam' => 'ចំនួនតេស្ត',
- 'doctor_net_amount' => 'តម្លៃត្រូវទូទាត់',
- 'summary_report_section_by_category'=>'របាយការណ៍សរុបតាមប្រភេទតេស្ត',
- 'summary_category_name'=>'ប្រភេទតេស្ត',
- 'total' => 'សរុប'
-
-];
diff --git a/lang/kh/sample.php b/lang/kh/sample.php
deleted file mode 100644
index f0d75d2..0000000
--- a/lang/kh/sample.php
+++ /dev/null
@@ -1,113 +0,0 @@
- 'តារាងសំណាក',
- 'table_no' => 'ល.រ',
- 'table_patient_code' => 'លេខកូដអ្នកជំងឺ',
- 'table_patient_name' => 'ឈ្មោះអ្នកជំងឺ',
- 'table_sample_number' => 'លេខកូដសំណាក',
- 'table_collected_date' => 'ថ្ងៃស្នើសុំធ្វើតេស្ត',
- 'table_received_date' => 'ថ្ងៃទទួលសំណាក',
- 'table_sample_source' => 'ប្រភពសំណាក',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_title' => 'បង្កើតសំណាកថ្មី',
- 'form_patient' => 'អ្នកជំងឺ',
- 'form_sample_number' => 'លេខកូដសំណាក',
- 'form_sample_source' => 'ប្រភពសំណាក',
- 'form_requester' => 'ស្នើសុំដោយ',
- 'form_collected_date' => 'ថ្ងៃស្នើសុំធ្វើតេស្ត',
- 'form_received_date' => 'ថ្ងៃទទួលសំណាក',
- 'form_admission_date' => 'ថ្ងៃចូលសម្រាកពេទ្យ',
- 'form_diagnisis' => 'រោគវិនិច្ឆ័យ',
- 'form_sample_condition' => 'ស្ថានភាពសំណាក',
- 'form_reject_reason' => 'មូលហេតុបដិសេធ',
- 'form_is_urgent' => 'បន្ទាន់',
- 'form_btn_save_assign_test' => 'រក្សាទុក និងបញ្ចូលតេស្ត',
- 'form_patient_info_title' => 'ព័ត៌មានអ្នកជំងឺ',
- 'form_patient_code' => 'លេខកូដអ្នកជំងឺ',
- 'form_patient_name' => 'ឈ្មោះអ្នកជំងឺ',
- 'form_patient_gender' => 'ភេទ',
- 'form_patient_age' => 'អាយុ',
- 'form_patient_mobile' => 'លេខទូរស័ព្ទ',
- 'form_patient_address' => 'អាសយដ្ឋាន',
- 'form_edit_title' => 'កែប្រែសំណាក',
- 'form_btn_update' => 'កែប្រែ',
- 'form_btn_assign_test' => 'ជ្រើសរើសតេស្ត',
- 'form_btn_add_result' => 'បញ្ចូលលទ្ធផល',
- 'form_btn_preview_result' => 'មើលលទ្ធផល',
- 'from_btn_remove' => 'លុបចេញ',
- 'form_btn_new_sample' => 'បង្កើតសំណាកថ្មី',
- 'assign_test_modal_title' => 'ជ្រើសរើសតេស្ត',
- 'assign_test_save_template' => 'បង្កើតក្រុមតេស្ត',
- 'assign_test_make_invoice' => 'បង្កើតវិក្កយបត្រ',
- 'assign_test_total_fee_text' => 'តម្លៃសរុប',
- 'assign_test_total_test' => 'ចំនួនតេស្តស្នើសុំ',
- 'assign_test_btn_save' => 'រក្សាទុក',
- 'assign_test_btn_save_add_result' => 'រក្សាទុក និងបញ្ចូលលទ្ធផល',
- 'assign_test_btn_cancel' => 'បោះបង់',
- 'add_result_title' => 'បញ្ចូលលទ្ធផល',
- 'sample_entry_by' => 'បញ្ចូលសំណាកដោយ',
- 'sample_modify_by' => 'កែប្រែដោយ',
- 'add_result_test' => 'ឈ្មោះតេស្ត',
- 'add_result_result' => 'លទ្ធផល',
- 'add_result_unit_sign' => 'សញ្ញាឯកត្តា',
- 'add_result_ref_range' => 'តម្លៃយោង',
- 'add_result_test_date' => 'ថ្ងៃធ្វើតេស្ត',
- 'add_result_performed_by' => 'តេស្តដោយ',
- 'add_result_hide' => 'លាក់',
- 'add_result_btn_edit_test' => 'កែប្រែតេស្ត',
- 'add_result_btn_save' => 'រក្សាទុក',
- 'add_result_btn_save_preview' => 'រក្សាទុក និងមើលលទ្ធផល',
- 'add_result_btn_cancel' => 'បោះបង់',
- 'print_title' => 'លទ្ធផលមន្ទីរពិសោធន៍',
- 'btn_print' => 'បោះពុម្ព',
- 'btn_approve' => 'យល់ព្រម',
- 'last_test_date' => 'ថ្ងៃធ្វើតេស្តចុងក្រោយ',
- 'verify_by' => 'ផ្ទៀងផ្ទាត់ដោយ',
- 'report_date' => 'ថ្ងៃធ្វើរបាយការណ៍',
-
- 'lab_technician' => 'បុគ្គលិកមន្ទីរពិសោធន៍ ',
- 'physician_name' => 'ឈ្មោះគ្រូពេទ្យ',
-
- 'search_placeholder' => 'ឈ្មោះអ្នកជំងឺ ឬលេខទូរស័ព្ទ..',
-
- 'condition_good' => 'ល្អ',
- 'condition_reject' => 'បដិសេធ',
- 'condition_acceptable' => 'អាចទទួលយកបាន',
-
- 'requested_date' => 'ថ្ងៃស្នើសុំ',
-
- 'year' => ' ឆ្នាំ',
- 'month' => ' ខែ',
- 'day' => ' ថ្ងៃ',
- 'sex_m' => ' ប្រុស',
- 'sex_f' => ' ស្រី',
-
- 'create_success' => 'សំណាកថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតសំណាកថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានសំណាកកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានសំណាកលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានសំណាកចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានសំណាកស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានសំណាកទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
-
- 'approve_success' => 'សំណាកអនុម័ត្តបានសម្រេច',
- 'approve_fail' => 'មិនអាចអនុម័ត្តសំណាកបានទេ',
-
- 'filter_all' => 'បង្ហាញទាំងអស់',
- 'filter_rejected' => 'បានបដិសេធ',
- 'filter_pending' => 'កំពុងរង់ចាំ',
- 'filter_processing' => 'កំពុងដំណើរការ',
- 'filter_completed' => 'រួចរាល់',
- 'filter_printed' => 'បានបោះពុម្ព',
- 'clear_selection' => 'ជម្រះជម្រើសតេស្ត',
- 'print_label' => 'បោះពុម្ព Label',
- 'previous_result' => 'ប្រវត្តិលទ្ធផល',
- 'sample_status' => ' ស្ថានភាព '
-
-];
diff --git a/lang/kh/sample_source.php b/lang/kh/sample_source.php
deleted file mode 100644
index ae8209d..0000000
--- a/lang/kh/sample_source.php
+++ /dev/null
@@ -1,25 +0,0 @@
- 'តារាងប្រភពសំណាក',
- 'search_placeholder' => 'ឈ្មោះប្រភពសំណាក',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'ប្រភពសំណាកថ្មី',
- 'form_name' => 'ឈ្មោះ',
- 'form_sort' => 'លេខរៀង',
- 'form_edit_tittle' => 'កែប្រែប្រភពសំណាក',
-
- 'create_success' => 'ប្រភពសំណាកថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតប្រភពសំណាកថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានប្រភពសំណាកកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានប្រភពសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានប្រភពសំណាកលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានប្រភពសំណាកចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានប្រភពសំណាកស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានប្រភពសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានប្រភពសំណាកទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានប្រភពសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត'
-];
diff --git a/lang/kh/sample_type.php b/lang/kh/sample_type.php
deleted file mode 100644
index 8bab2f5..0000000
--- a/lang/kh/sample_type.php
+++ /dev/null
@@ -1,33 +0,0 @@
- 'តារាងប្រភេទសំណាក',
- 'search_placeholder' => 'ឈ្មោះប្រភេទសំណាក...',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះ',
- 'table_department' => 'ផ្នែកមន្ទីរពិសោធន៌',
- 'table_sample_type' => 'ប្រភេទសំណាក',
- 'table_description' => 'ពិពណ៌នា',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'ប្រភេទសំណាកថ្មី',
- 'form_name' => 'ឈ្មោះ',
- 'form_sort' => 'លេខរៀង',
- 'form_department' => 'ផ្នែកមន្ទីរពិសោធន៌',
- 'form_select_all_department' => 'ជ្រើសរើសផ្នែកមន្ទីរពិសោធន៌ទាំងអស់',
- 'form_edit_tittle' => 'កែប្រែប្រភេទសំណាក',
- 'form_sample_description' => 'ប្រភេទសំណាក',
- 'tube' => 'ប្រភេទទីប',
-
- 'create_success' => 'ប្រភេទសំណាកថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតប្រភេទសំណាកថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានប្រភេទសំណាកកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានប្រភេទសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានប្រភេទសំណាកលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានប្រភេទសំណាកចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានប្រភេទសំណាកស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានប្រភេទសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានប្រភេទសំណាកទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានប្រភេទសំណាកបានទេ។ សូមសាកល្បងម្តងទៀត'
-
-];
diff --git a/lang/kh/sidebar.php b/lang/kh/sidebar.php
index afba6c2..566e98b 100644
--- a/lang/kh/sidebar.php
+++ b/lang/kh/sidebar.php
@@ -28,7 +28,7 @@ return [
'system_role' => 'System Roles',
'change_lab' => 'Change Lab',
'logout' => 'Logout',
- 'clone_lab' => 'Clone Laboratory',
+ 'clone_lab' => 'Clone Organization',
'medicines' => 'Logistics',
'supplier' => 'Supplier',
'medicine_group' => 'Item Group',
diff --git a/lang/kh/test_sample.php b/lang/kh/test_sample.php
deleted file mode 100644
index 538cea2..0000000
--- a/lang/kh/test_sample.php
+++ /dev/null
@@ -1,68 +0,0 @@
- 'តារាងតេស្ត',
- 'search_placeholder' => 'ផ្នែកមន្ទីរពិសោន័ ប្រភេទសំណាក ឬ ឈ្មោះតេស្ត',
- 'table_no' => 'ល.រ',
- 'table_name' => 'ឈ្មោះតេស្ត',
- 'table_department' => 'ផ្នែកមន្ទីរពិសោធន៌',
- 'table_sample_type' => 'ប្រភេទសំណាក',
- 'table_sign' => 'សញ្ញា',
- 'table_group_result' => 'ក្រុមលទ្ធផល',
- 'table_field_type' => 'ប្រភេទទិន្នន័យ',
- 'table_price' => 'តម្លៃ',
- 'table_sort' => 'លេខរៀង',
- 'table_btn_pc' => 'ប្រាក់ចំណែកគ្រូពេទ្យ',
- 'pc_physician' => 'គ្រូពេទ្យ',
- 'pc_rate' => 'ប្រាក់ចំណែក',
- 'pc_btn_apply_all_test' => 'អនុវត្តគ្រប់តេស្តទាំងអស់',
- 'table_status' => 'ស្ថានភាព',
- 'table_action' => 'ប្រតិបត្តិការ',
- 'form_add_tittle' => 'សំណាកតេស្តថ្មី',
- 'form_test_name' => 'ឈ្មោះតេស្ត',
- 'form_unit_sign' => 'ខ្នាតសញ្ញា',
- 'form_field_type' => 'ប្រភេទទិន្នន័យ',
- 'form_edit_tittle' => 'កែប្រែសំណាកតេស្ត',
- 'form_description' => 'ការពណ៌នា',
- 'form_format' => 'កំណត់ទំរង់',
- 'form_ref_range' => 'តម្លៃយោង',
- 'form_ref_min' => 'តម្លៃអបបរិមា',
- 'form_ref_sign' => 'សញ្ញា',
- 'form_ref_max' => 'តម្លៃអតិបរិមា',
- 'form_ref_patient_type' => 'ប្រភេទអ្នកជំងឺ',
- 'form_organism' => 'មេរោគ និង ថ្នាំអង់ទីប៊ីយោទិក',
- 'organism_input_placeholder' => 'ឈ្មោះមេរោគ',
- 'antibiotic_inut_placeholder' => 'ថ្នាំអង់ទីប៊ីយោទិក',
- 'form_organism_selected' => 'បានជ្រើសរើស',
- 'form_formula' => 'រូបមន្ត',
- 'formula_equation' => 'ប្រមាណវិធី',
-
- 'btn_apply_to_all_tests' => 'កំណត់តម្លៃគ្រប់តេស្តទាំងអស់',
- 'code' => 'លេខកូដ',
-
- 'create_success' => 'សំណាកតេស្តថ្មីបង្កើតបានសម្រេច។',
- 'create_fail' => 'មិនអាចបង្កើតសំណាកតេស្តថ្មីបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'update_success' => 'ព័ត៌មានសំណាកតេស្តកែប្រែបានសម្រេច។ ',
- 'update_fail' => 'មិនអាចកែប្រែព័ត៌មានសំណាកតេស្តបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'delete_success' => 'ព័ត៌មានសំណាកតេស្តលុបចេញពីប្រព័ន្ធបានសម្រេច។',
- 'delete_fail' => 'មិនអាចលុបព័ត៌មានសំណាកតេស្តចេញពីប្រព័ន្ធបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'restore_success' => 'ព័ត៌មានសំណាកតេស្តស្តារបានសម្រេច។',
- 'restore_fail' => 'មិនអាចស្តារព័ត៌មានសំណាកតេស្តបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'get_success' => 'ព័ត៌មានសំណាកតេស្តទាញយកបានសម្រេច។',
- 'get_fail' => 'មិនអាចទាញយកព័ត៌មានសំណាកតេស្តបានទេ។ សូមសាកល្បងម្តងទៀត',
-
- 'add_commission_success' => 'ព័ត៌មានប្រាក់ចំណែកគ្រូពេទ្យរក្សាទុកបានសម្រេច។',
- 'add_commission_fail' => 'មិនអាចរក្សាទុកព័ត៌មានប្រាក់ចំណែកគ្រូពេទ្យរក្សាទុកបានទេ។ សូមសាកល្បងម្តងទៀត',
- 'select_organism' => 'ឈ្មោះមេរោគដែលបានជ្រើសរើស',
- 'result_highlight_with_bold_text' => 'បន្លេចអក្សរឌិតនៅលើក្រដាសលទ្ធផល',
- 'auto_suggest_results' => 'ផ្ដល់ជំរើសលទ្ធផលដោយស្វ័យប្រវត្តិ',
-
- 'numeric' => 'លេខ',
- 'calculate' => 'គណនា',
- 'single' => 'ជ្រើសរើសមួយ',
- 'multiple' => 'ពហុជ្រើសរើស',
- 'text' => 'ពហុពាក្យ',
- 'attachment' => 'បញ្ចូលឯកសារ',
- 'heading' => 'រចនាសម្ព័ន្ធតេស្ត'
-
-];
diff --git a/lang/kh/vaccination.php b/lang/kh/vaccination.php
deleted file mode 100644
index bf96561..0000000
--- a/lang/kh/vaccination.php
+++ /dev/null
@@ -1,26 +0,0 @@
-'ថ្ងៃចាក់វ៉ាក់សាំង',
- 'next_visit' =>'ថ្ងៃណាត់ជួបលើកក្រោយ',
- 'name' =>'ឈ្មោះវ៉ាក់សាំង',
- 'unit_price' =>'តម្លៃ/ឯកត្តា',
- 'qty' =>'បរិមាណ',
- 'subtotal' =>'តម្លៃសរុប',
- 'new_title' =>'កត់ត្រាថ្មី',
- 'btn_save' =>'រក្សាទុក',
- 'create_success' =>'ព័ត៌មានវ៉ាក់សាំងរក្សាទុកបានសម្រេច',
- 'create_fail' =>'ព័ត៌មានវ៉ាក់សាំងមិនអាចរក្សាទុកបានទេ',
- 'update_success' =>'ព័ត៌មានវ៉ាក់សាំងកែប្រែបានសម្រេច',
- 'update_fail' =>'ព័ត៌មានវ៉ាក់សាំងមិនអាចកែប្រែបានទេ',
- 'delete_success' =>'ព័ត៌មានវ៉ាក់សាំងលុបបានសម្រេច',
- 'delete_fail' =>'ព័ត៌មានវ៉ាក់សាំងមិនអាចលុបបានទេ',
- 'restore_success' =>'ព័ត៌មានវ៉ាក់សាំងរក្សាទុកបានសម្រេច',
- 'restore_fail' =>'ព័ត៌មានវ៉ាក់សាំងមិនអាចរក្សាទុកបានទេ',
- 'list_title' =>'តារាងចាក់វ៉ាក់សាំង',
-'invoice_title' =>'វិក័យប័ត្រវ៉ាក់សាំង',
- 'edit_title' =>'កែប្រែព័ត៌មានចាក់វ៉ាក់សាំង',
-
-
-];
diff --git a/resources/views/aggregate_report.blade.php b/resources/views/aggregate_report.blade.php
deleted file mode 100644
index df4983e..0000000
--- a/resources/views/aggregate_report.blade.php
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
-
-
-
-
-@include('layout.common_script')
-
-
-
-{{----}}
-
-
-
-
-
diff --git a/resources/views/antibiotic.blade.php b/resources/views/antibiotic.blade.php
deleted file mode 100644
index 4e246a3..0000000
--- a/resources/views/antibiotic.blade.php
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
diff --git a/resources/views/appointment.blade.php b/resources/views/appointment.blade.php
deleted file mode 100644
index 3854bc9..0000000
--- a/resources/views/appointment.blade.php
+++ /dev/null
@@ -1,272 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
diff --git a/resources/views/bacteriology_report.blade.php b/resources/views/bacteriology_report.blade.php
deleted file mode 100644
index 022b138..0000000
--- a/resources/views/bacteriology_report.blade.php
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
- @include('layout.common_script')
-
-
-
-
diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php
index 50e6655..523b78b 100644
--- a/resources/views/base.blade.php
+++ b/resources/views/base.blade.php
@@ -39,7 +39,7 @@
}
.container-box {
- background: #37ff761c;
+ background: #ffffffa1;
border-radius: 15px;
overflow: hidden;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.24);
@@ -160,10 +160,10 @@
-
diff --git a/resources/views/clone_lab.blade.php b/resources/views/clone_lab.blade.php
deleted file mode 100644
index 8126ec6..0000000
--- a/resources/views/clone_lab.blade.php
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
- @include('layout.common_script')
-
-
-
-
-
-
-
diff --git a/resources/views/comment.blade.php b/resources/views/comment.blade.php
deleted file mode 100644
index 3083982..0000000
--- a/resources/views/comment.blade.php
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php
deleted file mode 100644
index 1121504..0000000
--- a/resources/views/dashboard.blade.php
+++ /dev/null
@@ -1,532 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
-@include('layout.common_script')
-
-
-{{-- --}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/resources/views/department.blade.php b/resources/views/department.blade.php
deleted file mode 100644
index 0639412..0000000
--- a/resources/views/department.blade.php
+++ /dev/null
@@ -1,164 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
-
diff --git a/resources/views/doctor_report.blade.php b/resources/views/doctor_report.blade.php
deleted file mode 100644
index 31b82ff..0000000
--- a/resources/views/doctor_report.blade.php
+++ /dev/null
@@ -1,207 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
-
-
-
-
-
-
-
-@include('layout.common_script')
-
-
-
-{{----}}
-
-
-
-
-
diff --git a/resources/views/edit_vaccination.blade.php b/resources/views/edit_vaccination.blade.php
deleted file mode 100644
index 054e123..0000000
--- a/resources/views/edit_vaccination.blade.php
+++ /dev/null
@@ -1,633 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/resources/views/expired_item.blade.php b/resources/views/expired_item.blade.php
deleted file mode 100644
index 048a19c..0000000
--- a/resources/views/expired_item.blade.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
- @include('layout.common_script')
-
-
-
-
diff --git a/resources/views/financial_report.blade.php b/resources/views/financial_report.blade.php
deleted file mode 100644
index b47d52b..0000000
--- a/resources/views/financial_report.blade.php
+++ /dev/null
@@ -1,256 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
-
-
-
-
-
-
-@include('layout.common_script')
-
-
-
-{{----}}
-
-
-
-
-
diff --git a/resources/views/individual_report.blade.php b/resources/views/individual_report.blade.php
deleted file mode 100644
index 9417824..0000000
--- a/resources/views/individual_report.blade.php
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
- @include('layout.common_script')
-
-
-
-
diff --git a/resources/views/inventory.blade.php b/resources/views/inventory.blade.php
deleted file mode 100644
index f2b8fb5..0000000
--- a/resources/views/inventory.blade.php
+++ /dev/null
@@ -1,203 +0,0 @@
-'
-
-
- @include('layout.header')
-
-
-
-
-
-
-
-
-
-@include('layout.common_script')
-
-
-
-
-
-
-
-
diff --git a/resources/views/invoice_list.blade.php b/resources/views/invoice_list.blade.php
deleted file mode 100644
index 89da05f..0000000
--- a/resources/views/invoice_list.blade.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- @include('layout.header')
-
-
-
-
- @include('layout.common_script')
-
-
-
-
diff --git a/resources/views/laboratory.blade.php b/resources/views/laboratory.blade.php
index 4531aa8..ed787db 100644
--- a/resources/views/laboratory.blade.php
+++ b/resources/views/laboratory.blade.php
@@ -1,16 +1,7 @@
-
-
@include('layout.header')
-
@@ -33,730 +24,281 @@
-
+
-
{{__('general.laboratory_settings')}}
-
-
-
{{__('general.general_settings')}}
-
-
-
-
{{__('lab_profile.sample_numner_conf')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.patient_numner_conf')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.based_currency')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.type_of_discount_conf')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.exchange_rate')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
+
{{__('laboratory.table_title')}}
+
+
-
-
-
-
{{__('sidebar.invoice')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
{{__('invoice.form_btn_generate_invoice')}}
-
-
-
-
-
-
-
-
{{__('lab_profile.invoice_template')}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{__('general.result_settings')}}
-
- @php
- $configures = collect($info->labConfigures);
-
- $fontNameHeader = ($configures->where('atrribute_code', 'FONT_NAME_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
- $fontSizeHeader = ($configures->where('atrribute_code', 'FONT_SIZE_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
- $resultColorHeader = ($configures->where('atrribute_code', 'COLOR_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
-
- $fontName = ($configures->where('atrribute_code', 'FONT_NAME_FOR_RESULT')->pluck('assigned_attribute_value')->first());
- $fontSize = ($configures->where('atrribute_code', 'FONT_SIZE_FOR_RESULT')->pluck('assigned_attribute_value')->first());
- $resultColor = ($configures->where('atrribute_code', 'COLOR_FOR_RESULT')->pluck('assigned_attribute_value')->first());
- $lineHeight = ($configures->where('atrribute_code', 'LINE_HEIGHT_FOR_RESULT_HEADER')->pluck('assigned_attribute_value')->first());
-
- $resultTemplateId = ($configures->where('atrribute_code', 'RESULT_TEMPLATE')->pluck('assigned_attribute_value')->first());
-
- @endphp
-
-
-
-
-
{{__('lab_profile.header_font_name')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
{{__('lab_profile.header_font_size')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.body_font_name')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.body_font_size')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
-
-
-
-
-
{{__('lab_profile.abnormal_result')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
-
-
-
-
{{__('lab_profile.font_weight')}}
-
-
-
-
-
-
-
{{__('lab_profile.text_color')}}
-
-
-
-
-
-
-
{{__('lab_profile.verify_label')}}
- @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['update_laboratory_information']))
-
- @endif
-
-
-
 ? url(env()
verify_label) :''}}">
-
-
+
+
+
+
+
-
-
-
@include('layout.footer')
-
@include('layout.common_script')
-
-
-
-
+
+