请教大神,创建物化视图A后,使用这个物化视图A去创建其他物化视图的数据量异常如何解决?

创建物化视图的脚本V_APPT_RECORD

CREATE  MATERIALIZED VIEW ods_qyhyc.V_APPT_RECORD 
DISTRIBUTED BY HASH( APPT_ID,ORG_CODE  ) BUCKETS 
3   -- 分桶 一般 3- 4 个就行了 
REFRESH ASYNC START("2023-10-18 03:02:00") EVERY(interval 5 HOUR) as
SELECT  
 A.APPT_ID
,T_DIM_ORG.ORG_CODE
,T_DIM_ORG.ORG_NAME
,A.APPT_SRC_ID
,A.ORDER_CODE
,A.SRC_DETL_ID
,A.APPT_CHAN_CODE
,A.USER_ID
,A.APPT_TIME
,A.ORG_ID
,A.DEPT_ID
,A.APPT_STATE
,A.TAKE_STATE
,A.VISIT_STATE
,A.PAYMENT_STATE
,A.RECORD_CLASS
,A.APLY_ID
,A.IS_PATIENT
,A.PATIENT_ID
,A.PATIENT_NAME
,A.PATIENT_IDCARD
,A.PATIENT_TEL
,A.INS_NO
,A.OUT_SNO
,A.VISIT_DATE
,A.PAY_MODE
,A.HIS_MONEY
,A.HANDLE
,A.HANDLE_TIME
,A.CANCEL_DT
,A.CANCEL_REASON_CODE
,A.CANCEL_EXP
,A.REC_CREATE_USER
,A.REC_CREATE_TIME
,A.REC_MODIFY_USER
,A.REC_MODIFY_TIME
,A.SKD_DATE
,A.CHAN_ORDER_CODE
,A.PATIENT_IDCODE
,A.DISEASE_NAME
,A.APPT_COME_FROM
,A.PATIENT_BIRTHDAY
,A.PATIENT_SEX
,A.CHAN_DETL_ID
,A.SORT_NUM
,A.ORDER_NO
,A.REFUND_ORDER_NO
,A.AGT_REFUND_ORDER_NO
,A.IS_COMMUNITY
,A.GUARD_PNAME
,A.GUARD_SEX
,A.GUARD_IDCARD
,A.GUARD_BIRTHDAY
,A.GUARD_MOBILE
,A.GUARD_INSURANCE_CARD
,A.GUARD_MEDICAL_CARD
,A.INSURANCE_SER_NUM
,A.ADD_FLAG
,A.ORDER_TYPE
,A.APPT_COME_UN
,A.PAY_SNO
,A.PAY_DATE
,A.PAY_COME_UN
,A.INSURANCE_CP_NO
,A.INSURANCE_TYPE
,A.BLACK_STATUS
,A.SK_ORG_NAME
,A.SK_DEPT_NAME
,A.SK_EMP_NAME
,A.SK_REFERRNAL_SIGN
,A.ADDR_CODE
,A.ADDR_NAME_ALL
,A.LEVEL_ID
,A.EMP_ID
,A.IN_BEGIN_TIME
,A.IN_END_TIME
,A.LAST_EDITED_TIME
,A.CDC_CREATE_TIME
,A.UD_CREATE_TIME
,A.UD_UPDATE_TIME
FROM   ods_qyhyc.APPT_RECORD  A 
inner join ods_qyhyc.T_ORGANIZATION ON T_ORGANIZATION.ID=A.ORG_ID
inner JOIN dim_odr.T_DIM_ORG ON T_DIM_ORG.ORG_CODE=T_ORGANIZATION.ORG_CODE
union all
SELECT 
 A.APPT_ID
,T_DIM_ORG.ORG_CODE
,T_DIM_ORG.ORG_NAME
  ,A.APPT_SRC_ID
,A.ORDER_CODE
,A.SRC_DETL_ID
,A.APPT_CHAN_CODE
,A.USER_ID
,A.APPT_TIME
,A.ORG_ID
,A.DEPT_ID
,A.APPT_STATE
,A.TAKE_STATE
,A.VISIT_STATE
,A.PAYMENT_STATE
,A.RECORD_CLASS
,A.APLY_ID
,A.IS_PATIENT
,A.PATIENT_ID
,A.PATIENT_NAME
,A.PATIENT_IDCARD
,A.PATIENT_TEL
,A.INS_NO
,A.OUT_SNO
,A.VISIT_DATE
,A.PAY_MODE
,A.HIS_MONEY
,A.HANDLE
,A.HANDLE_TIME
,A.CANCEL_DT
,A.CANCEL_REASON_CODE
,A.CANCEL_EXP
,A.REC_CREATE_USER
,A.REC_CREATE_TIME
,A.REC_MODIFY_USER
,A.REC_MODIFY_TIME
,A.SKD_DATE
,A.CHAN_ORDER_CODE
,A.PATIENT_IDCODE
,A.DISEASE_NAME
,A.APPT_COME_FROM
,A.PATIENT_BIRTHDAY
,A.PATIENT_SEX
,A.CHAN_DETL_ID
,A.SORT_NUM
,A.ORDER_NO
,A.REFUND_ORDER_NO
,A.AGT_REFUND_ORDER_NO
,A.IS_COMMUNITY
,A.GUARD_PNAME
,A.GUARD_SEX
,A.GUARD_IDCARD
,A.GUARD_BIRTHDAY
,A.GUARD_MOBILE
,A.GUARD_INSURANCE_CARD
,A.GUARD_MEDICAL_CARD
,A.INSURANCE_SER_NUM
,A.ADD_FLAG
,A.ORDER_TYPE
,A.APPT_COME_UN
,A.PAY_SNO
,A.PAY_DATE
,A.PAY_COME_UN
,A.INSURANCE_CP_NO
,A.INSURANCE_TYPE
,A.BLACK_STATUS
,A.SK_ORG_NAME
,A.SK_DEPT_NAME
,A.SK_EMP_NAME
,A.SK_REFERRNAL_SIGN
,A.ADDR_CODE
,A.ADDR_NAME_ALL
,A.LEVEL_ID
,A.EMP_ID
,A.IN_BEGIN_TIME
,A.IN_END_TIME
,A.LAST_EDITED_TIME
,A.CDC_CREATE_TIME
,A.UD_CREATE_TIME
,A.UD_UPDATE_TIME FROM   
ods_qyhyc.APPT_RECORD_HIS A 
inner join ods_qyhyc.T_ORGANIZATION ON T_ORGANIZATION.ID=A.ORG_ID
inner JOIN dim_odr.T_DIM_ORG ON T_DIM_ORG.ORG_CODE=T_ORGANIZATION.ORG_CODE  
WHERE NOT EXISTS (
SELECT 1 FROM ods_qyhyc.APPT_RECORD A1 WHERE A1.APPT_ID=A.APPT_ID
) AND A.SKD_DATE>='2018-01-01'

创建完成后,提示刷新成功后, 数据量2700W+ 。
image
------------ 第一种情况, 关联创建物化视图 ------------------------
用V_APPT_RECORD新建其他物化视图

CREATE  MATERIALIZED VIEW dwd_odr.MV_DWD_预约_门诊明细 
DISTRIBUTED BY HASH(机构代码,预约记录ID  ) BUCKETS 
3   -- 分桶 一般 3- 4 个就行了 
REFRESH ASYNC START("2023-10-18 03:02:00") EVERY(interval 6 HOUR) as
select 
A.ORG_CODE AS 机构代码
,A.	APPT_ID	预约记录ID
,A.ORG_NAME AS 机构名称
,A.	ORDER_CODE	订单编号
,A.	CHAN_ORDER_CODE	渠道订单编号
,A.	CHAN_DETL_ID	渠道的号源明细id
,A.	APPT_SRC_ID	号源标识
,A.	ORDER_NO	渠道方产生的订单号
,A.	SRC_DETL_ID	号源分时标识
,A.	APPT_CHAN_CODE	预约渠道编码
,A.	SKD_DATE	排班出诊日期
,A.	USER_ID	预约人ID
,A.PATIENT_NAME	就诊人姓名
,A.PATIENT_SEX	性别
,A.PATIENT_BIRTHDAY	出生日期
,A.PATIENT_IDCODE	就诊人证件代码
,A.PATIENT_IDCARD	就诊人证件号码
,A.	APPT_TIME	用户操作预约时间
,A.	ORG_ID	预约机构ID
,A.APPT_STATE	预约订单状态代码
,case A.APPT_STATE when -3 then'取号后退号'when -2 then'停诊'when -1 then'预约取消'when 1 then'预约成功'when 2 then '已付费' when 3 then '已取号' when 4 then'已挂号'when 5 then'已就诊'when 9 then'爽约' else A.APPT_STATE END 预约订单状态名称
,A.	PAYMENT_STATE	支付状态代码
,case A.PAYMENT_STATE	when 0 then'未付款'when 1 then'已付款'when 2 then'已退费'else A.PAYMENT_STATE end 支付状态名称
,case when A.	ADD_FLAG='1' then 1 else 0 end	加号标识
,A.	ORDER_TYPE	订单类型代码
,case when A.ORDER_TYPE is null then'病人在线预约'when A.ORDER_TYPE='2'then'医生诊间预约'when A.ORDER_TYPE='3'THEN'现场预约'ELSE A.ORDER_TYPE END 订单类型名称
,A.DEPT_ID 预约科室ID
,case A.IS_COMMUNITY when '2' then '1' else 0 end	是否为社康预约
,A.ORDER_CODE 区域号源池挂号预约序号
,case when A.APPT_STATE>=0 and A.APPT_STATE<>9 THEN 1 ELSE 0 END 有效预约标志
 ,T_EMPLOYEE_CONTRAST.EMP_CODE as 预约医生工号
,T_EMPLOYEE_CONTRAST.EMP_NAME  as 预约医生姓名
 ,YYKS.DEPT_CODE	院内_科室_编码	 
,YYKS.DEPT_NAME	院内_科室_名称	 
,YYKS.RHIN_CD	区域联网_编码体系	 	
,YYKS.RHIN_CODE	区域联网_编码	 
,YYKS.RHIN_NAME	区域联网_名称 
,YYKS.GHKSDM AS 预约挂号科室代码
,YYKS.GHKSMC AS 预约挂号科室名称
,YYKS.JZKSDM  预约挂号对应的门诊科室代码
,YYKS.JZKSMC  预约挂号对应的门诊科室名称
,ifnull(YYKS.科室代码,'其他')	as  科室代码
,ifnull(YYKS.科室名称,'其他') as  科室名称
 ,MS_GHMX.YYXH AS HIS挂号预约序号
,MS_GHMX.YYKSSJ AS 预约开始时间
,MS_GHMX.YYJSSJ AS 预约结束时间
,MS_GHMX.YYSD AS 预约时段
,MS_GHMX.SBXH AS 挂号序号
,MS_GHMX.BRID as 病人编号
,MS_GHMX.MS_GHMX_KSDM AS 挂号科室代码
,MS_GHMX.MS_GHKS_KSMC AS 挂号科室名称
,MS_GHMX.MZKS AS 挂号对应的门诊科室代码
,MS_GHMX.BRLY 病人来源
,MS_GHMX.互联网医院标志
,MS_GHMX.JZXH AS 就诊序号
,MS_GHMX.KSSJ AS 就诊开始时间
,MS_GHMX.GHSJ AS 挂号时间
 ,CASE WHEN 
(MS_GHMX.YYKSSJ IS NULL OR MS_GHMX.KSSJ  IS NULL OR (MS_GHMX.YYKSSJ>=MS_GHMX.KSSJ))THEN 0 
ELSE TIMESTAMPDIFF(MINUTE,MS_GHMX.YYKSSJ,MS_GHMX.KSSJ) END AS 预约就诊时差 
 ,MS_GHMX.YSDM AS 就诊医生代码
 ,MS_GHMX.YS_MZ_JZLS_KSDM AS 就诊科室代码
  ,MS_GHMX.业务科室名称  就诊科室名称  
 ,MS_GHMX.科室代码_就诊	科室代码_就诊标准
  ,MS_GHMX.科室名称_就诊	科室名称_就诊标准
 from ods_qyhyc.V_APPT_RECORD  A 
-- INNER JOIN ods_qyhyc.V_APPT_SRC on V_APPT_SRC.APPT_SRC_ID=A.APPT_SRC_ID
-- left JOIN ods_qyhyc.V_APPT_SRC_DETL B on A.SRC_DETL_ID=B.SRC_DETL_ID
-- select * from ods_qyhyc.T_DICT_EMPLOYEE
 left join ods_qyhyc.T_EMPLOYEE_CONTRAST ON T_EMPLOYEE_CONTRAST.P_ID=A.EMP_ID AND T_EMPLOYEE_CONTRAST.SYS_ID= 1 AND  T_EMPLOYEE_CONTRAST.SYS_VERS='HC01' 
LEFT JOIN dwd_odr.MV_DWD_预约_门诊明细_科室关联 YYKS ON   YYKS.ID=A.DEPT_ID 
LEFT JOIN dwd_odr.MV_DWD_预约_门诊明细_门诊挂号就诊 MS_GHMX ON A.ORDER_CODE=MS_GHMX.YYHM AND A.ORG_CODE=MS_GHMX.ORG_CODE

查询字典表 物化视图 已经success

查询 MV_DWD_预约_门诊明细 的数据量 只有 240条。

物化视图MV_DWD_预约_门诊明细的select 语句 查询总数 应该有 2700W+ 的数据量。

---------第二种 不关联其他 创建物化视图 ---------------

CREATE  MATERIALIZED VIEW dwd_odr.MV_DWD_预约_门诊明细 
DISTRIBUTED BY HASH(机构代码,预约记录ID  ) BUCKETS 
3   -- 分桶 一般 3- 4 个就行了 
REFRESH ASYNC START("2023-10-18 03:02:00") EVERY(interval 6 HOUR) as
select 
A.ORG_CODE AS 机构代码
,A.	APPT_ID	预约记录ID
,A.ORG_NAME AS 机构名称
,A.	ORDER_CODE	订单编号
,A.	CHAN_ORDER_CODE	渠道订单编号
,A.	CHAN_DETL_ID	渠道的号源明细id
,A.	APPT_SRC_ID	号源标识
,A.	ORDER_NO	渠道方产生的订单号
,A.	SRC_DETL_ID	号源分时标识
,A.	APPT_CHAN_CODE	预约渠道编码
,A.	SKD_DATE	排班出诊日期
,A.	USER_ID	预约人ID
,A.PATIENT_NAME	就诊人姓名
,A.PATIENT_SEX	性别
,A.PATIENT_BIRTHDAY	出生日期
,A.PATIENT_IDCODE	就诊人证件代码
,A.PATIENT_IDCARD	就诊人证件号码
,A.	APPT_TIME	用户操作预约时间
,A.	ORG_ID	预约机构ID
,A.APPT_STATE	预约订单状态代码
,case A.APPT_STATE when -3 then'取号后退号'when -2 then'停诊'when -1 then'预约取消'when 1 then'预约成功'when 2 then '已付费' when 3 then '已取号' when 4 then'已挂号'when 5 then'已就诊'when 9 then'爽约' else A.APPT_STATE END 预约订单状态名称
,A.	PAYMENT_STATE	支付状态代码
,case A.PAYMENT_STATE	when 0 then'未付款'when 1 then'已付款'when 2 then'已退费'else A.PAYMENT_STATE end 支付状态名称
,case when A.	ADD_FLAG='1' then 1 else 0 end	加号标识
,A.	ORDER_TYPE	订单类型代码
,case when A.ORDER_TYPE is null then'病人在线预约'when A.ORDER_TYPE='2'then'医生诊间预约'when A.ORDER_TYPE='3'THEN'现场预约'ELSE A.ORDER_TYPE END 订单类型名称
,A.DEPT_ID 预约科室ID
,case A.IS_COMMUNITY when '2' then '1' else 0 end	是否为社康预约
,A.ORDER_CODE 区域号源池挂号预约序号
,case when A.APPT_STATE>=0 and A.APPT_STATE<>9 THEN 1 ELSE 0 END 有效预约标志
from ods_qyhyc.V_APPT_RECORD  A 

此时 还是只有240条数据 。

您好 你使用的具体是什么版本 方便发下原表的创建语句吗

CREATE TABLE `APPT_RECORD` (

APPT_ID bigint(20) NOT NULL COMMENT “”,
APPT_SRC_ID bigint(20) NOT NULL COMMENT “”,
ORDER_CODE varchar(150) NOT NULL COMMENT “”,
SRC_DETL_ID bigint(20) NULL COMMENT “”,
APPT_CHAN_CODE varchar(150) NOT NULL COMMENT “”,
USER_ID bigint(20) NOT NULL COMMENT “”,
APPT_TIME datetime NOT NULL COMMENT “”,
ORG_ID bigint(20) NOT NULL COMMENT “”,
DEPT_ID bigint(20) NOT NULL COMMENT “”,
APPT_STATE bigint(20) NOT NULL COMMENT “”,
TAKE_STATE bigint(20) NULL COMMENT “”,
VISIT_STATE bigint(20) NULL COMMENT “”,
PAYMENT_STATE bigint(20) NOT NULL COMMENT “”,
RECORD_CLASS bigint(20) NOT NULL COMMENT “”,
APLY_ID bigint(20) NULL COMMENT “”,
IS_PATIENT bigint(20) NOT NULL COMMENT “”,
PATIENT_ID bigint(20) NULL COMMENT “”,
PATIENT_NAME varchar(300) NOT NULL COMMENT “”,
PATIENT_IDCARD varchar(150) NOT NULL COMMENT “”,
PATIENT_TEL varchar(90) NOT NULL COMMENT “”,
INS_NO varchar(150) NULL COMMENT “”,
OUT_SNO varchar(150) NULL COMMENT “”,
VISIT_DATE datetime NULL COMMENT “”,
PAY_MODE varchar(6) NOT NULL COMMENT “”,
HIS_MONEY decimal64(18, 2) NOT NULL COMMENT “”,
HANDLE varchar(300) NULL COMMENT “”,
HANDLE_TIME datetime NULL COMMENT “”,
CANCEL_DT datetime NULL COMMENT “”,
CANCEL_REASON_CODE varchar(6) NULL COMMENT “”,
CANCEL_EXP varchar(600) NULL COMMENT “”,
REC_CREATE_USER varchar(150) NOT NULL COMMENT “”,
REC_CREATE_TIME datetime NOT NULL COMMENT “”,
REC_MODIFY_USER varchar(150) NULL COMMENT “”,
REC_MODIFY_TIME datetime NULL COMMENT “”,
SKD_DATE date NOT NULL COMMENT “”,
CHAN_ORDER_CODE varchar(150) NOT NULL COMMENT “”,
PATIENT_IDCODE varchar(150) NULL COMMENT “”,
DISEASE_NAME varchar(765) NULL COMMENT “”,
APPT_COME_FROM varchar(150) NULL COMMENT “”,
PATIENT_BIRTHDAY date NULL COMMENT “”,
PATIENT_SEX varchar(3) NULL COMMENT “”,
CHAN_DETL_ID varchar(300) NULL COMMENT “”,
SORT_NUM bigint(20) NULL COMMENT “”,
ORDER_NO varchar(150) NULL COMMENT “”,
REFUND_ORDER_NO varchar(150) NULL COMMENT “”,
AGT_REFUND_ORDER_NO varchar(150) NULL COMMENT “”,
IS_COMMUNITY varchar(3) NULL COMMENT “”,
GUARD_PNAME varchar(150) NULL COMMENT “”,
GUARD_SEX varchar(3) NULL COMMENT “”,
GUARD_IDCARD varchar(150) NULL COMMENT “”,
GUARD_BIRTHDAY date NULL COMMENT “”,
GUARD_MOBILE varchar(150) NULL COMMENT “”,
GUARD_INSURANCE_CARD varchar(150) NULL COMMENT “”,
GUARD_MEDICAL_CARD varchar(150) NULL COMMENT “”,
INSURANCE_SER_NUM varchar(150) NULL COMMENT “”,
ADD_FLAG varchar(3) NULL COMMENT “”,
ORDER_TYPE varchar(3) NULL COMMENT “”,
APPT_COME_UN varchar(150) NULL COMMENT “”,
PAY_SNO varchar(150) NULL COMMENT “”,
PAY_DATE datetime NULL COMMENT “”,
PAY_COME_UN varchar(150) NULL COMMENT “”,
INSURANCE_CP_NO varchar(300) NULL COMMENT “”,
INSURANCE_TYPE varchar(6) NULL COMMENT “”,
BLACK_STATUS bigint(20) NULL COMMENT “”,
SK_ORG_NAME varchar(765) NULL COMMENT “”,
SK_DEPT_NAME varchar(765) NULL COMMENT “”,
SK_EMP_NAME varchar(765) NULL COMMENT “”,
SK_REFERRNAL_SIGN varchar(75) NULL COMMENT “”,
ADDR_CODE varchar(765) NULL COMMENT “”,
ADDR_NAME_ALL varchar(765) NULL COMMENT “”,
LEVEL_ID bigint(20) NULL COMMENT “”,
EMP_ID bigint(20) NULL COMMENT “”,
IN_BEGIN_TIME varchar(30) NULL COMMENT “”,
IN_END_TIME varchar(30) NULL COMMENT “”,
LAST_EDITED_TIME datetime NULL COMMENT “”,
CDC_CREATE_TIME datetime NULL COMMENT “”,
UD_CREATE_TIME datetime NULL COMMENT “”,
UD_UPDATE_TIME datetime NULL COMMENT “”
) ENGINE=OLAP
PRIMARY KEY(APPT_ID)
DISTRIBUTED BY HASH(APPT_ID)
PROPERTIES (
“replication_num” = “1”,
“in_memory” = “false”,
“enable_persistent_index” = “false”,
“replicated_storage” = “true”,
“compression” = “LZ4”
);
CREATE TABLE APPT_RECORD_HIS (
APPT_ID bigint(20) NOT NULL COMMENT “”,
APPT_SRC_ID bigint(20) NOT NULL COMMENT “”,
ORDER_CODE varchar(150) NOT NULL COMMENT “”,
SRC_DETL_ID bigint(20) NULL COMMENT “”,
APPT_CHAN_CODE varchar(150) NOT NULL COMMENT “”,
USER_ID bigint(20) NOT NULL COMMENT “”,
APPT_TIME datetime NOT NULL COMMENT “”,
ORG_ID bigint(20) NOT NULL COMMENT “”,
DEPT_ID bigint(20) NOT NULL COMMENT “”,
APPT_STATE bigint(20) NOT NULL COMMENT “”,
TAKE_STATE bigint(20) NULL COMMENT “”,
VISIT_STATE bigint(20) NULL COMMENT “”,
PAYMENT_STATE bigint(20) NOT NULL COMMENT “”,
RECORD_CLASS bigint(20) NOT NULL COMMENT “”,
APLY_ID bigint(20) NULL COMMENT “”,
IS_PATIENT bigint(20) NOT NULL COMMENT “”,
PATIENT_ID bigint(20) NULL COMMENT “”,
PATIENT_NAME varchar(300) NOT NULL COMMENT “”,
PATIENT_IDCARD varchar(150) NOT NULL COMMENT “”,
PATIENT_TEL varchar(90) NOT NULL COMMENT “”,
INS_NO varchar(150) NULL COMMENT “”,
OUT_SNO varchar(150) NULL COMMENT “”,
VISIT_DATE datetime NULL COMMENT “”,
PAY_MODE varchar(6) NOT NULL COMMENT “”,
HIS_MONEY decimal64(18, 2) NOT NULL COMMENT “”,
HANDLE varchar(300) NULL COMMENT “”,
HANDLE_TIME datetime NULL COMMENT “”,
CANCEL_DT datetime NULL COMMENT “”,
CANCEL_REASON_CODE varchar(6) NULL COMMENT “”,
CANCEL_EXP varchar(600) NULL COMMENT “”,
REC_CREATE_USER varchar(150) NOT NULL COMMENT “”,
REC_CREATE_TIME datetime NOT NULL COMMENT “”,
REC_MODIFY_USER varchar(150) NULL COMMENT “”,
REC_MODIFY_TIME datetime NULL COMMENT “”,
SKD_DATE date NOT NULL COMMENT “”,
CHAN_ORDER_CODE varchar(150) NOT NULL COMMENT “”,
PATIENT_IDCODE varchar(150) NULL COMMENT “”,
DISEASE_NAME varchar(765) NULL COMMENT “”,
APPT_COME_FROM varchar(150) NULL COMMENT “”,
PATIENT_BIRTHDAY date NULL COMMENT “”,
PATIENT_SEX varchar(3) NULL COMMENT “”,
CHAN_DETL_ID varchar(300) NULL COMMENT “”,
SORT_NUM bigint(20) NULL COMMENT “”,
ORDER_NO varchar(150) NULL COMMENT “”,
REFUND_ORDER_NO varchar(150) NULL COMMENT “”,
AGT_REFUND_ORDER_NO varchar(150) NULL COMMENT “”,
IS_COMMUNITY varchar(3) NULL COMMENT “”,
GUARD_PNAME varchar(150) NULL COMMENT “”,
GUARD_SEX varchar(3) NULL COMMENT “”,
GUARD_IDCARD varchar(150) NULL COMMENT “”,
GUARD_BIRTHDAY date NULL COMMENT “”,
GUARD_MOBILE varchar(150) NULL COMMENT “”,
GUARD_INSURANCE_CARD varchar(150) NULL COMMENT “”,
GUARD_MEDICAL_CARD varchar(150) NULL COMMENT “”,
INSURANCE_SER_NUM varchar(150) NULL COMMENT “”,
ADD_FLAG varchar(3) NULL COMMENT “”,
ORDER_TYPE varchar(3) NULL COMMENT “”,
APPT_COME_UN varchar(150) NULL COMMENT “”,
PAY_SNO varchar(150) NULL COMMENT “”,
PAY_DATE datetime NULL COMMENT “”,
PAY_COME_UN varchar(150) NULL COMMENT “”,
INSURANCE_CP_NO varchar(300) NULL COMMENT “”,
INSURANCE_TYPE varchar(6) NULL COMMENT “”,
BLACK_STATUS bigint(20) NULL COMMENT “”,
SK_ORG_NAME varchar(765) NULL COMMENT “”,
SK_DEPT_NAME varchar(765) NULL COMMENT “”,
SK_EMP_NAME varchar(765) NULL COMMENT “”,
SK_REFERRNAL_SIGN varchar(75) NULL COMMENT “”,
ADDR_CODE varchar(765) NULL COMMENT “”,
ADDR_NAME_ALL varchar(765) NULL COMMENT “”,
LEVEL_ID bigint(20) NULL COMMENT “”,
EMP_ID bigint(20) NULL COMMENT “”,
IN_BEGIN_TIME varchar(30) NULL COMMENT “”,
IN_END_TIME varchar(30) NULL COMMENT “”,
LAST_EDITED_TIME datetime NULL COMMENT “”,
CDC_CREATE_TIME datetime NULL COMMENT “”,
UD_CREATE_TIME datetime NULL COMMENT “”,
UD_UPDATE_TIME datetime NULL COMMENT “”,
INDEX I_APPT_RECORD_HIS (SKD_DATE) USING BITMAP
) ENGINE=OLAP
PRIMARY KEY(APPT_ID)
DISTRIBUTED BY HASH(APPT_ID)
PROPERTIES (
“replication_num” = “1”,
“in_memory” = “false”,
“enable_persistent_index” = “false”,
“replicated_storage” = “true”,
“compression” = “LZ4”
);
CREATE TABLE T_ORGANIZATION (
ID bigint(20) NOT NULL COMMENT “”,
ORG_CODE varchar(150) NOT NULL COMMENT “”,
ORG_NAME varchar(765) NOT NULL COMMENT “”,
DIRECTORY_ID varchar(192) NULL COMMENT “”,
REGISTRATIONNUMBER varchar(300) NULL COMMENT “”,
ADDR varchar(765) NULL COMMENT “”,
TEL varchar(240) NULL COMMENT “”,
FAX varchar(240) NULL COMMENT “”,
LEGAL_REPRESENTATIVE_CODE varchar(150) NULL COMMENT “”,
LEGAL_REPRESENTATIVE_NAME varchar(300) NULL COMMENT “”,
AREA varchar(75) NULL COMMENT “”,
HOSPITAL_LEVEL varchar(150) NULL COMMENT “”,
BED bigint(20) NULL COMMENT “”,
FLAG varchar(3) NOT NULL COMMENT “”,
LAST_EDITED_TIME datetime NULL COMMENT “”,
CREATE_PERSON varchar(60) NULL COMMENT “”,
CREATE_TIME datetime NULL COMMENT “”,
MODIFY_PERSON varchar(60) NULL COMMENT “”,
MODIFY_TIME datetime NULL COMMENT “”,
OLD_ORG_CODE varchar(60) NULL COMMENT “”,
AD_CODE varchar(18) NULL COMMENT “”,
SORT bigint(20) NULL COMMENT “”,
REG_TIME datetime NULL COMMENT “”,
AREA_CODE varchar(30) NULL COMMENT “”,
TMP varchar(600) NULL COMMENT “”,
ADMIN_CODE varchar(30) NULL COMMENT “”,
RHIN_CD varchar(150) NULL COMMENT “”,
RHIN_ID varchar(150) NULL COMMENT “”,
DIRECTORY_SYSTEM varchar(150) NULL COMMENT “”,
DIRECTORY_SYSTEM_NAME varchar(765) NULL COMMENT “”,
DIRECTORY_NAME varchar(765) NULL COMMENT “”,
EFFECTIVE_NAME varchar(765) NULL COMMENT “”,
EFFECTIVE_TIME_LOW date NULL COMMENT “”,
EFFECTIVE_TIME_HIGH date NULL COMMENT “”,
SCOPER_ORG_CODE varchar(150) NULL COMMENT “”,
SCOPER_ORG_NAME varchar(765) NULL COMMENT “”,
CREATE_PERSON_ID varchar(150) NULL COMMENT “”,
MODIFY_PERSON_ID varchar(150) NULL COMMENT “”,
CONTACT_PERSON varchar(150) NULL COMMENT “”,
CREATE_PERSON_ORG_CODE varchar(150) NULL COMMENT “”,
CREATE_PERSON_ORG_NAME varchar(765) NULL COMMENT “”,
MODIFY_PERSON_ORG_CODE varchar(150) NULL COMMENT “”,
MODIFY_PERSON_ORG_NAME varchar(765) NULL COMMENT “”,
P_ORG_CODE varchar(150) NULL COMMENT “”,
INSTITUTION_CLASS varchar(60) NULL COMMENT “”,
STREET_CODE varchar(150) NULL COMMENT “”,
COMMUNITY_CODE varchar(150) NULL COMMENT “”,
CDC_CREATE_TIME datetime NULL COMMENT “”,
UD_CREATE_TIME datetime NULL COMMENT “”,
UD_UPDATE_TIME datetime NULL COMMENT “”
) ENGINE=OLAP
PRIMARY KEY(ID)
DISTRIBUTED BY HASH(ID)
PROPERTIES (
“replication_num” = “1”,
“in_memory” = “false”,
“enable_persistent_index” = “false”,
“replicated_storage” = “true”,
“compression” = “LZ4”
);
CREATE TABLE T_DIM_ORG (
ID varchar(32) NOT NULL COMMENT “主键ID”,
ORG_CODE varchar(30) NOT NULL COMMENT “医疗机构编码”,
ORG_PID varchar(32) NULL COMMENT “父ID”,
ORG_PNAME varchar(50) NULL COMMENT “父机构名称”,
SEQ_NUM int(11) NULL COMMENT “显示排序”,
TREE_LEVEL int(11) NULL COMMENT “树层级”,
ORG_NAME varchar(100) NOT NULL COMMENT “医疗机构名称”,
ORG_SHORT_NAME varchar(255) NULL COMMENT “医疗机构简称”,
ORG_NAME_FULL varchar(255) NULL COMMENT “医疗机构全称”,
LEVEL_CODE varchar(50) NULL COMMENT “医院等级编码”,
LEVEL_NAME varchar(50) NULL COMMENT “医院等级名称”,
ORG_SORT_CODE varchar(10) NULL COMMENT “卫生机构类型编码”,
ORG_SORT_NAME varchar(50) NULL COMMENT “卫生机构类型名称”,
ECONOMIC_CODE varchar(10) NULL COMMENT “经济类型编码”,
ECONOMIC_NAME varchar(50) NULL COMMENT “经济类型名称”,
MANAGE_CODE varchar(10) NULL COMMENT “类型管理分类编码”,
MANAGE_NAME varchar(50) NULL COMMENT “类型管理分类名称”,
DIVISION_CODE varchar(10) NULL COMMENT “行政区划代码”,
PROVINCE_CODE varchar(10) NULL COMMENT “省代码”,
PROVINCE_NAME varchar(255) NULL COMMENT “省名称”,
CITY_CODE varchar(10) NULL COMMENT “市代码”,
CITY_NAME varchar(255) NULL COMMENT “市名称”,
COUNTY_CODE varchar(10) NULL COMMENT “区县代码”,
COUNTY_NAME varchar(255) NULL COMMENT “区县名称”,
TOWN_CODE varchar(10) NULL COMMENT “街道代码”,
TOWN_NAME varchar(255) NULL COMMENT “街道名称”,
ROAD_CODE varchar(50) NULL COMMENT “门牌”,
ADDR varchar(255) NULL COMMENT “完整详细地址”,
CERT_BED_CNT int(11) NULL COMMENT “编制床位数”,
OPEN_BED_CNT int(11) NULL COMMENT “开放床位数”,
STAFF_CNT int(11) NULL COMMENT “员工总数”,
MEDICAL_CNT int(11) NULL COMMENT “卫生技术人数”,
AREA decimal64(9, 2) NULL COMMENT “占地面积”,
OPEN_DATE datetime NULL COMMENT “开业日期”,
ORT_IMG varbinary NULL COMMENT “机构照片”,
LONGITUDE varchar(20) NULL COMMENT “经度信息”,
LATITUDE varchar(20) NULL COMMENT “纬度信息”,
TEL varchar(20) NULL COMMENT “联系电话”,
FAX varchar(20) NULL COMMENT “传真号码”,
MAIL varchar(30) NULL COMMENT “官方邮箱”,
URL varchar(100) NULL COMMENT “网址”,
ZIP varchar(6) NULL COMMENT “邮政编码”,
TREAT_SCOPE varchar(65533) NULL COMMENT “诊疗范围”,
HOS_INTRO varchar(65533) NULL COMMENT “医院简介”,
BUS_ROUTES varchar(65533) NULL COMMENT “乘车路线”,
LEGAL varchar(50) NULL COMMENT “法定代表人”,
PRINCIPAL varchar(50) NULL COMMENT “主要负责人”,
NOUSED_FLAG int(11) NULL COMMENT “停用标记(0:正常;1:停用)”,
NOUSED_TIME datetime NULL COMMENT “停用时间”,
ORG_SUB_CODE varchar(255) NULL COMMENT “单位隶属关系编码”,
ORG_SUB_NAME varchar(65533) NULL COMMENT “单位隶属关系名称”,
LEGAL_TELEPHONE varchar(20) NULL COMMENT “法定代表人电话(电子病历数据集中数据元要求字段)”,
HEAD_PY varchar(50) NULL COMMENT “名称拼音首码”,
FULL_PY varchar(255) NULL COMMENT “名称拼音全码”,
CREATE_USER_ID varchar(32) NULL COMMENT “创建人用户ID”,
CREATE_USER_NAME varchar(50) NULL COMMENT “创建人用户姓名”,
CREATE_TIME datetime NULL COMMENT “创建时间”,
MODIFY_USER_ID varchar(32) NULL COMMENT “最后修改人用户ID”,
MODIFY_USER_NAME varchar(50) NULL COMMENT “最后修改人用户姓名”,
MODIFY_TIME datetime NULL COMMENT “最后修改时间”,
ORG_SYMBOL varchar(20) NULL COMMENT “组织机构编码”,
DISTRICT_ID varchar(32) NULL COMMENT “区属id”,
INSTITUTION_TYPE varchar(20) NULL COMMENT “机构分类”,
VACCINATE_FLAG varchar(1) NULL COMMENT “是否接种单位,0否,1是”,
PUB_HEALTH_FLAG varchar(1) NULL COMMENT “是否公共卫生机构,0否,1是”,
sort varchar(50) NULL COMMENT “排序”,
delete_flag tinyint(4) NULL COMMENT “删除标识:0:未删除,1:已删除”,
REMARK varchar(500) NULL COMMENT “备注”,
INDEX I_T_DIM_ORG (ORG_CODE) USING BITMAP
) ENGINE=OLAP
PRIMARY KEY(ID)
DISTRIBUTED BY HASH(ID)
PROPERTIES (
“replication_num” = “1”,
“in_memory” = “false”,
“enable_persistent_index” = “true”,
“replicated_storage” = “true”,
“compression” = “LZ4”
);

版本号: 3.2.2