Improve execution of health care sheet v3

This commit is contained in:
Djery-Tom 2021-12-20 18:28:04 +01:00
parent bad3b7bca8
commit a67bf78966
3 changed files with 47 additions and 0 deletions

View File

@ -812,6 +812,7 @@ class HealthCareSheetController extends Controller
$healthCareSheet = $sheet->replicate(); $healthCareSheet = $sheet->replicate();
$healthCareSheet->health_care_sheet_id = $this->generateSheetID(); $healthCareSheet->health_care_sheet_id = $this->generateSheetID();
$healthCareSheet->network_agent_id = $request->input('network_agent_id');
$healthCareSheet->practitioner_lastname = $request->input('practitioner_lastname'); $healthCareSheet->practitioner_lastname = $request->input('practitioner_lastname');
$healthCareSheet->practitioner_firstname = $request->input('practitioner_firstname'); $healthCareSheet->practitioner_firstname = $request->input('practitioner_firstname');
$healthCareSheet->practitioner_provider_class_id = $request->input('practitioner_provider_class_id'); $healthCareSheet->practitioner_provider_class_id = $request->input('practitioner_provider_class_id');

View File

@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
class CreateNhInfosHealthCareSheetsView extends Migration class CreateNhInfosHealthCareSheetsView extends Migration

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class UpdateNhInfosHealthCareSheetsView extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("CREATE OR REPLACE VIEW `nh_infos_health_care_sheets` AS
SELECT nhi.insured_id,
nhi.network_id,
nhi.user_id,
nhcs.*,
nhpc.name as practitioner_provider_class,
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
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
ORDER BY nhcs.created_at DESC");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}