The Consultations module is where clinical encounters are formally documented. Each consultation is linked one-to-one with an appointment and captures the full clinical encounter: patient narrative, vital signs, physical examination by system, special procedures (colposcopy or obstetric control), diagnostic impression, treatment plan, and materials consumed — all in a structured, tab-based form that saves atomically to Supabase via an RPC call.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KevxxAlva/femesalud-zen-flow/llms.txt
Use this file to discover all available pages before exploring further.
Opening a Consultation
Consultations are always initiated from the Agenda module. Select any appointment card and click the Consulta action (stethoscope icon) to openConsultationForm as a full-screen dialog. The form pre-checks whether a consultation already exists for that appointment_id via useConsultationByAppointment:
- New consultation: all fields are blank with default values.
- Existing consultation: the form loads the saved data (including consumables) and switches to edit mode — the save button reads “Guardar Cambios” instead of “Completar Consulta”.
/facturacion) so the consultation fee can be processed immediately.
Visit Types
TheVisitType enum defines the nature of the encounter:
| Value | Display Label | Use Case |
|---|---|---|
CONTROL | Control | Routine follow-up or periodic check-up. |
EMERGENCIA | Emergencia | Urgent or unscheduled visit. Displayed in red throughout the UI. |
CONSULTA_NUEVA | Consulta Nueva | First encounter with a new complaint or new patient. Displayed in blue. |
POST_TRATAMIENTO | Post-Tratamiento | Follow-up after a surgical or clinical procedure. |
OTRO | Otro | Any visit that does not fit the above categories. |
Contact Channels
TheCONTACT_CHANNELS constant tracks how the patient learned about the clinic — used for marketing analytics:
contact_channel column of the consultations table.
Form Tabs
The consultation form is organised into five tabs. All fields are managed byreact-hook-form via a shared FormProvider context.
Anamnesis
Visit type (select from
VisitType), contact channel (select from CONTACT_CHANNELS), first-visit flag (checkbox — is_first_visit), and subjective exam (textarea — subjectiveExam: the patient’s own narrative, chief complaint, and immediate history).Físico y Vitales
Vital signs section:
BMI is read-only and recalculates live as the clinician types height and weight. It is stored as
| Field | Form Key | Unit |
|---|---|---|
| Height | heightCm | cm |
| Weight | weightKg | kg |
| BMI | auto-calculated | computed as weight / (height/100)² |
| Blood pressure | bloodPressure | e.g. 120/80 |
| Heart rate | heartRate | LPM |
| Respiratory rate | respiratoryRate | RPM |
| Temperature | temperature | °C |
bmi in the database.Physical exam by system (free-text inputs):| System | Form Key |
|---|---|
| Skin and teguments | skin |
| Head and neck | headNeck |
| Breasts | breasts |
| Abdomen | abdomen |
| Gynecological | gynecological |
| Extremities | extremities |
| Neurological | neurological |
Colpo & Obstetricia
Colposcopy findings (fill only if a colposcopy was performed):
Obstetric control (fill only if the patient is pregnant):
| Field | Form Key | Description |
|---|---|---|
| Acetic acid test result | aceticAcidTest | e.g. “Acetoblanco positivo” |
| Clock position (acetic) | aceticClockPosition | e.g. “12:00, 3:00” |
| Relative position (acetic) | aceticRelativePosition | e.g. “Zona de transformación” |
| Lugol (Schiller) test result | lugolTest | e.g. “Yodonegativo” |
| Clock position (Lugol) | lugolClockPosition | e.g. “6:00, 9:00” |
| Relative position (Lugol) | lugolRelativePosition | e.g. “Labio anterior” |
| Field | Form Key | Description |
|---|---|---|
| Gestational age | gestationalAge | e.g. “24.3 semanas” |
| Estimated fetal weight | fetalWeight | grams |
| Obstetric blood pressure | obstetricBp | e.g. “110/70” |
| Uterine height | uterineHeight | cm |
| Fetal presentation | presentation | Cefálica, Podálica, Transversa |
| Fetal heart rate | fetalHeartRate | LPM |
| Fetal movements | fetalMovements | e.g. “Activos, presentes” |
| Edema | edema | e.g. “Ausente, grado I” |
| Alarm signs | alarmSigns | e.g. “Niega cefalea, zumbidos” |
Diagnóstico & Plan
| Field | Form Key | Notes |
|---|---|---|
| Diagnosis | diagnosis | Required. Clinical impression. |
| Indications / Prescription | indications | Medication, dosage, rest orders. Supports prescription templates (see below). |
| Complementary exams | complementaryExams | Lab, imaging, or specialist referrals. |
| Plan / Conduct | plan | Clinical management plan, interconsultations, procedures. |
| Next appointment date | nextAppointmentDate | Suggested return date (type date). |
Consumables
Track all materials used during the encounter. Two sections are available:Common consumables (from Enter a quantity greater than 0 to include an item; leave it empty to exclude it.Custom consumables: click Añadir to add a row with free-text
COMMON_CONSUMABLES): a pre-defined list with quantity inputs and default units:item_name, numeric quantity, and unit (e.g., “U”, “par”, “cc”). Click the trash icon to remove a row.Consumables are passed to the RPC as an array and affect inventory stock if the inventory module is active. They also appear on the patient’s billing summary.Prescription Templates
The treatment plan tab includes a template system to avoid re-typing common medication instructions. To save the current indications as a template, type a name in the “Nombre de nueva plantilla” input and click Guardar. Templates are stored in theprescription_templates table and are available to all users in the clinic.
To apply a template, select it from the “Usar plantilla rápida…” dropdown. If the indications field already has content, the template text is appended (separated by a newline) rather than replacing what was already there. Templates can be deleted from the same dropdown using the trash icon next to each entry.
The PrescriptionTemplate interface:
Form Value Types
The complete set of form fields managed byreact-hook-form:
Saving
Consultations are persisted via two Supabase RPC functions to ensure atomicity:- Create:
create_consultation_rpc(p_consultation, p_consumables)— inserts the consultation row and all consumable records in a single database transaction. - Update:
update_consultation_rpc(p_consultation_id, p_patch, p_consumables)— updates the consultation and replaces the consumables set atomically.
Save and Print
The Guardar e Imprimir button saves the consultation and immediately generates a prescription PDF (generateRecipePDF) using the indications field, patient demographics, and doctor credentials. The PDF opens in a new browser tab for printing or saving.