Добавить колонку отделение. Пока добавлен только МИС #2

This commit is contained in:
brusnitsyn
2026-02-27 15:01:00 +09:00
parent f15a394d5e
commit 090c7709c0
6 changed files with 67 additions and 3 deletions

View File

@@ -57,6 +57,8 @@ class IndexSttMedicalHistoryResource extends JsonResource
? "$archiveInfoMisCardNumber / $archiveInfoFoxproCardNumber"
: $archiveInfoMisCardNumber ?? $archiveInfoFoxproCardNumber;
$department = $historyType === 'mis' ? $model->outcomeMigration->stationarBranch->department : null;
return [
'id' => $id,
'history_type' => $historyType,
@@ -69,6 +71,7 @@ class IndexSttMedicalHistoryResource extends JsonResource
'dr' => $formattedBirthDate,
'daterecipient' => $formattedDateRecipient,
'dateextract' => $formattedDateExtract,
'department' => $department?->DepartmentNAME,
// Номера карт
'medcardnum' => $cardNumber, // MIS номер или FoxPro номер

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models\Mis;
use Illuminate\Database\Eloquent\Model;
class OmsDepartment extends Model
{
protected $table = 'oms_department';
protected $primaryKey = 'DepartmentID';
}

View File

@@ -32,6 +32,18 @@ class SttMedicalHistory extends Model
return $this->hasOne(ArchiveInfo::class, 'mis_history_id', 'MedicalHistoryID');
}
public function migrations()
{
return $this->hasOne(SttMigrationPatient::class, 'rf_MedicalHistoryID', 'MedicalHistoryID');
}
public function outcomeMigration()
{
return $this->migrations()
->where('rf_kl_VisitResultID', 1)
->whereDate('DateOut', '<>', '2222-01-01');
}
/**
* Проверяет, можно ли выдать эту карту
*/

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Mis;
use Illuminate\Database\Eloquent\Model;
class SttMigrationPatient extends Model
{
protected $table = 'stt_migrationpatient';
protected $primaryKey = 'MigrationPatientID';
public function stationarBranch()
{
return $this->hasOne(SttStationarBranch::class, 'StationarBranchID', 'rf_StationarBranchID');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Mis;
use Illuminate\Database\Eloquent\Model;
class SttStationarBranch extends Model
{
protected $table = 'stt_stationarbranch';
protected $primaryKey = 'StationarBranchID';
public function department()
{
return $this->hasOne(OmsDepartment::class, 'DepartmentID', 'rf_DepartmentID');
}
}

View File

@@ -56,21 +56,27 @@ const columns = ref([
{
title: 'Дата рождения',
key: 'dr',
width: 130,
width: 100,
render: (row) => h(NEllipsis, null, { default: () => row.dr })
},
{
title: 'Дата поступления',
key: 'daterecipient',
width: 150,
width: 100,
render: (row) => h(NEllipsis, null, { default: () => row.daterecipient })
},
{
title: 'Дата выписки',
key: 'dateextract',
width: 130,
width: 100,
render: (row) => h(NEllipsis, null, { default: () => row.dateextract })
},
{
title: 'Отделение',
key: 'department',
width: 180,
render: (row) => h(NEllipsis, null, { default: () => row.department })
},
{
title: '№ архива',
key: 'card_num',