-- ----------------------------
-- Table structure for zy_receipt
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[zy_receipt_obsolete]') AND type IN ('U'))
	DROP TABLE [dbo].[zy_receipt_obsolete]
GO

CREATE TABLE [dbo].[zy_receipt_obsolete] (
  [inpatient_no] char(12) COLLATE Chinese_PRC_BIN  NOT NULL,
  [admiss_times] smallint  NOT NULL,
  [ledger_sn] int  NOT NULL,
  [receipt_sn] int  NOT NULL,
  [receipt_no] char(12) COLLATE Chinese_PRC_BIN  NOT NULL,
  [account_date] datetime  NULL,
  [date_1] datetime  NOT NULL,
  [date_2] datetime  NOT NULL,
  [ward] char(7) COLLATE Chinese_PRC_BIN  NOT NULL,
  [dept] char(7) COLLATE Chinese_PRC_BIN  NOT NULL,
  [print_date] datetime  NOT NULL,
  [responce_unit] char(2) COLLATE Chinese_PRC_BIN  NOT NULL,
  [op_id_code] char(5) COLLATE Chinese_PRC_BIN  NOT NULL,
  [total_charge] decimal(12,2)  NOT NULL,
  [charge1] decimal(12,2)  NOT NULL,
  [charge2] decimal(12,2)  NOT NULL,
  [charge3] decimal(12,2)  NOT NULL,
  [charge4] decimal(12,2)  NOT NULL,
  [charge5] decimal(12,2)  NOT NULL,
  [charge6] decimal(12,2)  NOT NULL,
  [charge7] decimal(12,2)  NOT NULL,
  [charge8] decimal(12,2)  NOT NULL,
  [charge9] decimal(12,2)  NOT NULL,
  [charge10] decimal(12,2)  NOT NULL,
  [charge11] decimal(12,2)  NOT NULL,
  [charge12] decimal(12,2)  NOT NULL,
  [charge13] decimal(12,2)  NOT NULL,
  [charge14] decimal(12,2)  NOT NULL,
  [charge15] decimal(12,2)  NOT NULL,
  [charge16] decimal(12,2)  NOT NULL,
  [charge17] decimal(12,2)  NOT NULL,
  [charge18] decimal(12,2)  NOT NULL,
  [charge19] decimal(12,2)  NOT NULL,
  [charge20] decimal(12,2)  NOT NULL,
  [charge21] decimal(12,2)  NOT NULL,
  [charge22] decimal(12,2)  NOT NULL,
  [charge23] decimal(12,2)  NOT NULL,
  [charge24] decimal(12,2)  NOT NULL,
  [charge25] decimal(12,2)  NOT NULL,
  [charge26] decimal(12,2)  NOT NULL,
  [charge27] decimal(12,2)  NOT NULL,
  [charge28] decimal(12,2)  NOT NULL,
  [charge29] decimal(12,2)  NOT NULL,
  [charge30] decimal(12,2)  NOT NULL,
  [doctor] char(5) COLLATE Chinese_PRC_BIN  NULL,
  [zy_serial_no] varchar(14) COLLATE Chinese_PRC_BIN  NULL,
  [receipt_status] tinyint DEFAULT ((0)) NOT NULL,
  [update_time] datetime2(0)  NULL,
  [update_id] varchar(255) COLLATE Chinese_PRC_BIN  NULL
)
GO

ALTER TABLE [dbo].[zy_receipt_obsolete] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'发票状态   2 作废',
'SCHEMA', N'dbo',
'TABLE', N'zy_receipt',
'COLUMN', N'receipt_status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'zy_receipt',
'COLUMN', N'update_time'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人id',
'SCHEMA', N'dbo',
'TABLE', N'zy_receipt',
'COLUMN', N'update_id'
GO


-- ----------------------------
-- Indexes structure for table zy_receipt
-- ----------------------------
CREATE UNIQUE NONCLUSTERED INDEX [ix_zy_receipt_obsolete_1]
ON [dbo].[zy_receipt_obsolete] (
  [inpatient_no] ASC,
  [admiss_times] ASC,
  [ledger_sn] ASC,
  [receipt_sn] ASC
)
GO