Изменения в основном report

This commit is contained in:
brusnitsyn
2026-05-06 22:32:11 +09:00
parent c5da85763c
commit 723ccee8d3
56 changed files with 1911 additions and 3814 deletions

View File

@@ -47,7 +47,7 @@ class MedicalHistorySnapshot extends Model
public function medicalHistory()
{
return $this->belongsTo(MisMedicalHistory::class, 'rf_medicalhistory_id', 'MedicalHistoryID');
return $this->belongsTo(MedicalHistory::class, 'rf_medicalhistory_id', 'original_id');
}
public function departmentPatient()
@@ -68,8 +68,8 @@ class MedicalHistorySnapshot extends Model
public function scopeByDepartment($query, $departmentId)
{
return $query->whereHas('medicalHistory.migrations.branch', function ($q) use ($departmentId) {
$q->where('rf_DepartmentID', $departmentId);
return $query->whereHas('medicalHistory.migrations', function ($q) use ($departmentId) {
$q->department($departmentId);
});
}
}