* добавил удаление карты, если она была добавлена не из МИС
* добавил диалог при удалении карты * добавил сохранение движения * добавил вывод сохраненного отчета * изменил логику сохранения отчета
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user