Skip to main content

Overview

The Medical Records module (Historial Clínico) allows doctors to document patient consultations, diagnoses, treatments, and future care plans. Each record is timestamped and linked to a specific doctor and patient.

Creating Medical Records

Access Points

Medical records are created from the patient profile page:
  1. Navigate to /patients/{uuid}
  2. Select the “History” tab
  3. Click ”➕ Nuevo registro” button (doctors only)
  4. Fill in the clinical record form
  5. Click “Guardar Evolución” to save
Only users with the CREATE_MEDICAL_RECORDS permission (typically doctors) can create new clinical records.

Database Schema

CREATE TABLE medical_records (
    id INT AUTO_INCREMENT PRIMARY KEY,
    patient_id INT NOT NULL,
    doctor_id INT NOT NULL,
    record_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    motif TEXT,
    diagnosis TEXT,
    treatment TEXT,
    future_plan TEXT,
    next_visit DATE,
    observations TEXT,
    FOREIGN KEY (patient_id) REFERENCES patients(id) ON DELETE CASCADE,
    FOREIGN KEY (doctor_id) REFERENCES doctors(id) ON DELETE CASCADE
);

Record Components

Clinical Fields

Each medical record contains the following structured information:
Field: motifThe reason for the patient’s visit. What brought them to the clinic today?Example: “Dolor intenso en molar inferior izquierdo. 3 días de evolución.”
Field: diagnosisThe clinical diagnosis based on examination and symptoms.Example: “Caries profunda con compromiso pulpar — pieza 3.6”
Field: treatmentThe treatment performed during this visit.Example: “Extracción de pieza 3.6 bajo anestesia local. Sin complicaciones.”
Field: future_planPlanned follow-up treatments or next steps in the treatment plan.Example: “Control en 7 días para evaluar cicatrización. Valorar implante en 3 meses.”
Field: next_visitAutomatically calculated based on selected interval (7 days, 15 days, 1 month, etc.).
Field: observationsAdditional notes, precautions, or special considerations.Example: “Paciente alérgica a penicilina. Se prescribió alternativa.”

Next Visit Intervals

The system provides pre-defined intervals for scheduling follow-up visits:
const nextVisitOptions = [
  { value: '', label: 'No requiere' },
  { value: '7', label: 'En 7 días' },
  { value: '15', label: 'En 15 días' },
  { value: '21', label: 'En 21 días' },
  { value: '30', label: 'En 1 mes' },
  { value: '60', label: 'En 2 meses' },
  { value: '90', label: 'En 3 meses' },
  { value: '180', label: 'En 6 meses' },
  { value: '365', label: 'En 1 año' }
];

Automatic Date Calculation

let finalNextVisit = null;
if (recordFormData.next_visit_interval) {
  const days = parseInt(recordFormData.next_visit_interval);
  const date = new Date();
  date.setDate(date.getDate() + days);
  finalNextVisit = date.toISOString().split('T')[0];
}

Viewing Medical Records

History Timeline

Medical records are displayed in reverse chronological order (newest first) on the patient’s History tab:
Medical records timeline view

Record Display Format

{
  date: "15 Febrero 2026",
  doctor: "Dr. Carlos Soto · Cirugía",
  status: "green",
  statusLabel: "Completado",
  motif: "Dolor intenso en molar inferior izquierdo. 3 días de evolución.",
  diagnosis: "Caries profunda con compromiso pulpar — pieza 3.6",
  treatment: "Extracción de pieza 3.6 bajo anestesia local. Sin complicaciones."
}

Status Badges

Records can be tagged with status badges:

Completado

Green badge - Treatment completed successfully

Control

Blue badge - Follow-up or control visit

En Tratamiento

Amber badge - Ongoing treatment

Editing Medical Records

Medical record editing requires the EDIT_MEDICAL_RECORDS permission. Some clinics restrict editing to maintain audit trail integrity.

Edit Workflow

  1. Locate the record in the History tab
  2. Click the edit button (if permission granted)
  3. Modify necessary fields
  4. Save changes
API Endpoint:
PUT /api/patients/{patientId}/records/{recordId}

Body: {
  motif?: string,
  diagnosis?: string,
  treatment?: string,
  future_plan?: string,
  next_visit?: string,
  observations?: string
}

Anamnesis Integration

Medical History Form

The Anamnesis (medical history questionnaire) complements clinical records:
  • Personal medical history: Chronic conditions, surgeries, medications
  • Family medical history: Hereditary conditions
  • Habits: Smoking, alcohol, oral hygiene
  • Vital signs: Blood pressure, heart rate, temperature
Anamnesis is typically filled out once during initial patient registration and updated periodically.

Anamnesis Permissions

VIEW_ANAMNESIS

View the patient’s medical history questionnaire.

EDIT_ANAMNESIS

Create or modify the patient’s anamnesis form.

Document Attachments

Uploading Files

Medical records can include attachments:
  • X-rays and radiographs
  • Lab results
  • Consent forms
  • Treatment photos
  • External reports

Files Database Schema

CREATE TABLE patient_files (
    id INT AUTO_INCREMENT PRIMARY KEY,
    patient_id INT NOT NULL,
    name VARCHAR(255) NOT NULL,
    file_type VARCHAR(50),
    file_size INT,
    file_url VARCHAR(255) NOT NULL,
    upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (patient_id) REFERENCES patients(id) ON DELETE CASCADE
);

File Management Permissions

VIEW_ATTACHMENTS

View uploaded files in the patient’s Files tab.

UPLOAD_ATTACHMENTS

Upload new documents and images to patient records.

API Reference

List Medical Records

GET /api/patients/{patientId}/records

Response: {
  success: true,
  records: [
    {
      id: number,
      patient_id: number,
      doctor_id: number,
      doctor_name: string,
      doctor_specialty: string,
      record_date: string,
      motif: string,
      diagnosis: string,
      treatment: string,
      future_plan: string,
      next_visit: string | null,
      observations: string
    }
  ]
}

Create Medical Record

POST /api/patients/{patientId}/records

Body: {
  motif: string,
  diagnosis: string,
  treatment: string,
  future_plan?: string,
  next_visit?: string,
  observations?: string
}

Response: {
  success: true,
  record_id: number
}

Update Medical Record

PUT /api/patients/{patientId}/records/{recordId}

Body: { /* Same as create */ }

Response: {
  success: true,
  message: 'Record updated'
}

Permissions Summary

Module: ClínicoAccess to view patient medical records and treatment history. Essential for continuity of care.
Module: ClínicoCreate new clinical records after patient consultations. Typically restricted to doctors.
Module: ClínicoModify existing clinical records. May be restricted for audit compliance.

Best Practices

1

Document Immediately

Record clinical notes during or immediately after the consultation while details are fresh.
2

Be Specific

Use precise dental terminology (e.g., “pieza 3.6” for specific teeth) and detailed descriptions.
3

Note Allergies

Always cross-reference with patient allergies before prescribing medications.
4

Plan Follow-ups

Use the next_visit field to ensure patients return for necessary follow-up care.
5

Complete All Fields

Fill in motif, diagnosis, and treatment for comprehensive records that support continuity of care.
6

Review History

Before creating a new record, review previous records to understand treatment context.

Regulatory Compliance

Medical records are legal documents. Ensure all entries are:
  • Accurate and truthful
  • Timestamped automatically by the system
  • Attributed to the treating doctor
  • Comprehensive and professionally written
The system automatically logs:
  • Record creation timestamp
  • Doctor ID (who created the record)
  • Patient ID (who the record belongs to)
This audit trail ensures regulatory compliance and supports medico-legal requirements.

Build docs developers (and LLMs) love