Clínica — Sistema de Gestión Hospitalaria

Microservices system for managing a health clinic — patients, appointments, admissions and billing with JWT auth, automatic migrations and an AI medical assistant.

  • Java 21
  • Spring
  • Microservices
  • PostgreSQL
  • Redis
  • Docker
  • JWT

Problem

Small and mid-sized clinics typically rely on spreadsheets or legacy systems to manage appointments, records and billing. The goal was to build a modern platform that centralized all clinical operations with enterprise-grade security and real scalability.

Solution

Modular microservices system where each domain (patients, appointments, admissions, billing, providers) runs as an independent service. All services register with Eureka for dynamic discovery. Centralized authentication with RSA-256 signed JWT. Integrated medical assistant via Gemini AI for support queries.

Architecture

  • Eureka Service Discovery — services register automatically; no manual IP configuration
  • JWT with RSA-256 — asymmetrically signed token; the auth service issues it, each microservice validates without a database
  • Multi-database — PostgreSQL for critical transactional data, MySQL where the schema justifies it; Flyway for versioned migrations on both
  • Docker Compose — brings up the full stack (services + databases + Eureka dashboard) with a single command
  • Spring AI + Gemini — assistant integrated directly into the medical consultation flow
Cl
Clínica · Sistema de Gestión Hospitalaria
Java 21 · Spring Boot 3.5 · Spring Cloud 2025 · 8 microservicios
▶ Pruébalo — arrastra nodos · click para inspeccionar
externogatewayserviciosIAinfra
HTTPS / JWTverificamédicocoberturafacturaintent →registerClientes ExternosBrowser · Apps · IntegracionesAPI GatewaySpring Cloud Gateway 4.3 · :8080LoggingFilterRateLimitFilter (Redis)AuthFilter JWT RSA-256CircuitBreakerRetryAuth ServiceJWT RSA-256 · :8084 · MySQLPatient ServicePacientes · :8082 · MySQLAdmissions ServiceAtenciones · :8083 · PostgreSQLSuppliers ServiceMédicos · :8085 · MySQLClients ServiceAseguradoras · :8086 · MySQLAI AssistantGemini · Spring AI · :8087 · PGGeminiClientIntent DetectionBilling ServiceFacturación · :8088 · MySQLEureka ServerService Discovery · :8761
cada barra representa un ciclo completo: cliente → gateway → servicio → respuesta
Architecture diagram of Clínica — Sistema de Gestión Hospitalaria

Technical Decisions

RSA-256 was chosen over HMAC-SHA for JWT because in a microservices architecture each service only needs the public key to verify — no shared secrets. Flyway over manual scripts because in a healthcare system schema change traceability is an audit requirement.

Architecture diagram of Clínica — Sistema de Gestión Hospitalaria