USE [Clinica]
GO
/****** Object:  Table [Clinica].[Cita]    Script Date: 18-08-2025 21:38:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Clinica].[Cita](
	[IdCita] [int] IDENTITY(1,1) NOT NULL,
	[IdProfesional] [int] NOT NULL,
	[IdPaciente] [int] NOT NULL,
	[IdPrestacion] [int] NOT NULL,
	[IdUsuario] [int] NULL,
	[FechaHora] [datetime] NULL,
	[DuracionMinutos] [int] NULL,
	[IdTipoEstadoCita] [int] NOT NULL,
	[IndEliminado] [tinyint] NOT NULL,
	[IdSistemaSalud] [int] NULL,
	[CodTransac] [varchar](20) NULL,
	[CodAuditoria] [varchar](50) NULL,
	[Token] [varchar](max) NULL,
	[IdEstadoImed] [int] NULL,
	[IdFichaEvolucion] [int] NULL,
	[IndCitaControl] [tinyint] NULL,
 CONSTRAINT [PK__Cita__394B0202EB968082] PRIMARY KEY CLUSTERED 
(
	[IdCita] 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] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [Clinica].[Cita] ADD  CONSTRAINT [DF__Cita__IndElimina__01D345B0]  DEFAULT ((0)) FOR [IndEliminado]
GO
ALTER TABLE [Clinica].[Cita]  WITH CHECK ADD  CONSTRAINT [FK__Cita__IdPaciente__7EF6D905] FOREIGN KEY([IdPaciente])
REFERENCES [Clinica].[Paciente] ([IdPaciente])
GO
ALTER TABLE [Clinica].[Cita] CHECK CONSTRAINT [FK__Cita__IdPaciente__7EF6D905]
GO
ALTER TABLE [Clinica].[Cita]  WITH CHECK ADD  CONSTRAINT [FK__Cita__IdPrestaci__7FEAFD3E] FOREIGN KEY([IdPrestacion])
REFERENCES [Clinica].[Prestacion] ([IdPrestacion])
GO
ALTER TABLE [Clinica].[Cita] CHECK CONSTRAINT [FK__Cita__IdPrestaci__7FEAFD3E]
GO
ALTER TABLE [Clinica].[Cita]  WITH CHECK ADD  CONSTRAINT [FK__Cita__IdProfesio__7E02B4CC] FOREIGN KEY([IdProfesional])
REFERENCES [Clinica].[Profesional] ([IdProfesional])
GO
ALTER TABLE [Clinica].[Cita] CHECK CONSTRAINT [FK__Cita__IdProfesio__7E02B4CC]
GO
ALTER TABLE [Clinica].[Cita]  WITH CHECK ADD  CONSTRAINT [FK__Cita__IdTipoEsta__00DF2177] FOREIGN KEY([IdTipoEstadoCita])
REFERENCES [Clinica].[TipoEstadoCita] ([IdTipoEstadoCita])
GO
ALTER TABLE [Clinica].[Cita] CHECK CONSTRAINT [FK__Cita__IdTipoEsta__00DF2177]
GO
ALTER TABLE [Clinica].[Cita]  WITH CHECK ADD  CONSTRAINT [FK_Cita_SistemaSalud] FOREIGN KEY([IdSistemaSalud])
REFERENCES [Clinica].[SistemaSalud] ([IdSistemaSalud])
GO
ALTER TABLE [Clinica].[Cita] CHECK CONSTRAINT [FK_Cita_SistemaSalud]
GO
