Overview
The Document Management system is designed to handle file uploads and discharge report management in ARCA. The database schema supports two types of documents with different workflows and purposes.Database Schemas
User Documents (DocumentoUsuario)
TheDocumentoUsuario model manages general file uploads associated with users:
- Unique ID (
id_Documento): Auto-generated UUID - User (
id_User): Reference to the user who uploaded the document - File Name (
nomeArquivo): Original filename (up to 100 characters) - File Path (
caminhoArquivo): Storage path or URL (up to 255 characters) - Upload Date (
dataUpload): Timestamp of upload (automatically set)
Discharge Reports (RelatorioAlta)
TheRelatorioAlta model manages formal treatment discharge reports:
- Unique ID (
id_Documento): Auto-generated UUID - Patient (
id_Paciente): Reference to the patient being discharged - Intern (
id_Estagiario): Reference to the intern who prepared the report - Supervisor (
id_Supervisor): Reference to the supervisor who reviews/approves - Content (
conteudo): Full report text (text field) - Issue Date (
dataEmissao): When the report was created (automatically set) - Status (
status): Report status (enum: PENDENTE, EMITIDO, CANCELADO)
Report Status Workflow
Discharge reports follow a structured approval workflow:PENDENTE (Pending)
- Initial status when intern creates the report
- Report is in draft or awaiting supervisor review
- Can be edited by the intern
- Not yet finalized
EMITIDO (Issued)
- Report approved by supervisor
- Considered official and final
- Locked from further editing
- Ready for patient records
CANCELADO (Cancelled)
- Report was rejected or withdrawn
- Not used for official documentation
- Preserved for audit trail
The three-stage status system ensures proper clinical oversight. Interns draft reports, supervisors review and approve, maintaining professional standards and training requirements.
Planned Features
When fully implemented, the document management system will enable:User Document Management
- Upload files (PDFs, images, documents)
- Associate documents with user accounts
- Download and view uploaded files
- Delete documents when no longer needed
- Track upload dates and metadata
Discharge Report Creation
- Intern creates discharge report for a patient
- Write or paste report content
- Save as pending/draft
- Submit for supervisor review
Discharge Report Review
- Supervisor views pending reports
- Reviews report content and quality
- Approves (sets status to EMITIDO)
- Requests revisions (returns to PENDENTE)
- Cancels if inappropriate (sets to CANCELADO)
Document Access Control
- Role-based permissions for viewing documents
- Only authorized staff can access patient reports
- Audit logging for document access
- LGPD compliance for sensitive data
Document Management
- List all documents by user or patient
- Filter by status, date, or type
- Search document content
- Export reports for external use
Current Implementation
Currently Available:- ✅ Complete database schemas (Prisma models)
- ✅ Foreign key relationships to users and patients
- ✅ Status enum for discharge reports
- ✅ Cascade delete rules for user documents
- ⏳ Document upload API endpoints
- ⏳ File storage integration
- ⏳ Discharge report creation forms
- ⏳ Report review and approval workflow
- ⏳ Document list and search interfaces
Database Model Reference
See the Database Schema documentation for:Related Features
Patient Management
Discharge reports are linked to patients
User Management
User documents are linked to user accounts