USE [Clinica]
GO
/****** Object:  Table [Ficha].[Ficha]    Script Date: 18-08-2025 21:40:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Ficha].[Ficha](
	[IdFicha] [int] IDENTITY(1,1) NOT NULL,
	[IdPaciente] [int] NOT NULL,
	[FechaCreacion] [datetime] NOT NULL,
	[IdUsuarioCreacion] [int] NOT NULL,
	[IdProfesional] [int] NOT NULL,
	[AntecedentesGenerales] [varchar](4096) NOT NULL,
	[AntecedentesQuirurgicos] [varchar](4096) NOT NULL,
	[Alergias] [varchar](4096) NOT NULL,
	[Contraindicaciones] [varchar](4096) NOT NULL,
	[IndEliminado] [tinyint] NOT NULL,
 CONSTRAINT [PK__Ficha__882089D5D19D00C5] PRIMARY KEY CLUSTERED 
(
	[IdFicha] 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 [Ficha].[Ficha] ADD  CONSTRAINT [DF__Ficha__Anteceden__379037E3]  DEFAULT ('') FOR [AntecedentesGenerales]
GO
ALTER TABLE [Ficha].[Ficha] ADD  CONSTRAINT [DF__Ficha__Anteceden__7775B2CE]  DEFAULT ('') FOR [AntecedentesQuirurgicos]
GO
ALTER TABLE [Ficha].[Ficha] ADD  CONSTRAINT [DF__Ficha__Alergias__38845C1C]  DEFAULT ('') FOR [Alergias]
GO
ALTER TABLE [Ficha].[Ficha] ADD  CONSTRAINT [DF__Ficha__Contraind__39788055]  DEFAULT ('') FOR [Contraindicaciones]
GO
ALTER TABLE [Ficha].[Ficha] ADD  CONSTRAINT [DF__Ficha__IndElimin__3A6CA48E]  DEFAULT ((0)) FOR [IndEliminado]
GO
ALTER TABLE [Ficha].[Ficha]  WITH CHECK ADD  CONSTRAINT [FK__Ficha__IdPacient__34B3CB38] FOREIGN KEY([IdPaciente])
REFERENCES [Clinica].[Paciente] ([IdPaciente])
GO
ALTER TABLE [Ficha].[Ficha] CHECK CONSTRAINT [FK__Ficha__IdPacient__34B3CB38]
GO
ALTER TABLE [Ficha].[Ficha]  WITH CHECK ADD  CONSTRAINT [FK__Ficha__IdProfesi__369C13AA] FOREIGN KEY([IdProfesional])
REFERENCES [Clinica].[Profesional] ([IdProfesional])
GO
ALTER TABLE [Ficha].[Ficha] CHECK CONSTRAINT [FK__Ficha__IdProfesi__369C13AA]
GO
ALTER TABLE [Ficha].[Ficha]  WITH CHECK ADD  CONSTRAINT [FK__Ficha__IdUsuario__35A7EF71] FOREIGN KEY([IdUsuarioCreacion])
REFERENCES [Core].[Usuario] ([IdUsuario])
GO
ALTER TABLE [Ficha].[Ficha] CHECK CONSTRAINT [FK__Ficha__IdUsuario__35A7EF71]
GO
