preworking pvadt

This commit is contained in:
mahdahar 2025-11-13 13:49:24 +07:00
parent 21abee1831
commit 8af8fea0ba
4 changed files with 40 additions and 23 deletions

View File

@ -39,18 +39,19 @@ class CreatePVTables extends Migration {
// patvisitadt
$this->forge->addField([
'PVADTID' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'InternalPVID'=> ['type' => 'INT', 'constraint' => 11, 'null' => true],
'ADTCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'RefDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'PVADTID' => ['type' => 'INT', 'unsigned' => true, 'auto_increment' => true],
'InternalPVID'=> ['type' => 'INT', 'null' => true],
'Sequence' => ['type' => 'INT', 'null' => true],
'ADTCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'LocationID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'AttDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'RefDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true],
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
'DelDate' => ['type' => 'DATETIME', 'null' => true],
'DelDate' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('PVADTID', true);
$this->forge->createTable('patvisitadt');

View File

@ -6,8 +6,11 @@ use CodeIgniter\Database\Seeder;
class DummySeeder extends Seeder {
protected array $map = [];
public function run() {
$now = date('Y-m-d H:i:s');
// location
$data = [
['LocationID'=>1, 'LocCode'=>'QLOC', 'LocFull'=>'Dummy Location', 'LocType'=>'ROOM', 'Description'=>'Location made for dummy testing', 'CreateDate'=> "$now" ],
@ -52,17 +55,13 @@ class DummySeeder extends Seeder {
// patient
$data = [
[ 'InternalPID'=>1, 'PatientID'=>'SMAJ1', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient M', 'Gender'=>'6', 'BirthDate'=>'1991-09-09', 'Street_1'=>'Makati', 'EmailAddress1'=>'smaj1@5panda.id',
'Province'=>'1', 'City'=>'37', 'Country'=>'325', 'Race'=>'175', 'Religion'=>'207', 'Ethnic'=>'218', 'DeathIndicator' => '16', 'CreateDate'=> "$now"],
[ 'InternalPID'=>2, 'PatientID'=>'SMAJ2', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient F', 'Gender'=>'6', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj2@5panda.id',
'Province'=>'2', 'City'=>'60', 'Country'=>'325', 'Race'=>'176', 'Religion'=>'206', 'Ethnic'=>'219', 'DeathIndicator' => '16', 'CreateDate'=> "$now"],
[ 'InternalPID'=>3, 'PatientID'=>'SMAJ3', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient L', 'Gender'=>'6', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj3@5panda.id',
'Province'=>'3', 'City'=>'103', 'Country'=>'325', 'Race'=>'176', 'Religion'=>'206', 'Ethnic'=>'219', 'DeathIndicator' => '16', 'CreateDate'=> "$now"]
[ 'InternalPID'=>1, 'PatientID'=>'SMAJ1', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient M', 'BirthDate'=>'1991-09-09', 'Street_1'=>'Makati', 'EmailAddress1'=>'smaj1@5panda.id', 'CreateDate'=> "$now"],
[ 'InternalPID'=>2, 'PatientID'=>'SMAJ2', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient F', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj2@5panda.id', 'CreateDate'=> "$now"],
[ 'InternalPID'=>3, 'PatientID'=>'SMAJ3', 'NameFirst'=>'Dummy', 'NameLast' => 'Patient L', 'BirthDate'=>'1997-02-02', 'Street_1'=>'Manila', 'EmailAddress1'=>'smaj3@5panda.id', 'CreateDate'=> "$now"]
];
$this->db->table('patient')->insertBatch($data);
$data = [
[ 'InternalPID'=>1, 'IdentifierType'=>'KTP', 'Identifier'=>'9901', 'CreateDate'=> "$now" ],
// [ 'InternalPID'=>2, 'IdentifierType'=>'KTP', 'Identifier'=>'9902', 'CreateDate'=> "$now" ],
[ 'InternalPID'=>3, 'IdentifierType'=>'KTP', 'Identifier'=>'9903', 'CreateDate'=> "$now" ]
];
$this->db->table('patidt')->insertBatch($data);
@ -76,13 +75,30 @@ class DummySeeder extends Seeder {
];
$this->db->table('patatt')->insertBatch($data);
// patvisit
$data = [
['InternalPVID'=>1, "PVID"=>"XLAB0001", "InternalPID"=>1, "EpisodeID"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>2, "PVID"=>"XLAB0002", "InternalPID"=>1, "EpisodeID"=>1, "CreateDate"=>"$now"],
];
$this->db->table('patvisit')->insertBatch($data);
$data = [
['InternalPVID'=>1, "Sequence"=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>1, "Sequence"=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>1, "Sequence"=>3, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>1, "Sequence"=>4, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"],
['InternalPVID'=>2, "Sequence"=>1, "ADTCode"=>"X01", "LocationID"=>1, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>2, "Sequence"=>2, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>1, "CreateDate"=>"$now"],
['InternalPVID'=>2, "Sequence"=>3, "ADTCode"=>"X01", "LocationID"=>2, "AttDoc"=>null, "CreateDate"=>"$now"],
['InternalPVID'=>2, "Sequence"=>4, "ADTCode"=>"X02", "LocationID"=>null, "AttDoc"=>2, "CreateDate"=>"$now"],
];
$this->db->table('patvisitadt')->insertBatch($data);
// Organization
$data = [
[ 'AccountID' => 1, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'City'=>'194', 'Province'=>'11', 'ZIP'=>'505', 'Country'=>'325', 'AreaCode'=>'', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
[ 'AccountID' => 2, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'City'=>'189', 'Province'=>'11', 'ZIP'=>'505', 'Country'=>'325', 'AreaCode'=>'', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
[ 'AccountID' => 3, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'City'=>'194', 'Province'=>'11', 'ZIP'=>'505', 'Country'=>'325', 'AreaCode'=>'', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ]
[ 'AccountID' => 1, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
[ 'AccountID' => 2, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ],
[ 'AccountID' => 3, 'Parent' => null, 'AccountName' => 'Dummy Account', 'Initial'=>'QAC', 'Street_1'=>'Dummy Address', 'EmailAddress1'=>'dummy@summit.co.id', 'Phone'=>'092029', 'Fax'=>'092029', 'CreateDate' => "$now" ]
];
$this->db->table('account')->insertBatch($data);

View File

@ -6,7 +6,7 @@ use App\Models\BaseModel;
class PatVisitADTModel extends BaseModel {
protected $table = 'patvisitadt';
protected $primaryKey = 'PVADTID';
protected $allowedFields = ['InternalPVID', 'ADTCode', 'LocationID', 'AttDoc', 'RefDoc', 'AdmDoc', 'CnsDoc',
protected $allowedFields = ['InternalPVID', 'Sequence', 'ADTCode', 'LocationID', 'AttDoc', 'RefDoc', 'AdmDoc', 'CnsDoc',
'CreateDate', 'EndDate', 'ArchivedDate', 'DelDate'];
protected $visnum_prefix;

View File

@ -108,7 +108,7 @@ class PatVisitModel extends BaseModel {
$tmp = $modelPD->insert($input['PatDiag']);
}
}
if ($tmp === false) {
if (isset($tmp) && $tmp === false) {
$error = $db->error();
throw new \Exception("Failed to update PatDiag record. ". $error['message']);
}