Изменения в основном 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

@@ -4,8 +4,8 @@ namespace App\Infrastructure\Reports\Sources;
use App\Data\UnifiedPatientData;
use App\Models\DepartmentPatientOperation;
use App\Models\MedicalHistory;
use App\Models\MedicalHistorySnapshot;
use App\Models\MisMedicalHistory;
use Illuminate\Support\Collection;
class SnapshotPatientSource
@@ -181,15 +181,15 @@ class SnapshotPatientSource
return [];
}
return MisMedicalHistory::query()
->whereIn('MedicalHistoryID', $historyIds)
->with(['surgicalOperations.serviceMedical'])
return MedicalHistory::query()
->whereIn('original_id', $historyIds)
->with(['operations'])
->get()
->mapWithKeys(function (MisMedicalHistory $history) {
->mapWithKeys(function (MedicalHistory $history) {
return [
$history->MedicalHistoryID => $history->surgicalOperations->map(fn ($operation) => [
'code' => $operation->serviceMedical?->ServiceMedicalCode,
'name' => $operation->serviceMedical?->ServiceMedicalName,
$history->original_id => $history->operations->map(fn ($operation) => [
'code' => $operation->service_medical_code ?? null,
'name' => $operation->service_medical_name ?? null,
])->values()->all(),
];
})