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.

The ADM_PACIENTE controller is the central hub for all patient demographic management within Gestión Clínica. It supports the full lifecycle of a patient record — from initial registration with duplicate-detection, through searching by flexible filters, to soft deletion — as well as a rich combined query that returns both patient demographics and their associated attendance history in a single call. A companion controller, ADM_PACIENTECONSULTADNI, integrates with an external Peruvian DNI verification service so that staff can auto-populate demographic data directly from RENIEC without manual data entry. Every endpoint in both controllers requires a valid JWT bearer token.
All routes follow the pattern POST /api/{controller}/{action}. The API does not use GET requests — even read operations are POST so that filter payloads can be sent in the request body.

Authentication

Every request must include a Bearer token in the Authorization header. The server validates the JWT signature, issuer, audience, and expiry on every call via a global TokenValidationHandler. Missing or invalid tokens receive an HTTP 401 Unauthorized response before the controller action is reached.
Authorization: Bearer <your_jwt_token>

Common Response Envelope

All endpoints return the same JsonResponse wrapper:
Success
boolean
required
true when the operation completed without an unhandled exception. Note that Success: true with Warning: true means the business rule rejected the request (e.g., duplicate record).
Warning
boolean
true when a non-fatal business rule was triggered (duplicate patient, missing record, etc.). The Message field contains a human-readable explanation.
Message
string
Human-readable status message in Spanish (e.g., "Registro satisfactorio", "Ya existe el registro").
Data
object | array | null
The operation payload. null for write operations that do not return data; an array of DTOs for queries; the new record ID (integer) for Add.

ADM_PACIENTEDTO — Field Reference

The ADM_PACIENTEDTO object is used as both the request body for write operations and the element type in list responses. It extends EntityAuditableDTO, which contributes audit fields shared across the entire API.

POST /api/ADM_PACIENTE/Add

Registers a new patient in the system. Before inserting, the business layer calls Exists() to check for duplicate records. If a duplicate is found the response returns Success: true, Warning: true with the message "Ya existe el registro" — no insert occurs. On a successful insert, Data is null; the new record ID is not returned by this endpoint.

Request Body

Send a full ADM_PACIENTEDTO object. All identity and contact fields listed above are accepted. Key required fields:
t_apellido_paterno
string
required
Paternal surname. Used in the duplicate-existence check.
t_apellido_materno
string
required
Maternal surname.
t_nombres
string
required
Given names.
id_documento_identidad
integer
required
Identity-document type FK.
c_documento_identidad
string
required
Identity-document number.
d_fecha_nacimiento
string
required
Date of birth in ISO 8601 format.
UsuarioCreacion
string
required
Username performing the action — written to the audit log.

Response

Success
boolean
true if no unhandled exception occurred.
Warning
boolean
true when a duplicate patient was detected ("Ya existe el registro").
Message
string
"Registro satisfactorio" on success, or an error/warning description.
Data
null
Always null. This endpoint does not return the new record ID.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/Add \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "t_apellido_paterno": "QUISPE",
    "t_apellido_materno": "MAMANI",
    "t_nombres": "ANA LUCIA",
    "d_fecha_nacimiento": "1995-03-15T00:00:00",
    "id_genero": 2,
    "id_estado_civil": 1,
    "id_documento_identidad": 1,
    "c_documento_identidad": "45678901",
    "id_grupo_sanguineo": 3,
    "t_email_paciente": "[email protected]",
    "c_p_fono_personal": "987654321",
    "id_ubigeo_nacimiento": 150101,
    "id_ubigeo_domicilio": 150101,
    "t_direccion": "Av. Arequipa 1234, Lima",
    "t_responsable": "QUISPE FLORES, PEDRO",
    "f_estado": 1,
    "UsuarioCreacion": "jperez"
  }'
Success response:
{
  "Success": true,
  "Warning": false,
  "Message": "Registro satisfactorio",
  "Data": null
}
Duplicate detected:
{
  "Success": true,
  "Warning": true,
  "Message": "Ya existe el registro",
  "Data": null
}

POST /api/ADM_PACIENTE/GetAllFilters

Returns a list of patient records filtered by the non-null / non-zero fields in the request body. The business layer builds a dynamic SQL query using the provided ADM_PACIENTEDTO fields as filter criteria. Send only the fields you want to filter by; unused fields should be omitted or set to their zero-values.

Request Body

Any subset of ADM_PACIENTEDTO fields. Common filter patterns:
t_apellido_paterno
string
Filter by paternal surname (typically an exact or LIKE match depending on the stored procedure).
c_documento_identidad
string
Filter by document number — useful for quick patient lookup.
f_estado
integer
1 to return only active patients; 0 for inactive. Omit to return all.
t_paciente
string
Filter on the full concatenated name field.

Response

Data
array
Array of ADM_PACIENTEDTO objects matching the filter criteria. Returns an empty array when no records match.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/GetAllFilters \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "t_apellido_paterno": "QUISPE",
    "f_estado": 1
  }'
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": [
    {
      "id_paciente": 1042,
      "n_historia_clinica": 5201,
      "t_apellido_paterno": "QUISPE",
      "t_apellido_materno": "MAMANI",
      "t_nombres": "ANA LUCIA",
      "t_paciente": "QUISPE MAMANI, ANA LUCIA",
      "d_fecha_nacimiento": "1995-03-15T00:00:00",
      "id_genero": 2,
      "sexo": "Femenino",
      "c_documento_identidad": "45678901",
      "f_estado": 1
    }
  ]
}

POST /api/ADM_PACIENTE/GetById

Retrieves full details for a single patient by their primary key.

Request Body

id_paciente
integer
required
The surrogate key of the patient to retrieve.

Response

Data
array
Single-element array containing the full ADM_PACIENTEDTO for the requested patient.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/GetById \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "id_paciente": 1042 }'

POST /api/ADM_PACIENTE/Update

Updates an existing patient record. The entire ADM_PACIENTEDTO object (including all fields to be retained) should be provided. The business layer calls Update() which returns an integer row-count; a count of 0 sets Warning: true.

Request Body

Full ADM_PACIENTEDTO including id_paciente (required to identify the record) and UsuarioModificacion.
id_paciente
integer
required
Identifies the patient record to update.
UsuarioModificacion
string
required
Username performing the update — written to the audit log.

Response

Message
string
"Actualización satisfactoria" on success; "Actualización fallida" with Warning: true if no rows were affected.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/Update \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_paciente": 1042,
    "t_apellido_paterno": "QUISPE",
    "t_apellido_materno": "MAMANI",
    "t_nombres": "ANA LUCIA",
    "t_email_paciente": "[email protected]",
    "c_p_fono_personal": "999000111",
    "f_estado": 1,
    "UsuarioModificacion": "jperez"
  }'
{
  "Success": true,
  "Warning": false,
  "Message": "Actualización satisfactoria",
  "Data": null
}

POST /api/ADM_PACIENTE/Delete

Marks a patient record as deleted. The business layer calls Delete() and checks the integer row-count; a count of 0 sets Warning: true.
This operation is a logical deletion controlled by the database stored procedure. Verify with your DBA whether the procedure performs a soft delete (sets f_estado = 0) or a hard DELETE statement, as this affects whether historical attendance records remain accessible.

Request Body

id_paciente
integer
required
The primary key of the patient to delete.
UsuarioModificacion
string
required
Username performing the deletion — written to the audit log.

Response

Message
string
"Eliminación satisfactoria" on success; "Eliminación fallida" with Warning: true otherwise.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/Delete \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "id_paciente": 1042,
    "UsuarioModificacion": "jperez"
  }'

POST /api/ADM_PACIENTE/GetAllPacienteAtencionFilters

This endpoint performs a combined patient + attendance search and is the primary entry point for the clinic reception workflow. It accepts a single search string (t_dato) along with a type discriminator (tipo_dato) and returns a rich payload that joins patient demographics with their attendance history. The search string is automatically converted to uppercase before querying.

Request Body (ADM_PACIENTEATENCIONReqDTO)

t_dato
string
required
The value to search for. The controller calls .ToUpper() on this string before passing it to the business layer — you may send mixed-case values safely.
tipo_dato
string
required
Specifies the semantic meaning of t_dato. Accepted values:
CodeMeaning
FFull name (t_paciente field)
PPatient ID (id_paciente)
HClinical history number
CIdentity document number

Response

When no records match, Data is an empty array and Message is set to "No existe información con los datos enviados.".
Data
array
Array of ADM_PACIENTEATENCIONResDTO objects. Each element contains the full patient demographic block plus the associated attendance record fields.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTE/GetAllPacienteAtencionFilters \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "t_dato": "45678901",
    "tipo_dato": "C"
  }'
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": [
    {
      "n_historia_clinica": 5201,
      "t_paciente": "QUISPE MAMANI, ANA LUCIA",
      "c_documento_identidad": "45678901",
      "Genero": "Femenino",
      "estado": "Activo",
      "id_atencion": 3305,
      "d_fecha_registro": "2024-11-10T00:00:00",
      "c_hora_registro": "09:30",
      "plan_seguro": "EPS RIMAC",
      "profesional": "DR. GARCIA TORRES, LUIS",
      "especialidad": "MEDICINA GENERAL"
    }
  ]
}

POST /api/ADM_PACIENTECONSULTADNI/GetPacienteConsultaDNI

Queries the external Peruvian RENIEC/DNI verification service configured in the application’s Web.config (UrlServicioConsultaDNI + TokenConsultaDNI). The API constructs the external URL as {UrlServicioConsultaDNI}?dni={dni}&token={TokenConsultaDNI}, calls it via an HTTP GET, and deserializes the response back to the client. This avoids exposing the service token to the front-end.
Use this endpoint before calling Add to pre-fill the patient registration form with verified name and address data from RENIEC, reducing transcription errors.

Request Body (ADM_PACIENTE_CONSULTADTO)

dni
string
required
Eight-digit Peruvian DNI number to look up.

Response

Data
object
Deserialized response from the external DNI service, shaped as ADM_PACIENTE_CONSULTADTO:
Data.dni
string
The queried DNI number (echoed back).
Data.paterno
string
Paternal surname as registered in RENIEC.
Data.materno
string
Maternal surname as registered in RENIEC.
Data.nombres
string
Given names as registered in RENIEC.
Data.domicilio
string
Registered domicile address from RENIEC.

Example

curl -X POST https://your-api-host/api/ADM_PACIENTECONSULTADNI/GetPacienteConsultaDNI \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{ "dni": "45678901" }'
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": {
    "dni": "45678901",
    "paterno": "QUISPE",
    "materno": "MAMANI",
    "nombres": "ANA LUCIA",
    "domicilio": "AV AREQUIPA NRO 1234 LIMA"
  }
}
If the external DNI service is unavailable or returns an unexpected format, the endpoint returns Success: false with Message: "Inténtelo más tarde". Ensure the UrlServicioConsultaDNI and TokenConsultaDNI keys in Web.config are correctly configured and that the application server has outbound HTTP access.

Build docs developers (and LLMs) love