- Add RecordNumberSettingsController for managing patient record number patterns. - Create RecordNumberPattern entity to represent the pattern configuration. - Implement RecordNumberPatternRepository for database interactions. - Develop RecordNumberGenerator service for generating and validating record numbers. - Add tests for record number generation, backfilling, and API interactions. - Ensure proper access control for viewing and updating patterns based on user roles.
48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* الگوی شمارهٔ پروندهٔ هر محیط + شمارندهٔ همان الگو.
|
|
*
|
|
* `diff` دو تغییر بیربط را هم برداشته بود (جدول `messenger_messages` که خودِ
|
|
* transport میسازد، و rename یک ایندکس روی `clinic_resources` که drift قبلی است)؛
|
|
* هر دو حذف شدند تا این migration فقط همین قابلیت را حمل کند.
|
|
*/
|
|
final class Version20260804082035 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Per-tenant patient record number pattern with its own counter';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
CREATE TABLE record_number_patterns (
|
|
id INT AUTO_INCREMENT NOT NULL,
|
|
entity_type VARCHAR(10) NOT NULL,
|
|
entity_id INT NOT NULL,
|
|
enabled TINYINT DEFAULT 0 NOT NULL,
|
|
pattern VARCHAR(60) NOT NULL,
|
|
reset_policy VARCHAR(10) DEFAULT 'none' NOT NULL,
|
|
counter INT DEFAULT 0 NOT NULL,
|
|
counter_period VARCHAR(7) DEFAULT NULL,
|
|
updated_at INT NOT NULL,
|
|
UNIQUE INDEX uniq_record_number_pattern (entity_type, entity_id),
|
|
PRIMARY KEY (id)
|
|
) DEFAULT CHARACTER SET utf8mb4
|
|
SQL);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('DROP TABLE record_number_patterns');
|
|
}
|
|
}
|