- Introduce v2 views directory with Alpine.js-based UI components - Add AuthV2 controller for v2 authentication flow - Update PagesController for v2 routing - Refactor ValueSet module with v2 dialogs and nested CRUD views - Add organization management views (accounts, departments, disciplines, sites, workstations) - Add specimen management views (containers, preparations) - Add master views for tests and valuesets - Migrate patient views to v2 pattern - Update Routes and Exceptions config for v2 support - Enhance CORS configuration - Clean up legacy files (check_db.php, llms.txt, sanity.php, old views) - Update agent workflow patterns for PHP Alpine.js
59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ValueSet;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class ValueSetModel extends BaseModel {
|
|
protected $table = 'valueset';
|
|
protected $primaryKey = 'VID';
|
|
protected $allowedFields = ['SiteID', 'VSetID', 'VOrder', 'VValue', 'VDesc', 'VCategory', 'CreateDate', 'EndDate'];
|
|
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'CreateDate';
|
|
protected $updatedField = '';
|
|
protected $useSoftDeletes = true;
|
|
protected $deletedField = 'EndDate';
|
|
|
|
public function getValueSets($param = null, $page = null, $limit = 50, $VSetID = null) {
|
|
$this->select("valueset.*, valuesetdef.VSName as VCategoryName")
|
|
->join('valuesetdef', 'valueset.VSetID = valuesetdef.VSetID', 'LEFT');
|
|
|
|
if ($VSetID !== null) {
|
|
$this->where('valueset.VSetID', $VSetID);
|
|
}
|
|
|
|
if ($param !== null) {
|
|
$this->groupStart()
|
|
->like('valueset.VValue', $param, 'both')
|
|
->orLike('valueset.VDesc', $param, 'both')
|
|
->orLike('valuesetdef.VSName', $param, 'both')
|
|
->groupEnd();
|
|
}
|
|
|
|
if ($page !== null) {
|
|
return [
|
|
'data' => $this->paginate($limit, 'default', $page),
|
|
'pager' => $this->pager
|
|
];
|
|
}
|
|
|
|
return $this->findAll();
|
|
}
|
|
|
|
public function getValueSet($VID) {
|
|
$rows = $this->select("valueset.*, valuesetdef.VSName")
|
|
->join('valuesetdef', 'valuesetdef.VSetID = valueset.VSetID', 'LEFT')
|
|
->find($VID);
|
|
|
|
return $rows;
|
|
}
|
|
|
|
public function getValueSetByValueSetDef($VSetID) {
|
|
$rows = $this->where('VSetID', (int) $VSetID)->findAll();
|
|
return $rows;
|
|
}
|
|
|
|
|
|
}
|