CREATE TABLE `dwd_activity_patient_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `act_no` varchar(48) NOT NULL COMMENT '活动编号',
  `register_id` varchar(48) NULL COMMENT '挂号ID',
  `patient_name` varchar(128) NULL COMMENT 'mc'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `act_no`)
COMMENT 'DWD_参加活动的患者'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_collect_fee_record_info` (
  `patient_id` varchar(64) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(64) NULL COMMENT '就诊记录号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `register_sn` varchar(48) NULL COMMENT '挂号流水号',
  `register_date` datetime NULL COMMENT '挂号时间',
  `register_department_code_raw` varchar(48) NULL COMMENT '挂号部门编号(原始)',
  `register_department_code_standard` varchar(48) NULL COMMENT '挂号部门编号(标准)',
  `fee_code_raw` varchar(48) NULL COMMENT '费用编号(原始)',
  `fee_name_raw` varchar(128) NULL COMMENT '费用名称(原始)',
  `fee_name_standard` varchar(128) NULL COMMENT '费用名称(标准)',
  `fee_code_standard` varchar(48) NULL COMMENT '费用编号(标准)',
  `item_name_raw` varchar(128) NULL COMMENT '收费项目名称(原始)',
  `item_name_standard` varchar(128) NULL COMMENT '收费项目名称(标准)',
  `item_code_raw` varchar(64) NULL COMMENT '收费项目编号(原始)',
  `item_code_standard` varchar(64) NULL COMMENT '收费项目编号(标准)',
  `doctor_code` varchar(48) NULL COMMENT '医生编号',
  `finance_department_code_raw` varchar(48) NULL COMMENT '执行部门编号(原始)',
  `finance_department_code_standard` varchar(48) NULL COMMENT '执行部门编号(标准)',
  `department_name_raw` varchar(128) NULL COMMENT '科室名称(原始)',
  `department_name_standard` varchar(128) NULL COMMENT '科室名称(标准)',
  `department_code_raw` varchar(64) NULL COMMENT '科室编码(原始)',
  `department_code_standard` varchar(64) NULL COMMENT '科室编码(标准)',
  `total_fee` DECIMAL(11, 2) NULL COMMENT '收费总金额',
  `own_fee` DECIMAL(11, 2) NULL COMMENT '自费金额',
  `own_pay_fee` DECIMAL(11, 2) NULL COMMENT '自付金额',
  `center_pay_fee` DECIMAL(11, 2) NULL COMMENT '统筹金额',
  `invoice_no` varchar(48) NULL COMMENT '发票号',
  `fee_date` datetime NULL COMMENT '收费时间',
  `status_raw` varchar(24) NULL COMMENT '状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态(标准)',
  `type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据更新时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD收费记录信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_diagnosis_report_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `recipe_id` varchar(64) NULL COMMENT '关联处方id',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '下诊断科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '下诊断科室名称(标准)',
  `department_code_raw` varchar(64) NULL COMMENT '下诊断科室编码(原始)',
  `department_code_standard` varchar(64) NULL COMMENT '下诊断科室编码(标准)',
  `doctor_code` varchar(128) NULL COMMENT '下诊断医生编号',
  `doctor_name` varchar(128) NULL COMMENT '下诊断医生姓名',
  `diagnosis_time` datetime NULL COMMENT '诊断时间',
  `scene_type_raw` varchar(48) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(48) NULL COMMENT '场景分类(标准)',
  `rel_type` varchar(48) NULL COMMENT '关联业务分类',
  `rel_id` varchar(48) NULL COMMENT '关联业务ID',
  `description` varchar(128) NULL COMMENT '备注',
  `diagnosis_code_raw` varchar(64) NULL COMMENT '诊断编码(原始)',
  `diagnosis_code_standard` varchar(64) NULL COMMENT '诊断编码(标准)',
  `diagnosis_name_raw` varchar(256) NULL COMMENT '诊断内容(原始)',
  `diagnosis_name_standard` varchar(256) NULL COMMENT '诊断内容(标准)',
  `main_flag` varchar(48) NULL COMMENT '是否主诊断',
  `confirm_flag` varchar(48) NULL COMMENT '是否确诊',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间',
  `sort_idx` int(11) NULL COMMENT '诊断排序'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD诊断信息'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_discharge_content_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `content_raw` text NULL COMMENT '出院小结(原文)',
  `content_standard` text NULL COMMENT '出院小结(解密文)'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD出院小结信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_discharge_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '关联住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `company_name` varchar(128) NULL COMMENT '医院名称',
  `admit_department_name_raw` varchar(64) NULL COMMENT '入住科室名称(原始)',
  `admit_department_name_standard` varchar(64) NULL COMMENT '入住科室名称(标准)',
  `admit_department_code_raw` varchar(64) NULL COMMENT '入住科室编码(原始)',
  `admit_department_code_standard` varchar(64) NULL COMMENT '入住科室编码(标准)',
  `out_department_name_raw` varchar(64) NULL COMMENT '离住科室名称(原始)',
  `out_department_name_standard` varchar(64) NULL COMMENT '离住科室名称(标准)',
  `out_department_code_raw` varchar(64) NULL COMMENT '离住科室编码(原始)',
  `out_department_code_standard` varchar(64) NULL COMMENT '离住科室编码(标准)',
  `leave_date` datetime NULL COMMENT '出院时间',
  `icu_days` int(11) NULL COMMENT 'icu天数',
  `leave_way_raw` varchar(48) NULL COMMENT '出院方式(原始)',
  `leave_way_name_raw` varchar(64) NULL COMMENT '出院方式名称(原始)',
  `leave_way_standard` varchar(48) NULL COMMENT '出院方式(标准)',
  `emergency_treatment_days` int(11) NULL COMMENT '病情危重天数',
  `diagnosis_raw` text NULL COMMENT '诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '诊断编码(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD出院信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_examination_patient_info` (
  `visit_id` varchar(48) NOT NULL COMMENT '体检记录号',
  `patient_name` varchar(64) NULL COMMENT '体检者姓名',
  `sex` varchar(24) NULL COMMENT '性别',
  `birth_day` datetime NULL COMMENT '生日',
  `id_card` varchar(48) NULL COMMENT '身份证号',
  `data_create_date` datetime NULL COMMENT '数据新建时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `main_person_id` varchar(48) NULL COMMENT '主客户ID',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`visit_id`)
COMMENT 'DWD体检患者信息表'
DISTRIBUTED BY HASH(`visit_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_examine_apply_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '检查申请单流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(64) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(64) NULL COMMENT '申请科室编码(标准)',
  `doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `pay_date` datetime NULL COMMENT '申请支付时间',
  `apply_date` datetime NULL COMMENT '申请时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `items_raw` varchar(1024) NULL COMMENT '检查项目(原始)-del-2',
  `items_standard` varchar(1024) NULL COMMENT '检查项目(标准)-del-2',
  `diagnosis_raw` text NULL COMMENT '诊断项目内容(原始)',
  `diagnosis_standard` text NULL COMMENT '诊断项目内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '医嘱诊断编号(标准)',
  `status_raw` varchar(48) NULL COMMENT '状态编号(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态编号(标准)',
  `status_name_raw` varchar(128) NULL COMMENT '状态名称(原始)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD检查申请单信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_examine_apply_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `apply_id` varchar(48) NOT NULL COMMENT '检查申请单流水号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `type_raw` varchar(64) NULL COMMENT '项目分类(原始)',
  `type_standard` varchar(64) NULL COMMENT '项目分类(标准)',
  `code_raw` varchar(64) NULL COMMENT '项目编号(原始)',
  `code_standard` varchar(64) NULL COMMENT '项目编号(标准)',
  `name_raw` varchar(128) NULL COMMENT '项目名称(原始)',
  `name_standard` varchar(128) NULL COMMENT '项目名称(标准)',
  `part_code_raw` varchar(128) NULL COMMENT '部位编号(原始)',
  `part_code_standard` varchar(128) NULL COMMENT '部位编号(标准)',
  `part_name_raw` varchar(128) NULL COMMENT '部位名称(原始)',
  `part_name_standard` varchar(128) NULL COMMENT '部位名称(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `apply_id`, `id`)
COMMENT 'DWD检查申请单明细信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_examine_report_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '报告ID',
  `apply_id` varchar(64) NULL COMMENT '申请流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `patient_phone` varchar(64) NULL COMMENT '患者电话',
  `patient_gender_raw` varchar(24) NULL COMMENT '患者性别(原始)',
  `patient_gender_standard` varchar(4) NULL COMMENT '患者性别(标准)',
  `patient_card_no` varchar(24) NULL COMMENT '患者证件号',
  `patient_age` varchar(24) NULL COMMENT '患者年龄',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(64) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(64) NULL COMMENT '申请科室编码(标准)',
  `reports_time` datetime NULL COMMENT '报告时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `inspect_time` datetime NULL COMMENT '检查时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `apply_doctor_code` varchar(128) NULL COMMENT '申请医生编号',
  `apply_doctor_name` varchar(128) NULL COMMENT '申请医生姓名',
  `doctor_code` varchar(128) NULL COMMENT '报告医生编号',
  `doctor_name` varchar(128) NULL COMMENT '报告医生姓名',
  `examine_type_raw` varchar(64) NULL COMMENT '检查类别(原始)',
  `examine_type_name_raw` varchar(64) NULL COMMENT '检查类别名称(原始)',
  `examine_type_standard` varchar(64) NULL COMMENT '检查类别(标准)',
  `report_name_raw` varchar(256) NULL COMMENT '报告名称(原始)',
  `report_name_standard` varchar(256) NULL COMMENT '报告名称(标准)',
  `body_part_name_raw` varchar(128) NULL COMMENT '检查部位名称(原始)',
  `body_part_name_standard` varchar(64) NULL COMMENT '检查部位名称(标准)',
  `body_part_code_raw` varchar(64) NULL COMMENT '检查部位编号(原始)',
  `body_part_code_standard` varchar(64) NULL COMMENT '检查部位编号(标准)',
  `report_description_raw` text NULL COMMENT '检查所见(原始)',
  `report_description_standard` varchar(1024) NULL COMMENT '检查所见(标准)',
  `report_result_raw` text NULL COMMENT '检查结果(原始)',
  `report_result_standard` varchar(1024) NULL COMMENT '检查结果(标准)',
  `report_path` varchar(256) NULL COMMENT '报告路径',
  `report_no` varchar(64) NULL COMMENT '影象报告编号',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间',
  `activity_no` varchar(48) NULL COMMENT '活动编号',
  `status` varchar(48) NULL
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD检查报告单信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_examine_reserve_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '预约申请号',
  `apply_id` varchar(48) NULL COMMENT '申请流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '关联住院号',
  `recipe_id` varchar(64) NULL COMMENT '关联处方号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `apply_department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `apply_department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `apply_department_code_raw` varchar(64) NULL COMMENT '申请科室编码(原始)',
  `apply_department_code_standard` varchar(64) NULL COMMENT '申请科室编码(标准)',
  `doctor_code` varchar(64) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生姓名',
  `apply_date` datetime NULL COMMENT '申请时间',
  `book_date` datetime NULL COMMENT '预约时间',
  `items_raw` varchar(1024) NULL COMMENT '检查项目(原始)',
  `items_standard` varchar(1024) NULL COMMENT '检查项目(标准)',
  `status_raw` varchar(24) NULL COMMENT '预约状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '预约状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD检查预约单信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_inpatient_change_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `change_id` varchar(48) NOT NULL COMMENT '转换流水号',
  `inpatient_id` varchar(48) NULL COMMENT '住院号',
  `change_time` varchar(48) NULL COMMENT '更改时间',
  `change_type` varchar(48) NULL COMMENT '更改类型',
  `change_type_name` varchar(48) NULL COMMENT '更改类型名称',
  `code` varchar(64) NULL COMMENT '更改编号',
  `name` varchar(128) NULL COMMENT '更改名称',
  `source_code` varchar(64) NULL COMMENT '源编号',
  `source_name` varchar(128) NULL COMMENT '源名称',
  `target_code` varchar(64) NULL COMMENT '目标编号',
  `target_name` varchar(128) NULL COMMENT '目标名称',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `change_id`)
COMMENT 'DWD患者住院更改数据'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 6
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_inpatient_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '住院流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(64) NULL COMMENT '关联住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `company_name` varchar(128) NULL COMMENT '医院名称',
  `admit_department_name_raw` varchar(64) NULL COMMENT '入住科室名称(原始)',
  `admit_department_name_standard` varchar(64) NULL COMMENT '入住科室名称(标准)',
  `admit_department_code_raw` varchar(48) NULL COMMENT '入住科室编码(原始)',
  `admit_department_code_standard` varchar(48) NULL COMMENT '入住科室编码(标准)',
  `inpatient_date` datetime NULL COMMENT '入住时间',
  `inpatient_ward` varchar(64) NULL COMMENT '入住病区',
  `bed_number` varchar(64) NULL COMMENT '床号',
  `enter_way_raw` varchar(48) NULL COMMENT '入院方式(原始)',
  `enter_way_standard` varchar(48) NULL COMMENT '入院方式(标准)',
  `book_date` datetime NULL COMMENT '预约时间',
  `status_raw` varchar(24) NULL COMMENT '住院状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '住院状态(标准)',
  `diagnosis_raw` text NULL COMMENT '入院诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '入院诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '入院诊断编码(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间',
  `doctor_code` varchar(64) NULL COMMENT '管床医生编号',
  `doctor_name` varchar(64) NULL COMMENT '管床医生名称'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD住院信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_inpatient_reserve_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '关联住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `company_name` varchar(128) NULL COMMENT '医院名称',
  `apply_department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `apply_department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `apply_department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `apply_department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `admit_department_name_raw` varchar(64) NULL COMMENT '入住科室名称(原始)',
  `admit_department_name_standard` varchar(64) NULL COMMENT '入住科室名称(标准)',
  `admit_department_code_raw` varchar(48) NULL COMMENT '入住科室编码(原始)',
  `admit_department_code_standard` varchar(48) NULL COMMENT '入住科室编码(标准)',
  `apply_date` datetime NULL COMMENT '申请时间',
  `book_date` datetime NULL COMMENT '预约时间',
  `doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `diagnosis_raw` text NULL COMMENT '入院诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '入院诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '入院诊断编码(标准)',
  `status_raw` varchar(24) NULL COMMENT '状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD住院预约信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_laboratory_apply_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'ID',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '支付时间',
  `apply_date` datetime NULL COMMENT '申请时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '医嘱诊断编码(标准)',
  `diagnosis_raw` text NULL COMMENT '医嘱诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '医嘱诊断内容(标准)',
  `status_raw` varchar(48) NULL COMMENT '状态(原始)',
  `status_standard` varchar(48) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD检验申请单信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_laboratory_apply_project_info` (
  `patient_id` varchar(128) NOT NULL COMMENT '患者编号',
  `laboratory_apply_id` varchar(48) NOT NULL COMMENT '检验申请单ID',
  `id` varchar(128) NOT NULL COMMENT 'id',
  `item_group_code_raw` varchar(64) NULL COMMENT '组套编号(原始)',
  `item_group_code_standard` varchar(64) NULL COMMENT '组套编号(标准)',
  `item_group_name_raw` varchar(256) NULL COMMENT '组套名称(原始)',
  `item_group_name_standard` varchar(256) NULL COMMENT '组套名称(标准)',
  `item_code_raw` varchar(64) NULL COMMENT '项目编号(原始)',
  `item_code_standard` varchar(64) NULL COMMENT '项目编号(标准)',
  `item_name_raw` varchar(256) NULL COMMENT '项目名称(原始)',
  `item_name_standard` varchar(256) NULL COMMENT '项目名称(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `laboratory_apply_id`, `id`)
COMMENT 'DWD检验申请单项目信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_laboratory_report_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `apply_id` varchar(512) NULL COMMENT '申请单流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `reports_time` datetime NULL COMMENT '报告时间',
  `check_time` datetime NULL COMMENT '复核时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `inspect_time` datetime NULL COMMENT '采样时间',
  `scene_type_raw` varchar(64) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(64) NULL COMMENT '场景分类(标准)',
  `apply_doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `apply_doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `doctor_code` varchar(64) NULL COMMENT '报告医生编号',
  `doctor_name` varchar(64) NULL COMMENT '报告医生姓名',
  `sample_type_raw` varchar(128) NULL COMMENT '样本类别(原始)',
  `sample_type_standard` varchar(128) NULL COMMENT '样本类别(标准)',
  `report_name` varchar(256) NULL COMMENT '报告名称',
  `description_raw` varchar(1024) NULL COMMENT '报告描述或备注(原始)',
  `description_standard` varchar(1024) NULL COMMENT '报告描述或备注(标准)',
  `conclusion_raw` varchar(1024) NULL COMMENT '初步结论(原始)',
  `conclusion_standard` varchar(1024) NULL COMMENT '初步结论(标准)',
  `status_raw` varchar(24) NULL COMMENT '状态编号(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态编号(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间',
  `activity_no` varchar(48) NULL COMMENT '活动编号'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD检验报告单信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_laboratory_report_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `laboratory_report_id` varchar(48) NOT NULL COMMENT '检验报告单ID',
  `id` varchar(128) NOT NULL COMMENT 'ID',
  `reports_time` datetime NULL COMMENT '报告时间',
  `sample_type_raw` varchar(128) NULL COMMENT '样本类别(原始)',
  `sample_type_standard` varchar(128) NULL COMMENT '样本类别(标准)',
  `project_group_code_raw` varchar(128) NULL COMMENT '检验组套编码(原始)',
  `project_group_code_standard` varchar(128) NULL COMMENT '检验组套编码(标准)',
  `project_group_name_raw` varchar(256) NULL COMMENT '检验组套名称(原始)',
  `project_group_name_standard` varchar(256) NULL COMMENT '检验组套名称(标准)',
  `project_id_raw` varchar(128) NULL COMMENT '检验项目编码(原始)',
  `project_id_standard` varchar(128) NULL COMMENT '检验项目编码(标准)',
  `name_raw` varchar(128) NULL COMMENT '检验项目名称(原始)',
  `name_standard` varchar(128) NULL COMMENT '检验项目名称(标准)',
  `code_raw` varchar(128) NULL COMMENT '检验项目缩写(原始)',
  `code_standard` varchar(128) NULL COMMENT '检验项目缩写(标准)',
  `abnormal` varchar(64) NULL COMMENT '是否异常(原始)',
  `abnormal_indicator` varchar(64) NULL COMMENT '结果状态异常标记(原始)',
  `unit_raw` varchar(128) NULL COMMENT '单位(原始)',
  `unit_standard` varchar(128) NULL COMMENT '单位(标准)',
  `reference_raw` varchar(512) NULL COMMENT '参考范围(原始)',
  `reference_standard` varchar(512) NULL COMMENT '参考范围(标准)',
  `inspect_result_raw` varchar(1024) NULL COMMENT '结果(原始)',
  `result_type` varchar(48) NULL COMMENT '结果分类(标准)',
  `result_two_category_code` varchar(64) NULL COMMENT '二分类结果(标准)',
  `result_two_category_name` varchar(128) NULL COMMENT '二分类结果名称(标准)',
  `result_narrate` varchar(1024) NULL COMMENT '叙述结果(标准)',
  `result_value` DECIMAL(24, 6) NULL COMMENT '结果值(标准)',
  `result_value_flag` varchar(48) NULL COMMENT '结果值标记(标准)',
  `result_value_rate` DECIMAL(24, 6) NULL COMMENT '结果值标记比例(标准)',
  `result_value_reference` varchar(256) NULL COMMENT '结果值参考范围',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `laboratory_report_id`, `id`)
COMMENT 'DWD检验报告单明细信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_operation_apply_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '付费时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `description` varchar(128) NULL COMMENT '备注',
  `diagnosis_raw` text NULL COMMENT '诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '诊断编码(标准)',
  `status_code_raw` varchar(48) NULL COMMENT '状态编号(原始)2',
  `status_name_raw` varchar(48) NULL COMMENT '状态名称(原始)',
  `status_standard` varchar(48) NULL COMMENT '状态编号(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD手术申请信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_operation_apply_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `operation_apply_id` varchar(48) NOT NULL COMMENT '医嘱手术申请ID',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `name_raw` varchar(256) NULL COMMENT '手术名称(原始)',
  `name_standard` varchar(256) NULL COMMENT '手术名称(标准)',
  `code_raw` varchar(48) NULL COMMENT '手术编码(原始)',
  `code_standard` varchar(48) NULL COMMENT '手术编码(标准)',
  `est_opt_duration` varchar(128) NULL COMMENT '预计手术时长',
  `operation_type_raw` varchar(128) NULL COMMENT '手术类别(原始)',
  `operation_type_standard` varchar(128) NULL COMMENT '手术类别(标准)',
  `operation_level_raw` varchar(128) NULL COMMENT '手术等级(原始)',
  `operation_level_standard` varchar(128) NULL COMMENT '手术等级(标准)',
  `anaesthesia_method_raw` varchar(128) NULL COMMENT '麻醉方法(原始)',
  `anaesthesia_method_standard` varchar(128) NULL COMMENT '麻醉方法(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `operation_apply_id`, `id`)
COMMENT 'DWD手术申请明细信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_operation_content_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `content_raw` text NULL COMMENT '内容(原文)',
  `content_standard` text NULL COMMENT '内容(解密文)'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD手术记录内容信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_operation_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '付费时间',
  `apply_time` datetime NULL COMMENT '手术申请时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `description` varchar(128) NULL COMMENT '备注',
  `pre_diagnosis_code_standard` varchar(1024) NULL COMMENT '手术前诊断编码(标准)',
  `pre_diagnosis_raw` text NULL COMMENT '手术前诊断内容(原始)',
  `pre_diagnosis_standard` text NULL COMMENT '手术前诊断内容(标准)',
  `final_diagnosis_code_standard` varchar(1024) NULL COMMENT '手术后诊断编码(标准)',
  `final_diagnosis_raw` text NULL COMMENT '手术后诊断内容(原始)',
  `final_diagnosis_standard` text NULL COMMENT '手术后诊断内容(标准)',
  `content_raw` text NULL COMMENT '手术文书(原始)',
  `content_standard` varchar(1024) NULL COMMENT '手术文书(标准)',
  `status_code_raw` varchar(48) NULL COMMENT '状态(原始)',
  `status_name_raw` varchar(48) NULL COMMENT '状态名称(原始)',
  `status_standard` varchar(48) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD手术记录信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_operation_record_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `operation_record_id` varchar(48) NOT NULL COMMENT '手术记录数据ID',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `code_raw` varchar(48) NULL COMMENT '手术编码(原始)',
  `code_standard` varchar(48) NULL COMMENT '手术编码(标准)',
  `name_raw` varchar(256) NULL COMMENT '手术名称(原始)',
  `name_standard` varchar(256) NULL COMMENT '手术名称(标准)',
  `est_opt_duration` varchar(48) NULL COMMENT '预计手术时长',
  `operation_type_raw` varchar(128) NULL COMMENT '手术类别(原始)',
  `operation_type_standard` varchar(128) NULL COMMENT '手术类别(标准)',
  `operation_level_raw` varchar(128) NULL COMMENT '手术等级(原始)',
  `operation_level_standard` varchar(128) NULL COMMENT '手术等级(标准)',
  `anaesthesia_method_raw` varchar(128) NULL COMMENT '麻醉方法(原始)',
  `anaesthesia_method_standard` varchar(128) NULL COMMENT '麻醉方法(标准)',
  `operation_doctor_code` varchar(128) NULL COMMENT '手术医生编码',
  `operation_doctor_name` varchar(128) NULL COMMENT '手术医生姓名',
  `act_start_time` varchar(48) NULL COMMENT '实际手术开始时间',
  `act_end_time` varchar(48) NULL COMMENT '实际手术结束时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `operation_record_id`, `id`)
COMMENT 'DWD手术记录明细信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_patient_emr_body_check_basic_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `emr_id` varchar(48) NOT NULL COMMENT '电子病例ID',
  `height` varchar(48) NULL COMMENT '身高',
  `weight` varchar(48) NULL COMMENT '体重',
  `blood_pressure` varchar(48) NULL COMMENT '血压',
  `heart_rate` varchar(48) NULL COMMENT '心率',
  `temperature` varchar(48) NULL COMMENT '体温',
  `bmi` varchar(48) NULL COMMENT 'BMI',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_user` varchar(24) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD电子病例体格检查基础检查'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_patient_emr_symptom_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `emr_id` varchar(48) NOT NULL COMMENT '电子病例ID',
  `name` varchar(128) NULL COMMENT '名称',
  `body_part` varchar(128) NULL COMMENT '部位',
  `degree` varchar(128) NULL COMMENT '程度',
  `type` varchar(24) NULL COMMENT '分类',
  `duration_time` varchar(128) NULL COMMENT '持续时间',
  `one_time` varchar(128) NULL COMMENT '单次时间',
  `name_standard` varchar(128) NULL COMMENT '标准名称',
  `body_part_standard` varchar(128) NULL COMMENT '标准部位',
  `degree_standard` varchar(128) NULL COMMENT '标准程度',
  `duration_time_standard` varchar(128) NULL COMMENT '标准持续时间',
  `one_time_standard` varchar(128) NULL COMMENT '标准单次时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_user` varchar(24) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD电子病例症状表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_patient_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `card_no_type_raw` varchar(24) NULL COMMENT '证件类型(原始)',
  `card_no_type_standard` varchar(24) NULL COMMENT '证件类型(标准)',
  `card_no` varchar(24) NULL COMMENT '证件号',
  `patient_gender_raw` varchar(24) NULL COMMENT '性别(原始)',
  `patient_gender_standard` varchar(24) NULL COMMENT '性别(标准)',
  `birthday` varchar(24) NULL COMMENT '生日',
  `phone` varchar(256) NULL COMMENT '电话号码',
  `remark` varchar(128) NULL COMMENT '备注信息',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_date` datetime(3) NULL COMMENT '操作时间',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `main_person_id` varchar(48) NULL COMMENT '主客户ID',
  `death_status` varchar(1) NULL COMMENT '死亡状态(Y生 N死)',
  `death_time` varchar(48) NULL COMMENT '死亡时间',
  `work_phone` varchar(128) NULL COMMENT '工作电话号码',
  `link_phone` varchar(128) NULL COMMENT '联系电话号码',
  `home_phone` varchar(128) NULL COMMENT '家庭电话号码'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`)
COMMENT '患者基本信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"compression" = "ZSTD",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_patient_medical_record_content_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `content_raw` text NULL COMMENT '内容(原文)',
  `content_standard` text NULL COMMENT '内容(解密文)',
  `struct_flag` varchar(24) NULL,
  `data_update_date` datetime NULL
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD电子病例内容信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_patient_medical_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `patient_type_raw` varchar(48) NULL COMMENT '患者类型(原始)',
  `patient_type_standard` varchar(48) NULL COMMENT '患者类型(标准)',
  `patient_card_no` varchar(48) NULL COMMENT '患者卡号',
  `department_name_raw` varchar(128) NULL COMMENT '申请科室名称(原始)',
  `department_code_raw` varchar(128) NULL COMMENT '申请科室编码(原始)',
  `department_name_standard` varchar(128) NULL COMMENT '申请科室名称(标准)',
  `department_code_standard` varchar(128) NULL COMMENT '申请科室编码(标准)',
  `doctor_code` varchar(48) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生姓名',
  `status_raw` varchar(48) NULL COMMENT '状态编号(原始)',
  `status_standard` varchar(48) NULL COMMENT '状态编号(标准)',
  `status_name_raw` varchar(64) NULL COMMENT '状态名称(原始)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DDWD电子病例信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_person_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `name` varchar(64) NULL COMMENT '姓名',
  `card_no_type` varchar(24) NULL COMMENT '证件类型',
  `card_no` varchar(48) NULL COMMENT '证件号',
  `gender` varchar(24) NULL COMMENT '性别',
  `birthday` varchar(24) NULL COMMENT '生日',
  `phone` varchar(256) NULL COMMENT '电话号码',
  `remark` varchar(256) NULL COMMENT '备注信息',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT 'DWD_客户主信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_recipe_medicine_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'ID',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `description` varchar(128) NULL COMMENT '备注',
  `diagnosis_raw` text NULL COMMENT '诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '诊断编码(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD医嘱用药数据表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_recipe_medicine_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `recipe_medicine_id` varchar(64) NOT NULL COMMENT '医嘱用药数据ID',
  `id` varchar(128) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `department_name_raw` varchar(64) NULL COMMENT '申请科室名称(原始)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '申请科室名称(标准)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `name_raw` varchar(256) NULL COMMENT '药品名称(原始)',
  `name_standard` varchar(256) NULL COMMENT '药品名称(标准)',
  `code_raw` varchar(128) NULL COMMENT '药品编码(原始)',
  `code_standard` varchar(128) NULL COMMENT '药品编码(标准)',
  `medicine_class_raw` varchar(128) NULL COMMENT '药物分类(原始)',
  `medicine_class_standard` varchar(128) NULL COMMENT '药物分类(标准)',
  `medicine_spec` varchar(256) NULL COMMENT '药品规格',
  `dose_unit_raw` varchar(128) NULL COMMENT '单次用药单位(原始)',
  `dose_unit_standard` varchar(128) NULL COMMENT '单次用药单位(标准)',
  `each_quantity` varchar(128) NULL COMMENT '单次用药数量',
  `inspect_result` varchar(128) NULL COMMENT '用药天数',
  `frequency_code_raw` varchar(128) NULL COMMENT '用药频次代码(原始)',
  `frequency_code_standard` varchar(128) NULL COMMENT '用药频次代码(标准)',
  `frequency_name_raw` varchar(128) NULL COMMENT '用药频次名称(原始)',
  `frequency_name_standard` varchar(128) NULL COMMENT '用药频次名称(标准)',
  `medication_amount` varchar(128) NULL COMMENT '带药(发药)总数',
  `packing_spec_num` varchar(128) NULL COMMENT '包装规格',
  `packing_spec_unit_raw` varchar(128) NULL COMMENT '包装单位(原始)',
  `packing_spec_unit_standard` varchar(128) NULL COMMENT '包装单位(标准)',
  `usage` varchar(512) NULL COMMENT '用法用量',
  `usage_advic` varchar(512) NULL COMMENT '用药建议',
  `usage_code_raw` varchar(128) NULL COMMENT '用药方式编码(原始)',
  `usage_code_standard` varchar(128) NULL COMMENT '用药方式编码(标准)',
  `usage_content_raw` varchar(128) NULL COMMENT '用药方式名称(原始)',
  `usage_content_standard` varchar(128) NULL COMMENT '用药方式名称(标准)',
  `status_raw` varchar(48) NULL COMMENT '状态(原始)',
  `status_standard` varchar(48) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间',
  `medication_amount_unit` varchar(128) NULL
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `recipe_medicine_id`, `id`)
COMMENT 'DWD医嘱用药明细数据表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_recipe_therapy_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(128) NULL COMMENT '申请科室名称(原始)',
  `department_name_standard` varchar(128) NULL COMMENT '申请科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `scene_type_raw` varchar(48) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(48) NULL COMMENT '场景分类(标准)',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `description` varchar(128) NULL COMMENT '备注',
  `diagnosis_raw` text NULL COMMENT '诊断内容(原始)',
  `diagnosis_standard` text NULL COMMENT '诊断内容(标准)',
  `diagnosis_code_standard` varchar(1024) NULL COMMENT '医嘱诊断编码(标准)',
  `status_raw` varchar(24) NULL COMMENT '状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD治疗信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_recipe_therapy_item_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `therapy_id` varchar(48) NOT NULL COMMENT '治疗ID',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `reg_in_id` varchar(48) NULL COMMENT '挂号住院号-del',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name_raw` varchar(128) NULL COMMENT '申请科室名称(原始)',
  `department_code_raw` varchar(48) NULL COMMENT '申请科室编码(原始)',
  `department_name_standard` varchar(128) NULL COMMENT '申请科室名称(标准)',
  `department_code_standard` varchar(48) NULL COMMENT '申请科室编码(标准)',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `name_raw` varchar(256) NULL COMMENT '项目名称(原始)',
  `name_standard` varchar(256) NULL COMMENT '项目名称(标准)',
  `code_raw` varchar(256) NULL COMMENT '项目编码(原始)',
  `code_standard` varchar(256) NULL COMMENT '项目编码(标准)',
  `parent_recipe_id` varchar(48) NULL COMMENT '父关联处方id',
  `status_raw` varchar(24) NULL COMMENT '状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `therapy_id`, `id`)
COMMENT 'DWD治疗明细表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_register_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '挂号ID',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `card_type_raw` varchar(24) NULL COMMENT '卡号类型(原始)',
  `card_type_standard` varchar(24) NULL COMMENT '卡号类型(标准)',
  `card_no` varchar(48) NULL COMMENT '证件号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `visit_card_no` varchar(48) NULL COMMENT '就诊卡号',
  `company_name` varchar(128) NULL COMMENT '医院名称',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `department_name_raw` varchar(64) NULL COMMENT '挂号科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '挂号科室名称(标准)',
  `department_code_raw` varchar(48) NULL COMMENT '挂号科室编码(原始)',
  `department_code_standard` varchar(48) NULL COMMENT '挂号科室编码(标准)',
  `doctor_code` varchar(48) NULL COMMENT '挂号医生编号',
  `doctor_name` varchar(64) NULL COMMENT '挂号医生姓名',
  `reg_level_code_raw` varchar(24) NULL COMMENT '挂号级别编号(原始)',
  `reg_level_name_raw` varchar(48) NULL COMMENT '挂号级别名称(原始)',
  `reg_level_code_standard` varchar(24) NULL COMMENT '挂号级别编号(标准)',
  `reg_way_raw` varchar(24) NULL COMMENT '挂号方式(原始)',
  `reg_way_standard` varchar(24) NULL COMMENT '挂号方式(标准)',
  `reg_date` datetime NULL COMMENT '挂号时间',
  `first_sub_type` varchar(24) NULL COMMENT '初诊复诊分类',
  `reserve_date` datetime NULL COMMENT '预约时间',
  `reserve_way_raw` varchar(24) NULL COMMENT '预约方式(原始)',
  `reserve_way_standard` varchar(24) NULL COMMENT '预约方式(标准)',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `visit_status_raw` varchar(24) NULL COMMENT '就诊状态(原始)',
  `visit_status_standard` varchar(24) NULL COMMENT '就诊状态(标准)',
  `visit_date` datetime NULL COMMENT '就诊时间',
  `status_raw` varchar(24) NULL COMMENT '挂号状态(原始)',
  `status_standard` varchar(24) NULL COMMENT '挂号状态(标准)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_data_user` varchar(48) NULL COMMENT '操作人',
  `op_date` datetime(3) NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT '【DWD挂号信息表】'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dwd_visit_record_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT '就诊记录号',
  `register_id` varchar(48) NULL COMMENT '挂号ID',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `card_type_raw` varchar(24) NULL COMMENT '卡号类型(原始)',
  `card_type_standard` varchar(24) NULL COMMENT '卡号类型(标准)',
  `card_no` varchar(64) NULL COMMENT '卡号',
  `patient_gender_raw` varchar(24) NULL COMMENT '患者性别(原始)',
  `patient_gender_standard` varchar(24) NULL COMMENT '患者性别(标准)',
  `patient_age` varchar(48) NULL COMMENT '患者年龄',
  `company_name` varchar(128) NULL COMMENT '医院名称',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `department_name_raw` varchar(64) NULL COMMENT '科室名称(原始)',
  `department_name_standard` varchar(64) NULL COMMENT '科室名称(标准)',
  `department_code_raw` varchar(64) NULL COMMENT '科室编码(原始)',
  `department_code_standard` varchar(64) NULL COMMENT '标准科室编码',
  `doctor_code` varchar(64) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生姓名',
  `visit_date` datetime NULL COMMENT '就诊时间',
  `visit_type_raw` varchar(24) NULL COMMENT '就诊类型(原始)',
  `visit_type_standard` varchar(24) NULL COMMENT '就诊类型(标准)',
  `visit_way_raw` varchar(24) NULL COMMENT '就诊方式(原始)',
  `visit_way_standard` varchar(24) NULL COMMENT '就诊方式(标准)',
  `scene_type_raw` varchar(24) NULL COMMENT '场景分类(原始)',
  `scene_type_standard` varchar(24) NULL COMMENT '场景分类(标准)',
  `status_raw` varchar(24) NULL COMMENT '状态编号(原始)',
  `status_standard` varchar(24) NULL COMMENT '状态编号(标准)',
  `status_name_raw` varchar(48) NULL COMMENT '状态名称(原始)',
  `data_update_date` datetime NULL COMMENT '数据更新时间(原始)',
  `op_date` datetime(3) NULL COMMENT '操作时间',
  `op_data_user` varchar(48) NULL COMMENT '操作人'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`)
COMMENT 'DWD就诊信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dws_patient_data_day_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `data_day` varchar(24) NOT NULL COMMENT '数据日期(天)',
  `data_num` int(11) SUM NULL COMMENT '数据数量'
) ENGINE=OLAP
AGGREGATE KEY(`patient_id`, `data_day`)
COMMENT 'DWS患者每日数据变化统计表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dws_patient_data_last_date_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `content` varchar(312) MAX NULL COMMENT '最新内容',
  `last_op_date` varchar(64) MAX NULL COMMENT '最新数据操作时间'
) ENGINE=OLAP
AGGREGATE KEY(`patient_id`)
COMMENT 'DWS患者最新数据日期统计表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dws_patient_event_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `event_date` varchar(48) NOT NULL COMMENT '事件时间',
  `event_type` varchar(48) NOT NULL COMMENT '事件分类'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `event_date`, `event_type`)
COMMENT 'DWS患者事件信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `dws_patient_inpatient_change_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `inpatient_id` varchar(48) NOT NULL COMMENT '住院号',
  `change_type` varchar(48) NOT NULL COMMENT '变更分类',
  `change_val` varchar(128) MAX NULL COMMENT '变更值'
) ENGINE=OLAP
AGGREGATE KEY(`patient_id`, `inpatient_id`, `change_type`)
COMMENT 'DWS患者住院变更统计表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_activity_examine_report_info` (
  `id` varchar(48) NOT NULL COMMENT 'ID',
  `apply_id` varchar(512) NULL COMMENT '申请流水号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `patient_phone` varchar(64) NULL COMMENT '患者电话',
  `patient_gender` varchar(48) NULL COMMENT '患者性别',
  `patient_id_no` varchar(48) NULL COMMENT '患者身份证号',
  `patient_age` varchar(64) NULL COMMENT '患者年龄',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(48) NULL COMMENT '申请科室编码',
  `reports_time` datetime NULL COMMENT '报告时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `inspect_time` datetime NULL COMMENT '检查时间',
  `scene_type` varchar(48) NULL COMMENT '场景分类',
  `apply_doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `apply_doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `doctor_code` varchar(48) NULL COMMENT '报告医生编号',
  `doctor_name` varchar(64) NULL COMMENT '报告医生姓名',
  `device_type_code` varchar(24) NULL COMMENT '设备类型id',
  `device_type_name` varchar(64) NULL COMMENT '设备类型名称',
  `examine_type` varchar(64) NULL COMMENT '检查类别',
  `report_name` varchar(256) NULL COMMENT '报告名称',
  `body_part_name` varchar(256) NULL COMMENT '检查部位',
  `body_part_code` varchar(64) NULL COMMENT '检查部位id',
  `report_description` text NULL COMMENT '检查所见',
  `report_result` text NULL COMMENT '检查结果',
  `report_path` varchar(256) NULL COMMENT '影象报告路径',
  `report_no` varchar(64) NULL COMMENT '影象报告编号',
  `is_sync` varchar(4) NULL COMMENT '是否同步',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `act_no` varchar(48) NULL COMMENT '活动编号'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT 'ODS活动检查报告单信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_collect_fee_record_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `fee_order` varchar(24) NULL COMMENT '处方内流水号[ID]',
  `fee_no` varchar(48) NULL COMMENT '处方内编号[ID]',
  `trans_type` varchar(24) NULL COMMENT '处方内交易类型[ID]',
  `mo_order` varchar(48) NULL COMMENT '处方内MO[ID]',
  `invoice_seq` varchar(48) NULL COMMENT '处方内SEQ[ID]',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `visit_card_no` varchar(48) NULL COMMENT '就诊卡号(visit_id)',
  `register_sn` varchar(48) NULL COMMENT '挂号流水号',
  `register_date` datetime NULL COMMENT '挂号时间',
  `register_department_code` varchar(48) NULL COMMENT '挂号部门编号',
  `doctor_code` varchar(48) NULL COMMENT '医生编号',
  `department_code` varchar(48) NULL COMMENT '科室编码',
  `department_name` varchar(128) NULL COMMENT '科室名称',
  `finance_department_code` varchar(48) NULL COMMENT '执行部门编号',
  `fee_code` varchar(48) NULL COMMENT '费用编号',
  `fee_name` varchar(128) NULL COMMENT '费用名称',
  `fee_item_code` varchar(64) NULL COMMENT '收费项目编号',
  `fee_item_name` varchar(128) NULL COMMENT '收费项目名称',
  `total_fee` DECIMAL(11, 2) NULL COMMENT '收费总金额',
  `own_fee` DECIMAL(11, 2) NULL COMMENT '自费金额',
  `own_pay_fee` DECIMAL(11, 2) NULL COMMENT '自付金额',
  `center_pay_fee` DECIMAL(11, 2) NULL COMMENT '统筹金额',
  `invoice_no` varchar(48) NULL COMMENT '发票号',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `fee_date` datetime NULL COMMENT '收费时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `is_sync` varchar(4) NULL COMMENT '同步状态'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '收费记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_diagnosis_report_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `patient_id` varchar(48) NULL COMMENT '患者ID',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_code` varchar(64) NULL COMMENT '科室编号',
  `department_name` varchar(128) NULL COMMENT '科室名称',
  `doctor_code` varchar(64) NULL COMMENT '医生编号',
  `doctor_name` varchar(128) NULL COMMENT '医生姓名',
  `diagnosis_time` varchar(24) NULL COMMENT '诊断时间',
  `type` varchar(24) NULL COMMENT '分类',
  `code` varchar(64) NULL COMMENT 'ICD10',
  `diag_code` varchar(64) NULL COMMENT '诊断编号',
  `diag_name` varchar(256) NULL COMMENT '诊断名称',
  `diag_type_code` varchar(48) NULL COMMENT '诊断场景',
  `is_main` varchar(48) NULL COMMENT '是否主诊断',
  `is_define` varchar(48) NULL COMMENT '是否确诊诊断',
  `sort_idx` int(11) NULL COMMENT '诊断排序',
  `is_sync` varchar(4) NULL COMMENT '是否同步',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '诊断数据表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_discharge_record_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(24) NULL COMMENT '关联住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `company_code` varchar(24) NULL COMMENT '医院编号',
  `company_name` varchar(64) NULL COMMENT '医院名称',
  `admit_department_name` varchar(64) NULL COMMENT '入住科室名称',
  `admit_department_code` varchar(24) NULL COMMENT '入住科室编码',
  `leave_department_name` varchar(64) NULL COMMENT '出院科室名称',
  `leave_department_code` varchar(24) NULL COMMENT '出院科室编码',
  `leave_date` datetime NULL COMMENT '出院时间',
  `icu_days` int(11) NULL COMMENT 'ICU天数',
  `leave_way` varchar(24) NULL COMMENT '出院方式',
  `leave_way_name` varchar(48) NULL COMMENT '出院方式名称',
  `emergency_treatment_days` int(11) NULL COMMENT '病情危重天数',
  `content` text NULL COMMENT '出院小结',
  `diagnosis` text NULL COMMENT '诊断',
  `status` varchar(24) NULL COMMENT '状态',
  `is_sync` varchar(4) NULL COMMENT '同步状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '出院记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_doctor_advice_info` (
  `order_sn` varchar(48) NOT NULL COMMENT '医嘱流水号',
  `dept_code` varchar(48) NULL COMMENT '部门编号',
  `dept_name` varchar(128) NULL COMMENT '部门名称',
  `status_code` varchar(128) NULL COMMENT '状态编号',
  `status_name` varchar(128) NULL COMMENT '状态名称',
  `fee_status` varchar(128) NULL COMMENT '费用状态',
  `patient_type` varchar(64) NULL COMMENT '患者类型(1.门诊 2，急诊 4.住院)',
  `parent_order_sn` varchar(64) NULL COMMENT '主医嘱流水号',
  `order_type` varchar(64) NULL COMMENT '医嘱类型',
  `code` varchar(64) NULL COMMENT '医嘱代码',
  `name` varchar(256) NULL COMMENT '医嘱内容',
  `data_update_date` varchar(64) NULL COMMENT '数据更新时间',
  `opid` varchar(64) NULL COMMENT '患者标记ID',
  `is_sync` varchar(4) NULL COMMENT '是否同步',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `op_data_user` varchar(48) NULL COMMENT 'czr',
  `op_update_data` datetime NULL COMMENT 'czsj'
) ENGINE=OLAP
UNIQUE KEY(`order_sn`)
COMMENT '医嘱信息表'
DISTRIBUTED BY HASH(`order_sn`) BUCKETS 6
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examination_final_report_info` (
  `visit_id` varchar(48) NOT NULL COMMENT '体检记录号',
  `id_card` varchar(64) NULL COMMENT '身份证号',
  `final_report_content` text NULL COMMENT '终检结论',
  `final_report_suggest` text NULL COMMENT '终检建议',
  `doctor_name` varchar(256) NULL COMMENT 'YS名称',
  `data_create_date` datetime NULL COMMENT '数据创建时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`visit_id`)
COMMENT '体检总检报告结果信息表'
DISTRIBUTED BY HASH(`visit_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examination_patient_info` (
  `visit_id` varchar(48) NOT NULL COMMENT '体检记录号',
  `patient_name` varchar(64) NULL COMMENT '体检者姓名',
  `sex` varchar(24) NULL COMMENT '性别',
  `birth_day` datetime NULL COMMENT '生日',
  `id_card` varchar(48) NULL COMMENT '身份证号',
  `data_create_date` datetime NULL COMMENT '数据新建时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`visit_id`)
COMMENT '体检患者信息表'
DISTRIBUTED BY HASH(`visit_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examination_problem_suggest_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `problem` text NULL COMMENT '异常指标',
  `suggest` text NULL COMMENT '建议',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '异常指标建议信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 3
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examination_register_info` (
  `visit_id` varchar(64) NOT NULL COMMENT '体检记录号',
  `sign_in_date` datetime NULL COMMENT '报到日期',
  `order_date` datetime NULL COMMENT '预约日期',
  `status_name` varchar(64) NULL COMMENT '状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `data_create_date` datetime NULL COMMENT '数据新建时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`visit_id`)
COMMENT '体检登记信息表'
DISTRIBUTED BY HASH(`visit_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examination_report_result_info` (
  `visit_id` varchar(48) NULL COMMENT '体检记录号',
  `id_card` varchar(48) NULL COMMENT '身份证号',
  `report_content` text NULL COMMENT '报告内容',
  `report_suggest` text NULL COMMENT '报告建议',
  `doctor_name` varchar(256) NULL COMMENT 'YS名称',
  `data_create_date` datetime NULL COMMENT '数据创建时间',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`visit_id`)
COMMENT '体检报告结果信息表'
DISTRIBUTED BY HASH(`visit_id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examine_apply_info` (
  `id` varchar(48) NOT NULL COMMENT '流水号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_type` varchar(24) NULL COMMENT '患者分类',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(64) NULL COMMENT '申请科室编码',
  `apply_date` datetime NULL COMMENT '申请时间',
  `pay_date` datetime NULL COMMENT '申请支付时间',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `diagnosis` text NULL COMMENT '医嘱诊断',
  `items` text NULL COMMENT '检查项目',
  `status` varchar(24) NULL COMMENT '状态编号',
  `status_name` varchar(24) NULL COMMENT '状态名称',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(24) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检查申请单数据表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examine_report_info` (
  `id` varchar(48) NOT NULL COMMENT 'ID',
  `apply_id` varchar(512) NULL COMMENT '申请流水号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `patient_phone` varchar(64) NULL COMMENT '患者电话',
  `patient_gender` varchar(48) NULL COMMENT '患者性别',
  `patient_id_no` varchar(48) NULL COMMENT '患者身份证号',
  `patient_age` varchar(64) NULL COMMENT '患者年龄',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(48) NULL COMMENT '申请科室编码',
  `reports_time` datetime NULL COMMENT '报告时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `inspect_time` datetime NULL COMMENT '检查时间',
  `scene_type` varchar(48) NULL COMMENT '场景分类',
  `apply_doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `apply_doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `doctor_code` varchar(48) NULL COMMENT '报告医生编号',
  `doctor_name` varchar(64) NULL COMMENT '报告医生姓名',
  `device_type_code` varchar(24) NULL COMMENT '设备类型id',
  `device_type_name` varchar(64) NULL COMMENT '设备类型名称',
  `examine_type` varchar(64) NULL COMMENT '检查类别',
  `report_name` varchar(256) NULL COMMENT '报告名称',
  `body_part_name` varchar(256) NULL COMMENT '检查部位',
  `body_part_code` varchar(64) NULL COMMENT '检查部位id',
  `report_description` text NULL COMMENT '检查所见',
  `report_result` text NULL COMMENT '检查结果',
  `report_path` varchar(256) NULL COMMENT '影象报告路径',
  `report_no` varchar(64) NULL COMMENT '影象报告编号',
  `is_sync` varchar(4) NULL COMMENT '是否同步',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `activity_no` varchar(48) NULL COMMENT '活动编号',
  `status` varchar(48) NULL
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检查报告单信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_examine_reserve_info` (
  `id` varchar(64) NOT NULL COMMENT '预约流水号',
  `apply_id` varchar(24) NULL COMMENT '申请流水号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(64) NULL COMMENT '申请科室编码',
  `apply_date` datetime NULL COMMENT '申请时间',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `doctor_code` varchar(64) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `items` text NULL COMMENT '检查项目',
  `book_date` varchar(24) NULL COMMENT '预约时间',
  `start_date` varchar(24) NULL COMMENT '开始时间',
  `end_date` varchar(24) NULL COMMENT '截止时间',
  `status` varchar(48) NULL COMMENT '预约状态',
  `status_name` varchar(64) NULL COMMENT '预约状态名称',
  `is_sync` varchar(4) NULL COMMENT '是否同步',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检查预约记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_first_course_illness_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `ip_id` varchar(48) NULL COMMENT '住院号',
  `pid` varchar(48) NULL COMMENT '患者号',
  `node_date` datetime NULL COMMENT '节点时间',
  `node_type` varchar(48) NULL COMMENT '节点分类编号',
  `node_type_name` varchar(64) NULL COMMENT '节点分类名称',
  `high_doc_code` varchar(64) NULL COMMENT '高等级医生编号',
  `high_doc_name` varchar(64) NULL COMMENT '高等级医生名称',
  `content` text NULL COMMENT '病例内容',
  `submit_time` datetime NULL COMMENT '提交时间',
  `doc_code` varchar(48) NULL COMMENT '医生编号',
  `doc_name` varchar(64) NULL COMMENT '医生名称',
  `dept_code` varchar(64) NULL COMMENT '科室编号',
  `dept_name` varchar(64) NULL COMMENT '科室名称',
  `ward_code` varchar(48) NULL COMMENT '病区号',
  `ward_name` varchar(64) NULL COMMENT '病区名称',
  `modify_code` varchar(64) NULL COMMENT '修改人',
  `modify_name` varchar(64) NULL COMMENT '修改名称',
  `template_id` varchar(64) NULL COMMENT '模板ID',
  `template_version` varchar(64) NULL COMMENT '模板版本号',
  `data_update_date` varchar(64) NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '患者首次病程信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_inpatient_change_info` (
  `id` varchar(48) NOT NULL COMMENT '流水号',
  `inpatient_id` varchar(48) NULL COMMENT '住院号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `change_time` varchar(48) NULL COMMENT '更改时间',
  `change_type` varchar(48) NULL COMMENT '更改类型',
  `change_type_name` varchar(48) NULL COMMENT '更改类型名称',
  `code` varchar(64) NULL COMMENT '更改编号',
  `name` varchar(128) NULL COMMENT '更改名称',
  `source_code` varchar(64) NULL COMMENT '源编号',
  `source_name` varchar(128) NULL COMMENT '源名称',
  `target_code` varchar(64) NULL COMMENT '目标编号',
  `target_name` varchar(128) NULL COMMENT '目标名称',
  `status` varchar(4) NULL COMMENT '清洗状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '患者住院更改数据'
DISTRIBUTED BY HASH(`id`) BUCKETS 6
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_inpatient_record_info` (
  `id` varchar(48) NOT NULL COMMENT '住院流水号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `patient_id_no` varchar(48) NULL COMMENT '患者身份证号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `visit_card_no` varchar(24) NULL COMMENT '就诊卡号',
  `in_patient_no` varchar(24) NULL COMMENT '关联住院号',
  `company_code` varchar(24) NULL COMMENT '医院编号',
  `company_name` varchar(64) NULL COMMENT '医院名称',
  `admit_department_name` varchar(64) NULL COMMENT '入住科室名称',
  `admit_department_code` varchar(24) NULL COMMENT '入住科室编码',
  `inpatient_ward_code` varchar(24) NULL COMMENT '入住病区编码',
  `inpatient_ward_name` varchar(64) NULL COMMENT '入住病区名称',
  `inpatient_date` datetime NULL COMMENT '入住时间',
  `bed_number` varchar(24) NULL COMMENT '床号',
  `inpatient_type` varchar(24) NULL COMMENT '住院分类',
  `admission_diagnosis` text NULL COMMENT '入院诊断内容',
  `enter_way` varchar(24) NULL COMMENT '入院方式',
  `status` varchar(24) NULL COMMENT '住院状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `doctor_code` varchar(64) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生名称'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '住院记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_inpatient_reserve_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `register_id` varchar(24) NULL COMMENT '挂号ID',
  `visit_card_no` varchar(48) NULL COMMENT '就诊卡号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `patient_id_no` varchar(24) NULL COMMENT '患者身份证号',
  `in_patient_no` varchar(48) NULL COMMENT '关联住院号',
  `company_code` varchar(24) NULL COMMENT '医院编号',
  `company_name` varchar(48) NULL COMMENT '医院名称',
  `apply_department_name` varchar(64) NULL COMMENT '申请科室名称',
  `apply_department_code` varchar(24) NULL COMMENT '申请科室编码',
  `admit_department_name` varchar(64) NULL COMMENT '入住科室名称',
  `admit_department_code` varchar(24) NULL COMMENT '入住科室编码',
  `apply_date` datetime NULL COMMENT '申请时间',
  `book_date` datetime NULL COMMENT '预约时间',
  `doctor_code` varchar(24) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `admission_diagnosis` text NULL COMMENT '入院诊断内容',
  `status` varchar(24) NULL COMMENT '状态编号',
  `status_name` varchar(48) NULL COMMENT '状态名称',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '住院预约信息记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);


CREATE TABLE `ods_laboratory_apply_info` (
  `id` varchar(64) NOT NULL COMMENT 'ID',
  `patient_id` varchar(64) NULL COMMENT '患者编号',
  `visit_id` varchar(64) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(64) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(64) NULL COMMENT '住院号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `department_name` varchar(128) NULL COMMENT '申请科室名称',
  `department_code` varchar(64) NULL COMMENT '申请科室编码',
  `pay_time` datetime NULL COMMENT '申请支付时间',
  `apply_date` datetime NULL COMMENT '申请时间',
  `scene_type` varchar(48) NULL COMMENT '场景分类',
  `doctor_code` varchar(128) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(128) NULL COMMENT '申请医生姓名',
  `diagnosis` text NULL COMMENT '医嘱诊断内容',
  `items` text NULL COMMENT '申请项目内容',
  `status` varchar(24) NULL COMMENT '申请状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检验申请单数据'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_laboratory_report_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `apply_id` varchar(512) NULL COMMENT '申请单号',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(24) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(24) NULL COMMENT '住院号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(24) NULL COMMENT '申请科室编码',
  `reports_time` datetime NULL COMMENT '报告时间',
  `check_time` datetime NULL COMMENT '复核时间',
  `apply_time` datetime NULL COMMENT '申请时间',
  `inspect_time` datetime NULL COMMENT '采样时间',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `apply_doctor_code` varchar(24) NULL COMMENT '申请医生编号',
  `apply_doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `doctor_code` varchar(24) NULL COMMENT '报告医生编号',
  `doctor_name` varchar(64) NULL COMMENT '报告医生姓名',
  `sample_type` varchar(64) NULL COMMENT '样本类别',
  `report_name` varchar(512) NULL COMMENT '报告名称',
  `description` varchar(1024) NULL COMMENT '报告描述或备注',
  `conclusion` varchar(1024) NULL COMMENT '初步结论',
  `status` varchar(24) NULL COMMENT '状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检验报告单数据'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_laboratory_report_item_info` (
  `id` varchar(128) NOT NULL COMMENT 'id',
  `laboratory_report_id` varchar(48) NOT NULL COMMENT '检验报告单ID',
  `sample_type` varchar(64) NULL COMMENT '样本类别',
  `prd_id` varchar(64) NULL COMMENT '检验项目编码(LIS编码)',
  `name` varchar(64) NULL COMMENT '检验项目名称',
  `code` varchar(64) NULL COMMENT '检验项目缩写',
  `abnormal_indicator` varchar(64) NULL COMMENT '结果状态(异常标记)',
  `abnormal` varchar(48) NULL COMMENT '是否异常',
  `unit` varchar(256) NULL COMMENT '单位',
  `reference` varchar(128) NULL COMMENT '参考范围',
  `inspect_result` varchar(512) NULL COMMENT '结果',
  `bar_code` varchar(48) NULL COMMENT '条码',
  `machine_code` varchar(48) NULL COMMENT '机器号',
  `test_date` varchar(24) NULL COMMENT '检验时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '检验报告单明细信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_operation_apply_info` (
  `id` varchar(48) NOT NULL COMMENT '流水号',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(48) NULL COMMENT '申请科室编码',
  `payTime` datetime NULL COMMENT '付费时间',
  `apply_time` datetime NULL COMMENT '手术申请时间',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `description` varchar(64) NULL COMMENT '备注',
  `diagnosis` text NULL COMMENT '诊断内容',
  `status_code` varchar(24) NULL COMMENT '状态编号',
  `status_name` varchar(48) NULL COMMENT '状态名称',
  `code` varchar(48) NULL COMMENT '手术编码',
  `name` varchar(512) NULL COMMENT '手术名称',
  `est_opt_duration` varchar(48) NULL COMMENT '预计手术时长',
  `operation_type` varchar(128) NULL COMMENT '手术类别',
  `operation_level` varchar(128) NULL COMMENT '手术等级',
  `anaesthesia_method` varchar(128) NULL COMMENT '麻醉方法',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '手术申请信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_operation_record_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `apply_id` varchar(24) NULL COMMENT '申请流水号',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_id` varchar(128) NULL COMMENT '患者编号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `department_name` varchar(128) NULL COMMENT '申请科室名称',
  `department_code` varchar(128) NULL COMMENT '申请科室编码',
  `pay_time` datetime NULL COMMENT '付费时间',
  `apply_time` datetime NULL COMMENT '手术申请时间',
  `scene_type` varchar(64) NULL COMMENT '场景分类',
  `doctor_code` varchar(128) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(128) NULL COMMENT '申请医生姓名',
  `description` varchar(256) NULL COMMENT '备注',
  `status_code` varchar(24) NULL COMMENT '申请状态',
  `status_name` varchar(48) NULL COMMENT '申请状态名称',
  `code` varchar(48) NULL COMMENT '手术编码',
  `name` varchar(512) NULL COMMENT '手术名称',
  `operation_level` varchar(128) NULL COMMENT '手术等级',
  `est_opt_duration` varchar(48) NULL COMMENT '预计手术时长',
  `operation_type` varchar(128) NULL COMMENT '手术类别',
  `anaesthesia_method` varchar(128) NULL COMMENT '麻醉方法',
  `operation_doctor_id` varchar(128) NULL COMMENT '手术医生编码',
  `operation_doctor` varchar(128) NULL COMMENT '手术医生姓名',
  `act_start_time` datetime NULL COMMENT '实际手术开始时间',
  `act_end_time` datetime NULL COMMENT '实际手术结束时间',
  `pre_diagnosis` text NULL COMMENT '手术前诊断内容',
  `final_diagnosis` text NULL COMMENT '手术后诊断内容',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `content` text NULL COMMENT '手术内容'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '手术记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_patient_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者(就诊)编号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `id_card_no` varchar(48) NULL COMMENT '身份证号',
  `patient_gender` varchar(24) NULL COMMENT '性别',
  `birthday` varchar(24) NULL COMMENT '生日',
  `phone` varchar(256) NULL COMMENT '电话号码',
  `remark` varchar(64) NULL COMMENT '备注信息',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间',
  `work_phone` varchar(128) NULL COMMENT '工作电话号码',
  `link_phone` varchar(128) NULL COMMENT '联系电话号码',
  `home_phone` varchar(128) NULL COMMENT '家庭电话号码'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`)
COMMENT '患者基本信息表'
DISTRIBUTED BY HASH(`patient_id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_patient_medical_record_info` (
  `id` varchar(48) NULL COMMENT '就诊记录号',
  `patient_id` varchar(128) NULL COMMENT '患者编号',
  `patient_name` varchar(128) NULL COMMENT '患者姓名',
  `patient_type` varchar(48) NULL COMMENT '患者类型',
  `patient_card_no` varchar(48) NULL COMMENT '患者卡号',
  `department_name` varchar(128) NULL COMMENT '申请科室名称',
  `department_code` varchar(128) NULL COMMENT '申请科室编码',
  `doctor_code` varchar(48) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生姓名',
  `status` varchar(48) NULL COMMENT '状态编号',
  `status_name` varchar(64) NULL COMMENT '状态名称',
  `content` text NULL COMMENT '内容',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '患者电子病例表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_patient_medical_record_structural_info` (
  `patient_id` varchar(48) NOT NULL COMMENT '患者编号',
  `id` varchar(48) NOT NULL COMMENT 'id',
  `type` varchar(48) NOT NULL COMMENT '结构化分类',
  `child_type` varchar(48) NOT NULL COMMENT '结构化子分类',
  `source` varchar(48) NOT NULL COMMENT '来源',
  `content` text NULL COMMENT '结构化内容',
  `nlp_status` varchar(24) NULL COMMENT '结构化状态',
  `op_date` datetime(3) NULL COMMENT '数据操作时间',
  `sync_status` varchar(24) NULL COMMENT '同步状态'
) ENGINE=OLAP
UNIQUE KEY(`patient_id`, `id`, `type`, `child_type`)
COMMENT 'ODS电子病例结构化信息表'
DISTRIBUTED BY HASH(`patient_id`, `id`) BUCKETS 8
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_patient_past_his_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `register_id` varchar(48) NOT NULL COMMENT '挂号流水号',
  `treat_date` datetime NULL COMMENT '看诊时间',
  `doc_code` varchar(48) NULL COMMENT '医生编号',
  `doc_name` varchar(64) NULL COMMENT '医生名称',
  `status` varchar(48) NULL COMMENT '状态',
  `pid` varchar(48) NULL COMMENT 'pid',
  `patient_name` varchar(64) NULL COMMENT '患者名称',
  `age` varchar(24) NULL COMMENT '患者年龄',
  `sex` varchar(24) NULL COMMENT '患者性别',
  `id_card` varchar(48) NULL COMMENT '患者身份证号',
  `dept_code` varchar(48) NULL COMMENT '科室编号',
  `dept_name` varchar(64) NULL COMMENT '科室名称',
  `illness_now` varchar(2048) NULL COMMENT '现病史',
  `illness_tell` text NULL COMMENT '主诉',
  `illness_history` varchar(2048) NULL COMMENT '既往史',
  `assistant_check` varchar(2048) NULL COMMENT '辅助检查',
  `content` text NULL COMMENT '病历原文',
  `data_update_date` varchar(64) NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '患者既往史信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_recipe_medicine_info` (
  `id` varchar(48) NOT NULL COMMENT 'id',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(48) NULL COMMENT '住院号',
  `patient_id` varchar(48) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(48) NULL COMMENT '申请科室编码',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `scene_type` varchar(64) NULL COMMENT '场景分类',
  `doctor_code` varchar(128) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(128) NULL COMMENT '申请医生姓名',
  `description` varchar(512) NULL COMMENT '备注',
  `diagnosis` text NULL COMMENT '诊断',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '医嘱用药信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_recipe_medicine_item_info` (
  `id` varchar(64) NOT NULL COMMENT 'id',
  `recipe_medicine_id` varchar(48) NULL COMMENT '医嘱用药数据ID',
  `visit_id` varchar(48) NULL COMMENT '就诊记录号',
  `reg_in_id` varchar(48) NULL COMMENT '挂号住院号',
  `recipe_id` varchar(48) NULL COMMENT '关联处方id',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(48) NULL COMMENT '申请科室编码',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `name` varchar(512) NULL COMMENT '药品名称',
  `code` varchar(64) NULL COMMENT '药品编码',
  `medicine_class` varchar(128) NULL COMMENT '药物分类',
  `medicine_spec` varchar(256) NULL COMMENT '药品规格',
  `dose_unit` varchar(64) NULL COMMENT '单次用药单位',
  `each_quantity` varchar(64) NULL COMMENT '单次用药数量',
  `total` varchar(64) NULL COMMENT '总量',
  `total_unit` varchar(64) NULL COMMENT '总量单位',
  `inspect_result` varchar(128) NULL COMMENT '用药天数',
  `frequency_code` varchar(128) NULL COMMENT '用药频次代码',
  `frequency_name` varchar(256) NULL COMMENT '用药频次名称',
  `medication_amount` varchar(128) NULL COMMENT '带药(发药)总数',
  `packing_spec_num` varchar(128) NULL COMMENT '包装规格',
  `packing_spec_unit` varchar(256) NULL COMMENT '包装单位',
  `usage` varchar(512) NULL COMMENT '用法用量',
  `usage_advic` varchar(512) NULL COMMENT '用药建议',
  `usage_code` varchar(128) NULL COMMENT '用药方式编码',
  `usage_content` varchar(256) NULL COMMENT '用药方式名称',
  `fee_status` varchar(48) NULL COMMENT '收费状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '医嘱用药明细表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_recipe_therapy_info` (
  `id` varchar(64) NOT NULL COMMENT 'id',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `recipe_id` varchar(24) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(24) NULL COMMENT '住院号',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(24) NULL COMMENT '申请科室编码',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `doctor_code` varchar(24) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(64) NULL COMMENT '申请医生姓名',
  `description` varchar(128) NULL COMMENT '备注',
  `diagnosis` text NULL COMMENT '诊断内容',
  `status` varchar(24) NULL COMMENT '状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '医嘱治疗信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_recipe_therapy_item_info` (
  `id` varchar(24) NOT NULL COMMENT 'id',
  `therapy_id` varchar(48) NULL COMMENT '医嘱治疗ID',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `reg_in_id` varchar(24) NULL COMMENT '挂号住院号',
  `recipe_id` varchar(24) NULL COMMENT '关联处方id',
  `in_patient_no` varchar(24) NULL COMMENT '住院号',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `department_name` varchar(64) NULL COMMENT '申请科室名称',
  `department_code` varchar(24) NULL COMMENT '申请科室编码',
  `doctor_code` varchar(48) NULL COMMENT '申请医生编号',
  `doctor_name` varchar(128) NULL COMMENT '申请医生姓名',
  `pay_time` datetime NULL COMMENT '付费时间',
  `recipe_time` datetime NULL COMMENT '处方时间',
  `name` varchar(256) NULL COMMENT '项目名称',
  `code` varchar(256) NULL COMMENT '项目编码',
  `parent_recipe_id` varchar(24) NULL COMMENT '父关联处方id',
  `status` varchar(24) NULL COMMENT '状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '医嘱治疗明细表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_register_record_info` (
  `id` varchar(24) NOT NULL COMMENT '挂号流水号',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `card_type` varchar(24) NULL COMMENT '证件类型',
  `card_no` varchar(48) NULL COMMENT '证件号',
  `visit_id` varchar(24) NULL COMMENT '就诊记录号',
  `visit_card_no` varchar(48) NULL COMMENT '就诊卡号',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `company_name` varchar(64) NULL COMMENT '医院名称',
  `department_name` varchar(64) NULL COMMENT '挂号科室名称',
  `department_code` varchar(24) NULL COMMENT '挂号科室编码',
  `doctor_code` varchar(24) NULL COMMENT '挂号医生编号',
  `doctor_name` varchar(64) NULL COMMENT '挂号医生姓名',
  `reg_level_code` varchar(24) NULL COMMENT '挂号级别编号',
  `reg_level_name` varchar(48) NULL COMMENT '挂号级别名称',
  `reg_date` datetime NULL COMMENT '挂号时间',
  `reg_way` varchar(24) NULL COMMENT '挂号方式',
  `first_sub_type` varchar(24) NULL COMMENT '初诊复诊分类',
  `reserve_date` datetime NULL COMMENT '预约时间',
  `reserve_way` varchar(24) NULL COMMENT '预约方式',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `visit_idx` int(11) NULL COMMENT '就诊序号',
  `visit_status` varchar(24) NULL COMMENT '就诊状态',
  `visit_date` datetime NULL COMMENT '就诊时间',
  `status` varchar(24) NULL COMMENT '状态',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '挂号记录信息表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);

CREATE TABLE `ods_visit_record_info` (
  `id` varchar(24) NOT NULL COMMENT '就诊记录号',
  `register_id` varchar(24) NULL COMMENT '挂号ID',
  `patient_id` varchar(24) NULL COMMENT '患者编号',
  `patient_name` varchar(64) NULL COMMENT '患者姓名',
  `patient_age` varchar(24) NULL COMMENT '患者年龄',
  `patient_sex` varchar(24) NULL COMMENT '患者性别',
  `patient_card_no` varchar(48) NULL COMMENT '患者卡号',
  `visit_card_no` varchar(64) NULL COMMENT '就诊卡号',
  `company_code` varchar(48) NULL COMMENT '医院编号',
  `company_name` varchar(64) NULL COMMENT '医院名称',
  `department_code` varchar(64) NULL COMMENT '科室编码',
  `department_name` varchar(64) NULL COMMENT '科室名称',
  `doctor_code` varchar(48) NULL COMMENT '医生编号',
  `doctor_name` varchar(64) NULL COMMENT '医生姓名',
  `visit_date` datetime NULL COMMENT '就诊时间',
  `visit_type` varchar(24) NULL COMMENT '就诊类型(1: 复诊 2: 首诊)',
  `visit_way` varchar(24) NULL COMMENT '就诊方式(1: 在线问诊 0:线下门诊)',
  `fee_type_code` varchar(24) NULL COMMENT '收费分类编号',
  `fee_type_name` varchar(48) NULL COMMENT '收费分类名称',
  `scene_type` varchar(24) NULL COMMENT '场景分类',
  `status_code` varchar(24) NULL COMMENT '状态编号',
  `status_name` varchar(48) NULL COMMENT '状态名称',
  `data_update_date` datetime NULL COMMENT '数据更新时间',
  `op_data_user` varchar(48) NULL COMMENT '数据操作人',
  `op_update_data` datetime NULL COMMENT '数据操作时间'
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT '就诊记录表'
DISTRIBUTED BY HASH(`id`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);




