Правка выдачи карт

This commit is contained in:
brusnitsyn
2025-12-26 14:29:55 +09:00
parent a5209f45c8
commit 329304076d
4 changed files with 25 additions and 24 deletions

View File

@@ -21,7 +21,6 @@ class ArchiveInfoResource extends JsonResource
'status' => $this->status,
'foxpro_num' => $this->foxpro_num,
'mis_num' => $this->mis_num,
'type' => $this->historyType()
];
}
}

View File

@@ -25,14 +25,20 @@ class SttMedicalHistoryResource extends JsonResource
$name = $this->resource['name'] ?? '';
$ot = $this->resource['ot'] ?? '';
$misCardNumber = $this->resource['mis_card_number'];
$foxproCardNumber = $this->resource['foxpro_card_number'];
$hasDividerCardNumber = isset($misCardNumber) && isset($foxproCardNumber);
$cardNumber = $hasDividerCardNumber ? "$misCardNumber / $foxproCardNumber" : $misCardNumber ?? $foxproCardNumber;
// Для временных записей (не в архиве) используем данные из MIS
if ($isTemporary) {
// Данные из stt_medicalhistory (не в архиве)
$fullName = trim("{$family} {$name} {$ot}");
$birthDate = $this->resource['birth_date'] ?? null;
$dateExtract = $this->resource['date_extract'] ?? null;
$dateRecipient = null; // Для MIS записей не в архиве может не быть
$cardNumber = $this->resource['card_number'] ?? null;
$dateRecipient = $this->resource['date_recipient'] ?? null;
$archiveNum = null;
$postIn = null;
$status = $this->resource['status_text'] ?? 'Не в архиве';
@@ -40,19 +46,11 @@ class SttMedicalHistoryResource extends JsonResource
// Данные из archive_infos (в архиве)
$fullName = trim("{$family} {$name} {$ot}");
$birthDate = $this->resource['birth_date'] ?? null;
// Для архивных записей date_extract может быть из MIS или FoxPro
$dateExtract = $this->resource['date_extract'] ?? null;
// Для MIS записей в архиве
if ($historyType === 'mis') {
$dateRecipient = $this->resource['date_recipient'] ?? null;
} else {
// Для FoxPro записей в архиве
$dateRecipient = $this->resource['mpostdate'] ?? null;
}
$dateRecipient = $this->resource['date_recipient'] ?? null;
$cardNumber = $this->resource['card_number'] ?? null;
$archiveNum = $this->resource['archive_num'] ?? null;
$postIn = $this->resource['post_in'] ?? null;
$status = $this->resource['status_text'] ?? 'Неизвестно';
@@ -64,8 +62,10 @@ class SttMedicalHistoryResource extends JsonResource
$formattedDateExtract = $dateExtract ? Carbon::parse($dateExtract)->format('d.m.Y') : null;
$formattedPostIn = $postIn ? Carbon::parse($postIn)->format('d.m.Y') : null;
$id = $historyType === 'mis' ? $this->resource['mis_history_id'] : $this->resource['foxpro_history_id'];
return [
'id' => $this->resource['id'],
'id' => $id,
'history_type' => $historyType,
'in_archive' => $isFromArchive,
'is_temporary' => $isTemporary,