Задача #8
Убран фильтр по номеру карты Добавлена загрузка связи visitResult Правка размеров колонок Добавлена колонка исход Исправлено определение последнего движения в SttMedicalHistory
This commit is contained in:
@@ -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 номер
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user