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:
parent
0ec13e404a
commit
4aad7d331a
@ -29,14 +29,22 @@ class OrderTestController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$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';
|
||||
|
||||
try {
|
||||
if ($internalPID) {
|
||||
$rows = $this->model->getOrdersByPatient($internalPID);
|
||||
$rows = $this->model->getOrdersByPatient((int) $internalPID, $pvadtid);
|
||||
} else {
|
||||
$rows = $this->db->table('ordertest')
|
||||
->where('DelDate', null)
|
||||
$builder = $this->db->table('ordertest')
|
||||
->where('DelDate', null);
|
||||
|
||||
if ($pvadtid !== null) {
|
||||
$builder->where('PVADTID', $pvadtid);
|
||||
}
|
||||
|
||||
$rows = $builder
|
||||
->orderBy('TrnDate', 'DESC')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
@ -299,10 +299,16 @@ class OrderTestModel extends BaseModel {
|
||||
->getRowArray();
|
||||
}
|
||||
|
||||
public function getOrdersByPatient(int $internalPID): array {
|
||||
return $this->select('*')
|
||||
public function getOrdersByPatient(int $internalPID, ?int $pvadtid = null): array {
|
||||
$builder = $this->select('*')
|
||||
->where('InternalPID', $internalPID)
|
||||
->where('DelDate', null)
|
||||
->where('DelDate', null);
|
||||
|
||||
if ($pvadtid !== null) {
|
||||
$builder->where('PVADTID', $pvadtid);
|
||||
}
|
||||
|
||||
return $builder
|
||||
->orderBy('TrnDate', 'DESC')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
@ -1245,6 +1245,11 @@ paths:
|
||||
schema:
|
||||
type: integer
|
||||
description: Filter by internal patient ID
|
||||
- name: PVADTID
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
description: Filter by patient visit ADT ID
|
||||
- name: OrderStatus
|
||||
in: query
|
||||
schema:
|
||||
|
||||
@ -18,6 +18,11 @@
|
||||
schema:
|
||||
type: integer
|
||||
description: Filter by internal patient ID
|
||||
- name: PVADTID
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
description: Filter by patient visit ADT ID
|
||||
- name: OrderStatus
|
||||
in: query
|
||||
schema:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user