diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 7cb4334..d2b2a52 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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) { diff --git a/app/Controllers/AreaGeoController.php b/app/Controllers/AreaGeoController.php index c2f1797..6fac970 100644 --- a/app/Controllers/AreaGeoController.php +++ b/app/Controllers/AreaGeoController.php @@ -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']]; diff --git a/app/Controllers/PatVisitController.php b/app/Controllers/PatVisitController.php index 7fc7591..045eb37 100644 --- a/app/Controllers/PatVisitController.php +++ b/app/Controllers/PatVisitController.php @@ -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 } } diff --git a/app/Models/Patient/PatientModel.php b/app/Models/Patient/PatientModel.php index 540cea5..95dc6a5 100644 --- a/app/Models/Patient/PatientModel.php +++ b/app/Models/Patient/PatientModel.php @@ -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"); diff --git a/public/api-docs.yaml b/public/api-docs.yaml index 025d4af..144bbf3 100644 --- a/public/api-docs.yaml +++ b/public/api-docs.yaml @@ -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]