Задача #8
Убран фильтр по номеру карты Добавлена загрузка связи visitResult Правка размеров колонок Добавлена колонка исход Исправлено определение последнего движения в SttMedicalHistory
This commit is contained in:
@@ -57,7 +57,9 @@ class IndexSttMedicalHistoryResource extends JsonResource
|
|||||||
? "$archiveInfoMisCardNumber / $archiveInfoFoxproCardNumber"
|
? "$archiveInfoMisCardNumber / $archiveInfoFoxproCardNumber"
|
||||||
: $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 [
|
return [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
@@ -71,7 +73,8 @@ class IndexSttMedicalHistoryResource extends JsonResource
|
|||||||
'dr' => $formattedBirthDate,
|
'dr' => $formattedBirthDate,
|
||||||
'daterecipient' => $formattedDateRecipient,
|
'daterecipient' => $formattedDateRecipient,
|
||||||
'dateextract' => $formattedDateExtract,
|
'dateextract' => $formattedDateExtract,
|
||||||
'department' => $department ? '[' . $department->DepartmentCODE . '] ' . $department->DepartmentNAME : '',
|
'department' => $department ? '[' . $department->DepartmentCODE . '] ' . $department->DepartmentNAME : 'Н/д',
|
||||||
|
'visitresult' => $visitResult,
|
||||||
|
|
||||||
// Номера карт
|
// Номера карт
|
||||||
'medcardnum' => $cardNumber, // MIS номер или FoxPro номер
|
'medcardnum' => $cardNumber, // MIS номер или FoxPro номер
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Models\Mis;
|
|||||||
|
|
||||||
use App\Models\ArchiveHistory;
|
use App\Models\ArchiveHistory;
|
||||||
use App\Models\ArchiveInfo;
|
use App\Models\ArchiveInfo;
|
||||||
|
use App\Models\OmsVisitResult;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
@@ -34,14 +35,14 @@ class SttMedicalHistory extends Model
|
|||||||
|
|
||||||
public function migrations()
|
public function migrations()
|
||||||
{
|
{
|
||||||
return $this->hasOne(SttMigrationPatient::class, 'rf_MedicalHistoryID', 'MedicalHistoryID');
|
return $this->hasMany(SttMigrationPatient::class, 'rf_MedicalHistoryID', 'MedicalHistoryID');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function outcomeMigration()
|
public function outcomeMigration()
|
||||||
{
|
{
|
||||||
return $this->migrations()
|
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')
|
->latest('issue_at')
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function visitResult()
|
||||||
|
{
|
||||||
|
return $this->hasOne(OmsVisitResult::class, 'kl_VisitResultID', 'rf_kl_VisitResultID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ class ArchiveCardService
|
|||||||
) : LengthAwarePaginator
|
) : LengthAwarePaginator
|
||||||
{
|
{
|
||||||
$query = ArchiveInfo::with(['misHistory', 'foxproHistory'])
|
$query = ArchiveInfo::with(['misHistory', 'foxproHistory'])
|
||||||
->orderBy('post_in', 'desc')
|
->orderBy('post_in', 'desc');
|
||||||
->orderBy('archive_num', 'asc');
|
|
||||||
|
|
||||||
// Поиск по тексту (если передан)
|
// Поиск по тексту (если передан)
|
||||||
if (!empty($searchText)) {
|
if (!empty($searchText)) {
|
||||||
@@ -79,6 +78,7 @@ class ArchiveCardService
|
|||||||
// Приоритет MIS истории
|
// Приоритет MIS истории
|
||||||
if ($archiveInfo->misHistory) {
|
if ($archiveInfo->misHistory) {
|
||||||
$history = $archiveInfo->misHistory;
|
$history = $archiveInfo->misHistory;
|
||||||
|
$history->load('visitResult');
|
||||||
$history->history_type = 'mis';
|
$history->history_type = 'mis';
|
||||||
} else {
|
} else {
|
||||||
$history = $archiveInfo->foxproHistory;
|
$history = $archiveInfo->foxproHistory;
|
||||||
|
|||||||
@@ -44,19 +44,25 @@ const columns = ref([
|
|||||||
{
|
{
|
||||||
title: '№ карты',
|
title: '№ карты',
|
||||||
key: 'medcardnum',
|
key: 'medcardnum',
|
||||||
width: 100,
|
width: 80,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.medcardnum })
|
render: (row) => h(NEllipsis, null, { default: () => row.medcardnum })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'ФИО',
|
title: 'ФИО',
|
||||||
key: 'fullname',
|
key: 'fullname',
|
||||||
width: 250,
|
width: 200,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.fullname })
|
render: (row) => h(NEllipsis, null, { default: () => row.fullname })
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Исход',
|
||||||
|
key: 'visitresult',
|
||||||
|
width: 60,
|
||||||
|
render: (row) => h(NEllipsis, null, { default: () => row.visitresult ?? 'Н/д' })
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Отделение',
|
title: 'Отделение',
|
||||||
key: 'department',
|
key: 'department',
|
||||||
width: 180,
|
width: 220,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.department })
|
render: (row) => h(NEllipsis, null, { default: () => row.department })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -74,25 +80,25 @@ const columns = ref([
|
|||||||
{
|
{
|
||||||
title: 'Дата выписки',
|
title: 'Дата выписки',
|
||||||
key: 'dateextract',
|
key: 'dateextract',
|
||||||
width: 100,
|
width: 80,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.dateextract })
|
render: (row) => h(NEllipsis, null, { default: () => row.dateextract })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '№ архива',
|
title: '№ архива',
|
||||||
key: 'card_num',
|
key: 'card_num',
|
||||||
width: 120,
|
width: 80,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.card_num || '-' })
|
render: (row) => h(NEllipsis, null, { default: () => row.card_num || '-' })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Дата архива',
|
title: 'Дата архива',
|
||||||
key: 'datearhiv',
|
key: 'datearhiv',
|
||||||
width: 130,
|
width: 80,
|
||||||
render: (row) => h(NEllipsis, null, { default: () => row.datearhiv })
|
render: (row) => h(NEllipsis, null, { default: () => row.datearhiv })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Статус',
|
title: 'Статус',
|
||||||
key: 'status',
|
key: 'status',
|
||||||
width: 100,
|
width: 60,
|
||||||
render: (row) => archiveStatusColumn(row.status)
|
render: (row) => archiveStatusColumn(row.status)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
@@ -152,6 +158,7 @@ watch(() => archiveCardStore.isOpenArchiveCard, (isOpen) => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NDataTable remote
|
<NDataTable remote
|
||||||
|
:single-line="false"
|
||||||
striped
|
striped
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
:row-props="rowProps"
|
:row-props="rowProps"
|
||||||
|
|||||||
Reference in New Issue
Block a user