USE [Clinica]
GO
/****** Object:  Table [Laboratorio].[Orden]    Script Date: 18-08-2025 21:40:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [Laboratorio].[Orden](
	[IdOrden] [int] IDENTITY(1,1) NOT NULL,
	[IdLaboratorio] [int] NOT NULL,
	[NumeroOrden] [varchar](64) NOT NULL,
	[Rut] [varchar](16) NOT NULL,
	[NombrePaciente] [varchar](256) NOT NULL,
	[TomaMuestra] [varchar](256) NOT NULL,
	[Convenio] [varchar](512) NOT NULL,
	[Fecha] [datetime] NULL,
	[NombreArchivoPdf] [varchar](512) NOT NULL,
	[FechaCaptura] [datetime] NULL,
	[FechaUltimaModificacion] [datetime] NULL,
	[IdPaciente] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[IdOrden] 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 [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [NumeroOrden]
GO
ALTER TABLE [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [Rut]
GO
ALTER TABLE [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [NombrePaciente]
GO
ALTER TABLE [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [TomaMuestra]
GO
ALTER TABLE [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [Convenio]
GO
ALTER TABLE [Laboratorio].[Orden] ADD  DEFAULT ('') FOR [NombreArchivoPdf]
GO
ALTER TABLE [Laboratorio].[Orden]  WITH CHECK ADD FOREIGN KEY([IdLaboratorio])
REFERENCES [Laboratorio].[Laboratorio] ([IdLaboratorio])
GO
