first commit
Some checks failed
tests / ci (8.5) (push) Has been cancelled
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-04-03 17:20:05 +09:00
commit 3edc8e667e
358 changed files with 39258 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Support\MedicalReport;
class StructuredTemplateRegistry
{
public function __construct(
private readonly DatabaseStructuredTemplateFactory $databaseStructuredTemplateFactory,
private readonly SourceStructuredTemplateFactory $sourceStructuredTemplateFactory,
private readonly DepartmentCatalog $departmentCatalog,
private readonly ReportInputTypeBlueprintFactory $reportInputTypeBlueprintFactory,
) {}
/**
* @return array<string, mixed>|null
*/
public function templateForDepartment(string $reportDepartmentKey): ?array
{
return $this->databaseStructuredTemplateFactory->templateForDepartment($reportDepartmentKey)
?? $this->blueprintTemplate($reportDepartmentKey)
?? $this->sourceStructuredTemplateFactory->templateForDepartment($reportDepartmentKey);
}
/**
* @return array<string, mixed>|null
*/
private function blueprintTemplate(string $reportDepartmentKey): ?array
{
$department = collect($this->departmentCatalog->departments())
->firstWhere('key', $reportDepartmentKey);
if ($department === null) {
return null;
}
return $this->reportInputTypeBlueprintFactory->templateForDepartment($department);
}
}