fix deathdate -> deathdatetime

This commit is contained in:
mahdahar 2025-10-21 09:28:30 +07:00
parent 60cfe5616a
commit 0acf985065
2 changed files with 5 additions and 5 deletions

View File

@ -79,14 +79,14 @@ class CreatePatientRegTables extends Migration {
'Ethnic' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'Ethnic' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'DeathIndicator'=> ['type' => 'INT', 'constraint' => 11, 'null' => true], 'DeathIndicator'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
'DeathDate' => ['type' => 'DATETIME', 'null' => true], 'DeathDateTime' => ['type' => 'DATETIME', 'null' => true],
'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true], 'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'DelDate' => ['type' => 'DATETIME', 'null' => true] 'DelDate' => ['type' => 'DATETIME', 'null' => true]
]); ]);
$this->forge->addKey('InternalPID', true); $this->forge->addKey('InternalPID', true);
$this->forge->addUniqueKey('PatientID'); $this->forge->addUniqueKey('PatientID');
$this->forge->addUniqueKey('AlternatePID'); $this->forge->addUniqueKey('AlternatePID');
$this->forge->addUniqueKey('EmailAddress1'); $this->forge->addUniqueKey('EmailAddress1');
$this->forge->createTable('patient'); $this->forge->createTable('patient');

View File

@ -14,7 +14,7 @@ class PatientModel extends BaseModel {
protected $primaryKey = 'InternalPID'; protected $primaryKey = 'InternalPID';
protected $allowedFields = ['PatientID', 'AlternatePID', 'Prefix', 'NameFirst', 'NameMiddle', 'NameMaiden', 'NameLast', 'Suffix', 'NameAlias', 'Gender', 'Birthdate', 'PlaceOfBirth', 'Street_1', 'Street_2', 'Street_3', protected $allowedFields = ['PatientID', 'AlternatePID', 'Prefix', 'NameFirst', 'NameMiddle', 'NameMaiden', 'NameLast', 'Suffix', 'NameAlias', 'Gender', 'Birthdate', 'PlaceOfBirth', 'Street_1', 'Street_2', 'Street_3',
'City', 'Province', 'ZIP', 'EmailAddress1', 'EmailAddress2', 'Phone', 'MobilePhone', 'Custodian', 'AccountNumber', 'Country', 'Race', 'MaritalStatus', 'Religion', 'Ethnic', 'Citizenship', 'City', 'Province', 'ZIP', 'EmailAddress1', 'EmailAddress2', 'Phone', 'MobilePhone', 'Custodian', 'AccountNumber', 'Country', 'Race', 'MaritalStatus', 'Religion', 'Ethnic', 'Citizenship',
'DeathIndicator', 'DeathDate', 'LinkTo', 'CreateDate', 'DelDate' ]; 'DeathIndicator', 'DeathDateTime', 'LinkTo', 'CreateDate', 'DelDate' ];
protected $useTimestamps = true; protected $useTimestamps = true;
protected $createdField = 'CreateDate'; protected $createdField = 'CreateDate';
@ -215,8 +215,8 @@ class PatientModel extends BaseModel {
} }
private function transformPatientData(array $patient): array { private function transformPatientData(array $patient): array {
$patient["Age"] = $this->calculateAgeFromBirthdate($patient["Birthdate"], $patient["DeathDate"]); $patient["Age"] = $this->calculateAgeFromBirthdate($patient["Birthdate"], $patient["DeathDateTime"]);
$patient["DeathDate"] = $this->formattedDate($patient["DeathDate"]); $patient["DeathDateTime"] = $this->formattedDate($patient["DeathDateTime"]);
$patient["CreateDate"] = $this->formattedDate($patient["CreateDate"]); $patient["CreateDate"] = $this->formattedDate($patient["CreateDate"]);
$patient["BirthdateConversion"] = $this->formatedDateForDisplay($patient["Birthdate"]); $patient["BirthdateConversion"] = $this->formatedDateForDisplay($patient["Birthdate"]);
$patient["LinkTo"] = $this->getLinkedPatients($patient['LinkTo']); $patient["LinkTo"] = $this->getLinkedPatients($patient['LinkTo']);