Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/corpentunida-org/corpen/llms.txt

Use this file to discover all available pages before exploring further.

The Insurance (Seguros) module delivers full lifecycle management for group life insurance plans offered to cooperative members. It covers insured-person registration, policy issuance, plan and coverage catalogues, policy change events (novedades), beneficiary designation, claims filing and resolution, and financial exports. All routes are prefixed under /seguros and require the auth middleware; several sub-resources additionally require specific candirect permissions.
candirect permission guards must be assigned to the relevant user roles in the permissions management panel before those routes become accessible. Without the correct permission, requests are rejected at the middleware level. See the table below for which routes require which permission string.

Sub-Resource Reference

Sub-resourceURL PrefixRequired PermissionDescription
poliza/seguros/polizacandirect:seguros.poliza.indexInsurance policies (one per insured person)
plan/seguros/planauth onlyPlan catalogue with coverage, value, and premium
cobertura/seguros/coberturaauth onlyCoverage type definitions
beneficiario/seguros/beneficiarioauth onlyPolicy beneficiary designations
convenio/seguros/conveniocandirect:seguros.convenio.indexInsurance agreements with providers
reclamacion/seguros/reclamacioncandirect:seguros.reclamacion.indexClaims (sinistros) management
novedades/seguros/novedadesauth onlyPolicy change events
beneficios/seguros/beneficioscandirect:seguros.beneficios.indexPolicy benefit records
condiciones(via plan routes)auth onlyAge-based plan conditions

Full Route Reference

MethodPathRoute NameDescription
GET/seguros/polizaseguros.poliza.indexList policies (paginated by AF parentesco)
GET/seguros/poliza/createseguros.poliza.createNew policy form
POST/seguros/polizaseguros.poliza.storeCreate insured person and policy
GET/seguros/poliza/{id}seguros.poliza.showPolicy detail with group, beneficiaries, novedades
GET/seguros/poliza/formatoseguros.poliza.formatoDownload blank policy upload template (Excel)
POST/seguros/poliza/uploadseguros.poliza.uploadUpload Excel to update primapagar per policy
POST/seguros/poliza/create/uploadseguros.poliza.createuploadBulk-create policies from Excel
POST/seguros/poliza/nuevo-convenio/uploadseguros.poliza.nuevo-convenioCSV bulk-update plan and premium fields
GET/seguros/poliza/create/uploadseguros.poliza.viewuploadUpload panel view
GET/seguros/polizas/polizas-no-actualizadasseguros.poliza.listar-no-actualizadasList policies not matched in last CSV upload
GET/seguros/seguros/cxcseguros.poliza.downloadExport active policies as CXC Excel
GET/seguros/polizaname/{name}poliza.searchSearch policies by insured name
DELETE/seguros/poliza/{id}seguros.poliza.destroyCancel a policy (creates novedad type 3)
GET/seguros/planseguros.planes.indexList insurance plans
GET/seguros/planes/{edad}seguros.planes.getplanesAge-based plan lookup
POST/seguros/planes/duplicar-gruposeguros.planes.duplicarGrupoDuplicate a condition group of plans
POST/seguros/planes/{plan}/duplicarseguros.planes.duplicarDuplicate a single plan
GET/seguros/coberturaseguros.cobertura.indexList coverages
GET/seguros/beneficiarioseguros.beneficiario.indexList beneficiaries
GET/seguros/beneficiario/createseguros.beneficiario.createNew beneficiary form
POST/seguros/beneficiarioseguros.beneficiario.storeAdd beneficiary (also creates novedad type 4)
GET/seguros/beneficiario/{id}/editseguros.beneficiario.editEdit beneficiary form
PUT/PATCH/seguros/beneficiario/{id}seguros.beneficiario.updateUpdate beneficiary details
DELETE/seguros/beneficiario/{id}seguros.beneficiario.destroyDeactivate beneficiary (activo = 0)
GET/seguros/convenioseguros.convenio.indexList insurance agreements
GET/seguros/reclamacionseguros.reclamacion.indexList all claims with status, gender, and overdue flags
GET/seguros/reclamacion/createseguros.reclamacion.createNew claim form (requires active policy)
POST/seguros/reclamacionseguros.reclamacion.storeFile a new claim
GET/seguros/reclamacion/{id}/editseguros.reclamacion.editEdit / advance a claim
PUT/PATCH/seguros/reclamacion/{id}seguros.reclamacion.updateUpdate claim state
POST/seguros/reclamacion/generarpdfseguros.reclamacion.generarpdfDownload claims report PDF (filtered by year)
GET/seguros/reclamacion/informe/excelseguros.reclamacion.downloadExport siniestros report to Excel
GET/seguros/seguros/reclamacion/informe-completoseguros.reclamacion.exportarInformeCompletoFull grouped claims report (Excel, by state)
GET/seguros/dashboard/reclamacionesseguros.reclamaciones.dashboardClaims analytics dashboard
GET/seguros/novedadesseguros.novedades.indexList novedades by state tab
POST/seguros/novedadesseguros.novedades.storeCreate a novedad
GET/seguros/novedades/{id}seguros.novedades.showNovedad creation form for an insured
GET/seguros/novedades/{id}/editseguros.novedades.editEdit a pending novedad
PUT/PATCH/seguros/novedades/{id}seguros.novedades.updateApprove / reject / update novedades (batch or individual)
DELETE/seguros/novedades/{id}seguros.novedades.destroyRegister a withdrawal novedad (type 3)
GET/seguros/novedades/{id}/formularioseguros.novedades.formularioView attached PDF file from S3
GET/seguros/seguros/novedades/downloadseguros.novedades.downloadDownload pending novedades as Excel
GET/seguros/beneficiosseguros.beneficios.indexList policy benefits
POST/seguros/beneficios/listseguros.beneficios.listFiltered benefit list
POST/seguros/seguros/filtopolizasseguros.poliza.filtrosExport filtered policies to PDF
POST/seguros/seguros/filtopolizas/excelseguros.poliza.filtroexcelExport filtered policies to Excel

Data Models

Insured persons registered in the module. Stored in SEG_terceros.
ColumnTypeNotes
cedulabigint (PK)National ID
nombrestringFull name (uppercase)
fechaNacimientostringDate of birth
telefonostringContact phone
generostringGender
distritostringDistrict code

Creating a Policy

1

Open the policy creation form

Navigate to GET /seguros/poliza/create. The form requires the insured person’s cédula, name, date of birth, phone number, gender, and district. You also select whether this person is the titular (AF) or a dependent of an existing titular.
2

Validate the person against SiaSoft

POST /seguros/poliza first checks whether the cédula already exists in SEG_terceros. If it does, the user is redirected back with an error. Otherwise, ComaeTerController@show is called to verify the cédula against the SiaSoft external directory — if the cédula is not found there, the process also stops with an error.
3

Create the third-party and insured records

On a valid cédula, the controller creates:
  1. A SEG_terceros record with the supplied personal data.
  2. A SEG_asegurados record:
    • parentesco = 'AF' and titular = cedula if the person is a principal insured.
    • The supplied parentesco and titular (head of family group’s cédula) if the person is a dependent.
Both creation steps are recorded in the Auditoría log as TERCERO CREADO and ASEGURADO CREADO. A POLIZA CREADA audit entry is also written; the policy record itself is associated after the insured is created.

Filing a Claim (Reclamación)

1

Confirm the policy is active

GET /seguros/reclamacion/create?a={cedula} looks up the policy (SEG_polizas) for the insured person. If the policy’s active field is false, the request is aborted with HTTP 403.
2

Complete the claim form

The form presents:
  • Coverage (idCobertura) — loaded from plan.coberturas via the policy’s plan relationship.
  • Diagnosis (idDiagnostico) — selectable from SEG_diagnosticos or entered as free text with the adddiagnostico checkbox.
  • Contact details — cédula, name, phone, relationship.
  • DatesfechaSiniestro, fechaContacto, horaContacto, optional fechadesembolso.
  • Beneficiary — from the insured’s active SEG_beneficiarios records.
  • Flagsfinreclamacion (mark as fully resolved), confirmviuda (changes spouse’s parentesco from CO to VDA), cambiovalasegurado (reduces insured value).
3

Submit the claim

POST /seguros/reclamacion creates a SEG_reclamaciones record and immediately logs the initial state in SEG_cambioEstadoReclamacion:
SegCambioEstadoReclamacion::create([
    'reclamacion_id'    => $reclamacion->id,
    'estado_id'         => $request->estado_id,
    'observacion'       => strtoupper($request->observacion),
    'fecha_actualizacion' => now()->toDateString(),
    'hora_actualizacion'  => now()->toTimeString(),
]);
If coverage type 1 (life coverage) is selected and finreclamacion is checked, the policy is deactivated (active = false).
4

Track and advance the claim

Open GET /seguros/reclamacion/{id}/edit. Each PUT /seguros/reclamacion/{id} call:
  • Updates estado in SEG_reclamaciones.
  • Creates a new SEG_cambioEstadoReclamacion entry, preserving a full audit trail.
  • If a fechadesembolso is supplied and estado_id = 4, sets finReclamacion = true.
  • If checkchangevalaseg = 1, reduces valor_asegurado by 50%.
The Auditoría log records update reclamacion id {id} on every update.

Managing Novedades (Policy Change Events)

The novedades sub-module is the approval queue for all policy changes. Each novedad has a tipo:
tipoMeaningEffect when approved (estado = 3)
1ModificationUpdates SEG_polizas premium and plan fields
2Inclusion (new insured)Creates a new SEG_polizas record
3WithdrawalSets SEG_polizas.active = false; optionally cancels whole family group
4BeneficiarySets SEG_beneficiarios.activo = 1
The GET /seguros/novedades?estado={tab} view displays five tab-filtered collections:
estado parameterFilter
nuevasestado = 1 (new requests)
radicadoestado = 2 (filed)
complementosestado = 5 (awaiting supplement)
aprobadoestado = 3 (approved)
rechazadoestado = 4 (rejected)
PDF forms uploaded during novedad creation are stored on Amazon S3 under corpentunida/seguros_vida/{novedad_id} and can be retrieved at GET /seguros/novedades/{id}/formulario.

Excel Exports and Reports

CXC Export

GET /seguros/seguros/cxc — exports all active policies to DATOS_SEGUROS_VIDA_{date}.xlsx with columns: POLIZA, ID, NOMBRE, NUM DOC, FECHA NAC, GENERO, EDAD, DOC AF, PARENTESCO, FEC NOVEDAD, VALOR ASEGURADO, EXTRA PRIMA, PRIMA PLAN, PRIMA CORPEN, VALOR TITULAR.

Policy Upload Template

GET /seguros/poliza/formato — downloads a blank POLIZAS.xlsx with the standard headers: POLIZA, TIP_DOC, NUM_DOC, NOMBRE, GENERO, FECHA_NAC, PARENTESCO, TITULAR, VALOR_ASEGURADO, EXTRA PRIM, PRIMA, PRIMA_CORPEN, VALOR_TITULAR.

Siniestros Excel Report

GET /seguros/reclamacion/informe/excel — exports all claims to a dated .xlsx file with columns CEDULA, NOMBRE, DTO, AMPARO, VALOR COBERTURA, BONO CANASTA, TOTAL DESEMBOLSADO, FECHA RADICADO, FECHA DESEMBOLSO, DIAS HABILES. A totals row (sum and average working days) is appended automatically using ReporteSiniestrosExport.

Full Claims Report

GET /seguros/seguros/reclamacion/informe-completo — exports claims grouped by state name using ExportSegInformeReclamacion, saved as informe_siniestros.xlsx.

Novedades Excel

GET /seguros/seguros/novedades/download — exports all non-approved novedades (estado != 3) to a dated NOVEDADES.xlsx with columns CEDULA, NOMBRE, FECHA NACIMIENTO, EDAD, FECHA SOLICITUD, TIPO NOVEDAD, VALOR ASEGURADO SOLICITADO, GENERO, PARENTESCO, OBSERVACIONES.

Claims PDF Report

POST /seguros/reclamacion/generarpdf — generates a landscape letter PDF filtered by year and optionally by insured type (todos, af for principal insured, co for female insured). Uses Barryvdh\DomPDF.

Claims Dashboard

The dashboard at GET /seguros/dashboard/reclamaciones aggregates claims data without any external API calls. Key metrics shown:
  • Claims grouped by SEG_estadoReclamacion.nombre (bar/doughnut chart data returned as labels + valores).
  • Claims broken down by coverage type and gender (SEG_coberturas joined with gender field from MaeTerceros).
  • Total claim count.
  • Full claims table segmented by state, each row including cobertura and tercero details.

Age-Based Plan Lookup

GET /seguros/planes/{edad} calls SegPlanController@getPlanes to return available plans for a given insured age. The controller internally uses getCondicion($edad) to resolve the applicable SegCondicion ID, then filters SEG_plans by condicion_corpen = {id} and vigente = true, loading each plan’s convenio relationship. This endpoint drives the plan selector shown during novedad creation and the policy show view.

Build docs developers (and LLMs) love