fix contactemail
This commit is contained in:
parent
11fd53ada6
commit
aa73f0d240
@ -3,9 +3,10 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use CodeIgniter\Database\RawSql;
|
|
||||||
|
|
||||||
use App\Models\CounterModel;
|
use App\Models\CounterModel;
|
||||||
|
use App\Models\PatVisitModel;
|
||||||
|
|
||||||
class PatVisit extends Controller {
|
class PatVisit extends Controller {
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
@ -20,10 +21,7 @@ class PatVisit extends Controller {
|
|||||||
|
|
||||||
public function show($PVID = null) {
|
public function show($PVID = null) {
|
||||||
try {
|
try {
|
||||||
$row = $this->db->table('patvisit pv')
|
$row = new PatVisitModel()->show($PVID);
|
||||||
->join('patdiag pd', 'pd.InternalPVID=pv.InternalPVID', 'left')
|
|
||||||
->join('patvisitadt pva', 'pd.InternalPVID=pva.InternalPVID', 'left')
|
|
||||||
->get()->getResultArray();
|
|
||||||
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
|
|||||||
@ -13,11 +13,12 @@ class CreatePVTables extends Migration {
|
|||||||
'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true],
|
'PVID' => ['type' => 'VARCHAR', 'constraint' => 20, 'null' => true],
|
||||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'EpisodeID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'EpisodeID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
|
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->forge->addKey('InternalPVID', true);
|
$this->forge->addKey('InternalPVID', true);
|
||||||
$this->forge->addUniqueKey('PVID');
|
$this->forge->addUniqueKey('PVID');
|
||||||
$this->forge->createTable('patvisit');
|
$this->forge->createTable('patvisit');
|
||||||
@ -28,11 +29,11 @@ class CreatePVTables extends Migration {
|
|||||||
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'InternalPID' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'DiagCode' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'Diagnosis' => ['type' => 'TEXT', 'null' => true],
|
'Diagnosis' => ['type' => 'TEXT', 'null' => true],
|
||||||
|
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->forge->addKey('InternalPVID', true);
|
$this->forge->addKey('InternalPVID', true);
|
||||||
$this->forge->createTable('patdiag');
|
$this->forge->createTable('patdiag');
|
||||||
|
|
||||||
@ -46,11 +47,11 @@ class CreatePVTables extends Migration {
|
|||||||
'RefDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'RefDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'AdmDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
'CnsDoc' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||||
|
'CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
'ArchivedDate'=> ['type' => 'DATETIME', 'null' => true],
|
||||||
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
||||||
]);
|
]);
|
||||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->forge->addKey('PVADTID', true);
|
$this->forge->addKey('PVADTID', true);
|
||||||
$this->forge->createTable('patvisitadt');
|
$this->forge->createTable('patvisitadt');
|
||||||
|
|
||||||
@ -74,8 +75,8 @@ class CreatePVTables extends Migration {
|
|||||||
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'EventID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'ActivityID' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
'Reason' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
||||||
|
'LogDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP'
|
||||||
]);
|
]);
|
||||||
$this->forge->addField('LogDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->forge->addKey('PatVisLogID', true);
|
$this->forge->addKey('PatVisLogID', true);
|
||||||
$this->forge->createTable('patvisitlog');
|
$this->forge->createTable('patvisitlog');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,8 +37,8 @@ class CreateContactTable extends Migration {
|
|||||||
'OccupationID' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
'OccupationID' => [ 'type' => 'VARCHAR', 'constraint' => 50, 'null' => true ],
|
||||||
'JobTitle' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
'JobTitle' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
||||||
'Department' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
'Department' => [ 'type' => 'VARCHAR', 'constraint' => 100, 'null' => true ],
|
||||||
'ContactStartDate' => [ 'type' => 'DATE', 'null' => true ],
|
'ContactStartDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
'ContactEndDate' => [ 'type' => 'DATE', 'null' => true ],
|
'ContactEndDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
]);
|
]);
|
||||||
$this->forge->addKey('ContactDetID', true);
|
$this->forge->addKey('ContactDetID', true);
|
||||||
$this->forge->addUniqueKey(['SiteID','ContactID']);
|
$this->forge->addUniqueKey(['SiteID','ContactID']);
|
||||||
@ -50,8 +50,8 @@ class CreateContactTable extends Migration {
|
|||||||
'AbbTex' => [ 'type' => 'VARCHAR', 'constraint' => 5, 'null' => true ],
|
'AbbTex' => [ 'type' => 'VARCHAR', 'constraint' => 5, 'null' => true ],
|
||||||
'FullText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
'FullText' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => true ],
|
||||||
'Description' => [ 'type' => 'TEXT', 'null' => true ],
|
'Description' => [ 'type' => 'TEXT', 'null' => true ],
|
||||||
|
'CreateDate' => [ 'type' => 'DATETIME', 'null' => true ],
|
||||||
]);
|
]);
|
||||||
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
||||||
$this->forge->addKey('OccupationID', true);
|
$this->forge->addKey('OccupationID', true);
|
||||||
$this->forge->createTable('occupation');
|
$this->forge->createTable('occupation');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class ContactModel extends Model {
|
|||||||
'SiteID' => $row['SiteID'] ?? null,
|
'SiteID' => $row['SiteID'] ?? null,
|
||||||
'ContactDetID' => $row['ContactDetID'],
|
'ContactDetID' => $row['ContactDetID'],
|
||||||
'ContactCode' => $row['ContactCode'] ?? null,
|
'ContactCode' => $row['ContactCode'] ?? null,
|
||||||
'ContactEmail' => $row['DetailPhone'] ?? null,
|
'ContactEmail' => $row['ContactEmail'] ?? null,
|
||||||
'OccupationID' => $row['OccupationID'] ?? null,
|
'OccupationID' => $row['OccupationID'] ?? null,
|
||||||
'JobTitle' => $row['JobTitle'] ?? null,
|
'JobTitle' => $row['JobTitle'] ?? null,
|
||||||
'Department' => $row['Department'] ?? null,
|
'Department' => $row['Department'] ?? null,
|
||||||
|
|||||||
39
app/Models/PatVisitModel.php
Normal file
39
app/Models/PatVisitModel.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class PatVisitModel extends Model {
|
||||||
|
protected $table = 'patvisit';
|
||||||
|
protected $primaryKey = 'InternalPVID';
|
||||||
|
protected $allowedFields = ['PVID', 'InternalPID', 'EpisodeID', 'EndDate'];
|
||||||
|
|
||||||
|
protected $useTimestamps = true;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'CreateDate';
|
||||||
|
protected $deletedField = 'EndDate';
|
||||||
|
|
||||||
|
public function show($PVID) {
|
||||||
|
$rows = $this->join('patdiag pd', 'pd.InternalPVID=pv.InternalPVID', 'left')
|
||||||
|
->join('patvisitadt pva', 'pd.InternalPVID=pva.InternalPVID', 'left')
|
||||||
|
->where('PVID',$PVID)->get()->getResultArray();
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function use($CounterID) {
|
||||||
|
$row = $this->where('CounterID',$CounterID)->get()->getResultArray();
|
||||||
|
$cValue = $row[0]['CounterValue'];
|
||||||
|
$cStart = $row[0]['CounterStart'];
|
||||||
|
$cEnd = $row[0]['CounterEnd'];
|
||||||
|
$cReset = $row[0]['CounterReset'];
|
||||||
|
$cPad = strlen((string)$cEnd);
|
||||||
|
// next value > end, back to start
|
||||||
|
if($cValue > $cEnd) { $cValue = $cStart; }
|
||||||
|
$cnum = str_pad($cValue, $cPad, "0", STR_PAD_LEFT);
|
||||||
|
$cValue_next = $cValue+1;
|
||||||
|
$this->set('CounterValue', $cValue_next)->where('CounterID',$CounterID)->update();
|
||||||
|
return $cnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user