Add endpoint to consult health care sheet
This commit is contained in:
parent
2005b15208
commit
4ceddac738
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
abstract class HealthCareSheetType
|
||||
{
|
||||
const CONSULTATION = 'CONSULTATION';
|
||||
const EXECUTION = 'EXECUTION';
|
||||
}
|
|
@ -3,12 +3,15 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\HealthCareSheetType;
|
||||
use App\InsuranceState;
|
||||
use App\InsuranceSubscriptionState;
|
||||
use App\Models\AgentPlus;
|
||||
use App\Models\NhAct;
|
||||
use App\Models\NhDrugsAndDevice;
|
||||
use App\Models\NhExam;
|
||||
use App\Models\NhHealthCareSheet;
|
||||
use App\Models\NhHealthCareSheetsExam;
|
||||
use App\Models\NhHealthCareSheetsHistory;
|
||||
use App\Models\NhHealthCareSheetsPerformance;
|
||||
use App\Models\NhHealthCareSheetsPrescription;
|
||||
|
@ -17,6 +20,7 @@ use App\Models\NhInsurancesSubscription;
|
|||
use App\Models\NhMedicalPrescription;
|
||||
use App\Models\NhNetworksConfig;
|
||||
use App\Models\NhPerformance;
|
||||
use App\Models\NhProviderClass;
|
||||
use App\Traits\ApiResponser;
|
||||
use App\Traits\Helper;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -40,7 +44,8 @@ class HealthCareSheetController extends Controller
|
|||
* name="network_id",
|
||||
* description="ID du reseau",
|
||||
* @OA\Schema(
|
||||
* type="integer"
|
||||
* type="integer",
|
||||
* default = 250
|
||||
* ),
|
||||
* in="query",
|
||||
* required=true
|
||||
|
@ -162,8 +167,297 @@ class HealthCareSheetController extends Controller
|
|||
return $this->successResponse(trans('messages.drug_device_saved'));
|
||||
}
|
||||
|
||||
public function storeHealthCareSheet(Request $request)
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/provider-classes",
|
||||
* summary="Obtenir toutes les classes de prestataires d'un reseau",
|
||||
* tags={"Classes de prestataires"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="network_id",
|
||||
* name="network_id",
|
||||
* description="ID du reseau",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default = 250
|
||||
* ),
|
||||
* in="query",
|
||||
* required=true
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : {{"id":2,"name":"Pharmacien"}},
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function getNetworkProviderClasses(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
]);
|
||||
|
||||
$network_id = $request->input('network_id');
|
||||
|
||||
$classes = NhProviderClass::whereHas('network_config', function ($query) use ($network_id) {
|
||||
return $query->where('network_id', $network_id);
|
||||
})->get(['id', 'name']);
|
||||
|
||||
return $this->successResponse($classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/acts",
|
||||
* summary="Obtenir ou rechercher par code tous les actes d'un reseau",
|
||||
* tags={"Actes"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\Parameter(
|
||||
* parameter="network_id",
|
||||
* name="network_id",
|
||||
* description="ID du reseau",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* default = 250
|
||||
* ),
|
||||
* in="query",
|
||||
* required=true
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* parameter="code",
|
||||
* name="code",
|
||||
* description="Code de l'acte",
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* default = "CODE1"
|
||||
* ),
|
||||
* in="query",
|
||||
* required=false
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : {{"id":2,"code": "CODE2", "name":"Les actes infirmiers"}},
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function getNetworkActs(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'network_id' => 'required|integer|exists:networks,id',
|
||||
'code' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$network_id = $request->input('network_id');
|
||||
|
||||
$query = NhAct::whereHas('network_config', function ($query) use ($network_id) {
|
||||
return $query->where('network_id', $network_id);
|
||||
});
|
||||
|
||||
if ($request->has('code')) {
|
||||
$code = $request->input('code');
|
||||
$query = $query->where('code', 'like', '%' . $code . '%');
|
||||
}
|
||||
|
||||
$classes = $query->get(['id', 'code', 'name']);
|
||||
|
||||
return $this->successResponse($classes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/health-care-sheets/consultation",
|
||||
* summary="Consulter ou prescrire une feuille de soins",
|
||||
* tags={"Feuilles de soins"},
|
||||
* security={{"api_key":{}}},
|
||||
* @OA\RequestBody(
|
||||
* description="Corps de la requete",
|
||||
* required=true,
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* schema="consult_health_care_sheet",
|
||||
* title = "Consulter ou prescrire une feuille de soins",
|
||||
* required={"insured_id", "network_agent_id", "password", "practitioner_lastname", "practitioner_provider_class_id", "care_condition"},
|
||||
* @OA\Property(
|
||||
* property="insured_id",
|
||||
* description = "Numéro immatriculation de l’assuré",
|
||||
* type="string",
|
||||
* example= "INSUF45548"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="network_agent_id",
|
||||
* description = "ID de l'agent qui saisit la feuille de soin dans le reseau",
|
||||
* type="integer",
|
||||
* example= 4325
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="password",
|
||||
* description = "Mot de passe de l'agent",
|
||||
* type="string",
|
||||
* example= "password"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="beneficiary_id",
|
||||
* description = "ID du beneficiaire , s'il s'agit d'une feuille de soins pour beneficiaire",
|
||||
* type="integer",
|
||||
* example= 4
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="practitioner_lastname",
|
||||
* description = "Nom du pratricien",
|
||||
* type="string",
|
||||
* example= "Dr DIETCHI"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="practitioner_firstname",
|
||||
* description = "Prenom du pratricien",
|
||||
* type="string",
|
||||
* example= "Djery"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="practitioner_provider_class_id",
|
||||
* description = "ID de la classe de prestataire du praticien",
|
||||
* type="integer",
|
||||
* example= 12
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="care_condition",
|
||||
* description = "Condition de prise en charge",
|
||||
* type="string",
|
||||
* enum={"CURRENT_AFFECTION","LONG_TERM_AFFECTION","EXONERATION"},
|
||||
* example= "CURRENT_AFFECTION"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="accident_date",
|
||||
* description = "Date de l'accident en cas d'accident",
|
||||
* type="string",
|
||||
* example= "2021-10-01"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="pregnancy_start_at",
|
||||
* description = "Date de début de la grossesse (si grossesse)",
|
||||
* type="string",
|
||||
* example= "2021-01-01"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="pregnancy_end_at",
|
||||
* description = "Date de fin de la grossese (si grossesse)",
|
||||
* type="string",
|
||||
* example= "2021-09-01"
|
||||
* ),
|
||||
* @OA\Property(property="performances",
|
||||
* type="array",
|
||||
* description="Listes des prestations",
|
||||
* @OA\Items(ref="#/components/schemas/add_performance")
|
||||
* ),
|
||||
* @OA\Property(property="prescriptions",
|
||||
* type="array",
|
||||
* description="Listes des prescriptions medicales",
|
||||
* @OA\Items(ref="#/components/schemas/add_prescription")
|
||||
* ),
|
||||
* @OA\Property(property="exams",
|
||||
* type="array",
|
||||
* description="Listes des examens",
|
||||
* @OA\Items(ref="#/components/schemas/add_exam")
|
||||
* )
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="OK",
|
||||
* @OA\JsonContent(
|
||||
* ref="#/components/schemas/ApiResponse",
|
||||
* example = {
|
||||
* "status" : 200,
|
||||
* "response" : "Médicament / Appareillage enregistré",
|
||||
* "error":null
|
||||
* }
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function storeHealthCareSheetConsultation(Request $request)
|
||||
{
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="add_performance",
|
||||
* title = "Ajouter une prestation",
|
||||
* required={"act_id", "amount"},
|
||||
* @OA\Property(property="act_id",
|
||||
* type="integer",
|
||||
* example = 2,
|
||||
* description="ID de l'acte "
|
||||
* ),
|
||||
* @OA\Property(property="amount",
|
||||
* type="number",
|
||||
* example=30000,
|
||||
* description="Montant de la prestation"
|
||||
* ),
|
||||
* @OA\Property(property="home_visit_fees",
|
||||
* type="number",
|
||||
* example=5000,
|
||||
* description="Frais de deplacement pour visiste à domicile "
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="add_prescription",
|
||||
* title = "Ajouter une prescription medicale",
|
||||
* required={"drug_or_device_id", "dosage", "quantity"},
|
||||
* @OA\Property(property="drug_or_device_id",
|
||||
* type="integer",
|
||||
* example = 2,
|
||||
* description="ID du medicament ou appareillage"
|
||||
* ),
|
||||
* @OA\Property(property="dosage",
|
||||
* type="string",
|
||||
* example="3 fois / jour pendant 1e semaine",
|
||||
* description="Posologie ou frequence de consommation"
|
||||
* ),
|
||||
* @OA\Property(property="quantity",
|
||||
* type="int",
|
||||
* example=5,
|
||||
* description="Quantité"
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="add_exam",
|
||||
* title = "Ajouter un examen",
|
||||
* required={"act_id", "description", "quantity"},
|
||||
* @OA\Property(property="act_id",
|
||||
* type="integer",
|
||||
* example = 2,
|
||||
* description="ID de l'acte"
|
||||
* ),
|
||||
* @OA\Property(property="description",
|
||||
* type="string",
|
||||
* example="Une descrition de l'examen",
|
||||
* description="Description de l'examene"
|
||||
* ),
|
||||
* @OA\Property(property="quantity",
|
||||
* type="int",
|
||||
* example=5,
|
||||
* description="Quantité"
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
$this->validate($request, [
|
||||
'insured_id' => 'required|string',
|
||||
'network_agent_id' => 'required|integer|exists:networks_agents,id',
|
||||
|
@ -177,14 +471,17 @@ class HealthCareSheetController extends Controller
|
|||
'pregnancy_start_at' => 'nullable|date_format:Y-m-d|before:today',
|
||||
'pregnancy_end_at' => 'required_with:pregnancy_start_at|date_format:Y-m-d|after:pregnancy_start_at',
|
||||
'performances' => 'nullable|array',
|
||||
'performances.*.act_code' => 'required|string',
|
||||
'performances.*.act_id' => 'required|integer|exists:nh_acts,id',
|
||||
'performances.*.amount' => 'required|numeric',
|
||||
'performances.*.home_visit_fees' => 'nullable|numeric',
|
||||
'prescriptions' => 'nullable|array',
|
||||
'prescriptions.*.drug_or_device_id' => 'required|integer|exists:nh_drugs_and_devices,id',
|
||||
'prescriptions.*.dosage' => 'required|string',
|
||||
'prescriptions.*.quantity' => 'required|integer',
|
||||
'prescriptions.*.unit_price' => 'required|numeric'
|
||||
'exams' => 'nullable|array',
|
||||
'exams.*.act_id' => 'required|integer|exists:nh_acts,id',
|
||||
'exams.*.description' => 'required|string',
|
||||
'exams.*.quantity' => 'required|integer',
|
||||
]);
|
||||
|
||||
$insurance = NhInsurance::where('insured_id', $request->input('insured_id'))->where('state', InsuranceState::PAID)->first();
|
||||
|
@ -199,7 +496,7 @@ class HealthCareSheetController extends Controller
|
|||
if ($request->has('beneficiary_id')) {
|
||||
$beneficiary = $insurance->beneficiaries()->where('nh_having_rights.id', $request->input('beneficiary_id'))->first();
|
||||
if (!isset($beneficiary)) {
|
||||
return $this->errorResponse("Ce béneficiaire n'existe pas");
|
||||
return $this->errorResponse(trans('errors.beneficiary_not_found'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,13 +534,13 @@ class HealthCareSheetController extends Controller
|
|||
'patient_lastname' => isset($beneficiary) ? $beneficiary->lastname : $insurance->user->lastname,
|
||||
'patient_firstname' => isset($beneficiary) ? $beneficiary->firstname : $insurance->user->firstname,
|
||||
'patient_situation' => isset($beneficiary) ? 'HAVING_RIGHT' : 'INSURED',
|
||||
'type' => HealthCareSheetType::CONSULTATION,
|
||||
'state' => InsuranceSubscriptionState::UNDER_VALIDATION
|
||||
]));
|
||||
|
||||
foreach ($request->input('performances', []) as $p) {
|
||||
$act = NhAct::where('code', $p['act_code'])->first();
|
||||
$performance = NhPerformance::create([
|
||||
'act_id' => $act->id,
|
||||
'act_id' => $p['act_id'],
|
||||
'amount' => $p['amount'],
|
||||
'home_visit_fees' => $p['home_visit_fees'] ?? null,
|
||||
'moderator_ticket' => $insuredPart * $p['amount'], // to calculate,
|
||||
|
@ -259,10 +556,7 @@ class HealthCareSheetController extends Controller
|
|||
}
|
||||
|
||||
foreach ($request->input('prescriptions', []) as $p) {
|
||||
$amount = $p['unit_price'] * $p['quantity'];
|
||||
$prescription = NhMedicalPrescription::create(array_merge($p, [
|
||||
'insured_paid_amount' => $insuredPart * $amount, // to calculate,
|
||||
'insurer_paid_amount' => $insurerPart * $amount, // to calculate, montant de l'assurance
|
||||
'created_at' => $datetime, 'updated_at' => $datetime,
|
||||
]));
|
||||
|
||||
|
@ -273,6 +567,21 @@ class HealthCareSheetController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
foreach ($request->input('exams', []) as $e) {
|
||||
$exam = NhExam::create([
|
||||
'act_id' => $e['act_id'],
|
||||
'description' => $e['description'],
|
||||
'quantity' => $e['quantity'] ?? null,
|
||||
'created_at' => $datetime, 'updated_at' => $datetime,
|
||||
]);
|
||||
|
||||
NhHealthCareSheetsExam::create([
|
||||
'sheet_id' => $healthCareSheet->id,
|
||||
'exam_id' => $exam->id,
|
||||
'created_at' => $datetime, 'updated_at' => $datetime,
|
||||
]);
|
||||
}
|
||||
|
||||
NhHealthCareSheetsHistory::create([
|
||||
'action' => 'ADD',
|
||||
'health_care_sheet_id' => $healthCareSheet->health_care_sheet_id,
|
||||
|
@ -281,7 +590,7 @@ class HealthCareSheetController extends Controller
|
|||
]);
|
||||
|
||||
DB::commit();
|
||||
return $this->successResponse(trans('messages.successful_transaction'));
|
||||
return $this->successResponse(trans('messages.consultation_or_prescription_carried_out'));
|
||||
} catch (Throwable $e) {
|
||||
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
|
||||
DB::rollBack();
|
||||
|
|
|
@ -38,4 +38,9 @@ class NhAct extends Model
|
|||
'billing_type',
|
||||
'authorization_type'
|
||||
];
|
||||
|
||||
public function network_config()
|
||||
{
|
||||
return $this->belongsTo(NhNetworksConfig::class, 'nh_network_config_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhExam
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $act_id
|
||||
* @property string $description
|
||||
* @property int $quantity
|
||||
* @property float $unit_price
|
||||
* @property float $insured_paid_amount
|
||||
* @property float $insurer_paid_amount
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhExam extends Model
|
||||
{
|
||||
protected $table = 'nh_exams';
|
||||
|
||||
protected $casts = [
|
||||
'act_id' => 'int',
|
||||
'quantity' => 'int',
|
||||
'unit_price' => 'float',
|
||||
'insured_paid_amount' => 'float',
|
||||
'insurer_paid_amount' => 'float'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'act_id',
|
||||
'description',
|
||||
'quantity',
|
||||
'unit_price',
|
||||
'insured_paid_amount',
|
||||
'insurer_paid_amount'
|
||||
];
|
||||
}
|
|
@ -26,7 +26,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property Carbon|null $accident_date
|
||||
* @property Carbon|null $pregnancy_start_at
|
||||
* @property Carbon|null $pregnancy_end_at
|
||||
* @property float $amount
|
||||
* @property string $type
|
||||
* @property string $state
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
|
@ -40,7 +40,6 @@ class NhHealthCareSheet extends Model
|
|||
protected $casts = [
|
||||
'insurance_id' => 'int',
|
||||
'network_agent_id' => 'int',
|
||||
'amount' => 'float'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
|
@ -63,7 +62,7 @@ class NhHealthCareSheet extends Model
|
|||
'accident_date',
|
||||
'pregnancy_start_at',
|
||||
'pregnancy_end_at',
|
||||
'amount',
|
||||
'type',
|
||||
'state'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class NhHealthCareSheetsExam
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $sheet_id
|
||||
* @property int $exam_id
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class NhHealthCareSheetsExam extends Model
|
||||
{
|
||||
protected $table = 'nh_health_care_sheets_exams';
|
||||
|
||||
protected $casts = [
|
||||
'sheet_id' => 'int',
|
||||
'exam_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'sheet_id',
|
||||
'exam_id'
|
||||
];
|
||||
}
|
|
@ -32,4 +32,9 @@ class NhProviderClass extends Model
|
|||
'nh_network_config_id',
|
||||
'name'
|
||||
];
|
||||
|
||||
public function network_config()
|
||||
{
|
||||
return $this->belongsTo(NhNetworksConfig::class, 'nh_network_config_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhExamsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_exams', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('act_id')->comment("Classe ou acte de l’examen");
|
||||
$table->text('description');
|
||||
$table->tinyInteger('quantity');
|
||||
$table->decimal('unit_price')->nullable();
|
||||
$table->decimal('insured_paid_amount')->nullable()->comment("Part à payer par assuré");
|
||||
$table->decimal('insurer_paid_amount')->nullable()->comment("Part à la charge assureur ");
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_exams');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeInNhHealthCareSheetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('nh_health_care_sheets', function (Blueprint $table) {
|
||||
$table->enum('type', ['CONSULTATION', 'PRESCRIPTION'])->default('CONSULTATION')->after('pregnancy_end_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('nh_health_care_sheets', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhHealthCareSheetsExamsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('nh_health_care_sheets_exams', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('sheet_id');
|
||||
$table->integer('exam_id');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('nh_health_care_sheets_exams');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MakeUnitPriceAndInsuranceAmountsNullablesForHealthCareSheets extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('nh_medical_prescriptions', function (Blueprint $table) {
|
||||
$table->decimal('unit_price')->nullable()->change();
|
||||
$table->decimal('insured_paid_amount')->nullable()->change();
|
||||
$table->decimal('insurer_paid_amount')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateNhInfosHealthCareSheetsView 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
|
||||
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
|
||||
ORDER BY nhcs.created_at DESC");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -33,4 +33,5 @@ return [
|
|||
"subscription_cannot_be_submitted" => "Your previous application :state . You cannot submit another one at this time",
|
||||
"not_insured" => "You are not insured",
|
||||
'drug_device_already_exists' => "This drug / device code already exists",
|
||||
"beneficiary_not_found" => "This beneficiary does not exist"
|
||||
];
|
||||
|
|
|
@ -91,4 +91,5 @@ Your request to add a beneficiary to your insurance is being validated.
|
|||
- Number of beneficiaries : :number_of_beneficiaries
|
||||
",
|
||||
'drug_device_saved' => "Drug / Device registered",
|
||||
'consultation_or_prescription_carried_out' => "Consultation or prescription carried out"
|
||||
];
|
||||
|
|
|
@ -19,5 +19,8 @@ return [
|
|||
"SYRUP" => "Syrup",
|
||||
"SOLUTION" => "Solution",
|
||||
"SUPPOSITORY" => "Suppository",
|
||||
"DEVICE" => "Device"
|
||||
"DEVICE" => "Device",
|
||||
'CURRENT_AFFECTION' => "CURRENT AFFECTION",
|
||||
'LONG_TERM_AFFECTION' => "LONG TERM AFFECTION",
|
||||
'EXONERATION' => "EXONERATION"
|
||||
];
|
||||
|
|
|
@ -33,4 +33,5 @@ return [
|
|||
"subscription_cannot_be_submitted" => "Votre demande précédente :state. Vous ne pouvez pas en soumettre une autre pour l'instant",
|
||||
"not_insured" => "Vous n'êtes pas assuré",
|
||||
'drug_device_already_exists' => "Ce code médicament / appareillage existe deja",
|
||||
"beneficiary_not_found" => "Ce bénéficiaire n'existe pas"
|
||||
];
|
||||
|
|
|
@ -91,4 +91,5 @@ Votre demande d'ajout d'ayant droit à votre assurance est en cours de validatio
|
|||
- Nombre d'ayants droit : :number_of_beneficiaries
|
||||
",
|
||||
'drug_device_saved' => "Médicament / Appareillage enregistré",
|
||||
'consultation_or_prescription_carried_out' => "Consultation ou prescription effectuée"
|
||||
];
|
||||
|
|
|
@ -19,5 +19,8 @@ return [
|
|||
"SYRUP" => "Sirop",
|
||||
"SOLUTION" => "Solution",
|
||||
"SUPPOSITORY" => "Suppositoire",
|
||||
"DEVICE" => "Appareillage"
|
||||
"DEVICE" => "Appareillage",
|
||||
'CURRENT_AFFECTION' => "AFFECTION COURANTE",
|
||||
'LONG_TERM_AFFECTION' => "AFFECTION LONGUE DURÉE",
|
||||
'EXONERATION' => "EXONERATION"
|
||||
];
|
||||
|
|
|
@ -39,7 +39,11 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route
|
|||
|
||||
$router->get('drugs-and-devices', 'HealthCareSheetController@getDrugsAndDevices');
|
||||
$router->post('drugs-and-devices', 'HealthCareSheetController@storeDrugsAndDevices');
|
||||
$router->post('health-care-sheets', 'HealthCareSheetController@storeHealthCareSheet');
|
||||
$router->get('provider-classes', 'HealthCareSheetController@getNetworkProviderClasses');
|
||||
$router->get('acts', 'HealthCareSheetController@getNetworkActs');
|
||||
|
||||
$router->post('health-care-sheets/consultation', 'HealthCareSheetController@storeHealthCareSheetConsultation');
|
||||
$router->post('health-care-sheets/execution', 'HealthCareSheetController@storeHealthCareSheetExecution');
|
||||
|
||||
//QRCode for agents
|
||||
$router->get('qrcode/generate/{id_user}', 'QRCodeController@generate');
|
||||
|
|
Loading…
Reference in New Issue