线上问诊:数仓开发(二)

系列文章目录

线上问诊:业务数据采集
线上问诊:数仓数据同步
线上问诊:数仓开发(一)
线上问诊:数仓开发(二)


文章目录

  • 系列文章目录
  • 前言
  • 一、DWS
    • 1.最近1日汇总表
      • 1.交易域医院患者性别年龄段粒度问诊最近1日汇总表
      • 2.交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表
      • 3.交易域医院患者性别年龄段粒度处方开单最近1日汇总表
      • 4.交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表
      • 5.交易域医生粒度问诊最近1日汇总表
      • 6.首日装载脚本
      • 7.每日数据装载
    • 2.最近n日汇总表
      • 1.交易域医院患者性别年龄段粒度问诊最近n日汇总表
      • 2.交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表
      • 3.交易域医院患者性别年龄段粒度处方开单最近n日汇总表
      • 4.交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表
      • 5.交易域医生粒度问诊最近n日汇总表
      • 6.首日装载脚本
    • 3.历史至今汇总表
      • 1.交易域医生粒度问诊历史至今汇总表
      • 2.互动域医院用户粒度用户评价历史至今汇总表
      • 3.互动域医院粒度用户评价历史至今汇总表
      • 4.首日数据装载
      • 5.每日数据装载
  • 总结


前言

我们这次博客继续完成数仓的开发


一、DWS

1.最近1日汇总表

1.交易域医院患者性别年龄段粒度问诊最近1日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_1d
(
    `hospital_id`         STRING COMMENT '医院ID',
    `hospital_name`       STRING COMMENT '医院名称',
    `gender_code`         STRING COMMENT '患者性别编码',
    `gender`              STRING COMMENT '患者性别',
    `age_group`           STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-122]老年期',
    `consultation_amount` DECIMAL(16, 2) COMMENT '问诊金额',
    `consultation_count`  BIGINT COMMENT '问诊次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊最近1日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_1d'
    TBLPROPERTIES ('orc.compress' = 'snappy');

2.交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `consultation_pay_suc_amount` DECIMAL(16, 2) COMMENT '问诊支付成功金额',
    `consultation_pay_suc_count`  BIGINT COMMENT '问诊支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊支付成功最近1日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_pay_suc_1d'
    TBLPROPERTIES ('orc.compress' = 'snappy');

3.交易域医院患者性别年龄段粒度处方开单最近1日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_1d
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `prescription_amount` DECIMAL(16, 2) COMMENT '处方开单金额',
    `prescription_count`  BIGINT COMMENT '处方开单次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单最近1日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_1d'
    TBLPROPERTIES ('orc.compress' = 'snappy');

4.交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `prescription_pay_suc_amount` DECIMAL(16, 2) COMMENT '处方开单支付成功金额',
    `prescription_pay_suc_count`  BIGINT COMMENT '处方开单支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单支付成功最近1日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_pay_suc_1d'
    TBLPROPERTIES ('orc.compress' = 'snappy');

5.交易域医生粒度问诊最近1日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_doctor_consultation_1d
(
    `doctor_id`                 STRING COMMENT '医生ID',
    `doctor_name`               STRING COMMENT '医生姓名',
    `consultation_count`  BIGINT COMMENT '接诊次数'
) COMMENT '交易域医生粒度问诊最近1日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_1d'
    TBLPROPERTIES ('orc.compress' = 'snappy');

6.首日装载脚本

vim ~/bin/medical_dwd_to_dws_1d_init.sh

#!/bin/bash

APP=medical

if [ -n $2 ]
then 
    do_date=$2
else
    echo "请传入日期参数!!!"
    exit
fi

dws_trade_hospital_gender_age_group_consultation_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_1d
    partition (dt)
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(consultation_fee) consultation_amount,
       count(*)              consultation_count,
       dt
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             consultation_fee,
             dt
      from (select doctor_id,
                   patient_id,
                   consultation_fee,
                   dt
            from ${APP}.dwd_trade_consultation_inc) consul
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group,
         dt;
"

dws_trade_hospital_gender_age_group_consultation_pay_suc_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
    partition (dt)
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(consultation_fee) consultation_pay_suc_amount,
       count(*)              consultation_pay_suc_count,
       dt
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             consultation_fee,
             dt
      from (select doctor_id,
                   patient_id,
                   consultation_fee,
                   dt
            from ${APP}.dwd_trade_consultation_pay_suc_inc) consul
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group,
         dt;
"

dws_trade_hospital_gender_age_group_prescription_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_1d
    partition (dt)
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(total_amount) prescription_amount,
       count(*)          prescription_count,
       dt
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             total_amount,
             dt
      from (select max(doctor_id)    doctor_id,
                   max(patient_id)   patient_id,
                   max(total_amount) total_amount,
                   max(dt)           dt
            from ${APP}.dwd_trade_prescription_inc
            group by prescription_id) prescr
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group,
         dt;
"

dws_trade_hospital_gender_age_group_prescription_pay_suc_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
    partition (dt)
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(total_amount) prescription_pay_suc_amount,
       count(*)          prescription_pay_suc_count,
       dt
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             total_amount,
             dt
      from (select max(doctor_id)    doctor_id,
                   max(patient_id)   patient_id,
                   max(total_amount) total_amount,
                   max(dt)           dt
            from ${APP}.dwd_trade_prescription_pay_suc_inc
            group by prescription_id) prescr
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group,
         dt;
"

dws_trade_doctor_consultation_1d="
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table ${APP}.dws_trade_doctor_consultation_1d
    partition (dt)
select doctor_id,
       name doctor_name,
       consultation_count,
       dt
from (select doctor_id,
             dt,
             count(*) consultation_count
      from ${APP}.dwd_trade_consultation_inc
      group by doctor_id,
               dt) avg
         left join (select id,
                           name
                    from ${APP}.dim_doctor_full
                    where dt = '$do_date') doc
                   on avg.doctor_id = doc.id;
"

case $1 in
    dws_trade_hospital_gender_age_group_consultation_1d | dws_trade_hospital_gender_age_group_consultation_pay_suc_1d | dws_trade_hospital_gender_age_group_prescription_1d | dws_trade_hospital_gender_age_group_prescription_pay_suc_1d | dws_trade_doctor_consultation_1d)
    hive -e "${!1}"
    ;;
    "all")
    hive -e "$dws_trade_hospital_gender_age_group_consultation_1d$dws_trade_hospital_gender_age_group_consultation_pay_suc_1d$dws_trade_hospital_gender_age_group_prescription_1d$dws_trade_hospital_gender_age_group_prescription_pay_suc_1d$dws_trade_doctor_consultation_1d"
    ;;
esac

添加权限
chmod +x ~/bin/medical_dwd_to_dws_1d_init.sh
数据载入
medical_dwd_to_dws_1d_init.sh all 2023-05-09
在这里插入图片描述
随便找一个查看一下最后的日期

7.每日数据装载

vim ~/bin/medical_dwd_to_dws_1d.sh

#!/bin/bash

APP=medical

if [ -n $2 ]
then 
    do_date=$2
else
    echo "请传入日期参数!!!"
    exit
fi

dws_trade_hospital_gender_age_group_consultation_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_1d
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(consultation_fee) consultation_amount,
       count(*)              consultation_count
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             consultation_fee
      from (select doctor_id,
                   patient_id,
                   consultation_fee
            from ${APP}.dwd_trade_consultation_inc
            where dt = '$do_date') consul
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;"

dws_trade_hospital_gender_age_group_consultation_pay_suc_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(consultation_fee) consultation_pay_suc_amount,
       count(*)              consultation_pay_suc_count
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             consultation_fee
      from (select doctor_id,
                   patient_id,
                   consultation_fee
            from ${APP}.dwd_trade_consultation_pay_suc_inc
            where dt = '$do_date') consul
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;"

dws_trade_hospital_gender_age_group_prescription_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_1d
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(total_amount) prescription_amount,
       count(*)          prescription_count
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             total_amount
      from (select max(doctor_id)    doctor_id,
                   max(patient_id)   patient_id,
                   max(total_amount) total_amount
            from ${APP}.dwd_trade_prescription_inc
            where dt = '$do_date'
            group by prescription_id) prescr
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;"

dws_trade_hospital_gender_age_group_prescription_pay_suc_1d="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(total_amount) prescription_pay_suc_amount,
       count(*)          prescription_pay_suc_count
from (select hospital_id,
             hospital_name,
             gender_code,
             gender,
             case
                 when age >= 0 and age <= 2 then '婴儿期'
                 when age >= 3 and age <= 5 then '幼儿期'
                 when age >= 6 and age <= 11 then '小学阶段'
                 when age >= 12 and age <= 17 then '青少年期(中学阶段)'
                 when age >= 18 and age <= 29 then '青年期'
                 when age >= 30 and age <= 59 then '中年期'
                 when age >= 60 and age <= 122 then '老年期'
                 else '年龄异常' end age_group,
             total_amount
      from (select max(doctor_id)    doctor_id,
                   max(patient_id)   patient_id,
                   max(total_amount) total_amount
            from ${APP}.dwd_trade_prescription_inc
            where dt = '$do_date'
            group by prescription_id) prescr
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on doctor_id = doc.id
               left join (select id,
                                 name hospital_name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on doc.hospital_id = hos.id
               left join
           (select id,
                   gender_code,
                   gender,
                   year('$do_date') - year(birthday) age
            from ${APP}.dim_patient_full
            where dt = '$do_date') patient
           on patient_id = patient.id) with_group
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;"

dws_trade_doctor_consultation_1d="
insert overwrite table ${APP}.dws_trade_doctor_consultation_1d
    partition (dt = '$do_date')
select doctor_id,
       name doctor_name,
       consultation_count
from (select doctor_id,
             count(*) consultation_count
      from ${APP}.dwd_trade_consultation_inc
      where dt = '$do_date'
      group by doctor_id) avg
         left join (select id,
                           name
                    from ${APP}.dim_doctor_full
                    where dt = '$do_date') doc
                   on avg.doctor_id = doc.id;"

case $1 in
    dws_trade_hospital_gender_age_group_consultation_1d | dws_trade_hospital_gender_age_group_consultation_pay_suc_1d | dws_trade_hospital_gender_age_group_prescription_1d | dws_trade_hospital_gender_age_group_prescription_pay_suc_1d | dws_trade_doctor_consultation_1d)
    hive -e "${!1}"
    ;;
    "all")
    hive -e "$dws_trade_hospital_gender_age_group_consultation_1d$dws_trade_hospital_gender_age_group_consultation_pay_suc_1d$dws_trade_hospital_gender_age_group_prescription_1d$dws_trade_hospital_gender_age_group_prescription_pay_suc_1d$dws_trade_doctor_consultation_1d"
    ;;
esac

添加权限
chmod +x ~/bin/medical_dwd_to_dws_1d.sh

2.最近n日汇总表

1.交易域医院患者性别年龄段粒度问诊最近n日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_nd
(
    `hospital_id`             STRING COMMENT '医院ID',
    `hospital_name`           STRING COMMENT '医院名称',
    `gender_code`             STRING COMMENT '患者性别编码',
    `gender`                  STRING COMMENT '患者性别',
    `age_group`               STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-122]老年期',
    `consultation_amount_7d`  DECIMAL(16, 2) COMMENT '最近 7 日问诊金额',
    `consultation_count_7d`   BIGINT COMMENT '最近 7 日问诊次数',
    `consultation_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日问诊金额',
    `consultation_count_30d`  BIGINT COMMENT '最近 30 日问诊次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊最近n日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_nd'
    TBLPROPERTIES ('orc.compress' = 'snappy');

2.交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_consultation_pay_suc_nd
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `consultation_pay_suc_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日问诊支付成功金额',
    `consultation_pay_suc_count_7d`  BIGINT COMMENT '最近 7 日问诊支付成功次数',
    `consultation_pay_suc_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日问诊支付成功金额',
    `consultation_pay_suc_count_30d`  BIGINT COMMENT '最近 30 日问诊支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度问诊支付成功最近n日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_consultation_pay_suc_nd'
    TBLPROPERTIES ('orc.compress' = 'snappy');

3.交易域医院患者性别年龄段粒度处方开单最近n日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_nd
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `prescription_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日处方开单金额',
    `prescription_count_7d`  BIGINT COMMENT '最近 7 日处方开单次数',
    `prescription_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日处方开单金额',
    `prescription_count_30d`  BIGINT COMMENT '最近 30 日处方开单次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单最近n日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_nd'
    TBLPROPERTIES ('orc.compress' = 'snappy');

4.交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_hospital_gender_age_group_prescription_pay_suc_nd
(
    `hospital_id`                 STRING COMMENT '医院ID',
    `hospital_name`               STRING COMMENT '医院名称',
    `gender_code`                 STRING COMMENT '患者性别编码',
    `gender`                      STRING COMMENT '患者性别',
    `age_group`                   STRING COMMENT '年龄段:[0,2]婴儿期, [3,5]幼儿期, [6,11]小学阶段, [12,17]青少年期(中学阶段), [18-29]青年期, [30-59]中年期, [60-]老年期',
    `prescription_pay_suc_amount_7d` DECIMAL(16, 2) COMMENT '最近 7 日处方开单支付成功金额',
    `prescription_pay_suc_count_7d`  BIGINT COMMENT '最近 7 日处方开单支付成功次数',
    `prescription_pay_suc_amount_30d` DECIMAL(16, 2) COMMENT '最近 30 日处方开单支付成功金额',
    `prescription_pay_suc_count_30d`  BIGINT COMMENT '最近 30 日处方开单支付成功次数'
) COMMENT '交易域医院患者性别年龄段粒度处方开单支付成功最近n日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_hospital_gender_age_group_prescription_pay_suc_nd'
    TBLPROPERTIES ('orc.compress' = 'snappy');

5.交易域医生粒度问诊最近n日汇总表

建表语句

CREATE EXTERNAL TABLE IF NOT EXISTS dws_trade_doctor_consultation_nd
(
    `doctor_id`                 STRING COMMENT '医生ID',
    `doctor_name`               STRING COMMENT '医生姓名',
    `consultation_count_7d`  BIGINT COMMENT '最近 7 日接诊次数',
    `consultation_count_30d`  BIGINT COMMENT '最近 30 日接诊次数'
) COMMENT '交易域医生粒度问诊最近n日汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_nd'
    TBLPROPERTIES ('orc.compress' = 'snappy');

6.首日装载脚本

vim ~/bin/medical_dws_1d_to_dws_nd.sh

#!/bin/bash

APP=medical

if [ -n $2 ]
then 
    do_date=$2
else
    echo "请传入日期参数!!!"
    exit
fi

dws_trade_hospital_gender_age_group_consultation_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_nd
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(if(dt >= date_add('$do_date', -6), consultation_amount, 0)) consultation_amount_7d,
       sum(if(dt >= date_add('$do_date', -6), consultation_count, 0))  consultation_count_7d,
       sum(consultation_amount)                                          consultation_amount_30d,
       sum(consultation_count)                                           consultation_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_consultation_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;
"

dws_trade_hospital_gender_age_group_consultation_pay_suc_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_nd
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(if(dt >= date_add('$do_date', -6), consultation_pay_suc_amount, 0)) consultation_pay_suc_amount_7d,
       sum(if(dt >= date_add('$do_date', -6), consultation_pay_suc_count, 0))  consultation_pay_suc_count_7d,
       sum(consultation_pay_suc_amount)                                          consultation_pay_suc_amount_30d,
       sum(consultation_pay_suc_count)                                           consultation_pay_suc_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_consultation_pay_suc_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;
"

dws_trade_hospital_gender_age_group_prescription_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_nd
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(if(dt >= date_add('$do_date', -6), prescription_amount, 0)) prescription_amount_7d,
       sum(if(dt >= date_add('$do_date', -6), prescription_count, 0))  prescription_count_7d,
       sum(prescription_amount)                                          prescription_amount_30d,
       sum(prescription_count)                                           prescription_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_prescription_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;
"

dws_trade_hospital_gender_age_group_prescription_pay_suc_nd="
insert overwrite table ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_nd
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       gender_code,
       gender,
       age_group,
       sum(if(dt >= date_add('$do_date', -6), prescription_pay_suc_amount, 0)) prescription_pay_suc_amount_7d,
       sum(if(dt >= date_add('$do_date', -6), prescription_pay_suc_count, 0))  prescription_pay_suc_count_7d,
       sum(prescription_pay_suc_amount)                                          prescription_pay_suc_amount_30d,
       sum(prescription_pay_suc_count)                                           prescription_pay_suc_count_30d
from ${APP}.dws_trade_hospital_gender_age_group_prescription_pay_suc_1d
where dt >= date_add('$do_date', -29)
group by hospital_id,
         hospital_name,
         gender_code,
         gender,
         age_group;
"

dws_trade_doctor_consultation_nd="
insert overwrite table ${APP}.dws_trade_doctor_consultation_nd
    partition (dt = '$do_date')
select doctor_id,
       doctor_name,
       sum(if(dt >= date_add('$do_date', -6), consultation_count, 0)) consultation_count_7d,
       sum(consultation_count)                                          consultation_count_30d
from ${APP}.dws_trade_doctor_consultation_1d
where dt >= date_add('$do_date', -29)
group by doctor_id,
         doctor_name;
"

case $1 in
    dws_trade_hospital_gender_age_group_consultation_nd | dws_trade_hospital_gender_age_group_consultation_pay_suc_nd | dws_trade_hospital_gender_age_group_prescription_nd | dws_trade_hospital_gender_age_group_prescription_pay_suc_nd | dws_trade_doctor_consultation_nd)
    hive -e "${!1}"
    ;;
    "all")
    hive -e "$dws_trade_hospital_gender_age_group_consultation_nd$dws_trade_hospital_gender_age_group_consultation_pay_suc_nd$dws_trade_hospital_gender_age_group_prescription_nd$dws_trade_hospital_gender_age_group_prescription_pay_suc_nd$dws_trade_doctor_consultation_nd"
    ;;
    "*")
    echo "非法参数!!!"
    ;;
esac

添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_nd.sh
数据装载
medical_dws_1d_to_dws_nd.sh all 2023-05-09
在这里插入图片描述

3.历史至今汇总表

1.交易域医生粒度问诊历史至今汇总表

建表语句

CREATE TABLE IF NOT EXISTS dws_trade_doctor_consultation_td(
    `doctor_id` STRING COMMENT '医生ID',
    `doctor_name` STRING COMMENT '医生姓名',
    `first_consultation_dt` STRING COMMENT '首次接诊日期'
) COMMENT '交易域医生粒度问诊历史至今汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_trade_doctor_consultation_td'
    TBLPROPERTIES ('orc.compress' = 'snappy');

2.互动域医院用户粒度用户评价历史至今汇总表

建表语句

CREATE TABLE IF NOT EXISTS dws_interaction_hospital_user_review_td(
    `hospital_id` STRING COMMENT '医院ID',
    `hospital_name` STRING COMMENT '医院名称',
    `user_id` STRING COMMENT '用户ID',
    `username` STRING COMMENT '用户姓名',
    `first_review_dt` STRING COMMENT '首次评价日期'
) COMMENT '互动域医院用户粒度用户评价历史至今汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_interaction_hospital_user_review_td'
    TBLPROPERTIES ('orc.compress' = 'snappy');

3.互动域医院粒度用户评价历史至今汇总表

建表语句

CREATE TABLE IF NOT EXISTS dws_interaction_hospital_review_td(
    `hospital_id` STRING COMMENT '医院ID',
    `hospital_name` STRING COMMENT '医院名称',
    `review_count` BIGINT COMMENT '评价次数',
    `good_review_count` BIGINT COMMENT '好评次数'
) COMMENT '互动域医院粒度用户评价历史至今汇总表'
    PARTITIONED BY (`dt` STRING)
    STORED AS ORC
    LOCATION '/warehouse/medical/dws/dws_interaction_hospital_review_td'
    TBLPROPERTIES ('orc.compress' = 'snappy');

4.首日数据装载

vim ~/bin/medical_dws_1d_to_dws_td_init.sh

#!/bin/bash

APP=medical

if [ -n $2 ]
then 
    do_date=$2
else
    echo "请传入日期参数!!!"
    exit
fi

dws_trade_doctor_consultation_td="
insert overwrite table ${APP}.dws_trade_doctor_consultation_td
    partition (dt = '$do_date')
select doctor_id,
       doctor_name,
       min(dt) first_consultation_dt
from ${APP}.dws_trade_doctor_consultation_1d
group by doctor_id,
         doctor_name;
"

dws_interaction_hospital_user_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_user_review_td
    partition (dt = '$do_date')
select hospital_id,
       name hospital_name,
       user_id,
       username,
       first_review_dt
from (select hospital_id,
             user_id,
             min(review.dt) first_review_dt
      from (select doctor_id,
                   user_id,
                   dt
            from ${APP}.dwd_interaction_review_inc) review
               left join (select id,
                                 hospital_id
                          from ${APP}.dim_doctor_full
                          where dt = '$do_date') doc
                         on review.doctor_id = doc.id
      group by hospital_id,
               user_id) avg
         left join (select id,
                           name
                    from ${APP}.dim_hospital_full
                    where dt = '$do_date') hos
                   on avg.hospital_id = hos.id
         left join (select id,
                           username
                    from ${APP}.dim_user_full
                    where dt = '$do_date') \`user\`
                   on avg.user_id = \`user\`.id;
"

dws_interaction_hospital_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_review_td
    partition (dt = '$do_date')
select hospital_id,
       name hospital_name,
       review_count,
       good_review_count
from (select hospital_id,
             count(*)                  review_count,
             sum(if(rating = 5, 1, 0)) good_review_count
      from (select doctor_id,
                   rating
            from ${APP}.dwd_interaction_review_inc) review
               left join
           (select id,
                   hospital_id
            from ${APP}.dim_doctor_full
            where dt = '$do_date') doc
           on review.doctor_id = doc.id
      group by hospital_id) avg
         left join (select id,
                           name
                    from ${APP}.dim_hospital_full
                    where dt = '$do_date') hos
                   on hospital_id = hos.id;
"

case $1 in
    dws_trade_doctor_consultation_td | dws_interaction_hospital_user_review_td | dws_interaction_hospital_review_td)
    hive -e "${!1}"
    ;;
    "all")
    hive -e "$dws_trade_doctor_consultation_td$dws_interaction_hospital_user_review_td$dws_interaction_hospital_review_td"
    ;;
    "*")
    echo "非法参数!!!"
    ;;
esac

添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_td_init.sh
数据装载
medical_dws_1d_to_dws_td_init.sh all 2023-05-09

5.每日数据装载

vim ~/bin/medical_dws_1d_to_dws_td.sh

#!/bin/bash

APP=medical

if [ -n $2 ]
then 
    do_date=$2
else
    echo "请传入时间参数!!!"
    exit
fi

dws_trade_doctor_consultation_td="
insert overwrite table ${APP}.dws_trade_doctor_consultation_td
    partition (dt = '$do_date')
select nvl(old.doctor_id, new.doctor_id)                              doctor_id,
       nvl(old.doctor_name, new.doctor_name)                          doctor_name,
       if(old.doctor_id is null, '$do_date', first_consultation_dt) first_consultation_dt
from (select doctor_id,
             doctor_name,
             first_consultation_dt
      from ${APP}.dws_trade_doctor_consultation_td
      where dt = date_add('$do_date', -1)) old
         full outer join
     (select doctor_id,
             doctor_name
      from ${APP}.dws_trade_doctor_consultation_1d
      where dt = '$do_date') new
     on old.doctor_id = new.doctor_id
         and old.doctor_name = new.doctor_name;
"

dws_interaction_hospital_user_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_user_review_td
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       user_id,
       username,
       min(first_review_dt) first_review_dt
from (select hospital_id,
             hospital_name,
             user_id,
             username,
             first_review_dt
      from ${APP}.dws_interaction_hospital_user_review_td
      where dt = date_add('$do_date', -1)
      union
      select hospital_id,
             name hospital_name,
             user_id,
             username,
             first_reveiw_dt
      from (select hospital_id,
                   user_id,
                   '$do_date' first_reveiw_dt
            from (select doctor_id,
                         user_id
                  from ${APP}.dwd_interaction_review_inc
                  where dt = '$do_date') reivew
                     left join (select id,
                                       hospital_id
                                from ${APP}.dim_doctor_full) doc
                               on reivew.doctor_id = doc.id
            group by user_id,
                     hospital_id) avg
               left join (select id,
                                 name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on avg.hospital_id = hos.id
               left join (select id,
                                 username
                          from ${APP}.dim_user_full
                          where dt = '$do_date') \`user\`
                         on avg.user_id = \`user\`.id) \`all\`
group by hospital_id,
         hospital_name,
         user_id,
         username;
"

dws_interaction_hospital_review_td="
insert overwrite table ${APP}.dws_interaction_hospital_review_td
    partition (dt = '$do_date')
select hospital_id,
       hospital_name,
       sum(review_count)      review_count,
       sum(good_review_count) good_review_count
from (select hospital_id,
             hospital_name,
             review_count,
             good_review_count
      from ${APP}.dws_interaction_hospital_review_td
      where dt = date_add('$do_date', -1)
      union
      select hospital_id,
             name hospital_name,
             review_count,
             good_review_count
      from (select hospital_id,
                   count(*)                  review_count,
                   sum(if(rating = 5, 1, 0)) good_review_count
            from (select doctor_id,
                         rating
                  from ${APP}.dwd_interaction_review_inc
                  where dt = '$do_date') review
                     left join (select id,
                                       hospital_id
                                from ${APP}.dim_doctor_full
                                where dt = '$do_date') doc
            group by hospital_id) avg
               left join (select id,
                                 name
                          from ${APP}.dim_hospital_full
                          where dt = '$do_date') hos
                         on hospital_id = hos.id) \`all\`
group by hospital_id,
         hospital_name;
"

case $1 in
    dws_trade_doctor_consultation_td | dws_interaction_hospital_user_review_td | dws_interaction_hospital_review_td)
    hive -e "${!1}"
    ;;
    "all")
    hive -e "$dws_trade_doctor_consultation_td$dws_interaction_hospital_user_review_td$dws_interaction_hospital_review_td"
    ;;
    "*")
    echo "非法参数!!!"
    ;;
esac

添加权限
chmod +x ~/bin/medical_dws_1d_to_dws_td.sh


总结

内容有点多,可能还要一次才能完成。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/101493.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

用正则清除标记符号

定义方法 clearHtml(str){return str.replace(/<[^>]>/g,) }

LeetCode 82 删除排序链表中的重复元素 II

LeetCode 82 删除排序链表中的重复元素 II 来源&#xff1a;力扣&#xff08;LeetCode&#xff09; 链接&#xff1a;https://leetcode.cn/problems/remove-duplicates-from-sorted-list-ii/description/ 博主Github&#xff1a;https://github.com/GDUT-Rp/LeetCode 题目&am…

Xubuntu16.04系统中解决无法识别exFAT格式的U盘

问题描述 将exFAT格式的U盘插入到Xubuntu16.04系统中&#xff0c;发现系统可以识别到此U盘&#xff0c;但是打不开&#xff0c;查询后发现需要安装exfat-utils库才行。 解决方案&#xff1a; 1.设备有网络的情况下 apt-get install exfat-utils直接安装exfat-utils库即可 2.设备…

AUTOSAR规范与ECU软件开发(实践篇)7.10MCAL模块配置方法及常用接口函数介绍之Base与Resource的配置

目录 1、前言 2 、Base与Resource模块 1、前言 本例程的硬件平台为MPC5744P开发板&#xff0c;主要配置MPC5744P的mcal的每个模块的配置&#xff0c;如要配置NXP的MCU之S32k324的例程请参考&#xff1a; 2 、Base与Resource模块 Base与Resource这两个模块与具体功能无关&…

搜索二维矩阵 II

题目链接 搜索二维矩阵 II 题目描述 注意点 矩阵具有以下特性&#xff1a; 每行的元素从左到右升序排列。 每列的元素从上到下升序排列。 解答思路 最初想到使用深度优先遍历剪枝实现&#xff0c;但是运行后超出时间限制了可以直接遍历整个矩阵查找&#xff0c;虽然不超时…

Standford Compiler Course Assignment 1

第一个作业是写一个词法分析的rule&#xff0c;词法分析对我帮助不大&#xff0c;主要是理解使用就可以&#xff0c;就大部分参照github上的实现了。 实验需要注意的内容&#xff1a; 1&#xff09;cool/include/PA2/cool-parse.h 里面定义了需要处理的关键字 /* Tokens. */ …

Java智慧工地源码 智慧工地APP源码

Java智慧工地源码 智慧工地APP源码 系统定义&#xff1a; 智慧工地信息化管理平台是依托计算机信息、网络通讯、物联网、系统集成及云计算技术&#xff0c;通过数据采集、信息动态交互、智能分析&#xff0c;建立起来的一套集成的项目建设综合管理系统。实现项目管理信息化、网…

用迅为RK3568开发板使用OpenCV处理图像颜色通道提取ROI

本小节代码在配套资料“iTOP-3568 开发板\03_【iTOP-RK3568 开发板】指南教程 \04_OpenCV 开发配套资料\07”目录下&#xff0c;如下图所示&#xff1a; 在计算机的色彩图像中存有三个通道&#xff0c;即 BGR 通道&#xff0c;根据三个颜色通道的亮度值来显示出不同的颜色&…

ThinkPHP 集成 jwt 技术 token 验证

ThinkPHP 集成 jwt 技术 token 验证 一、思路流程二、安装 firebase/php-jwt三、封装token类四、创建中间件&#xff0c;检验Token校验时效性五、配置路由中间件六、写几个测试方法&#xff0c;通过postman去验证 一、思路流程 客户端使用用户名和密码请求登录服务端收到请求&…

2.2 Vector<T> 动态数组(模板语法)

C数据结构与算法 目录 本文前驱课程 1 C自学精简教程 目录(必读) 2 动态数组 Vector&#xff08;难度1&#xff09; 其中&#xff0c;2 是 1 中的一个作业。2 中详细讲解了动态数组实现的基本原理。 本文目标 1 学会写基本的C类模板语法&#xff1b; 2 为以后熟练使用 S…

Unity中Shader的混合模式Blend

文章目录 前言一、混合的作用就是实现各种半透明效果二、混合操作三、在 Shader 中暴露两个属性 来调节 混合的效果 前言 Unity中Shader的混合模式Blend 一、混合的作用就是实现各种半透明效果 这里用PS里的混合作为例子 没选择混合效果前&#xff0c;显示的效果是这样 选择…

2 | Window 搭建单机 Hadoop 和Spark

搭建单机 Hadoop 和 Spark 环境可以学习和测试大数据处理的基础知识。在 Windows 操作系统上搭建这两个工具需要一些配置和设置,下面是一个详细的教程: 注意: 在开始之前,请确保你已经安装了 Java 开发工具包(JDK),并且已经下载了 Hadoop 和 Spark 的最新版本。你可以从…

GitLab启动失败:fail: alertmanager: runsv not running

问题描述 sudo gitlab-ctl restart &#xff0c;报错如下 &#xff1a; summergaoubuntu:/etc/gitlab$ sudo gitlab-ctl start fail: alertmanager: runsv not running fail: gitaly: runsv not running fail: gitlab-exporter: runsv not running fail: gitlab-workhorse: run…

一句话画出动漫效果

链接&#xff1a; AI Comic Factory - a Hugging Face Space by jbilcke-hfDiscover amazing ML apps made by the communityhttps://huggingface.co/spaces/jbilcke-hf/ai-comic-factory 选择类型&#xff1a; Japanese 输入提示词&#xff1a; beauty and school love st…

WebSocket(一)

一.什么是WebSocket 【1】WebSocket是一种协议&#xff0c;设计用于提供低延迟&#xff0c;全双工和长期运行的连接。 全双工&#xff1a;通信的两个参与方可以同时发送和接收数据&#xff0c;不需要等待对方的响应或传输完成。 【2】比较 传统通信&#xff08;http协议&am…

【Linux】文件

Linux 文件 什么叫文件C语言视角下文件的操作文件的打开与关闭文件的写操作文件的读操作 & cat命令模拟实现 文件操作的系统接口open & closewriteread 文件描述符进程与文件的关系重定向问题Linux下一切皆文件的认识文件缓冲区缓冲区的刷新策略 stuout & stderr 什…

【小沐学Unity3d】3ds Max 骨骼动画制作(CAT、Character Studio、Biped、骨骼对象)

文章目录 1、简介2、 CAT2.1 加载 CATRig 预设库2.2 从头开始创建 CATRig 3、character studio3.1 基本描述3.2 Biped3.3 Physique 4、骨骼系统4.1 创建方法4.2 简单示例 结语 1、简介 官网地址&#xff1a; https://help.autodesk.com/view/3DSMAX/2018/CHS https://help.aut…

11.物联网lwip,网卡原理

一。LWIP协议栈内存管理 1.LWIP内存管理方案 &#xff08;1&#xff09;堆heap 1.灰色为已使用内存 2.黑色为未使用内存 3.紫色为使用后内存 按照某种算法&#xff0c;把数据放在内存块中 &#xff08;2&#xff09;池pool 设置内存池&#xff0c;设置成大小相同的内存块。 2…

element-plus指定el-date-picker的弹出框位置

此处记录一下,通过popper-options指定popper出现的位置

【051】基于Vue、Springboot电商管理系统(含源码、详细论文、数据库)

基于Vue、Springboot、Mysql的前后端分离的电商管理系统&#xff0c;不仅功能完善&#xff0c;还有详细课设报告供查看&#xff0c;这不收藏起来&#xff0c;源码和论文获取见文末结尾 部分报告内容如下&#xff08;省略图片&#xff09; c 目录 1 引言 4 1.…