feat(ordertest): add PVADTID filter support and sync order API docs

- Add PVADTID query param handling in OrderTestController::index() (supports both PVADTID and pvadtid, with numeric casting).

- Extend OrderTestModel::getOrdersByPatient() with optional PVADTID filtering.

- Apply PVADTID filtering to general order listing queries.

- Update public/paths/orders.yaml to document PVADTID on GET /api/ordertest.

- Regenerate public/api-docs.bundled.yaml to keep OpenAPI bundle in sync.
This commit is contained in:
mahdahar 2026-04-20 13:48:18 +07:00
parent 0ec13e404a
commit 4aad7d331a
4 changed files with 8986 additions and 8962 deletions

View File

@ -29,14 +29,22 @@ class OrderTestController extends Controller {
public function index() { public function index() {
$internalPID = $this->request->getVar('InternalPID'); $internalPID = $this->request->getVar('InternalPID');
$pvadtid = $this->request->getVar('PVADTID') ?? $this->request->getVar('pvadtid');
$pvadtid = is_numeric($pvadtid) ? (int) $pvadtid : null;
$includeDetails = $this->request->getVar('include') === 'details'; $includeDetails = $this->request->getVar('include') === 'details';
try { try {
if ($internalPID) { if ($internalPID) {
$rows = $this->model->getOrdersByPatient($internalPID); $rows = $this->model->getOrdersByPatient((int) $internalPID, $pvadtid);
} else { } else {
$rows = $this->db->table('ordertest') $builder = $this->db->table('ordertest')
->where('DelDate', null) ->where('DelDate', null);
if ($pvadtid !== null) {
$builder->where('PVADTID', $pvadtid);
}
$rows = $builder
->orderBy('TrnDate', 'DESC') ->orderBy('TrnDate', 'DESC')
->get() ->get()
->getResultArray(); ->getResultArray();

View File

@ -299,10 +299,16 @@ class OrderTestModel extends BaseModel {
->getRowArray(); ->getRowArray();
} }
public function getOrdersByPatient(int $internalPID): array { public function getOrdersByPatient(int $internalPID, ?int $pvadtid = null): array {
return $this->select('*') $builder = $this->select('*')
->where('InternalPID', $internalPID) ->where('InternalPID', $internalPID)
->where('DelDate', null) ->where('DelDate', null);
if ($pvadtid !== null) {
$builder->where('PVADTID', $pvadtid);
}
return $builder
->orderBy('TrnDate', 'DESC') ->orderBy('TrnDate', 'DESC')
->get() ->get()
->getResultArray(); ->getResultArray();

View File

@ -1245,6 +1245,11 @@ paths:
schema: schema:
type: integer type: integer
description: Filter by internal patient ID description: Filter by internal patient ID
- name: PVADTID
in: query
schema:
type: integer
description: Filter by patient visit ADT ID
- name: OrderStatus - name: OrderStatus
in: query in: query
schema: schema:

View File

@ -18,6 +18,11 @@
schema: schema:
type: integer type: integer
description: Filter by internal patient ID description: Filter by internal patient ID
- name: PVADTID
in: query
schema:
type: integer
description: Filter by patient visit ADT ID
- name: OrderStatus - name: OrderStatus
in: query in: query
schema: schema: