Обновление 1.0

This commit is contained in:
brusnitsyn
2025-12-29 17:08:26 +09:00
parent c5c1a2b3e1
commit 56be95caa4
9 changed files with 191 additions and 66 deletions

View File

@@ -22,7 +22,19 @@ class MedicalHistoryController extends Controller
if ($viewType == 'foxpro') $patient = SiSttMedicalHistory::where('keykarta', $id)->first();
else $patient = MisSttMedicalHistory::where('MedicalHistoryID', $id)->first();
$archiveJournal = $patient->archiveHistory ? ArchiveHistoryResource::collection($patient->archiveHistory) : null;
if($patient instanceof MisSttMedicalHistory) {
if ($patient->archiveHistory->count() === 0) {
$foxproCardId = $patient->archiveInfo->foxpro_history_id;
$foxproPatient = SiSttMedicalHistory::where('keykarta', $foxproCardId)->first();
$journalHistory = $foxproPatient->archiveHistory;
} else {
$journalHistory = $patient->archiveHistory;
}
} else {
$journalHistory = $patient->archiveHistory;
}
$archiveInfo = $patient->archiveInfo ? $patient->archiveInfo : null;
$patientInfo = [
@@ -32,7 +44,7 @@ class MedicalHistoryController extends Controller
...PatientInfoResource::make($patient)->toArray(request()),
'can_be_issued' => $patient->canBeIssued()
],
'journal' => $archiveJournal,
'journal' => ArchiveHistoryResource::collection($journalHistory),
'archiveInfo' => $archiveInfo ? ArchiveInfoResource::make($archiveInfo) : null
];