* исправление подсчета операций пациентов
* поправил поле выбора даты * добавил индикатор в контроле * окно выбора пользователя для сводной * привязка окна для ввода причины контроля * добавил привязку историй пациентов для просмотра статистики по дням * поправил фиксацию фио ответственного, убрал при диапазоне * отключение ролей адм и зав от реплики
This commit is contained in:
@@ -18,4 +18,27 @@ class MedicalHistorySnapshot extends Model
|
||||
{
|
||||
return $this->belongsTo(Report::class, 'rf_report_id');
|
||||
}
|
||||
|
||||
public function medicalHistory()
|
||||
{
|
||||
return $this->belongsTo(MisMedicalHistory::class, 'rf_medicalhistory_id', 'MedicalHistoryID');
|
||||
}
|
||||
|
||||
// Скоупы для фильтрации
|
||||
public function scopeForReport($query, $reportId)
|
||||
{
|
||||
return $query->where('rf_report_id', $reportId);
|
||||
}
|
||||
|
||||
public function scopeByPatientType($query, $type)
|
||||
{
|
||||
return $query->where('patient_type', $type);
|
||||
}
|
||||
|
||||
public function scopeByDepartment($query, $departmentId)
|
||||
{
|
||||
return $query->whereHas('medicalHistory.migrations.branch', function($q) use ($departmentId) {
|
||||
$q->where('rf_DepartmentID', $departmentId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
25
app/Models/MisLpuDoctor.php
Normal file
25
app/Models/MisLpuDoctor.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class MisLpuDoctor extends Model
|
||||
{
|
||||
public $table = 'hlt_lpudoctor';
|
||||
protected $primaryKey = 'LPUDoctorID';
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->whereDate('DateEnd', '2222-01-01');
|
||||
}
|
||||
|
||||
public function scopeInMyDepartment($query)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$department = $user->department->first();
|
||||
|
||||
return $query->where('rf_DepartmentID', $department->rf_mis_department_id);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,9 @@ class MisMigrationPatient extends Model
|
||||
return $this->hasOne(MisMKB::class, 'MKBID', 'rf_MKBID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Находятся на лечении
|
||||
*/
|
||||
public function scopeCurrentlyInTreatment($query, $branchId = null, $startDate = null, $endDate = null)
|
||||
{
|
||||
$query->where('rf_kl_VisitResultID', 0)
|
||||
|
||||
@@ -14,6 +14,7 @@ class Report extends Model
|
||||
'sent_at',
|
||||
'rf_department_id',
|
||||
'rf_user_id',
|
||||
'rf_lpudoctor_id'
|
||||
];
|
||||
|
||||
public function metrikaResults(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
|
||||
Reference in New Issue
Block a user