Clean with short codes
This commit is contained in:
parent
18563c439a
commit
ccdf80a007
32
migrations/Version20251022085244.php
Normal file
32
migrations/Version20251022085244.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20251022085244 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE contacts ADD msg_content_type INT DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SCHEMA public');
|
||||||
|
$this->addSql('ALTER TABLE contacts DROP msg_content_type');
|
||||||
|
}
|
||||||
|
}
|
||||||
34
migrations/Version20251022090715.php
Normal file
34
migrations/Version20251022090715.php
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20251022090715 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE contacts ALTER msg_content_type SET DEFAULT 1');
|
||||||
|
$this->addSql('ALTER TABLE contacts ALTER msg_content_type SET NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SCHEMA public');
|
||||||
|
$this->addSql('ALTER TABLE contacts ALTER msg_content_type DROP DEFAULT');
|
||||||
|
$this->addSql('ALTER TABLE contacts ALTER msg_content_type DROP NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
32
migrations/Version20251022160213.php
Normal file
32
migrations/Version20251022160213.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20251022160213 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE contacts ADD study_id_short VARCHAR(50) DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SCHEMA public');
|
||||||
|
$this->addSql('ALTER TABLE contacts DROP study_id_short');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -205,13 +205,20 @@ final class CleanMobileCommand extends Command
|
||||||
$contact->setStudyId($study_id);
|
$contact->setStudyId($study_id);
|
||||||
$contact->setParsedFileLinenum($rowCount + 1);
|
$contact->setParsedFileLinenum($rowCount + 1);
|
||||||
$contact->setParsedFileLine(implode(';', $row));
|
$contact->setParsedFileLine(implode(';', $row));
|
||||||
|
$contact->setMsgContentType($rowCount % 2 ? 1 : 2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->http->request('POST', $this->backendApiURL . "/" . $study_id . "/" . $study_id_chain, [
|
$result = $this->http->request('POST', $this->backendApiURL . "/" . $study_id . "/" . $study_id_chain, [
|
||||||
'body' => '',
|
'body' => '',
|
||||||
'headers' => [],
|
'headers' => [],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($result->getStatusCode() == 200) {
|
||||||
|
$response = json_decode($result->getContent());
|
||||||
|
$shortCode = $response->{'subject_id_short'};
|
||||||
|
$contact->setStudyIdShort($shortCode);
|
||||||
|
}
|
||||||
|
|
||||||
$validContacts[] = $contact;
|
$validContacts[] = $contact;
|
||||||
} catch (TransportExceptionInterface $e) {
|
} catch (TransportExceptionInterface $e) {
|
||||||
$backendErrorCount++;
|
$backendErrorCount++;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ class ContactUncontactedCommand extends Command
|
||||||
|
|
||||||
// 1. Get uncontacted rows with a date in the past
|
// 1. Get uncontacted rows with a date in the past
|
||||||
$now = new DateTime();
|
$now = new DateTime();
|
||||||
|
/** @var Contacts[] $phoneNumbersToContact */
|
||||||
$phoneNumbersToContact = $this->entityManager->getRepository(Contacts::class)->createQueryBuilder('p')
|
$phoneNumbersToContact = $this->entityManager->getRepository(Contacts::class)->createQueryBuilder('p')
|
||||||
->where('p.contacted = :state_contacted')
|
->where('p.contacted = :state_contacted')
|
||||||
->andWhere('p.due_date < :now')
|
->andWhere('p.due_date < :now')
|
||||||
|
|
@ -82,6 +83,15 @@ class ContactUncontactedCommand extends Command
|
||||||
// 3. Contact the HTTP REST API
|
// 3. Contact the HTTP REST API
|
||||||
try {
|
try {
|
||||||
$study_id = $phoneContact->getStudyId();
|
$study_id = $phoneContact->getStudyId();
|
||||||
|
$msgContentType = $phoneContact->getMsgContentType();
|
||||||
|
$message = 'Liebe Patientin, lieber Patient, \ngerne möchten wir von Ihnen erfahren, wie zufrieden Sie mit uns sind. Wir freuen uns, wenn Sie sich die Zeit nehmen und uns Ihre Eindrücke mitteilen.\nIhre Anregungen gehen direkt zum Qualitäts- und Risikomanagement.\n\nhttps://umfragetool.ukbonn.de/login?id={$study_id} \n\nIhr UKB.\n\nSMS vom UKB abbestellen per E-Mail an: datenschutz@ukbonn.de';
|
||||||
|
switch ($msgContentType) {
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$message = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
$response = $this->httpClient->request('POST', self::$apiEndpoint, [
|
$response = $this->httpClient->request('POST', self::$apiEndpoint, [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'X-CM-PRODUCTTOKEN' => $this->sms_gateway_api_key,
|
'X-CM-PRODUCTTOKEN' => $this->sms_gateway_api_key,
|
||||||
|
|
@ -98,7 +108,7 @@ class ContactUncontactedCommand extends Command
|
||||||
],
|
],
|
||||||
'body': {
|
'body': {
|
||||||
'type': 'auto',
|
'type': 'auto',
|
||||||
'content': 'Liebe Patientin, lieber Patient, \ngerne möchten wir von Ihnen erfahren, wie zufrieden Sie mit uns sind. Wir freuen uns, wenn Sie sich die Zeit nehmen und uns Ihre Eindrücke mitteilen.\nIhre Anregungen gehen direkt zum Qualitäts- und Risikomanagement.\n\nhttps://umfragetool.ukbonn.de/login?id={$study_id} \n\nIhr UKB.\n\nSMS vom UKB abbestellen per E-Mail an: datenschutz@ukbonn.de'
|
'content': ''
|
||||||
},
|
},
|
||||||
'minimumNumberOfMessageParts': 1,
|
'minimumNumberOfMessageParts': 1,
|
||||||
'maximumNumberOfMessageParts': 8,
|
'maximumNumberOfMessageParts': 8,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,12 @@ class Contacts
|
||||||
#[ORM\Column(length: 50, nullable: true)]
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
private ?string $study_id = null;
|
private ?string $study_id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 50, nullable: true)]
|
||||||
|
private ?string $study_id_short = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: false, options: ['default' => 1])]
|
||||||
|
private ?int $msg_content_type = 1;
|
||||||
|
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
|
|
@ -158,4 +164,24 @@ class Contacts
|
||||||
{
|
{
|
||||||
$this->parsed_file_line = $parsed_file_line;
|
$this->parsed_file_line = $parsed_file_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMsgContentType(): ?int
|
||||||
|
{
|
||||||
|
return $this->msg_content_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMsgContentType(?int $msg_content_type): void
|
||||||
|
{
|
||||||
|
$this->msg_content_type = $msg_content_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStudyIdShort(): ?string
|
||||||
|
{
|
||||||
|
return $this->study_id_short;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStudyIdShort(?string $study_id_short): void
|
||||||
|
{
|
||||||
|
$this->study_id_short = $study_id_short;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user