- 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.
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* یکتایی شمارهٔ پرونده در هر محیط.
|
|
*
|
|
* پیش از اجرا روی دادهٔ واقعی بررسی شد که شمارهٔ تکراری وجود ندارد. چند `NULL` در
|
|
* unique index مجاز است، پس پروندههای بیشماره (که تا پیش از این قابلیت اکثریتاند)
|
|
* مانع نمیشوند.
|
|
*/
|
|
final class Version20260804082400 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Unique patient record number per tenant';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('CREATE UNIQUE INDEX uniq_patient_record_number ON patient_records (entity_type, entity_id, record_number)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('DROP INDEX uniq_patient_record_number ON patient_records');
|
|
}
|
|
}
|