first commit

This commit is contained in:
brusnitsyn
2025-11-30 23:04:45 +09:00
commit c9a392f84f
76 changed files with 15085 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use App\Http\Resources\SI\SttMedicalHistoryResource;
use App\Models\SI\SttMedicalHistory;
use Illuminate\Http\Request;
use Inertia\Inertia;
class IndexController extends Controller
{
public function index(Request $request)
{
$pageSize = $request->get('pageSize', 15);
$cards = SttMedicalHistory::query();
$cards = SttMedicalHistoryResource::collection($cards->paginate($pageSize));
return Inertia::render('Home/Index', [
'cards' => $cards,
]);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{
/**
* The root template that's loaded on the first page visit.
*
* @see https://inertiajs.com/server-side-setup#root-template
*
* @var string
*/
protected $rootView = 'app';
/**
* Determines the current asset version.
*
* @see https://inertiajs.com/asset-versioning
*/
public function version(Request $request): ?string
{
return parent::version($request);
}
/**
* Define the props that are shared by default.
*
* @see https://inertiajs.com/shared-data
*
* @return array<string, mixed>
*/
public function share(Request $request): array
{
return [
...parent::share($request),
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Resources\SI;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Carbon;
class SttMedicalHistoryResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'fullname' => $this->getFullNameAttribute(),
'mpostdate' => Carbon::parse($this->mpostdate)->format('d.m.Y'),
'menddate' => Carbon::parse($this->menddate)->format('d.m.Y'),
'narhiv' => $this->narhiv,
'datearhiv' => Carbon::parse($this->datearhiv)->format('d.m.Y'),
'statgod' => $this->statgod,
'enp' => $this->enp,
'nkarta' => $this->nkarta,
'dr' => Carbon::parse($this->dr)->format('d.m.Y'),
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ArchiveHistory extends Model
{
protected $fillable = [
'historyable_type',
'historyable_id',
'issue_at',
'return_at',
'name_org',
'employee_name',
'employee_position',
];
public function historyable()
{
return $this->morphTo();
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models\SI;
use App\Models\ArchiveHistory;
use Illuminate\Database\Eloquent\Model;
class SttMedicalHistory extends Model
{
protected $table = 'si_stt_patients';
protected $fillable = [
'fam', // Фамилия
'im', // Имя
'ot', // Отчество
'mpostdate', // Д. пост.
'menddate', // Д. вып.
'narhiv', // № в архиве
'datearhiv', // Д. архив
'statgod', // Год нахождения в стационаре
'enp', // ЕНП
'nkarta', // № карты
'dr', // ДР
];
public function getFullNameAttribute()
{
return "$this->fam $this->im $this->ot";
}
public function getArchiveHistory()
{
return $this->morphMany(ArchiveHistory::class, 'historyable');
}
}

48
app/Models/User.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}