add internalpvid to pv creation
This commit is contained in:
parent
28d0d8cddd
commit
51c369ebe5
@ -11,18 +11,19 @@ class Contact extends Controller {
|
|||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
|
|
||||||
protected $db;
|
protected $db;
|
||||||
protected $contactRule;
|
protected $model;
|
||||||
|
protected $rule;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
$this->contactRule = [ 'NameFirst' => 'required' ];
|
$this->model = new ContactModel();
|
||||||
|
$this->rule = [ 'NameFirst' => 'required' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
$ContactName = $this->request->getVar('ContactName');
|
$ContactName = $this->request->getVar('ContactName');
|
||||||
$Specialty = $this->request->getVar('Specialty');
|
$Specialty = $this->request->getVar('Specialty');
|
||||||
$model = new ContactModel();
|
$rows = $this->model->getContacts($ContactName, $Specialty);
|
||||||
$rows = $model->getContacts($ContactName, $Specialty);
|
|
||||||
//$rows = $model->getContacts();
|
//$rows = $model->getContacts();
|
||||||
|
|
||||||
if (empty($rows)) {
|
if (empty($rows)) {
|
||||||
|
|||||||
@ -8,6 +8,8 @@ use CodeIgniter\Database\RawSql;
|
|||||||
class Counter extends Controller {
|
class Counter extends Controller {
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
|
|
||||||
|
protected $db;
|
||||||
|
protected $model;
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
}
|
}
|
||||||
@ -85,7 +87,7 @@ class Counter extends Controller {
|
|||||||
$dataCounter = $this->prepareCounterData($input);
|
$dataCounter = $this->prepareCounterData($input);
|
||||||
|
|
||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
$this->db->table('counter')->where('CounterID', $dataCounter["CounterID"])->update($dataCounterID);
|
$this->db->table('counter')->where('CounterID', $dataCounter["CounterID"])->update($dataCounter);
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
if ($this->db->transStatus() === false) {
|
if ($this->db->transStatus() === false) {
|
||||||
@ -115,7 +117,7 @@ class Counter extends Controller {
|
|||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
$CounterID = $input["CounterID"];
|
$CounterID = $input["CounterID"];
|
||||||
if (!$CounterID) {
|
if (!$CounterID) {
|
||||||
return $this->failValidationError('CounterID is required.');
|
return $this->failValidationErrors('CounterID is required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class PatVisit extends Controller {
|
|||||||
$input = $this->request->getJSON(true);
|
$input = $this->request->getJSON(true);
|
||||||
try {
|
try {
|
||||||
$data = $this->model->createPatVisit($input);
|
$data = $this->model->createPatVisit($input);
|
||||||
return $this->respond(['status' => 'success', 'message' => 'Data updated successfully', 'data' => $data], 201);
|
return $this->respond(['status' => 'success', 'message' => 'Data created successfully', 'data' => $data], 201);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,8 @@ class PatVisitModel extends BaseUtcModel {
|
|||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
|
||||||
$this->insert($input);
|
$this->insert($input);
|
||||||
/*
|
$InternalPVID = $this->getInsertID();
|
||||||
|
|
||||||
if(!empty($input['PatDiag'])) {
|
if(!empty($input['PatDiag'])) {
|
||||||
$input['PatDiag']['InternalPVID'] = $InternalPVID;
|
$input['PatDiag']['InternalPVID'] = $InternalPVID;
|
||||||
$this->db->table('patdiag')->insert($input['PatDiag']);
|
$this->db->table('patdiag')->insert($input['PatDiag']);
|
||||||
@ -60,9 +61,10 @@ class PatVisitModel extends BaseUtcModel {
|
|||||||
$input['PatVisitADT']['InternalPVID'] = $InternalPVID;
|
$input['PatVisitADT']['InternalPVID'] = $InternalPVID;
|
||||||
$this->db->table('patvisitadt')->insert($input['PatVisitADT']);
|
$this->db->table('patvisitadt')->insert($input['PatVisitADT']);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
return $input['PVID'];
|
$data = [ "PVID"=>$input['PVID'], "InternalPVID"=>$InternalPVID ];
|
||||||
|
return $data;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->db->transRollback();
|
$this->db->transRollback();
|
||||||
|
|||||||
@ -6,18 +6,12 @@ use CodeIgniter\Database\RawSql;
|
|||||||
class PatientModel extends BaseUtcModel {
|
class PatientModel extends BaseUtcModel {
|
||||||
protected $table = 'patient';
|
protected $table = 'patient';
|
||||||
protected $primaryKey = 'InternalPID';
|
protected $primaryKey = 'InternalPID';
|
||||||
|
protected $useTimestamps = true;
|
||||||
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', 'DeathDateTime', 'LinkTo', 'CreateDate', 'DelDate' ];
|
'DeathIndicator', 'DeathDateTime', 'LinkTo', 'CreateDate', 'DelDate' ];
|
||||||
protected $useTimestamps = true;
|
|
||||||
protected $createdField = 'CreateDate';
|
|
||||||
protected $updatedField = '';
|
|
||||||
|
|
||||||
protected $beforeInsert = ['normalizeDatesToUTC'];
|
|
||||||
protected $beforeUpdate = ['normalizeDatesToUTC'];
|
|
||||||
protected $afterFind = ['convertDatesToUTCISO'];
|
|
||||||
protected $afterInsert = ['convertDatesToUTCISO'];
|
|
||||||
protected $afterUpdate = ['convertDatesToUTCISO'];
|
|
||||||
|
|
||||||
public function getPatients($filters = []) {
|
public function getPatients($filters = []) {
|
||||||
$qname = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
|
$qname = "LOWER(CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,'')))";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user