diff --git a/app/Database/Migrations/2025-09-02-070826_Patient_Reg.php b/app/Database/Migrations/2025-09-02-070826_Patient_Reg.php index 51f7bab..0762923 100644 --- a/app/Database/Migrations/2025-09-02-070826_Patient_Reg.php +++ b/app/Database/Migrations/2025-09-02-070826_Patient_Reg.php @@ -74,11 +74,11 @@ class CreatePatientRegTables extends Migration { 'AccountNumber' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'Country' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'Race' => ['type' => 'INT', 'constraint' => 11, 'null' => true], - 'MaritalStatus' => ['type' => 'VARCHAR', 'constraint' => 1, 'null' => true], + 'MaritalStatus' => ['type' => 'TINYINT', 'null' => true], 'Religion' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'Ethnic' => ['type' => 'INT', 'constraint' => 11, 'null' => true], 'Citizenship' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], - 'DeathIndicator'=> ['type' => 'BIT', 'constraint' => 1, 'null' => true], + 'DeathIndicator'=> ['type' => 'TINYINT', 'null' => true], 'DeathDateTime' => ['type' => 'DATETIME', 'null' => true], 'LinkTo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', diff --git a/app/Models/PatientModel.php b/app/Models/PatientModel.php index a638123..af86843 100644 --- a/app/Models/PatientModel.php +++ b/app/Models/PatientModel.php @@ -46,6 +46,9 @@ class PatientModel extends Model { race.VDesc as Race, religion.VDesc as Religion, ethnic.VDesc as Ethnic, + gender.VDesc as Gender, + deathindicator.VDesc as DeathIndicator, + maritalstatus.VDesc as MaritalStatus, patcom.Comment as Comment, patidt.IdentifierType, patidt.Identifier, @@ -55,6 +58,9 @@ class PatientModel extends Model { ->join('valueset race', 'race.VID = p.Race', 'left') ->join('valueset religion', 'religion.VID = p.Religion', 'left') ->join('valueset ethnic', 'ethnic.VID = p.Ethnic', 'left') + ->join('valueset gender', 'gender.VID = p.Gender', 'left') + ->join('valueset deathindicator', 'deathindicator.VID = p.DeathIndicator', 'left') + ->join('valueset maritalstatus', 'maritalstatus.VID = p.MaritalStatus', 'left') ->join('patcom', 'patcom.InternalPID = p.InternalPID', 'left') ->join('patidt', 'patidt.InternalPID = p.InternalPID', 'left') ->join('patatt', 'patatt.InternalPID = p.InternalPID and patatt.DelDate is null', 'left') @@ -70,7 +76,6 @@ class PatientModel extends Model { // Default nested structures $patient['PatIdt'] = null; - $patient['PatCom'] = null; $patient['PatAtt'] = []; foreach ($rows as $row) { @@ -81,10 +86,6 @@ class PatientModel extends Model { ]; } - if ($row['Comment']) { - $patient['PatCom'] = $row['Comment']; - } - if ($row['Address']) { $patient['PatAtt'][] = ['Address' => $row['Address']]; } @@ -142,7 +143,7 @@ class PatientModel extends Model { $db = \Config\Database::connect(); $patidt = $input['PatIdt'] ?? []; $patatt = $input['PatAtt'] ?? []; - $patcom['Comment'] = $input['PatCom'] ?? []; + $patcom['Comment'] = $input['Comment'] ?? []; try { $db->transStart(); @@ -259,7 +260,6 @@ class PatientModel extends Model { return $patient; } - private function getLinkedPatients(?string $linkTo): ?array { if (empty($linkTo)) { return null; }