Add type to act and update authorization care requests fields
This commit is contained in:
parent
62a0d21a74
commit
7bf22610d6
|
@ -56,6 +56,12 @@ class AuthorizationCareRequestController extends Controller
|
|||
* title = "Demande autorisation de soins",
|
||||
* required={"health_care_sheet_id", "network_agent_id", "password", "practitioner_lastname", "practitioner_provider_class_id",
|
||||
* "prescriptions" , "exams"},
|
||||
* @OA\Property(
|
||||
* property="issuer_network_agent_id",
|
||||
* description = "ID network de l'agent emetteur de la demande",
|
||||
* type="integer",
|
||||
* example= 43565
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="act_id",
|
||||
* description = "ID de l'acte",
|
||||
|
@ -101,6 +107,7 @@ class AuthorizationCareRequestController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'issuer_network_agent_id' => 'required|integer|exists:networks_agents,id',
|
||||
'act_id' => 'required|integer|exists:nh_acts,id',
|
||||
'insurance_id' => 'required|integer|exists:nh_insurances,id',
|
||||
'beneficiary_id' => 'nullable|int|exists:nh_having_rights,id',
|
||||
|
@ -108,6 +115,7 @@ class AuthorizationCareRequestController extends Controller
|
|||
]);
|
||||
|
||||
$act_id = $request->input('act_id');
|
||||
$issuer_network_agent_id = $request->input('issuer_network_agent_id');
|
||||
$insurance = NhInsurance::find($request->input('insurance_id'));
|
||||
if (!in_array($insurance->state, [InsuranceState::PAID, InsuranceState::PARTIALLY_PAID])) {
|
||||
return $this->errorResponse(__('errors.insurance_not_in_order'));
|
||||
|
@ -140,6 +148,7 @@ class AuthorizationCareRequestController extends Controller
|
|||
DB::beginTransaction();
|
||||
$authRequest = NhAuthorizationOfCareRequest::create([
|
||||
'request_id' => $this->generateRequestID(),
|
||||
'issuer_network_agent_id' => $issuer_network_agent_id,
|
||||
'insurance_id' => $insurance->id,
|
||||
'beneficiary_id' => $beneficiary_id,
|
||||
'to' => isset($beneficiary) ? 'HAVING_RIGHT' : 'INSURED',
|
||||
|
@ -238,12 +247,22 @@ class AuthorizationCareRequestController extends Controller
|
|||
* summary="Lister toutes les demandes autorisation de soin",
|
||||
* tags={"Demandes d'autorisation de soins"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="issuer_network_agent_id",
|
||||
* name="issuer_network_agent_id",
|
||||
* description="ID network de l'agent emetteur",
|
||||
* in="query",
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* parameter="user_id",
|
||||
* name="user_id",
|
||||
* description="ID de l'utilisateur",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
|
@ -277,11 +296,22 @@ class AuthorizationCareRequestController extends Controller
|
|||
public function getAll(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'user_id' => 'nullable|integer|exists:users,id'
|
||||
'user_id' => 'nullable|integer|exists:users,id',
|
||||
'issuer_network_agent_id' => 'nullable|integer|exists:networks_agents,id',
|
||||
]);
|
||||
|
||||
$requests = NhInfosAuthorizationOfCareRequest::with(['network:id,name'])->where('user_id', $request->input('user_id'))
|
||||
->orderBy('created_at', 'DESC')->paginate($request->input('perPage', 10));
|
||||
$user_id = $request->input('user_id');
|
||||
$issuer_network_agent_id = $request->input('issuer_network_agent_id');
|
||||
|
||||
$query = NhInfosAuthorizationOfCareRequest::with(['network:id,name']);
|
||||
if (!empty($user_id)) {
|
||||
$query = $query->where('user_id', $user_id);
|
||||
}
|
||||
if (!empty($issuer_network_agent_id)) {
|
||||
$query = $query->where('issuer_network_agent_id', $issuer_network_agent_id);
|
||||
}
|
||||
|
||||
$requests = $query->orderBy('created_at', 'DESC')->paginate($request->input('perPage', 10));
|
||||
foreach ($requests->items() as $r) {
|
||||
$r->state = trans('states.' . $r->state);
|
||||
if ($r->to == 'HAVING_RIGHT') {
|
||||
|
|
|
@ -337,7 +337,7 @@ class HealthCareSheetController extends Controller
|
|||
|
||||
}
|
||||
|
||||
$classes = $query->select('id', 'code', 'name', 'billing_type' , 'unit_value', 'amount')->get();
|
||||
$classes = $query->select('id', 'code', 'name', 'type', 'billing_type', 'unit_value', 'amount')->get();
|
||||
|
||||
return $this->successResponse($classes);
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ class HealthCareSheetController extends Controller
|
|||
'exams' => 'nullable|array',
|
||||
'exams.*.act_id' => 'required|integer|exists:nh_acts,id',
|
||||
'exams.*.description' => 'required|string',
|
||||
'exams.*.quantity' => 'required|integer',
|
||||
'exams.*.quantity' => 'nullable|integer',
|
||||
]);
|
||||
|
||||
$performances = $request->input('performances', []);
|
||||
|
@ -739,7 +739,7 @@ class HealthCareSheetController extends Controller
|
|||
$exam = NhExam::create([
|
||||
'act_id' => $e['act_id'],
|
||||
'description' => $e['description'],
|
||||
'quantity' => $e['quantity'] ?? null,
|
||||
'quantity' => $e['quantity'] ?? 1,
|
||||
'created_at' => $datetime, 'updated_at' => $datetime,
|
||||
]);
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ class HealthCareSheetController extends Controller
|
|||
}
|
||||
|
||||
|
||||
$query = $query->with(['network:id,name', 'performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name']);
|
||||
$query = $query->with(['network:id,name', 'performances.act:id,code,name,type,billing_type,unit_value,amount', 'exams.act:id,code,name,type,billing_type,unit_value,amount', 'prescriptions.drug_or_device:id,name']);
|
||||
|
||||
if (!empty($state) && $state == 'TO_BILL') {
|
||||
// Liste des feuilles de soins a afficher pour l'execution
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HelperController extends Controller
|
||||
{
|
||||
|
@ -37,4 +38,41 @@ class HelperController extends Controller
|
|||
$url = $request->input('url');
|
||||
return view('pdf-viewer', compact('url'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/exclusions/{network_id}",
|
||||
* summary="Afficher les exclusions d'un reseau",
|
||||
* tags={"Exclusions"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="network_id",
|
||||
* name="network_id",
|
||||
* description="ID du reseau",
|
||||
* in="path",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default="250"
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : {"document" : "Interdit de fumer"},
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function getNetworkExclusions($network_id)
|
||||
{
|
||||
$exclusion = current(DB::select("SELECT document FROM nh_exclusions WHERE network_id = :network_id LIMIT 1", ['network_id' => $network_id]));
|
||||
return $this->successResponse($exclusion);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
*
|
||||
* @property int $id
|
||||
* @property string $request_id
|
||||
* @property int $issuer_network_agent_id
|
||||
* @property int $act_id
|
||||
* @property int $insurance_id
|
||||
* @property int|null $beneficiary_id
|
||||
|
@ -40,6 +41,7 @@ class NhAuthorizationOfCareRequest extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'request_id',
|
||||
'issuer_network_agent_id',
|
||||
'act_id',
|
||||
'insurance_id',
|
||||
'beneficiary_id',
|
||||
|
|
|
@ -18,6 +18,7 @@ class AddAmountToNhActsAndUpdateNhInsurancesState extends Migration
|
|||
DB::statement("alter table nh_insurances modify state enum ('PAID', 'UNDER_STOPPING',
|
||||
'STOPPED', 'EXPIRED', 'UNDER_ACTIVATION', 'UNDER_RENEW','UNDER_ADDING_BENEFICIARY', 'PARTIALLY_PAID', 'SUSPENDED') default 'PAID' not null;");
|
||||
|
||||
$table->enum('type', ['CONSULTATION', 'EXAM'])->default('CONSULTATION')->after('name');
|
||||
$table->string('unit_value')->nullable()->after('billing_type');
|
||||
$table->decimal('amount', 10)->nullable()->after('unit_value');
|
||||
});
|
||||
|
@ -31,7 +32,7 @@ class AddAmountToNhActsAndUpdateNhInsurancesState extends Migration
|
|||
public function down()
|
||||
{
|
||||
Schema::table('nh_acts', function (Blueprint $table) {
|
||||
$table->dropColumn(['amount', 'unit_value']);
|
||||
$table->dropColumn(['amount', 'unit_value', 'type']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhExclusionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_exclusions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('network_id')->unique();
|
||||
$table->longText('document');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_exclusions');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIssuerAgentIdToNhAuthorizationRequests extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('nh_authorization_of_care_requests', function (Blueprint $table) {
|
||||
$table->integer('issuer_network_agent_id')->nullable()->after('request_id')
|
||||
->comment("Id de l'agent emetteur");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('nh_authorization_of_care_requests', function (Blueprint $table) {
|
||||
$table->dropColumn(['issuer_network_agent_id']);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateNhInfosAuthorizationOfCareRequestsView extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement("CREATE OR REPLACE VIEW nh_infos_authorization_of_care_requests AS
|
||||
SELECT r.* , nhi.user_id , na.name as act_name , na.code as act_code, nnc.network_id , u.lastname as user_lastname , u.firstname as user_firstname , u.phone as user_phone, u.email as user_email ,
|
||||
ag.lastname as issuer_agent_lastname, ag.firstname as issuer_agent_firstname , ag.phone as issuer_agent_phone,
|
||||
nva.lastname as validating_agent_lastname, nva.firstname as validating_agent_firstname , nva.phone as validating_agent_phone, nva.email as validating_agent_email, nhr.lastname as beneficiary_lastname , nhr.firstname as beneficiary_firstname
|
||||
FROM nh_authorization_of_care_requests r JOIN nh_insurances nhi ON nhi.id = r.insurance_id JOIN users u ON nhi.user_id = u.id JOIN nh_acts na on na.id = r.act_id JOIN nh_networks_configs nnc on na.nh_network_config_id = nnc.id
|
||||
LEFT JOIN nh_having_rights nhr on nhr.id = r.beneficiary_id LEFT JOIN nh_validating_agents nva on r.validating_agent_id = nva.id
|
||||
LEFT JOIN agent_plus ag on r.issuer_network_agent_id = ag.network_agent_id;
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -72,4 +72,6 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route
|
|||
$router->get('authorizations-care-requests', 'AuthorizationCareRequestController@getAll');
|
||||
$router->post('authorizations-care-requests', 'AuthorizationCareRequestController@store');
|
||||
$router->put('authorizations-care-requests', 'AuthorizationCareRequestController@treatRequest');
|
||||
|
||||
$router->get('exclusions/{network_id}', 'HelperController@getNetworkExclusions');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue