From 40d1af7212fa3b35bc43f8eae371b94d416e424c Mon Sep 17 00:00:00 2001 From: brusnitsyn Date: Tue, 17 Mar 2026 14:34:39 +0900 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D1=87=D0=B0=20#8=20?= =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D1=80=20=D0=BF=D0=BE=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=D1=83=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=82=D1=8B=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B8=20visitResult=20?= =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=80=D0=B0=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D1=80=D0=BE=D0=B2=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BA=D0=B0=20=D0=B8=D1=81?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=D0=B4?= =?UTF-8?q?=D0=BD=D0=B5=D0=B3=D0=BE=20=D0=B4=D0=B2=D0=B8=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B2=20SttMedicalHistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndexSttMedicalHistoryResource.php | 7 +++++-- app/Models/Mis/SttMedicalHistory.php | 12 ++++++++--- app/Services/ArchiveCardService.php | 4 ++-- resources/js/Pages/Home/DataTable/Index.vue | 21 ++++++++++++------- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/app/Http/Resources/IndexSttMedicalHistoryResource.php b/app/Http/Resources/IndexSttMedicalHistoryResource.php index f86ed17..63d9161 100644 --- a/app/Http/Resources/IndexSttMedicalHistoryResource.php +++ b/app/Http/Resources/IndexSttMedicalHistoryResource.php @@ -57,7 +57,9 @@ class IndexSttMedicalHistoryResource extends JsonResource ? "$archiveInfoMisCardNumber / $archiveInfoFoxproCardNumber" : $archiveInfoMisCardNumber ?? $archiveInfoFoxproCardNumber; - $department = $historyType === 'mis' ? $model->outcomeMigration?->stationarBranch->department : null; + $department = $historyType === 'mis' ? $model->outcomeMigration?->first()?->stationarBranch->department : null; + + $visitResult = $historyType === 'mis' ? $this->visitResult->NAME : null; return [ 'id' => $id, @@ -71,7 +73,8 @@ class IndexSttMedicalHistoryResource extends JsonResource 'dr' => $formattedBirthDate, 'daterecipient' => $formattedDateRecipient, 'dateextract' => $formattedDateExtract, - 'department' => $department ? '[' . $department->DepartmentCODE . '] ' . $department->DepartmentNAME : '', + 'department' => $department ? '[' . $department->DepartmentCODE . '] ' . $department->DepartmentNAME : 'Н/д', + 'visitresult' => $visitResult, // Номера карт 'medcardnum' => $cardNumber, // MIS номер или FoxPro номер diff --git a/app/Models/Mis/SttMedicalHistory.php b/app/Models/Mis/SttMedicalHistory.php index 51444a9..bf46f82 100644 --- a/app/Models/Mis/SttMedicalHistory.php +++ b/app/Models/Mis/SttMedicalHistory.php @@ -4,6 +4,7 @@ namespace App\Models\Mis; use App\Models\ArchiveHistory; use App\Models\ArchiveInfo; +use App\Models\OmsVisitResult; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -34,14 +35,14 @@ class SttMedicalHistory extends Model public function migrations() { - return $this->hasOne(SttMigrationPatient::class, 'rf_MedicalHistoryID', 'MedicalHistoryID'); + return $this->hasMany(SttMigrationPatient::class, 'rf_MedicalHistoryID', 'MedicalHistoryID'); } public function outcomeMigration() { return $this->migrations() - ->where('rf_kl_VisitResultID', 1) - ->whereDate('DateOut', '<>', '2222-01-01'); + ->whereDate('DateOut', '<>', '2222-01-01') + ->orderBy('DateOut', 'desc'); } /** @@ -77,4 +78,9 @@ class SttMedicalHistory extends Model ->latest('issue_at') ->first(); } + + public function visitResult() + { + return $this->hasOne(OmsVisitResult::class, 'kl_VisitResultID', 'rf_kl_VisitResultID'); + } } diff --git a/app/Services/ArchiveCardService.php b/app/Services/ArchiveCardService.php index 8e19939..9913852 100644 --- a/app/Services/ArchiveCardService.php +++ b/app/Services/ArchiveCardService.php @@ -17,8 +17,7 @@ class ArchiveCardService ) : LengthAwarePaginator { $query = ArchiveInfo::with(['misHistory', 'foxproHistory']) - ->orderBy('post_in', 'desc') - ->orderBy('archive_num', 'asc'); + ->orderBy('post_in', 'desc'); // Поиск по тексту (если передан) if (!empty($searchText)) { @@ -79,6 +78,7 @@ class ArchiveCardService // Приоритет MIS истории if ($archiveInfo->misHistory) { $history = $archiveInfo->misHistory; + $history->load('visitResult'); $history->history_type = 'mis'; } else { $history = $archiveInfo->foxproHistory; diff --git a/resources/js/Pages/Home/DataTable/Index.vue b/resources/js/Pages/Home/DataTable/Index.vue index c9b3379..efa5aed 100644 --- a/resources/js/Pages/Home/DataTable/Index.vue +++ b/resources/js/Pages/Home/DataTable/Index.vue @@ -44,19 +44,25 @@ const columns = ref([ { title: '№ карты', key: 'medcardnum', - width: 100, + width: 80, render: (row) => h(NEllipsis, null, { default: () => row.medcardnum }) }, { title: 'ФИО', key: 'fullname', - width: 250, + width: 200, render: (row) => h(NEllipsis, null, { default: () => row.fullname }) }, + { + title: 'Исход', + key: 'visitresult', + width: 60, + render: (row) => h(NEllipsis, null, { default: () => row.visitresult ?? 'Н/д' }) + }, { title: 'Отделение', key: 'department', - width: 180, + width: 220, render: (row) => h(NEllipsis, null, { default: () => row.department }) }, { @@ -74,25 +80,25 @@ const columns = ref([ { title: 'Дата выписки', key: 'dateextract', - width: 100, + width: 80, render: (row) => h(NEllipsis, null, { default: () => row.dateextract }) }, { title: '№ архива', key: 'card_num', - width: 120, + width: 80, render: (row) => h(NEllipsis, null, { default: () => row.card_num || '-' }) }, { title: 'Дата архива', key: 'datearhiv', - width: 130, + width: 80, render: (row) => h(NEllipsis, null, { default: () => row.datearhiv }) }, { title: 'Статус', key: 'status', - width: 100, + width: 60, render: (row) => archiveStatusColumn(row.status) } ]) @@ -152,6 +158,7 @@ watch(() => archiveCardStore.isOpenArchiveCard, (isOpen) => {