Update health care sheet infos view

This commit is contained in:
Djery-Tom 2021-12-22 10:01:55 +01:00
parent 1d5113ad26
commit 41c4e33947
3 changed files with 13 additions and 6 deletions

View File

@ -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);
}

View File

@ -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');
}

View File

@ -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");
}