Merge branch 'main' of github.com:mahdahar1/clqms01-be

Resolved conflicts and integrated remote changes:
- Keep PatVisitController fixes (validation, soft delete, proper HTTP status codes)
- Updated routes and controllers from remote
- Synced api-docs.yaml
This commit is contained in:
mahdahar 2026-02-12 16:53:58 +07:00
commit 305e605a60
5 changed files with 25 additions and 21 deletions

View File

@ -73,25 +73,6 @@ $routes->group('api', function ($routes) {
});
// Master Data
$routes->group('race', function ($routes) {
$routes->get('/', 'Race::index');
$routes->get('(:num)', 'Race::show/$1');
});
$routes->group('country', function ($routes) {
$routes->get('/', 'Country::index');
$routes->get('(:num)', 'Country::show/$1');
});
$routes->group('religion', function ($routes) {
$routes->get('/', 'Religion::index');
$routes->get('(:num)', 'Religion::show/$1');
});
$routes->group('ethnic', function ($routes) {
$routes->get('/', 'Ethnic::index');
$routes->get('(:num)', 'Ethnic::show/$1');
});
// Location
$routes->group('location', function ($routes) {

View File

@ -40,7 +40,7 @@ class AreaGeoController extends BaseController {
}
public function getCities() {
$filter = [ 'Parent' => $this->request->getVar('Parent') ?? null ];
$filter = [ 'Parent' => $this->request->getVar('province_id') ?? null ];
$rows = $this->model->getCities($filter);
$transformed = array_map(function($row) {
return ['value' => $row['AreaGeoID'], 'label' => $row['AreaName']];

View File

@ -18,6 +18,7 @@ class PatVisitController extends BaseController {
public function index() {
try {
<<<<<<< HEAD
$InternalPID = $this->request->getVar('InternalPID');
$PVID = $this->request->getVar('PVID');
@ -40,6 +41,17 @@ class PatVisitController extends BaseController {
return $this->respond(['status' => 'success', 'message' => 'data found', 'data' => $rows], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
=======
$page = $this->request->getVar('page') ?? 1;
$perPage = $this->request->getVar('per_page') ?? 50;
$rows = $this->model->paginate($perPage, 'default', $page);
$total = $this->model->countAllResults(false);
if($rows == []) { $message = "data not found"; }
else { $message = "data found"; }
return $this->respond(['status' => 'success', 'message'=> $message, 'data' => $rows, 'total' => $total, 'page' => $page, 'per_page' => $perPage ], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong '.$e->getMessage());
>>>>>>> c38f9d2f914aa58a65dd6faf90b98f448cf4347d
}
}

View File

@ -22,7 +22,7 @@ class PatientModel extends BaseModel {
protected $deletedField = 'DelDate';
public function getPatients($filters = []) {
$qname = "CONCAT_WS(' ', IFNULL(Prefix,''), IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''), IFNULL(NameMaiden,''), IFNULL(Suffix,''))";
$qname = "CONCAT_WS(' ', IFNULL(NameFirst,''), IFNULL(NameMiddle,''), IFNULL(NameLast,''))";
$this->select("InternalPID, PatientID, $qname as FullName, Sex, Birthdate, EmailAddress1 as Email, MobilePhone");

View File

@ -1391,10 +1391,21 @@ paths:
properties:
status:
type: string
message:
type: string
data:
type: array
items:
$ref: '#/components/schemas/PatientVisit'
total:
type: integer
description: Total number of records
page:
type: integer
description: Current page number
per_page:
type: integer
description: Number of records per page
post:
tags: [Patient Visits]