Задача #8
Some checks failed
Build and Push Docker Image / test (push) Failing after 4s
Build and Push Docker Image / build (push) Failing after 25s

Убран фильтр по номеру карты
Добавлена загрузка связи visitResult
Правка размеров колонок
Добавлена колонка исход
Исправлено определение последнего движения в SttMedicalHistory
This commit is contained in:
brusnitsyn
2026-03-17 14:34:39 +09:00
parent 3c32aeabbe
commit 40d1af7212
4 changed files with 30 additions and 14 deletions

View File

@@ -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 номер

View File

@@ -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');
}
}

View File

@@ -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;

View File

@@ -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) => {
<template>
<NDataTable remote
:single-line="false"
striped
:loading="isLoading"
:row-props="rowProps"