Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ttpullima/RomsoftBackEnd2021_v2/llms.txt

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

In the Peruvian health system, clinics enter formal agreements (convenios) with insurance providers (SEGUS — Seguros) that are regulated and monitored by SUSALUD (Superintendencia Nacional de Salud). Each agreement is represented in Gestión Clínica as a CVN_PLAN_SEGURO record — the insurance plan master — which links a guarantor contact, a contracting party, a payment category, and an optional insurance product. The plan is bounded by a contractual validity window (d_fecha_i_vigencia / d_fecha_f_vigencia) and carries IAFA classification codes required for SUSALUD compliance reporting. Plan line items — the individual covered benefits, co-payment amounts, and currency rules — live in the child table CVN_PLAN_SEGURO_DETALLE. The CVN_PRODUCTO_PLAN table lets you associate specific product offerings to a plan, and CVN_BENEFICIO provides the master catalog of healthcare benefits that can be included in plan details.

Common Response Envelope

Every endpoint in the Gestión Clínica API returns the same JsonResponse wrapper:
{
  "Success": true,
  "Warning": false,
  "Message": "Registro Satisfactorio",
  "Data": { ... }
}
FieldTypeDescription
Successbooleantrue when the operation completed without an unhandled exception.
Warningbooleantrue when the operation completed but a business rule was violated.
MessagestringHuman-readable result message (Spanish).
DataanyPayload returned for read operations; null for mutations.

CVN_PLAN_SEGURO Endpoints

POST /api/CVN_PLAN_SEGURO/Add

Creates a new insurance plan record. Before inserting, the business layer calls CVN_PLAN_SEGUROBL.Instancia.Exists() to detect duplicates — if a matching record already exists the response is returned with Warning: true and the plan is not created.
A duplicate check is performed before every insert. If Warning: true is returned alongside Success: true, no record was written — inspect Message for the reason (typically "Ya existe el registro").
Request bodyCVN_PLAN_SEGURODTO
id_contacto_garante
integer
required
ID of the guarantor contact (insurance company) from the contacts master.
id_contacto_contratante
integer
required
ID of the contracting party (employer, fund, or individual) contact.
id_categoria_pago
integer
required
ID of the payment category (CVN_CATEGORIA_PAGO) that defines price factors for this plan.
id_producto_plan
integer
required
ID of the insurance product (CVN_PRODUCTO_PLAN) associated with this plan.
c_codigo
string
required
Short alphanumeric code that uniquely identifies the plan.
t_descripcion
string
required
Full descriptive name of the plan.
t_observacion
string
Free-text observation or internal notes.
c_codigo_iafa
string
IAFA code required by SUSALUD for regulatory reporting.
d_fecha_i_vigencia
string (ISO 8601 date)
required
Plan validity start date (YYYY-MM-DD).
d_fecha_f_vigencia
string (ISO 8601 date)
required
Plan validity end date (YYYY-MM-DD).
c_contrato
string
Contract reference number.
c_certificado
string
Certificate reference number.
f_estado
integer
required
Status flag: 1 = active, 0 = inactive.
UsuarioCreacion
string
required
Username of the authenticated user creating the record (audit field).
id_usuarioCreacion
integer
required
Numeric user ID of the creator (audit field).
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO/Add \
  -H "Content-Type: application/json" \
  -d '{
    "id_contacto_garante": 12,
    "id_contacto_contratante": 34,
    "id_categoria_pago": 2,
    "id_producto_plan": 5,
    "c_codigo": "PS-001",
    "t_descripcion": "Plan Básico Salud 2024",
    "c_codigo_iafa": "IAFA-001",
    "d_fecha_i_vigencia": "2024-01-01",
    "d_fecha_f_vigencia": "2024-12-31",
    "c_contrato": "CTR-2024-001",
    "c_certificado": "CERT-2024-001",
    "f_estado": 1,
    "UsuarioCreacion": "admin",
    "id_usuarioCreacion": 1
  }'
Example response (success)
{
  "Success": true,
  "Warning": false,
  "Message": "Registro Satisfactorio",
  "Data": null
}
Example response (duplicate)
{
  "Success": true,
  "Warning": true,
  "Message": "Ya existe el registro",
  "Data": null
}

POST /api/CVN_PLAN_SEGURO/GetAllFilters

Returns a filtered list of insurance plans. Pass any combination of CVN_PLAN_SEGURODTO fields as filter criteria; the business layer builds a dynamic query from non-null values.
valorRequest
string
Free-text search value applied across searchable text columns.
f_estado
integer
Filter by status: 1 active, 0 inactive. Omit to return all statuses.
id_categoria_pago
integer
Filter by payment category ID.
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO/GetAllFilters \
  -H "Content-Type: application/json" \
  -d '{ "valorRequest": "Básico", "f_estado": 1 }'

POST /api/CVN_PLAN_SEGURO/GetAllActives

Returns all active insurance plans without any filter criteria. Send an empty JSON body {}. Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO/GetAllActives \
  -H "Content-Type: application/json" \
  -d '{}'
Example response
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": [
    {
      "id_plan_seguro": 1,
      "c_codigo": "PS-001",
      "t_descripcion": "Plan Básico Salud 2024",
      "garante": "Rímac Seguros",
      "contratante": "Empresa XYZ S.A.C.",
      "producto": "Seguro de Salud Individual",
      "d_fecha_i_vigencia": "2024-01-01T00:00:00",
      "d_fecha_f_vigencia": "2024-12-31T00:00:00",
      "f_estado": 1,
      "estado": "Activo"
    }
  ]
}

POST /api/CVN_PLAN_SEGURO/GetById

Retrieves a single plan record by its primary key.
id_plan_seguro
integer
required
Primary key of the insurance plan to retrieve.
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO/GetById \
  -H "Content-Type: application/json" \
  -d '{ "id_plan_seguro": 1 }'

POST /api/CVN_PLAN_SEGURO/Update

Updates an existing insurance plan. Send the full CVN_PLAN_SEGURODTO object including the id_plan_seguro primary key and the UsuarioModificacion / id_usuarioModifica audit fields.
id_plan_seguro
integer
required
Primary key of the plan to update.
UsuarioModificacion
string
required
Username of the user performing the update (audit field).
id_usuarioModifica
integer
required
Numeric user ID of the modifier (audit field).
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO/Update \
  -H "Content-Type: application/json" \
  -d '{
    "id_plan_seguro": 1,
    "c_codigo": "PS-001",
    "t_descripcion": "Plan Básico Salud 2024 (Actualizado)",
    "d_fecha_f_vigencia": "2025-03-31",
    "f_estado": 1,
    "UsuarioModificacion": "admin",
    "id_usuarioModifica": 1
  }'

CVN_PLAN_SEGURO Response Fields

When plan records are returned in Data, each object exposes the following fields:
id_plan_seguro
integer
Auto-generated primary key of the insurance plan.
c_codigo
string
Plan code.
t_descripcion
string
Plan description / name.
c_codigo_iafa
string
IAFA regulatory code.
d_fecha_i_vigencia
string
Validity start date (ISO 8601).
d_fecha_f_vigencia
string
Validity end date (ISO 8601).
c_contrato
string
Contract reference number.
c_certificado
string
Certificate reference number.
garante
string
Resolved name of the guarantor contact (denormalized for display).
contratante
string
Resolved name of the contracting party (denormalized for display).
producto
string
Resolved product name from CVN_PRODUCTO_PLAN (denormalized for display).
estado
string
Human-readable status label (e.g., "Activo" / "Inactivo").
f_estado
integer
Raw status flag: 1 = active, 0 = inactive.

CVN_PLAN_SEGURO_DETALLE Endpoints

Plan details store the benefit-level coverage rules for each plan — which benefits are covered, the co-payment amounts (fixed and variable), and the currency applicable. The detail table is a child of CVN_PLAN_SEGURO joined via id_plan_seguro.

POST /api/CVN_PLAN_SEGURO_DETALLE/Add

Adds a benefit detail line to an existing insurance plan. Performs a duplicate check before inserting; returns the new detail’s id_plan_seguro_detalle in Data on success.
A duplicate check runs before every insert. If Warning: true is returned, the benefit line was not added — it already exists for this plan.
id_plan_seguro
integer
required
Parent plan ID to which this benefit detail belongs.
id_beneficio
integer
required
Benefit ID from the CVN_BENEFICIO catalog.
id_moneda
integer
required
Currency ID from the CVN_MONEDA catalog (e.g., Soles or USD).
n_copago_fijo
decimal
Fixed co-payment amount in the specified currency.
n_copago_variable
decimal
Variable co-payment percentage applied to the service cost.
n_copago_variable_farmacia
decimal
Variable co-payment percentage applied specifically to pharmacy charges.
f_estado
integer
required
Status flag: 1 = active, 0 = inactive.
UsuarioCreacion
string
required
Audit: username of the record creator.
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO_DETALLE/Add \
  -H "Content-Type: application/json" \
  -d '{
    "id_plan_seguro": 1,
    "id_beneficio": 3,
    "id_moneda": 1,
    "n_copago_fijo": 20.00,
    "n_copago_variable": 0.10,
    "n_copago_variable_farmacia": 0.20,
    "f_estado": 1,
    "UsuarioCreacion": "admin",
    "id_usuarioCreacion": 1
  }'
Example response (success)
{
  "Success": true,
  "Warning": false,
  "Message": "Registro Satisfactorio",
  "Data": 47
}

POST /api/CVN_PLAN_SEGURO_DETALLE/Delete

Performs a logical or physical deletion of a plan benefit detail line.
id_plan_seguro_detalle
long
required
Primary key of the detail record to delete.
UsuarioModificacion
string
required
Audit: username of the user performing the deletion.
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO_DETALLE/Delete \
  -H "Content-Type: application/json" \
  -d '{
    "id_plan_seguro_detalle": 47,
    "UsuarioModificacion": "admin",
    "id_usuarioModifica": 1
  }'

POST /api/CVN_PLAN_SEGURO_DETALLE/GetAllActivesFilters

Returns all active benefit detail lines for a given plan, optionally filtered by benefit or currency.
id_plan_seguro
integer
required
Parent plan ID whose detail lines should be retrieved.
id_beneficio
integer
Optionally filter by a specific benefit.
Example request
curl -X POST https://{host}/api/CVN_PLAN_SEGURO_DETALLE/GetAllActivesFilters \
  -H "Content-Type: application/json" \
  -d '{ "id_plan_seguro": 1 }'
Example response
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": [
    {
      "id_plan_seguro_detalle": 47,
      "id_plan_seguro": 1,
      "id_beneficio": 3,
      "beneficio": "Consulta Médica General",
      "id_moneda": 1,
      "moneda": "PEN",
      "n_copago_fijo": 20.00,
      "n_copago_variable": 0.10,
      "n_copago_variable_farmacia": 0.20,
      "f_estado": 1,
      "estado": "Activo"
    }
  ]
}

CVN_BENEFICIO — Benefit Catalog

The benefit catalog (CVN_BENEFICIO) lists all healthcare services and coverages that can be assigned to a plan detail line. Use the following endpoint to populate benefit selection lists in the UI. POST /api/CVN_BENEFICIO/GetAllActives — Returns all active benefits. Send an empty body {}.
curl -X POST https://{host}/api/CVN_BENEFICIO/GetAllActives \
  -H "Content-Type: application/json" \
  -d '{}'

CVN_PRODUCTO_PLAN — Plan Products

The plan product table (CVN_PRODUCTO_PLAN) represents specific insurance product offerings that can be linked to insurance plans. Two endpoints are available: POST /api/CVN_PRODUCTO_PLAN/GetAllActives — Returns the complete list of active plan products (empty body). POST /api/CVN_PRODUCTO_PLAN/GetAllActivesFilters — Returns filtered plan products.
id_producto_plan
integer
Filter by specific product ID.
curl -X POST https://{host}/api/CVN_PRODUCTO_PLAN/GetAllActives \
  -H "Content-Type: application/json" \
  -d '{}'

Audit Fields (EntityAuditableDTO)

All mutable DTOs extend EntityAuditableDTO. Include these fields in every create/update request:
FieldTypeDescription
UsuarioCreacionstringUsername of the record creator.
UsuarioModificacionstringUsername of the last modifier.
id_usuarioCreacionintegerNumeric user ID of the creator.
id_usuarioModificaintegerNumeric user ID of the last modifier.
FechaCreaciondatetimeSet automatically by the server.
FechaModificaciondatetimeSet automatically by the server.
The IdUsuarioActual field on EntityAuditableDTO can be set to the currently logged-in user’s ID to support role-based filtering at the business-logic layer.

Build docs developers (and LLMs) love