feat: initialize Dr-Panel project with patient file number support
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
protected static ?string $password;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('username')->unique();
|
||||
$table->string('email')->unique()->nullable();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue');
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
|
||||
$table->index(['queue', 'reserved_at', 'available_at']);
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), Exception::class, 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
|
||||
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id');
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id')
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id')
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id')
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id')
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('imports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_name');
|
||||
$table->string('file_path');
|
||||
$table->string('importer');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('imports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('exports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_disk');
|
||||
$table->string('file_name')->nullable();
|
||||
$table->string('exporter');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('exports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_import_rows', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->json('data');
|
||||
$table->foreignId('import_id')->constrained()->cascadeOnDelete();
|
||||
$table->text('validation_error')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_import_rows');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('doctors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('first_name', 50);
|
||||
$table->string('last_name', 50);
|
||||
$table->string('speciality', 100)->nullable();
|
||||
$table->string('license_id', 50)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('doctors');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payment_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('payment_type', 50);
|
||||
$table->string('account_no', 50)->nullable();
|
||||
$table->string('pos_no', 50)->nullable();
|
||||
$table->mediumText('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('patient_illness', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('illness', 200);
|
||||
$table->tinyInteger('row_no')->nullable();
|
||||
$table->tinyInteger('priority')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('patient_illness');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('treatments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('treatment_type', 50)->nullable();
|
||||
$table->string('treatment_name', 50)->nullable();
|
||||
$table->mediumText('descriptions')->nullable();
|
||||
$table->integer('treatment_cost')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('treatments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('surgery_centers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255);
|
||||
$table->text('address')->nullable();
|
||||
$table->string('phone', 50)->default('0');
|
||||
$table->string('email', 100)->nullable();
|
||||
$table->string('contact_person', 100)->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('surgery_centers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('patients', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('icno', 11)->index();
|
||||
$table->string('first_name', 50)->nullable();
|
||||
$table->string('last_name', 50)->nullable();
|
||||
$table->string('father_name', 50)->nullable();
|
||||
$table->string('gender', 50)->nullable();
|
||||
$table->string('birth_date', 50)->nullable();
|
||||
$table->integer('age')->nullable();
|
||||
$table->string('marital_status', 50)->nullable();
|
||||
$table->string('education', 50)->nullable();
|
||||
$table->string('job', 50)->nullable();
|
||||
$table->string('hand_phone', 50)->nullable();
|
||||
$table->string('home_phone', 50)->nullable();
|
||||
$table->string('work_phone', 50)->nullable();
|
||||
$table->string('other_phone', 50)->nullable();
|
||||
$table->mediumText('home_address')->nullable();
|
||||
$table->mediumText('work_address')->nullable();
|
||||
$table->string('refered_by', 50)->nullable();
|
||||
$table->mediumText('referal_reason')->nullable();
|
||||
$table->string('doc_id', 50)->nullable();
|
||||
$table->string('insurance', 50)->nullable();
|
||||
$table->string('insurance_no', 50)->nullable();
|
||||
$table->integer('blood_pressure')->nullable();
|
||||
$table->integer('blood_sugar')->nullable();
|
||||
$table->string('current_illness_1', 50)->nullable();
|
||||
$table->string('current_illness_2', 50)->nullable();
|
||||
$table->string('is_undercare', 50)->nullable();
|
||||
$table->string('undercare_reason', 50)->nullable();
|
||||
$table->string('is_usingdrug', 50)->nullable();
|
||||
$table->string('underdrug_reason', 50)->nullable();
|
||||
$table->string('has_alergyto', 50)->nullable();
|
||||
$table->string('alergy_reason', 50)->nullable();
|
||||
$table->string('description', 50)->nullable();
|
||||
$table->boolean('has_surgery_appointment')->default(false);
|
||||
$table->mediumText('surgery_before')->nullable();
|
||||
$table->mediumText('sergery_after')->nullable();
|
||||
$table->mediumText('photos_before')->nullable();
|
||||
$table->mediumText('photos_after')->nullable();
|
||||
$table->mediumText('videos')->nullable();
|
||||
$table->mediumText('audio_files')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('patients');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('created_by')->nullable()->after('audio_files');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->after('created_by');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->dropColumn(['created_by', 'updated_by']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->json('current_illness_1')->nullable()->change();
|
||||
$table->json('current_illness_2')->nullable()->change();
|
||||
$table->json('has_alergyto')->nullable()->change();
|
||||
$table->text('description')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->string('current_illness_1', 50)->nullable()->change();
|
||||
$table->string('current_illness_2', 50)->nullable()->change();
|
||||
$table->string('has_alergyto', 50)->nullable()->change();
|
||||
$table->string('description', 50)->nullable()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('medications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->comment('نام دارو');
|
||||
$table->string('dosage_form', 50)->nullable()->comment('شکل دارویی (Tab, Cap, Amp, Drop, Serum, Cream, ...)');
|
||||
$table->string('strength', 100)->nullable()->comment('دوز (مثلاً 500mg, 5mg/5ml)');
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->string('timing', 100)->nullable()->comment('زمان مصرف (مثلاً q8h, q12h)');
|
||||
$table->text('notes')->nullable()->comment('یادداشتها');
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->boolean('is_active')->default(true)->comment('فعال/غیرفعال');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('medications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sync_log', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamp('datetime')->useCurrent();
|
||||
$table->string('ip', 50)->nullable();
|
||||
$table->string('user', 100)->nullable();
|
||||
$table->string('table_name', 100);
|
||||
$table->string('action', 20);
|
||||
$table->unsignedBigInteger('record_id')->nullable();
|
||||
$table->json('changed_data')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sync_log');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('osurg_initials', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('init_parameter', 50)->unique();
|
||||
$table->string('init_value', 50)->nullable();
|
||||
$table->mediumText('attachment')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('osurg_initials');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('prescriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('patient')->nullable()->comment('شناسه بیمار');
|
||||
$table->string('issue_date', 50)->nullable()->comment('تاریخ صدور (شمسی)');
|
||||
$table->dateTime('issue_datetime')->nullable()->comment('تاریخ و ساعت صدور');
|
||||
$table->string('doctor', 50)->nullable()->comment('نام پزشک');
|
||||
$table->mediumText('content')->nullable()->comment('محتوای نسخه');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('prescriptions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('surgery_appointments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('patient_id')->constrained('patients')->cascadeOnDelete();
|
||||
$table->dateTime('surgery_date');
|
||||
$table->foreignId('surgery_center_id')->nullable()->constrained('surgery_centers')->nullOnDelete();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('patient_id');
|
||||
$table->index('surgery_center_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('surgery_appointments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('created_by')->nullable()->after('content');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->after('created_by');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->dropColumn(['created_by', 'updated_by']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->dropColumn('has_surgery_appointment');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->boolean('has_surgery_appointment')->default(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->json('medication_ids')->nullable()->after('doctor')->comment('شناسه داروهای انتخابشده');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->dropColumn('medication_ids');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('visits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('patient')->nullable()->comment('شناسه بیمار');
|
||||
$table->string('visit_date', 50)->nullable()->comment('تاریخ ویزیت (شمسی)');
|
||||
$table->string('visit_time', 50)->nullable()->comment('ساعت ویزیت');
|
||||
$table->unsignedBigInteger('treatment')->nullable()->comment('شناسه نوع درمان');
|
||||
$table->unsignedInteger('treatment_cost')->nullable()->comment('هزینه درمان');
|
||||
$table->unsignedBigInteger('payment_type')->nullable()->comment('شناسه روش پرداخت');
|
||||
$table->unsignedInteger('paid_amount')->nullable()->comment('مبلغ پرداخت شده');
|
||||
$table->tinyInteger('pos_ul')->nullable()->comment('موقعیت دندان: بالا چپ');
|
||||
$table->tinyInteger('pos_ll')->nullable()->comment('موقعیت دندان: پایین چپ');
|
||||
$table->tinyInteger('pos_ur')->nullable()->comment('موقعیت دندان: بالا راست');
|
||||
$table->tinyInteger('pos_lr')->nullable()->comment('موقعیت دندان: پایین راست');
|
||||
$table->mediumText('treatment_description')->nullable()->comment('شرح درمان');
|
||||
$table->unsignedBigInteger('doctor')->nullable()->comment('شناسه پزشک');
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('visits');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('doctors', function (Blueprint $table) {
|
||||
$table->boolean('is_default')->default(false)->after('license_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('doctors', function (Blueprint $table) {
|
||||
$table->dropColumn('is_default');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('lab_tests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 255)->comment('نام آزمایش');
|
||||
$table->string('category', 100)->nullable()->comment('دستهبندی (مثلاً هماتولوژی، بیوشیمی، سرولوژی)');
|
||||
$table->text('notes')->nullable()->comment('یادداشتها');
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->boolean('is_active')->default(true)->comment('فعال/غیرفعال');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('lab_tests');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->json('lab_test_ids')->nullable()->after('medication_ids')->comment('آرایه شناسههای آزمایشهای انتخابشده');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->dropColumn('lab_test_ids');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('lab_tests', function (Blueprint $table) {
|
||||
$table->dropColumn('category');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('lab_tests', function (Blueprint $table) {
|
||||
$table->string('category', 100)->nullable()->after('name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->mediumText('lab_content')->nullable()->after('content')->comment('متن درخواست آزمایش');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('prescriptions', function (Blueprint $table) {
|
||||
$table->dropColumn('lab_content');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->unsignedInteger('file_number')->nullable()->unique()->after('id');
|
||||
});
|
||||
|
||||
$patients = DB::table('patients')->orderBy('id')->get(['id']);
|
||||
$counter = 100;
|
||||
foreach ($patients as $patient) {
|
||||
DB::table('patients')->where('id', $patient->id)->update(['file_number' => $counter++]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('patients', function (Blueprint $table) {
|
||||
$table->dropColumn('file_number');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
use WithoutModelEvents;
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
DoctorSeeder::class,
|
||||
PaymentTypeSeeder::class,
|
||||
PatientIllnessSeeder::class,
|
||||
TreatmentSeeder::class,
|
||||
SurgeryCenterSeeder::class,
|
||||
MedicationSeeder::class,
|
||||
LabTestSeeder::class,
|
||||
OsurgInitialSeeder::class,
|
||||
RolePermissionSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Doctor;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DoctorSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$doctors = [
|
||||
[
|
||||
'first_name' => 'مسعود',
|
||||
'last_name' => 'شایگان',
|
||||
'speciality' => 'متخصص جراحی فک و صورت',
|
||||
'license_id' => '126900',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($doctors as $doctor) {
|
||||
Doctor::firstOrCreate(
|
||||
['license_id' => $doctor['license_id']],
|
||||
$doctor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\LabTest;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LabTestSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tests = [
|
||||
'CBC',
|
||||
'PT/PTT/INR',
|
||||
'BS',
|
||||
'HIV/Ab',
|
||||
'HBS/Ag',
|
||||
'Hcv/Ab',
|
||||
];
|
||||
|
||||
foreach ($tests as $name) {
|
||||
LabTest::firstOrCreate(
|
||||
['name' => $name],
|
||||
['is_default' => true, 'is_active' => true],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Medication;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MedicationSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$medications = [
|
||||
['name' => 'Cephalexin', 'dosage_form' => 'Cap', 'strength' => '500mg', 'quantity' => 20, 'timing' => 'q8h', 'notes' => '', 'is_default' => true, 'is_active' => true],
|
||||
['name' => 'Brozyne Ultra', 'dosage_form' => 'Cap', 'strength' => '8mg', 'quantity' => 11, 'timing' => 'q12h', 'notes' => '', 'is_default' => true, 'is_active' => true],
|
||||
['name' => 'Acetaminophen', 'dosage_form' => 'Tab', 'strength' => '#20', 'quantity' => null, 'timing' => '8h', 'notes' => '', 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'Cetirizin', 'dosage_form' => 'Tab', 'strength' => '#20', 'quantity' => null, 'timing' => '12h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'Serum', 'dosage_form' => 'Serum', 'strength' => 'N/S', 'quantity' => null, 'timing' => '11h', 'notes' => '', 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'Pedia', 'dosage_form' => 'Amp', 'strength' => '8mg', 'quantity' => null, 'timing' => '10h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'Phenyle Phrine', 'dosage_form' => 'Nasal Drop', 'strength' => '#1', 'quantity' => null, 'timing' => '8h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'Sodium Chloride', 'dosage_form' => 'Nasal Drop', 'strength' => '#1', 'quantity' => null, 'timing' => '8h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'آموکسیسیلین', 'dosage_form' => 'Cap', 'strength' => '500mg', 'quantity' => null, 'timing' => '8h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'متروندیازول', 'dosage_form' => 'Tab', 'strength' => '250mg', 'quantity' => null, 'timing' => '8h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'ایبوپروفن', 'dosage_form' => 'Tab', 'strength' => '400mg', 'quantity' => null, 'timing' => '8h', 'notes' => '', 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'دیکلوفناک', 'dosage_form' => 'Tab', 'strength' => '50mg', 'quantity' => null, 'timing' => '12h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'پردنیزولون', 'dosage_form' => 'Tab', 'strength' => '5mg', 'quantity' => null, 'timing' => '8&12h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'اومپرازول', 'dosage_form' => 'Cap', 'strength' => '20mg', 'quantity' => null, 'timing' => '24h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
['name' => 'ویتامین C', 'dosage_form' => 'Tab', 'strength' => '500mg', 'quantity' => null, 'timing' => '12h', 'notes' => null, 'is_default' => false, 'is_active' => true],
|
||||
];
|
||||
|
||||
foreach ($medications as $item) {
|
||||
Medication::firstOrCreate(
|
||||
['name' => $item['name'], 'dosage_form' => $item['dosage_form']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\OsurgInitial;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class OsurgInitialSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$initials = [
|
||||
[
|
||||
'init_parameter' => 'login_bg.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/login_bg.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'list_bg.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/list_bg.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'listlogo_per.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/listlogo_per.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'listlogo_eng.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/listlogo_eng.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'loginlogo_per.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/loginlogo_per.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'loginlogo_eng.png',
|
||||
'init_value' => null,
|
||||
'attachment' => 'initials/loginlogo_eng.png',
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sync_peer_ip',
|
||||
'init_value' => '192.168.1.XX',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sync_peer_port',
|
||||
'init_value' => '8000',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sync_token',
|
||||
'init_value' => 'change-this-to-a-secret-token',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sms_api_url',
|
||||
'init_value' => 'http://94.101.184.91/api/sms',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sms_api_key',
|
||||
'init_value' => 'surgery-sms-2024',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'ftp_user',
|
||||
'init_value' => 'root',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'ftp_pass',
|
||||
'init_value' => 'Mjoshanitcm7717',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'ftp_port',
|
||||
'init_value' => '2121',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'ftp_remote_path',
|
||||
'init_value' => '/',
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'sync_peer_cursor',
|
||||
'init_value' => null,
|
||||
'attachment' => null,
|
||||
],
|
||||
[
|
||||
'init_parameter' => 'our_sync_cursor',
|
||||
'init_value' => null,
|
||||
'attachment' => null,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($initials as $item) {
|
||||
OsurgInitial::firstOrCreate(
|
||||
['init_parameter' => $item['init_parameter']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\PatientIllness;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PatientIllnessSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$illnesses = [
|
||||
['illness' => 'بیماری کبدی یا هپاتیت', 'row_no' => 2, 'priority' => 4],
|
||||
['illness' => 'اعتیاد به مواد مخدر', 'row_no' => 2, 'priority' => 3],
|
||||
['illness' => 'سابقه سکته', 'row_no' => 2, 'priority' => 2],
|
||||
['illness' => 'سابقه ضربه به فک و مفصل گیجگاهی فکی', 'row_no' => 2, 'priority' => 1],
|
||||
['illness' => 'ضایعات مادرزادی قلبی', 'row_no' => 1, 'priority' => 8],
|
||||
['illness' => 'رماتیسم قلبی یا ضایعات دریچه ای قلبی', 'row_no' => 1, 'priority' => 7],
|
||||
['illness' => 'دیابت (قند خون)', 'row_no' => 1, 'priority' => 6],
|
||||
['illness' => 'بیماری تنفسی یا آسم', 'row_no' => 1, 'priority' => 5],
|
||||
['illness' => 'بیماری کلیوی', 'row_no' => 1, 'priority' => 4],
|
||||
['illness' => 'بیماری عصبی یا صرع', 'row_no' => 1, 'priority' => 3],
|
||||
['illness' => 'فشار خون بالا', 'row_no' => 1, 'priority' => 2],
|
||||
['illness' => 'بیماری قلبی و عروقی', 'row_no' => 1, 'priority' => 1],
|
||||
['illness' => 'ایدز', 'row_no' => 2, 'priority' => 8],
|
||||
['illness' => 'سابقه عمل جراحی', 'row_no' => 2, 'priority' => 7],
|
||||
['illness' => 'اختلالات خونریزی دهنده و هموفیلی', 'row_no' => 2, 'priority' => 6],
|
||||
['illness' => 'بیماری غددی و تیروئید، پانکراس', 'row_no' => 2, 'priority' => 5],
|
||||
['illness' => 'الرژی', 'row_no' => 1, 'priority' => 1],
|
||||
];
|
||||
|
||||
foreach ($illnesses as $item) {
|
||||
PatientIllness::firstOrCreate(
|
||||
['illness' => $item['illness']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PaymentTypeSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$paymentTypes = [
|
||||
['payment_type' => 'بانک ملت', 'account_no' => '222', 'pos_no' => null, 'description' => null],
|
||||
['payment_type' => 'بانک سامان', 'account_no' => '111', 'pos_no' => null, 'description' => null],
|
||||
['payment_type' => 'پرداخت نقدی', 'account_no' => null, 'pos_no' => null, 'description' => null],
|
||||
['payment_type' => 'بانک صادرات', 'account_no' => null, 'pos_no' => null, 'description' => null],
|
||||
['payment_type' => 'کارت به کارت بانکی', 'account_no' => '123', 'pos_no' => '456', 'description' => null],
|
||||
['payment_type' => 'نقد و کارت', 'account_no' => null, 'pos_no' => null, 'description' => null],
|
||||
['payment_type' => 'توسعه عصر', 'account_no' => null, 'pos_no' => null, 'description' => null],
|
||||
];
|
||||
|
||||
foreach ($paymentTypes as $item) {
|
||||
PaymentType::firstOrCreate(
|
||||
['payment_type' => $item['payment_type']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RolePermissionSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
$resources = [
|
||||
'user',
|
||||
'role',
|
||||
'doctor',
|
||||
'patient',
|
||||
'visit',
|
||||
'prescription',
|
||||
'medication',
|
||||
'treatment',
|
||||
'payment_type',
|
||||
'patient_illness',
|
||||
'surgery_center',
|
||||
'surgery_appointment',
|
||||
'osurg_initial',
|
||||
'osurg_audit',
|
||||
'lab_test',
|
||||
];
|
||||
|
||||
$actions = ['view_any', 'view', 'create', 'update', 'delete', 'delete_any', 'restore', 'restore_any', 'replicate', 'reorder', 'force_delete', 'force_delete_any'];
|
||||
|
||||
$pages = ['page_dashboard', 'page_sync_page', 'page_sms_logs_page'];
|
||||
|
||||
foreach ($resources as $resource) {
|
||||
foreach ($actions as $action) {
|
||||
Permission::firstOrCreate([
|
||||
'name' => "{$action}_{$resource}",
|
||||
'guard_name' => 'web',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pages as $page) {
|
||||
Permission::firstOrCreate([
|
||||
'name' => $page,
|
||||
'guard_name' => 'web',
|
||||
]);
|
||||
}
|
||||
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
$superAdmin = Role::firstOrCreate(['name' => 'super_admin', 'guard_name' => 'web']);
|
||||
$superAdmin->syncPermissions(Permission::all());
|
||||
|
||||
Role::firstOrCreate(['name' => 'panel_user', 'guard_name' => 'web']);
|
||||
|
||||
$admin = User::where('username', 'admin')->first();
|
||||
if ($admin) {
|
||||
$admin->syncRoles(['super_admin']);
|
||||
$this->command->info("super_admin role assigned to user: {$admin->name}");
|
||||
} else {
|
||||
$this->command->warn('Admin user not found!');
|
||||
}
|
||||
|
||||
$this->command->info('Roles and permissions seeded successfully.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\SurgeryCenter;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SurgeryCenterSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$centers = [
|
||||
[
|
||||
'name' => 'کلینیک پارس',
|
||||
'address' => 'مازندران، ساری، میدان امام، مجتمع برلیان',
|
||||
'phone' => '9122283482',
|
||||
'email' => null,
|
||||
'contact_person' => 'دکتر شایگان',
|
||||
'description' => null,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($centers as $item) {
|
||||
SurgeryCenter::firstOrCreate(
|
||||
['name' => $item['name']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Treatment;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class TreatmentSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$treatments = [
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'دندان', 'descriptions' => null, 'treatment_cost' => 0],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'ویزیت', 'descriptions' => null, 'treatment_cost' => 300000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'بررسی وضعیت بیمار', 'descriptions' => null, 'treatment_cost' => 0],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'تزریق ژل', 'descriptions' => null, 'treatment_cost' => null],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'تزریق تریامیسنولون', 'descriptions' => null, 'treatment_cost' => null],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'خارج کردن اسپلینت ها و بخیه', 'descriptions' => null, 'treatment_cost' => 300000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'تعویض چسب', 'descriptions' => null, 'treatment_cost' => 150000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'مشاوره', 'descriptions' => null, 'treatment_cost' => 300000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'کشیدن تامپون', 'descriptions' => null, 'treatment_cost' => 300000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'ودیعه', 'descriptions' => null, 'treatment_cost' => 1000000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'بوتاکس', 'descriptions' => null, 'treatment_cost' => null],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'مزوتراپی', 'descriptions' => null, 'treatment_cost' => null],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'چک کردن', 'descriptions' => null, 'treatment_cost' => 150000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'جراحی سرپایی', 'descriptions' => null, 'treatment_cost' => null],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'چسب سفید', 'descriptions' => null, 'treatment_cost' => 200000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'چسب کرم', 'descriptions' => null, 'treatment_cost' => 250000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'کشیدن بخیه', 'descriptions' => null, 'treatment_cost' => 150000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'نوزونت تیوبی', 'descriptions' => null, 'treatment_cost' => 500000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'نوستریل ریتینر', 'descriptions' => null, 'treatment_cost' => 1500000],
|
||||
['treatment_type' => 'ویزیت', 'treatment_name' => 'نوزونت مخروطی', 'descriptions' => null, 'treatment_cost' => 500000],
|
||||
];
|
||||
|
||||
foreach ($treatments as $item) {
|
||||
Treatment::firstOrCreate(
|
||||
['treatment_name' => $item['treatment_name']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$users = [
|
||||
[
|
||||
'name' => 'مدیر برنامه',
|
||||
'username' => 'admin',
|
||||
'email' => null,
|
||||
'password' => Hash::make('nn'),
|
||||
],
|
||||
[
|
||||
'name' => 'مسعود شایگان',
|
||||
'username' => 'shaygan',
|
||||
'email' => null,
|
||||
'password' => Hash::make('nn'),
|
||||
],
|
||||
[
|
||||
'name' => 'امامی',
|
||||
'username' => '09120861101',
|
||||
'email' => null,
|
||||
'password' => Hash::make('09120861101'),
|
||||
],
|
||||
[
|
||||
'name' => 'رمضانی',
|
||||
'username' => '09365233699',
|
||||
'email' => null,
|
||||
'password' => Hash::make('09365233699'),
|
||||
],
|
||||
[
|
||||
'name' => 'رضایی',
|
||||
'username' => '09118989216',
|
||||
'email' => null,
|
||||
'password' => Hash::make('09118989216'),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($users as $data) {
|
||||
User::updateOrCreate(
|
||||
['username' => $data['username']],
|
||||
$data
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user