diff --git a/app/Http/Controllers/ArchiveHistoryController.php b/app/Http/Controllers/ArchiveHistoryController.php
new file mode 100644
index 0000000..07ac590
--- /dev/null
+++ b/app/Http/Controllers/ArchiveHistoryController.php
@@ -0,0 +1,21 @@
+json($archiveHistory);
+ }
+}
diff --git a/app/Http/Controllers/MedicalHistoryController.php b/app/Http/Controllers/MedicalHistoryController.php
index a23fced..82512f5 100644
--- a/app/Http/Controllers/MedicalHistoryController.php
+++ b/app/Http/Controllers/MedicalHistoryController.php
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
+use App\Http\Resources\ArchiveHistoryResource;
use App\Models\SI\SttMedicalHistory;
use Illuminate\Http\Request;
@@ -15,11 +16,13 @@ class MedicalHistoryController extends Controller
$patientInfo = null;
if ($viewType == 'si') {
$patient = SttMedicalHistory::where('id', $id)->first();
- $archiveJournal = $patient->archiveHistory;
+ $archiveJournal = ArchiveHistoryResource::collection($patient->archiveHistory);
+ $archiveInfo = $patient->archiveInfo;
$patientInfo = [
'info' => $patient,
'journal' => $archiveJournal,
+ 'archiveInfo' => $archiveInfo,
];
}
diff --git a/app/Http/Controllers/OrgController.php b/app/Http/Controllers/OrgController.php
new file mode 100644
index 0000000..2ced191
--- /dev/null
+++ b/app/Http/Controllers/OrgController.php
@@ -0,0 +1,16 @@
+json($orgs);
+ }
+}
diff --git a/app/Http/Resources/ArchiveHistoryResource.php b/app/Http/Resources/ArchiveHistoryResource.php
new file mode 100644
index 0000000..63c6042
--- /dev/null
+++ b/app/Http/Resources/ArchiveHistoryResource.php
@@ -0,0 +1,30 @@
+
+ */
+ public function toArray(Request $request): array
+ {
+ return [
+ 'id' => $this->id,
+ 'issue_at' => Carbon::parse($this->issue_at)->format('d.m.Y'),
+ 'return_at' => Carbon::parse($this->return_at)->format('d.m.Y'),
+ 'comment' => $this->comment,
+ 'org_id' => $this->org_id,
+ 'org' => $this->org->name,
+ 'employee_name' => $this->employee_name,
+ 'employee_post' => $this->employee_post,
+ 'has_lost' => $this->has_lost,
+ ];
+ }
+}
diff --git a/app/Models/ArchiveHistory.php b/app/Models/ArchiveHistory.php
index d4aa79d..e08605e 100644
--- a/app/Models/ArchiveHistory.php
+++ b/app/Models/ArchiveHistory.php
@@ -22,4 +22,9 @@ class ArchiveHistory extends Model
{
return $this->morphTo();
}
+
+ public function org(): \Illuminate\Database\Eloquent\Relations\BelongsTo
+ {
+ return $this->belongsTo(Org::class);
+ }
}
diff --git a/app/Models/ArchiveInfo.php b/app/Models/ArchiveInfo.php
new file mode 100644
index 0000000..d660e0b
--- /dev/null
+++ b/app/Models/ArchiveInfo.php
@@ -0,0 +1,21 @@
+morphTo();
+ }
+}
diff --git a/app/Models/ArchiveStatus.php b/app/Models/ArchiveStatus.php
new file mode 100644
index 0000000..2edf9ee
--- /dev/null
+++ b/app/Models/ArchiveStatus.php
@@ -0,0 +1,16 @@
+morphMany(ArchiveHistory::class, 'historyable');
}
+ public function archiveInfo()
+ {
+ return $this->morphOne(ArchiveInfo::class, 'historyable');
+ }
+
public function scopeSearch($query, $searchText)
{
return $query->where(function($q) use ($searchText) {
diff --git a/database/migrations/2025_12_05_021415_add_code_column_in_orgs_table.php b/database/migrations/2025_12_05_021415_add_code_column_in_orgs_table.php
new file mode 100644
index 0000000..3a16b6d
--- /dev/null
+++ b/database/migrations/2025_12_05_021415_add_code_column_in_orgs_table.php
@@ -0,0 +1,28 @@
+string('code')->after('id');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('orgs', function (Blueprint $table) {
+ $table->dropColumn('code');
+ });
+ }
+};
diff --git a/database/migrations/2025_12_05_030600_create_archive_statuses_table.php b/database/migrations/2025_12_05_030600_create_archive_statuses_table.php
new file mode 100644
index 0000000..94e3167
--- /dev/null
+++ b/database/migrations/2025_12_05_030600_create_archive_statuses_table.php
@@ -0,0 +1,29 @@
+id();
+ $table->string('text');
+ $table->string('variant');
+ $table->boolean('has_user_set')->default(false);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('archive_statuses');
+ }
+};
diff --git a/database/migrations/2025_12_05_030609_create_archive_infos_table.php b/database/migrations/2025_12_05_030609_create_archive_infos_table.php
new file mode 100644
index 0000000..71122f0
--- /dev/null
+++ b/database/migrations/2025_12_05_030609_create_archive_infos_table.php
@@ -0,0 +1,31 @@
+id();
+ $table->morphs('historyable');
+ $table->string('num');
+ $table->date('post_in');
+ $table->foreignIdFor(\App\Models\ArchiveStatus::class, 'status_id')->default(1);
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('archive_infos');
+ }
+};
diff --git a/database/seeders/ArchiveStatusSeeder.php b/database/seeders/ArchiveStatusSeeder.php
new file mode 100644
index 0000000..9525fb6
--- /dev/null
+++ b/database/seeders/ArchiveStatusSeeder.php
@@ -0,0 +1,31 @@
+ 'Не определен',
+ 'variant' => 'default'
+ ]);
+
+ ArchiveStatus::create([
+ 'text' => 'В архиве',
+ 'variant' => 'success'
+ ]);
+
+ ArchiveStatus::create([
+ 'text' => 'Выдана',
+ 'variant' => 'warning'
+ ]);
+ }
+}
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 6b901f8..21c4c1d 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -15,11 +15,8 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
- // User::factory(10)->create();
-
- User::factory()->create([
- 'name' => 'Test User',
- 'email' => 'test@example.com',
+ $this->call([
+ ArchiveStatusSeeder::class,
]);
}
}
diff --git a/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue b/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
index a924eaf..db98048 100644
--- a/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
+++ b/resources/js/Pages/Home/ArchiveHistoryModal/Index.vue
@@ -1,5 +1,6 @@
+
+
+
+
+ {{ archiveHistoryId === null ? 'Добавить' : 'Редактировать' }} запись выдачи
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Закрыть без сохранения
+
+
+
+ Сохранить
+
+
+
+
+
+
+
+
diff --git a/routes/api.php b/routes/api.php
index 792eb33..7b87400 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -12,4 +12,14 @@ Route::prefix('si')->group(function () {
Route::get('{id}', [\App\Http\Controllers\MedicalHistoryController::class, 'patient']);
});
});
+
+Route::prefix('archive')->group(function () {
+ Route::prefix('histories')->group(function () {
+ Route::get('{id}', [\App\Http\Controllers\ArchiveHistoryController::class, 'show']);
+ });
+});
+
+Route::prefix('orgs')->group(function () {
+ Route::get('/', [\App\Http\Controllers\OrgController::class, 'index']);
+});
//Route::get('')