# 新增临床路径

新建表

```sql
-- auto-generated definition
create table clinical_pathway_day
(
    id            varchar(18)       not null
        constraint clinical_pathway_day_pk
            primary key,
    template_id   varchar(18)       not null,
    execution_day tinyint           not null,
    sort          tinyint default 0 not null
)
go

exec sp_addextendedproperty 'MS_Description', N'路径每天应该做什么', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_day'
go

exec sp_addextendedproperty 'MS_Description', N'临床路径的模板', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_day',
     'COLUMN', 'template_id'
go

exec sp_addextendedproperty 'MS_Description', N'执行间隔几天', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_day',
     'COLUMN', 'execution_day'
go

exec sp_addextendedproperty 'MS_Description', N'排序', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_day', 'COLUMN',
     'sort'
go

create index clinical_pathway_day_template_id_index
    on clinical_pathway_day (template_id)
go

-- auto-generated definition
create table clinical_pathway_diagnose
(
    id            varchar(18) not null
        constraint clinical_pathway_diagnose_pk
            primary key,
    diagnose_code varchar(32) not null,
    template_id   varchar(18) not null
)
go

exec sp_addextendedproperty 'MS_Description', N'临床路径诊断表', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_diagnose'
go

exec sp_addextendedproperty 'MS_Description', N'主键', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_diagnose', 'COLUMN',
     'id'
go

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

create index clinical_pathway_diagnose_index
    on clinical_pathway_diagnose (diagnose_code)
go

-- auto-generated definition
create table clinical_pathway_order
(
    id               varchar(18) not null
        primary key,
    work_id          varchar(18) not null,
    order_code       varchar(5),
    order_name       varchar(100),
    frequ_code       varchar(10),
    drug_flag        varchar,
    supply_code      varchar(5),
    drug_quan        decimal(18, 3),
    instruction      nvarchar(40),
    specification    nvarchar(16),
    mini_unit        varchar(2),
    drug_weight      decimal(18, 3),
    drug_weight_unit varchar(3),
    parent_no        varchar(18),
    drug_volume      decimal(10, 3),
    drug_vol_unit    varchar(2),
    dose             decimal(18, 3),
    dose_unit        varchar(10),
    drug_occ         decimal(18, 3),
    discription      nvarchar(200),
    serial           varchar(2),
    exec_unit        varchar(7),
    type             tinyint,
    exec_day         tinyint default 0
)
go

exec sp_addextendedproperty 'MS_Description', N'临床路径医嘱表', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order'
go

exec sp_addextendedproperty 'MS_Description', 'id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN', 'id'
go

exec sp_addextendedproperty 'MS_Description', N'工作内容id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order',
     'COLUMN', 'work_id'
go

exec sp_addextendedproperty 'MS_Description', N'医嘱编码', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'order_code'
go

exec sp_addextendedproperty 'MS_Description', N'医嘱名称', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'order_name'
go

exec sp_addextendedproperty 'MS_Description', N'执行频率', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'frequ_code'
go

exec sp_addextendedproperty 'MS_Description', N'药品标志', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'drug_flag'
go

exec sp_addextendedproperty 'MS_Description', N'给药方式/如果type=1就是标本了', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_order', 'COLUMN', 'supply_code'
go

exec sp_addextendedproperty 'MS_Description', N'一次剂量', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'drug_quan'
go

exec sp_addextendedproperty 'MS_Description', N'嘱托', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'instruction'
go

exec sp_addextendedproperty 'MS_Description', N'规格', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'specification'
go

exec sp_addextendedproperty 'MS_Description', N'最小单位', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'mini_unit'
go

exec sp_addextendedproperty 'MS_Description', N'药品的重量', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order',
     'COLUMN', 'drug_weight'
go

exec sp_addextendedproperty 'MS_Description', N'药品的重量单位', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order',
     'COLUMN', 'drug_weight_unit'
go

exec sp_addextendedproperty 'MS_Description', N'父医嘱', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'parent_no'
go

exec sp_addextendedproperty 'MS_Description', N'药品的卷大小', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order',
     'COLUMN', 'drug_volume'
go

exec sp_addextendedproperty 'MS_Description', N'单位', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'drug_vol_unit'
go

exec sp_addextendedproperty 'MS_Description', N'一次剂量', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'dose'
go

exec sp_addextendedproperty 'MS_Description', N'剂量单位', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'dose_unit'
go

exec sp_addextendedproperty 'MS_Description', N'00 项目 01 小包装 99 大包装', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_order', 'COLUMN', 'serial'
go

exec sp_addextendedproperty 'MS_Description', N'执行科室', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'exec_unit'
go

exec sp_addextendedproperty 'MS_Description', N'0-医嘱 1-检验 2-检查', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_order', 'COLUMN', 'type'
go

exec sp_addextendedproperty 'MS_Description', N'执行几天', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_order', 'COLUMN',
     'exec_day'
go

create index clinical_pathway_order_work_id_index
    on clinical_pathway_order (work_id)
go

-- auto-generated definition
create table clinical_pathway_patient
(
    id          varchar(18)                not null,
    pat_no      varchar(10)                not null,
    times       tinyint,
    template_id varchar(18)                not null,
    create_time datetime default getdate() not null,
    create_code varchar(10)                not null,
    state       tinyint  default 0         not null,
    update_code varchar(10),
    update_time datetime,
    reason      nvarchar(100)
)
go

exec sp_addextendedproperty 'MS_Description', N'患者路径路径表', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient'
go

exec sp_addextendedproperty 'MS_Description', N'住院号', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient', 'COLUMN',
     'pat_no'
go

exec sp_addextendedproperty 'MS_Description', N'住院次数', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient',
     'COLUMN', 'times'
go

exec sp_addextendedproperty 'MS_Description', N'选中的临床路径id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient',
     'COLUMN', 'template_id'
go

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

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

exec sp_addextendedproperty 'MS_Description', N'0-入径 1-出径 2-变异 3-完成', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_patient', 'COLUMN', 'state'
go

exec sp_addextendedproperty 'MS_Description', N'出径-变异的理由', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient',
     'COLUMN', 'reason'
go

-- auto-generated definition
create table clinical_pathway_patient_day_log
(
    id          varchar(18)                not null
        constraint clinical_pathway_patient_day_log_pk
            primary key,
    day_id      varchar(18),
    create_code varchar(5)                 not null,
    create_time datetime default getdate() not null,
    pat_no      varchar(8),
    times       tinyint                    not null,
    state       tinyint  default 0         not null,
    describe    nvarchar(200),
    template_id varchar(18)                not null,
    update_code varchar(10),
    update_time datetime,
    exec_date   date                       not null
)
go

exec sp_addextendedproperty 'MS_Description', N'天数id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'day_id'
go

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

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

exec sp_addextendedproperty 'MS_Description', N'住院号', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'pat_no'
go

exec sp_addextendedproperty 'MS_Description', N'住院次数', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'times'
go

exec sp_addextendedproperty 'MS_Description', N'0-入径 1-出径 2-变异 3-完成', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_patient_day_log', 'COLUMN', 'state'
go

exec sp_addextendedproperty 'MS_Description', N'描述', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'describe'
go

exec sp_addextendedproperty 'MS_Description', N'模板id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'template_id'
go

exec sp_addextendedproperty 'MS_Description', N'执行时间', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_day_log',
     'COLUMN', 'exec_date'
go

create index clinical_pathway_patient_day_log_pat_no_times_index
    on clinical_pathway_patient_day_log (pat_no, times)
go

-- auto-generated definition
create table clinical_pathway_work
(
    id           varchar(18)       not null
        constraint clinical_pathway_work_pk
            primary key,
    day_id       varchar(18)       not null,
    work_content nvarchar(20)      not null,
    type         smallint          not null,
    exec_type    tinyint default 1 not null,
    sort         smallint          not null
)
go

exec sp_addextendedproperty 'MS_Description', N'工作', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_work'
go

exec sp_addextendedproperty 'MS_Description', N'工作内容', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_work', 'COLUMN',
     'work_content'
go

exec sp_addextendedproperty 'MS_Description', N'0 - 主要诊疗工作 - 1长期医嘱 2-临时医嘱 3-主要护理', 'SCHEMA', 'dbo',
     'TABLE', 'clinical_pathway_work', 'COLUMN', 'type'
go

exec sp_addextendedproperty 'MS_Description', N'执行方式 0- 每天执行 1- 必要时执行 ', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_work', 'COLUMN', 'exec_type'
go

create index clinical_pathway_work_day_id_index
    on clinical_pathway_work (day_id)
go

-- auto-generated definition
create table clinical_pathway_patient_work_log
(
    id          varchar(18)                not null
        constraint clinical_pathway_patient_work_log_pk
            primary key,
    day_id      varchar(18)                not null,
    complete    tinyint                    not null,
    create_code varchar(5)                 not null,
    create_time datetime default getdate() not null,
    content_id  varchar(18)                not null,
    describe    nvarchar(50),
    pat_no      varchar(10)                not null,
    times       tinyint                    not null
)
go

exec sp_addextendedproperty 'MS_Description', N'每天的工作内容', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_patient_work_log'
go

exec sp_addextendedproperty 'MS_Description', N'这个id是 clinical_pathway_patient_day_log 这个表的主键', 'SCHEMA',
     'dbo', 'TABLE', 'clinical_pathway_patient_work_log', 'COLUMN', 'day_id'
go

exec sp_addextendedproperty 'MS_Description', N'0-没有完成1-完成2-半完成', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_patient_work_log', 'COLUMN', 'complete'
go

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

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

exec sp_addextendedproperty 'MS_Description', N'工作内容的id  clinical_pathway_work 这个表中的id', 'SCHEMA', 'dbo',
     'TABLE', 'clinical_pathway_patient_work_log', 'COLUMN', 'content_id'
go

exec sp_addextendedproperty 'MS_Description', N'描述', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_patient_work_log',
     'COLUMN', 'describe'
go

create index clinical_pathway_patient_work_log_day_id_index
    on clinical_pathway_patient_work_log (day_id)
go

create index clinical_pathway_patient_work_log_pat_no_times_index
    on clinical_pathway_patient_work_log (pat_no, times)
go

-- auto-generated definition
create table clinical_pathway_templates
(
    id          varchar(18)   not null
        constraint clinical_pathway_templates_pk
            primary key,
    name        nvarchar(20)  not null,
    dept_code   varchar(20)   not null,
    create_time datetime      not null,
    create_code varchar(10),
    update_time datetime,
    del_flag    bit default 0 not null,
    update_code varchar(20),
    is_dir      bit,
    parent_code varchar(18),
    publish     bit default 0 not null,
    describe    nvarchar(200)
)
go

exec sp_addextendedproperty 'MS_Description', N'临床路径模板表', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates'
go

exec sp_addextendedproperty 'MS_Description', N'雪花算法id', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'id'
go

exec sp_addextendedproperty 'MS_Description', N'模板名称', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'name'
go

exec sp_addextendedproperty 'MS_Description', N'科室名称 00000 - 全院模板', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_templates', 'COLUMN', 'dept_code'
go

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

exec sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'update_time'
go

exec sp_addextendedproperty 'MS_Description', N'逻辑删除', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'del_flag'
go

exec sp_addextendedproperty 'MS_Description', N'是否文件夹', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'is_dir'
go

exec sp_addextendedproperty 'MS_Description', N'父节点', 'SCHEMA', 'dbo', 'TABLE', 'clinical_pathway_templates',
     'COLUMN', 'parent_code'
go

exec sp_addextendedproperty 'MS_Description', N'是否发布发布后就不能再修改和删除了就一直存在', 'SCHEMA', 'dbo', 'TABLE',
     'clinical_pathway_templates', 'COLUMN', 'publish'
go


```

新增页面

```
INSERT INTO t_intergration_menu (id, type, path, icon, name, parent_id, meta_title, meta_hide_tabs, meta_pass_rule, sort, component, redirect, path_params, meta_show_menu, main_card, main_overflow_auto, meta_link, fullscreen) VALUES (323, 2, N'clinicalPathway', N'', N'clinicalPathway', 16, N'临床路径模板维护', 0, 0, 9999, N'../views/dictionary/clinical-pathway/index.vue', N'', N'', 1, 0, 0, 0, 0);
INSERT INTO t_intergration_menu (id, type, path, icon, name, parent_id, meta_title, meta_hide_tabs, meta_pass_rule, sort, component, redirect, path_params, meta_show_menu, main_card, main_overflow_auto, meta_link, fullscreen) VALUES (331, 2, N'patientClinicalPathway', N'', N'patientClinicalPathway', 89, N'临床路径', 0, 0, 9999, N'../views/hospitalization/zhu-yuan-yi-sheng/clinical-pathway/index.vue', N'', N'', 1, 0, 0, 0, 0);

```

# 新增配置

```yaml
thyy:
  archive:
    path: "/mnt/archive"
    archive-url: http://172.16.32.197:20921/thyy/api/archive
    emr-archive-url: "http://webhis.thyy.cn:8080/thyyemrpdfserver/emr/archive/pdf"
```

## 新增ca签名缓存表

```sql
-- auto-generated definition
create table ca_sign_redis
(
    id          varchar(100)               not null
        constraint ca_sign_redis_pk
            primary key,
    value       text,
    create_time datetime default getdate() not null
)
go

exec sp_addextendedproperty 'MS_Description', 'key', 'SCHEMA', 'dbo', 'TABLE', 'ca_sign_redis', 'COLUMN', 'id'
go

exec sp_addextendedproperty 'MS_Description', N'值', 'SCHEMA', 'dbo', 'TABLE', 'ca_sign_redis', 'COLUMN', 'value'
go


```

