Código migrado del proyecto monorepo original Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
102 lines
5.8 KiB
SQL
102 lines
5.8 KiB
SQL
-- ============================================================================
|
|
-- SEED DATA: Catálogos de Clínica Dental
|
|
-- Especialización de ERP-Clínicas
|
|
-- ============================================================================
|
|
-- NOTA: Ejecutar después de SET app.current_tenant_id = 'UUID-DEL-TENANT';
|
|
-- ============================================================================
|
|
|
|
-- Tratamientos dentales
|
|
INSERT INTO dental.tratamientos_catalogo (tenant_id, codigo, nombre, categoria, duracion_minutos, precio_base, requiere_rx, requiere_anestesia)
|
|
SELECT current_setting('app.current_tenant_id', true)::UUID, codigo, nombre, categoria, duracion, precio, rx, anestesia
|
|
FROM (VALUES
|
|
-- Prevención
|
|
('PREV-001', 'Limpieza dental básica', 'prevencion', 45, 600.00, false, false),
|
|
('PREV-002', 'Limpieza dental profunda', 'prevencion', 60, 1200.00, false, true),
|
|
('PREV-003', 'Aplicación de flúor', 'prevencion', 15, 300.00, false, false),
|
|
('PREV-004', 'Sellador de fosetas', 'prevencion', 20, 400.00, false, false),
|
|
-- Restauración
|
|
('REST-001', 'Resina simple (1 cara)', 'restauracion', 30, 800.00, true, true),
|
|
('REST-002', 'Resina compuesta (2 caras)', 'restauracion', 45, 1000.00, true, true),
|
|
('REST-003', 'Resina compleja (3+ caras)', 'restauracion', 60, 1300.00, true, true),
|
|
('REST-004', 'Incrustación de resina', 'restauracion', 90, 2500.00, true, true),
|
|
('REST-005', 'Incrustación de porcelana', 'restauracion', 90, 4000.00, true, true),
|
|
-- Endodoncia
|
|
('ENDO-001', 'Endodoncia unirradicular', 'endodoncia', 60, 3000.00, true, true),
|
|
('ENDO-002', 'Endodoncia birradicular', 'endodoncia', 90, 4000.00, true, true),
|
|
('ENDO-003', 'Endodoncia multirradicular', 'endodoncia', 120, 5000.00, true, true),
|
|
('ENDO-004', 'Retratamiento endodóntico', 'endodoncia', 120, 5500.00, true, true),
|
|
-- Periodoncia
|
|
('PERIO-001', 'Raspado y alisado radicular (cuadrante)', 'periodoncia', 60, 1500.00, true, true),
|
|
('PERIO-002', 'Cirugía periodontal', 'periodoncia', 120, 6000.00, true, true),
|
|
-- Cirugía
|
|
('CIRUG-001', 'Extracción simple', 'cirugia', 30, 800.00, true, true),
|
|
('CIRUG-002', 'Extracción de tercer molar', 'cirugia', 60, 3500.00, true, true),
|
|
('CIRUG-003', 'Extracción quirúrgica compleja', 'cirugia', 90, 5000.00, true, true),
|
|
-- Prótesis
|
|
('PROT-001', 'Corona de porcelana', 'protesis', 60, 6000.00, true, true),
|
|
('PROT-002', 'Corona de zirconia', 'protesis', 60, 8000.00, true, true),
|
|
('PROT-003', 'Puente fijo (3 unidades)', 'protesis', 120, 18000.00, true, true),
|
|
('PROT-004', 'Prótesis parcial removible', 'protesis', 120, 8000.00, true, false),
|
|
('PROT-005', 'Prótesis total', 'protesis', 180, 12000.00, true, false),
|
|
-- Implantes
|
|
('IMPL-001', 'Implante dental (sin corona)', 'implantes', 90, 15000.00, true, true),
|
|
('IMPL-002', 'Corona sobre implante', 'implantes', 60, 8000.00, false, false),
|
|
-- Ortodoncia
|
|
('ORTO-001', 'Brackets metálicos (tratamiento completo)', 'ortodoncia', 60, 35000.00, true, false),
|
|
('ORTO-002', 'Brackets estéticos (tratamiento completo)', 'ortodoncia', 60, 45000.00, true, false),
|
|
('ORTO-003', 'Alineadores invisibles', 'ortodoncia', 45, 60000.00, true, false),
|
|
('ORTO-004', 'Control mensual ortodoncia', 'ortodoncia', 30, 800.00, false, false),
|
|
('ORTO-005', 'Retenedor fijo', 'ortodoncia', 45, 3000.00, false, false),
|
|
-- Estética
|
|
('ESTE-001', 'Blanqueamiento en consultorio', 'estetica', 90, 5000.00, false, false),
|
|
('ESTE-002', 'Blanqueamiento casero', 'estetica', 30, 3000.00, false, false),
|
|
('ESTE-003', 'Carilla de resina', 'estetica', 60, 3500.00, false, false),
|
|
('ESTE-004', 'Carilla de porcelana', 'estetica', 60, 8000.00, false, false),
|
|
-- Diagnóstico
|
|
('DIAG-001', 'Radiografía periapical', 'diagnostico', 5, 100.00, false, false),
|
|
('DIAG-002', 'Radiografía panorámica', 'diagnostico', 10, 500.00, false, false),
|
|
('DIAG-003', 'Radiografía cefalométrica', 'diagnostico', 10, 400.00, false, false),
|
|
('DIAG-004', 'Tomografía dental', 'diagnostico', 15, 1500.00, false, false)
|
|
) AS t(codigo, nombre, categoria, duracion, precio, rx, anestesia)
|
|
WHERE current_setting('app.current_tenant_id', true) IS NOT NULL
|
|
AND current_setting('app.current_tenant_id', true) != ''
|
|
ON CONFLICT (tenant_id, codigo) DO NOTHING;
|
|
|
|
-- Skills específicos dentales
|
|
INSERT INTO hr.skills (tenant_id, skill_type_id, name, requiere_cedula)
|
|
SELECT
|
|
current_setting('app.current_tenant_id', true)::UUID,
|
|
st.id,
|
|
unnest(ARRAY[
|
|
'Odontología General',
|
|
'Ortodoncia',
|
|
'Endodoncia',
|
|
'Periodoncia',
|
|
'Cirugía Maxilofacial',
|
|
'Odontopediatría',
|
|
'Prostodoncia',
|
|
'Implantología',
|
|
'Estética Dental',
|
|
'Rehabilitación Oral'
|
|
]),
|
|
true
|
|
FROM hr.skill_types st
|
|
WHERE st.name = 'Especialidad Médica'
|
|
AND st.tenant_id = current_setting('app.current_tenant_id', true)::UUID
|
|
ON CONFLICT DO NOTHING;
|
|
|
|
-- Ubicaciones (unidades dentales)
|
|
INSERT INTO hr.work_locations (tenant_id, name, tipo_consultorio, capacidad, equipamiento)
|
|
SELECT current_setting('app.current_tenant_id', true)::UUID, name, tipo, capacidad, equipamiento::TEXT[]
|
|
FROM (VALUES
|
|
('Unidad Dental 1', 'especialidad', 1, ARRAY['sillon', 'rayos_x', 'ultrasonido']),
|
|
('Unidad Dental 2', 'especialidad', 1, ARRAY['sillon', 'rayos_x', 'ultrasonido']),
|
|
('Unidad Dental 3', 'especialidad', 1, ARRAY['sillon', 'rayos_x']),
|
|
('Quirófano Dental', 'quirofano', 1, ARRAY['sillon', 'rayos_x', 'equipo_cirugia']),
|
|
('Sala de Rayos X', 'laboratorio', 2, ARRAY['panoramico', 'cefalometrico']),
|
|
('Laboratorio Dental', 'laboratorio', 2, ARRAY['modelos', 'protesis'])
|
|
) AS t(name, tipo, capacidad, equipamiento)
|
|
WHERE current_setting('app.current_tenant_id', true) IS NOT NULL
|
|
AND current_setting('app.current_tenant_id', true) != ''
|
|
ON CONFLICT DO NOTHING;
|