USE [Clinica]
GO
/****** Object:  Table [Clinica].[Paciente]    Script Date: 18-08-2025 21:38:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Clinica].[Paciente](
	[IdPaciente] [int] IDENTITY(1,1) NOT NULL,
	[Rut] [varchar](16) NOT NULL,
	[Nombres] [varchar](256) NOT NULL,
	[Apellidos] [varchar](256) NOT NULL,
	[Direccion] [varchar](256) NOT NULL,
	[IdComuna] [int] NOT NULL,
	[IdRegion] [int] NULL,
	[FechaNacimiento] [date] NULL,
	[Telefono] [varchar](256) NOT NULL,
	[Email] [varchar](256) NOT NULL,
	[IndVigente] [tinyint] NOT NULL,
	[IndEliminado] [tinyint] NOT NULL,
 CONSTRAINT [PK__Paciente__C93DB49B8A79AF36] PRIMARY KEY CLUSTERED 
(
	[IdPaciente] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Rut__59904A2C]  DEFAULT ('') FOR [Rut]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Nombre__56B3DD81]  DEFAULT ('') FOR [Nombres]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Apelli__5A846E65]  DEFAULT ('') FOR [Apellidos]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF_Paciente_Direccion]  DEFAULT ('') FOR [Direccion]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Comuna__5B78929E]  DEFAULT ('') FOR [IdComuna]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Telefo__5C6CB6D7]  DEFAULT ('') FOR [Telefono]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__Email__5D60DB10]  DEFAULT ('') FOR [Email]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__IndVig__57A801BA]  DEFAULT ((1)) FOR [IndVigente]
GO
ALTER TABLE [Clinica].[Paciente] ADD  CONSTRAINT [DF__Paciente__IndEli__589C25F3]  DEFAULT ((0)) FOR [IndEliminado]
GO
ALTER TABLE [Clinica].[Paciente]  WITH CHECK ADD  CONSTRAINT [FK_Paciente_Comuna] FOREIGN KEY([IdComuna])
REFERENCES [Parametro].[Comuna] ([IdComuna])
GO
ALTER TABLE [Clinica].[Paciente] CHECK CONSTRAINT [FK_Paciente_Comuna]
GO
