From 41c4e339471a7d14d3d641bb4ec95bf6d9f5ae05 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Wed, 22 Dec 2021 10:01:55 +0100 Subject: [PATCH] Update health care sheet infos view --- app/Exceptions/Handler.php | 3 ++- app/Traits/Helper.php | 6 +++--- ..._154710_update_nh_infos_health_care_sheets_view.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 50be8ef..c1c1395 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,6 +3,7 @@ namespace App\Exceptions; use App\Traits\ApiResponser; +use ErrorException; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ServerException; use Illuminate\Auth\Access\AuthorizationException; @@ -105,7 +106,7 @@ class Handler extends ExceptionHandler return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR); } - if ($exception instanceof \ErrorException) { + if ($exception instanceof ErrorException) { return $this->errorResponse($exception->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR); } diff --git a/app/Traits/Helper.php b/app/Traits/Helper.php index 6067b3c..9e16b94 100644 --- a/app/Traits/Helper.php +++ b/app/Traits/Helper.php @@ -83,8 +83,8 @@ trait Helper { $country = CountriesCurrency::find($id_country); $country_code = isset($country) ? $country->code_country : 'GA'; - $timezone = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $country_code); - $date = (sizeof($timezone) > 0) ? new DateTime('now', new \DateTimeZone($timezone[0])) : new \DateTime(); + $timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code); + $date = (sizeof($timezone) > 0) ? new DateTime('now', new DateTimeZone($timezone[0])) : new DateTime(); return $date->format('Y-m-d H:i:s'); } @@ -92,7 +92,7 @@ trait Helper public function getCurrentTimeByCountryCode($country_code = 'GA') { $timezone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code); - $date = (sizeof($timezone) > 0) ? new DateTime('now', new DateTimeZone($timezone[0])) : new \DateTime(); + $date = (sizeof($timezone) > 0) ? new DateTime('now', new DateTimeZone($timezone[0])) : new DateTime(); return $date->format('Y-m-d H:i:s'); } diff --git a/database/migrations/2021_12_20_154710_update_nh_infos_health_care_sheets_view.php b/database/migrations/2021_12_20_154710_update_nh_infos_health_care_sheets_view.php index deb473c..5588b00 100644 --- a/database/migrations/2021_12_20_154710_update_nh_infos_health_care_sheets_view.php +++ b/database/migrations/2021_12_20_154710_update_nh_infos_health_care_sheets_view.php @@ -15,7 +15,7 @@ class UpdateNhInfosHealthCareSheetsView extends Migration public function up() { DB::statement("CREATE OR REPLACE VIEW `nh_infos_health_care_sheets` AS - SELECT nhi.insured_id, + SELECT nhi.insured_id, nhi.network_id, nhi.user_id, nhcs.*, @@ -23,13 +23,19 @@ class UpdateNhInfosHealthCareSheetsView extends Migration ag.lastname as institution_name, ag.code_membre as institution_code, cc.currency_code, - p_nhcs.health_care_sheet_id as prescription_health_care_sheet_id + p_nhcs.health_care_sheet_id as consultation_health_care_sheet_id, + p_nhcs.practitioner_lastname as consultation_practitioner_lastname, + p_nhcs.practitioner_firstname as consultation_practitioner_firstname, + p_ag.lastname as consultation_institution_name, + p_nhpc.name as consultation_practitioner_provider_class FROM nh_health_care_sheets nhcs INNER JOIN nh_insurances nhi ON nhi.id = nhcs.insurance_id INNER JOIN agent_plus ag ON ag.network_agent_id = nhcs.network_agent_id INNER JOIN countries_currencies cc ON cc.id = ag.country_id INNER JOIN nh_provider_classes nhpc ON nhpc.id = nhcs.practitioner_provider_class_id LEFT JOIN nh_health_care_sheets p_nhcs ON p_nhcs.id = nhcs.prescription_sheet_id + LEFT JOIN agent_plus p_ag ON p_nhcs.network_agent_id = p_ag.network_agent_id + LEFT JOIN nh_provider_classes p_nhpc ON p_nhpc.id = p_nhcs.practitioner_provider_class_id ORDER BY nhcs.created_at DESC"); }