Много чего

This commit is contained in:
brusnitsyn
2025-12-25 17:30:50 +09:00
parent c4bb7ec6f9
commit a5209f45c8
25 changed files with 1521 additions and 574 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Http\Resources\ArchiveHistoryResource;
use App\Http\Resources\ArchiveInfoResource;
use App\Http\Resources\PatientInfoResource;
use App\Models\ArchiveInfo;
use App\Models\SI\SttMedicalHistory as SiSttMedicalHistory;
use App\Models\Mis\SttMedicalHistory as MisSttMedicalHistory;
use App\Repositories\MedicalHistoryRepository;
@@ -14,24 +15,25 @@ class MedicalHistoryController extends Controller
{
public function patient($id, Request $request)
{
$viewType = $request->get('view_type', 'si');
$viewType = $request->get('view_type', 'mis');
$patientId = $request->get('patient_id');
$patientInfo = null;
if ($viewType == 'si') $patient = SiSttMedicalHistory::where('id', $id)->first();
else $patient = MisSttMedicalHistory::where('MedicalHistoryID', $id)->first();
$archiveJournal = $patient->archiveHistory ? ArchiveHistoryResource::collection($patient->archiveHistory) : null;
$archiveInfo = ArchiveInfo::whereId($id)->first()->load('status');
if ($viewType == 'foxpro') $patient = $archiveInfo->foxproHistory;
else $patient = $archiveInfo->misHistory;
if (!empty($patient->archiveInfo)) {
$archiveInfo = ArchiveInfoResource::make($patient->archiveInfo)->toArray(request());
$archiveJournal = $patient->archiveHistory ? ArchiveHistoryResource::collection($patient->archiveHistory) : null;
// dd($archiveInfo);
if (!empty($archiveInfo)) {
$archiveInfo = ArchiveInfoResource::make($archiveInfo)->toArray(request());
} else {
$archiveInfo = null;
}
$patientInfo = [
'historyable_type' => $viewType == 'si' ? SiSttMedicalHistory::class : MisSttMedicalHistory::class,
'historyable_type' => $viewType == 'foxpro' ? SiSttMedicalHistory::class : MisSttMedicalHistory::class,
'info' => [
'historyable_type' => $viewType == 'si' ? SiSttMedicalHistory::class : MisSttMedicalHistory::class,
'historyable_type' => $viewType == 'foxpro' ? SiSttMedicalHistory::class : MisSttMedicalHistory::class,
...PatientInfoResource::make($patient)->toArray(request()),
'can_be_issued' => $patient->canBeIssued()
],