2025-09-26 13:08:30 +07:00
|
|
|
<?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) {
|
2025-09-26 15:03:11 +07:00
|
|
|
$rows = $this->join('patdiag pd', 'pd.InternalPVID=patvisit.InternalPVID', 'left')
|
|
|
|
|
->join('patvisitadt pva', 'pva.InternalPVID=patvisit.InternalPVID', 'left')
|
|
|
|
|
->where('patvisit.PVID',$PVID)->get()->getResultArray();
|
2025-09-26 13:08:30 +07:00
|
|
|
return $rows;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-26 15:03:11 +07:00
|
|
|
public function showByPatient($InternalPID) {
|
|
|
|
|
$rows = $this->join('patdiag pd', 'pd.InternalPVID=patvisit.InternalPVID', 'left')
|
|
|
|
|
->join('patvisitadt pva', 'pd.InternalPVID=pva.InternalPVID', 'left')
|
|
|
|
|
->where('patvisit.InternalPID',$InternalPID)->get()->getResultArray();
|
|
|
|
|
return $rows;
|
2025-09-26 13:08:30 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|