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.

Romsoft Gestión Clínica API is a comprehensive backend system built for Peruvian healthcare clinics. It covers the full operational lifecycle of a clinic — from registering patients and recording medical attendance, to managing insurance plans, dispensing pharmacy items, and processing billing. The API is designed to be consumed by web and desktop front-ends, and every endpoint speaks a single, consistent JSON contract, making integration predictable and straightforward.

What the System Does

The API serves as the authoritative data layer for a healthcare clinic’s day-to-day operations. Clinical staff interact with patients, doctors manage consultations, the billing department processes charges, and administrators control system access — all through a unified set of HTTP endpoints. The system also integrates with the Peruvian national health regulator (SUSALUD) and supports DNI-based patient lookup via an external identity service.

Key Domain Areas

DomainDescription
Patient Management (ADM_PACIENTE)Register, search, and update patient demographic and clinical records.
Medical AttendanceRecord consultations, diagnoses (ICD-10 / CIE-10 codes), and clinical notes for each visit.
Insurance Plans (CVN_PLAN_SEGURO, SEGUS/SUSALUD)Manage health insurance plans and coverage, including Peruvian public-sector SUSALUD schemes.
CIE-10 CodesReference the full International Classification of Diseases catalogue used for diagnosis coding.
PharmacyControl medication inventory, prescriptions, and dispensing records.
BillingGenerate charges, manage invoices, and track payment status for services rendered.
User Security (SEG_USUARIO)Authenticate users, manage roles, and control access to sensitive operations via JWT tokens.

Technology Stack

The API is built on Microsoft’s server-side ecosystem and hosted on Azure:
  • ASP.NET Web API (.NET Framework 4.5) — the HTTP hosting layer, attribute-routed with a convention-based fallback route of api/{controller}/{action}/{id}.
  • SQL Server on Azure — the primary data store (romsoftservidor.database.windows.net, database ROMSOFT-CLINICA).
  • JWT Authentication — stateless bearer-token authentication implemented with Microsoft.IdentityModel.Tokens and a custom TokenValidationHandler delegating handler.
  • log4net — structured application logging to rolling files (Log/Log.txt) and the debug appender.
  • AutoMapper — object-to-object mapping between entity and DTO layers (via a MapperHelper wrapper).
  • Swashbuckle / Swagger — auto-generated interactive API documentation surfaced at the /swagger endpoint.
  • Enterprise Library Data — data access abstraction over ADO.NET for SQL Server queries.

Architecture Overview

The solution follows a strict four-layer pattern. Each layer has a single responsibility and depends only on the layer immediately below it:
┌─────────────────────────────────────┐
│          WebApi Layer               │  HTTP Controllers, routing, JWT middleware
├─────────────────────────────────────┤
│       Business.Logic Layer          │  Domain rules, validation, orchestration
├─────────────────────────────────────┤
│        DataAccess Layer             │  SQL queries, stored procedures, ADO.NET
├─────────────────────────────────────┤
│     Entidades / DTO Layer           │  Plain C# model classes and data-transfer objects
└─────────────────────────────────────┘
Controllers live in Romsoft.GESTIONCLINICA.WebApi and delegate immediately to business-logic singletons (e.g., SEG_USUARIOBL.Instancia). DTOs in Romsoft.GESTIONCLINICA.DTO are what controllers accept as request bodies and return as response data; entity classes in Romsoft.GESTIONCLINICA.Entidades are what the data-access layer returns from the database. AutoMapper bridges the two.

The JSON Response Envelope

Every endpoint in the API — success or failure — wraps its result in the same JsonResponse envelope. You will never receive a raw object at the top level:
{
  "Success": true,
  "Warning": false,
  "Message": null,
  "Data": { }
}
Success
boolean
required
true when the operation completed without a server-side exception. false indicates an unhandled error — check Message for details.
Warning
boolean
required
true when the operation completed but produced a business-logic warning (e.g., user not found, record already exists). Success will still be true in this case.
Message
string
Human-readable message describing the warning or error. null on clean successes.
Data
object
The payload for the request — a single object, an array, or null when there is nothing to return.
When Success is true and Warning is false, Data contains the result you asked for. When Warning is true, inspect Message for a user-friendly explanation. When Success is false, the operation failed entirely — Message will contain a generic error message.

Explore the API

Quickstart

Authenticate and make your first request in five steps.

Authentication

Understand JWT bearer tokens and how to obtain and send them.

Architecture Overview

Deep-dive into the four-layer project structure.

Login Endpoint

Full reference for POST /api/Account/Login.

Build docs developers (and LLMs) love