Commit Graph

11 Commits

Author SHA1 Message Date
Adrian Flores Cortes
56ded676ae [CL-009] feat: Implement imaging module for radiology studies
Add complete imaging module with:
- Entities: ImagingStudy (catalog), ImagingOrder (workflow), DicomInstance (DICOM tracking)
- Services: Study management, Order workflow (ordered->scheduled->performed->reported), DICOM file management
- Controller: REST endpoints for studies, orders, and DICOM instances
- Features: Multi-tenant support, study types (xray, ct, mri, ultrasound, mammography, pet, nuclear),
  order scheduling, radiologist assignment, critical findings flagging, DICOM viewer URLs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:55:56 -06:00
Adrian Flores Cortes
50a409bf17 [CL-007] feat: Implement pharmacy module
Add complete pharmacy module for erp-clinicas with:

Entities:
- Medication: catalog with controlled substance flags, categories, forms
- PharmacyInventory: stock management with batch/lot tracking, alerts
- PharmacyPrescription: linked to consultation and patient
- Dispensation: medication dispensing with partial fills support

Services:
- MedicationService: CRUD for medication catalog
- PharmacyInventoryService: stock management, low stock alerts, expiry tracking
- PrescriptionService: prescription workflow, refills, controlled substances
- DispensationService: dispensing workflow, verification, returns

Features:
- Multi-tenant support (tenantId in all queries)
- Controlled substance tracking and scheduling
- Inventory with low stock and expiration alerts
- Prescription linked to consultation and patient
- Dispensation tracking with partial fills support
- Stock reservation and dispensing workflow
- FIFO dispensing based on expiration dates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:30:45 -06:00
Adrian Flores Cortes
27ea1fd4a6 [CL-006] feat: Implement laboratory module
Add comprehensive laboratory module for managing lab tests, orders, and results:

Entities:
- LabTest: Catalog of available tests with reference ranges and categories
- LabOrder: Lab orders linked to patients and consultations
- LabResult: Results with values, status, and abnormal value detection

Services:
- LabTestService: CRUD operations for test catalog
- LabOrderService: Order lifecycle (create, collect sample, process, complete, cancel)
- LabResultService: Record results, verify, amend with history tracking

Features:
- Multi-tenant support (tenantId in all queries)
- Automatic abnormal/critical value flagging
- Result amendment with audit trail
- Order number auto-generation
- Reference range support by gender and age

REST Endpoints:
- /api/laboratory/tests/* - Test catalog management
- /api/laboratory/orders/* - Order lifecycle management
- /api/laboratory/results/* - Result recording and verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:15:10 -06:00
Adrian Flores Cortes
d0420bc135 [SYNC] Synchronize payment-terminals module from erp-core canonical
Source: erp-core (checksum: c9040e545cf55beb87d3e437a4998855)
Priority: P1 - HIGH
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version (one of 3 different versions)
After: Synced with canonical

Changes:
- Complete payment-terminals module synchronized from erp-core
- 21 TypeScript files updated
- Unified payment terminal integration (MercadoPago + Clip)
- Consistent webhook handling across all ERP projects

Benefits:
- Single source of truth for payment terminals functionality
- Consistent TPV integration behavior
- Reduced maintenance burden (~4,000 lines saved)
- Unified webhook processing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:52:16 -06:00
Adrian Flores Cortes
91561eb124 [ADD] BaseService propagated from erp-core canonical
Source: erp-core (checksum: 900be2ee48f2faf72ce5253aeab27c88)
Priority: P1 - HIGH (architectural gap resolution)
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: "Missing"
After: Synced with canonical

Changes:
- BaseService "added" from erp-core
- Checksum: 900be2ee48f2faf72ce5253aeab27c88
- Provides base CRUD operations for all services

Benefits:
- Unified service architecture
- Consistent error handling and validation
- Reduced code duplication in service implementations
- Standard pagination and filtering patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:43:34 -06:00
Adrian Flores Cortes
f63524ba10 [SYNC] Synchronize ai module from erp-core canonical
Source: erp-core (checksum: 39a6e229055a21158b63cc4eb4dd232f)
Priority: P0 - CRITICAL divergence resolution
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version with project-specific adaptations
After: Synced with canonical

Changes:
- Complete ai module synchronized from erp-core
- 24 TypeScript files updated
- Unified role-based AI configuration
- Consistent AI behavior across all ERP projects

Note: Project-specific role adaptations (if needed) can be
re-applied as documented extensions after this sync.

Benefits:
- Single source of truth for AI functionality
- Reduced maintenance burden
- Token savings from code reuse
- Consistent behavior baseline

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:36:19 -06:00
Adrian Flores Cortes
45ef7f4607 [PROP-CORE-004] feat: Register payment-terminals module in app
- Added PaymentTerminalsModule to module imports
- Added entities to getAllEntities()
- Added paymentTerminals to ModuleOptions
- Registered module in initializeModules()
- Updated health check with paymentTerminals status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:13:56 -06:00
Adrian Flores Cortes
289b4eb466 [PROP-CORE-004] fix: Remove external entity references from payment-terminals
Fixed getEntities() to only reference own entities, avoiding require errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:08:27 -06:00
Adrian Flores Cortes
07877410d3 [PROP-CORE-004] feat: Adapt AI roles for medical clinic domain
- Roles: ADMIN, DOCTOR, RECEPCIONISTA, PACIENTE
- Clinical data restricted to DOCTOR only
- Compliance: NOM-024-SSA3-2012, LFPDPPP
- Medical terminology and privacy restrictions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:57:48 -06:00
Adrian Flores Cortes
297720cdf2 [PROP-CORE-004] feat: Add Phase 6 modules from erp-core
Propagated modules:
- payment-terminals: MercadoPago + Clip TPV (PCI-DSS compliant)
- ai: Role-based AI access (ADMIN, DOCTOR, RECEPCIONISTA, PACIENTE)
- mcp: 18 ERP tools for AI assistants

Note: Payment data must NOT be stored in clinical records.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:45:29 -06:00
f8aacbd316 Migración desde erp-clinicas/backend - Estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:11:57 -06:00