# 新建表

```sql
-- auto-generated definition
create table diagnose_to_req
(
    id          varchar(50) not null
        constraint diagnose_to_req_pk
            primary key,
    name        nvarchar(50),
    create_code varchar(20) not null,
    create_time datetime    not null,
    update_code varchar(20),
    update_time datetime,
    py_code     varchar(50) not null,
    wb_code     varchar(50) not null
)
go

exec sp_addextendedproperty 'MS_Description', N'开了诊断触发是否开具检验检查', 'SCHEMA', 'dbo', 'TABLE',
     'diagnose_to_req'
go

exec sp_addextendedproperty 'MS_Description', N'诊断的编码，主键', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_to_req', 'COLUMN',
     'id'
go

exec sp_addextendedproperty 'MS_Description', N'创建人', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_to_req', 'COLUMN',
     'create_code'
go

exec sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_to_req', 'COLUMN',
     'create_time'
go


```
```sql
-- auto-generated definition
create table diagnose_req_template
(
    id             varchar(32) not null
        constraint diagnose_req_template_pk
            primary key,
    order_code     varchar(32) not null,
    req_type       smallint    not null,
    exec_dept      varchar(20) not null,
    part_or_sample varchar(30),
    template_id    varchar(32) not null
)
go

exec sp_addextendedproperty 'MS_Description', N'检验检查模板', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_req_template'
go

exec sp_addextendedproperty 'MS_Description', N'2-检验 -3检查', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_req_template',
     'COLUMN', 'req_type'
go

exec sp_addextendedproperty 'MS_Description', N'执行科室', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_req_template', 'COLUMN',
     'exec_dept'
go

exec sp_addextendedproperty 'MS_Description', N'部位或者标本', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_req_template',
     'COLUMN', 'part_or_sample'
go

exec sp_addextendedproperty 'MS_Description', N'对应的是 diagnose_to_req 的id', 'SCHEMA', 'dbo', 'TABLE',
     'diagnose_req_template', 'COLUMN', 'template_id'
go


```
```sql
-- auto-generated definition
create table diagnose_template
(
    id            varchar(32)  not null
        constraint diagnose_template_pk
            primary key,
    diagnose_code varchar(100) not null,
    template_id   varchar(32)  not null
)
go

exec sp_addextendedproperty 'MS_Description', N'一个诊断可以对应多个检验检查', 'SCHEMA', 'dbo', 'TABLE',
     'diagnose_template'
go

exec sp_addextendedproperty 'MS_Description', N'诊断编码', 'SCHEMA', 'dbo', 'TABLE', 'diagnose_template', 'COLUMN',
     'diagnose_code'
go

exec sp_addextendedproperty 'MS_Description', N'对应的是 diagnose_to_req 的id', 'SCHEMA', 'dbo', 'TABLE',
     'diagnose_template', 'COLUMN', 'template_id'
go

create index diagnose_template_diagnose_code_index
    on diagnose_template (diagnose_code)
go


```
