* добавил удаление карты, если она была добавлена не из МИС

* добавил диалог при удалении карты
* добавил сохранение движения
* добавил вывод сохраненного отчета
* изменил логику сохранения отчета
This commit is contained in:
brusnitsyn
2026-05-06 17:03:41 +09:00
parent fe2264dfce
commit 2026a1ca9f
22 changed files with 928 additions and 195 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class MigrationPatientNurse extends Model
{
@@ -22,4 +23,27 @@ class MigrationPatientNurse extends Model
'mis_user_id',
'comment',
];
protected $casts = [
'ingoing_date' => 'datetime:Y-m-d H:i:s',
'out_date' => 'datetime:Y-m-d H:i:s',
];
// Фильтр по подразделению (получает ID отделений)
public function scopeDepartment($query, int $departmentId)
{
$branchIds = DB::table('stt_stationarbranch')
->where('rf_DepartmentID', $departmentId)
->pluck('StationarBranchID');
return $query->whereIn('stationar_branch_id', $branchIds);
}
public function scopeCurrentMigration($query, $historyId, $departmentId)
{
return $query->where('medical_history_id', $historyId)
->department($departmentId)
->orderBy('ingoing_date', 'desc')
->limit(1)->first();
}
}