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

news2025/1/24 14:31:28

系列文章目录

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


文章目录

  • 系列文章目录
  • 前言
  • 一、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


总结

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

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

身份识别与鉴权技术调研方案

对称加密算法 对称加密方式又称为私钥加密方式&#xff0c;该方式的加密和解密过程使用同一个密钥&#xff0c;因此该密钥又称为共享密钥。如图2.2所示&#xff0c;在对称加密方式中&#xff0c;发送方使用对称加密算法和共享密钥处理原始数据&#xff0c;得到一个加密后的密文…

vulnhub渗透测试靶场练习2

靶场介绍 靶场名&#xff1a;easy_cloudantivirus 靶场地址&#xff1a;https://www.vulnhub.com/entry/boredhackerblog-cloud-av,453 环境搭建 依旧使用VM VirtualBox搭建靶场&#xff0c;攻击机使用的是VMware中的kali&#xff0c;需要将VMware虚拟机kali和virtualbox靶机…

Web服务器部署上线踩坑流程回顾

5月份时曾部署上线了C的Web服务器&#xff0c;温故而知新&#xff0c;本篇文章梳理总结一下部署流程知识&#xff1b; 最初的解决方案&#xff1a;https://blog.csdn.net/BinBinCome/article/details/129750951?spm1001.2014.3001.5501后来的解决方案&#xff1a;https://blog…

Mysql数据库(3)—架构和日志

Mysql的架构设计 Mysql分为Server层和存储引擎层&#xff1a; Server层 主要包括连接器、查询缓存、分析器、优化器、执行器等&#xff0c;涵盖 MySQL 的大多数核心服务功能&#xff0c;以及所有的内置函数&#xff08;如日期、时间、数学和加密函数等&#xff09;&#xff…

Android逆向学习(一)vscode进行android逆向修改并重新打包

Android逆向学习&#xff08;一&#xff09;vscode进行android逆向修改并重新打包 写在前面 其实我不知道这个文章能不能写下去&#xff0c;其实我已经开了很多坑但是都没填上&#xff0c;现在专利也发出去了&#xff0c;就开始填坑了&#xff0c;本坑的主要内容是关于androi…

回归拟合 | 灰狼算法优化核极限学习机(GWO-KELM)MATLAB实现

这周有粉丝私信想让我出一期GWO-KELM的文章&#xff0c;因此乘着今天休息就更新了(希望不算晚) 作者在前面的文章中介绍了ELM和KELM的原理及其实现&#xff0c;ELM具有训练速度快、复杂度低、克服了传统梯度算法的局部极小、过拟合和学习率的选择不合适等优点&#xff0c;而KEL…

OpenCV(十):图像缩放、翻转、拼接的介绍与使用

目录 &#xff08;1&#xff09;图像缩放&#xff1a;resize() &#xff08;2&#xff09;图像翻转&#xff1a; flip() &#xff08;3&#xff09;图像拼接&#xff1a;hconcat() 和vconcat() &#xff08;1&#xff09;图像缩放&#xff1a;resize() 使用 cv2.resize() 函…

React笔记(三)类组件(1)

一、组件的概念 使用组件方式进行编程&#xff0c;可以提高开发效率&#xff0c;提高组件的复用性、提高代码的可维护性和可扩展性 React定义组件的方式有两种 类组件&#xff1a;React16.8版本之前几乎React使用都是类组件 函数组件:React16.8之后&#xff0c;函数式组件使…

北京APP外包开发团队人员构成

下面是一个标准的APP开发团队构成&#xff0c;但具体的人员规模和角色可能会根据项目的规模和需求进行调整。例如&#xff0c;一些小型项目或初创公司可能将一些角色合并&#xff0c;或者聘请外包团队来完成部分工作。北京木奇移动技术有限公司&#xff0c;专业的软件外包开发公…

使用rabbitmq进行支付之后的消息通知

订单服务完成支付后将支付结果发给每一个与订单服务对接的微服务&#xff0c;订单服务将消息发给交换机&#xff0c;由交换机广播消息&#xff0c;每个订阅消息的微服务都可以接收到支付结果. 微服务收到支付结果根据订单的类型去更新自己的业务数据。 相关技术方案 使用消息…

【LeetCode】85.最大矩形

题目 给定一个仅包含 0 和 1 、大小为 rows x cols 的二维二进制矩阵&#xff0c;找出只包含 1 的最大矩形&#xff0c;并返回其面积。 示例 1&#xff1a; 输入&#xff1a;matrix [["1","0","1","0","0"],["1&quo…

11. 微积分 - 偏导数方向导数

文章目录 偏导数方向导数方向余弦投影继续讲方向导数Hi, 大家好。我是茶桁。 我们上节课学习了链式法则,本节课,我们要学习「偏导数」和「方向导数」。 偏导数 偏导数在导论课里面也提到过。偏导数针对多元函数去讲的。 多元函数是什么,我们拿个例子来看: 多元函数: y…

springboot配置ym管理各种日记(log)

1&#xff1a;yml配置mybatis_plus默认日记框架 mybatis-plus:#这个作用是扫描xml文件生效可以和mapper接口文件使用&#xff0c;#如果不加这个,就无法使用xml里面的sql语句#启动类加了MapperScan是扫描指定包下mapper接口生效&#xff0c;如果不用MapperScan可以在每一个mapp…

2023.9.2 关于 JVM 垃圾回收机制(GC)

目录 为什么要有垃圾回收机制? STW&#xff08;Stop The World&#xff09;问题 垃圾回收机制主要回收哪个内存区域? 垃圾对象判断算法 引用计数算法 可达性分析算法 垃圾对象回收算法 标记清除算法 复制算法 标记整理算法 分代算法 为什么要有垃圾回收机制? 自动…

thinkphp中使用Elasticsearch 7.0进行多表的搜索

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、thinkphp中使用Elasticsearch 7.0进行多表的搜索二、使用步骤1.引入库2.读入数据 总结 前言 提示&#xff1a;thinkphp中使用Elasticsearch 7.0进行多表的…

stable diffusion实践操作-批次出图

系列文章目录 stable diffusion实践操作 文章目录 系列文章目录前言一、批次出图介绍1.1 webUI设置1.2 参数介绍 二、批次出图使用2.1 如何设置2.1 效果展示 总结 前言 本章主要介绍SD批次出图。 想要一次产生多张图片的时候使用。 一、批次出图介绍 1.1 webUI设置 1.2 参数…

[管理与领导-65]:IT基层管理者 - 辅助技能 - 4- 乌卡时代(VUCA )

前言&#xff1a; 大多数IT人&#xff0c;很勤奋&#xff0c;但都没有职业规划&#xff0c;被工作驱动着前行&#xff0c;然而&#xff0c;作为管理者&#xff0c;你就不能没有职业规划思维&#xff0c;因为你代表一个团队&#xff0c;你的思维决定了一个团队的思维。本文探讨…

2023-9-2 染色法判定二分图

题目链接&#xff1a;染色法判定二分图 #include <iostream> #include <cstring> #include <algorithm>using namespace std;const int N 100010l, M 200010;int n, m; int h[N], e[M], ne[M], idx;int color[N];void add(int a, int b) {e[idx] b, ne[id…

CSS中border-radius的来美化table的实战方案

border-radius是一种CSS属性&#xff0c;用于设置元素的边框的圆角程度。其具体的用法如下&#xff1a; 设置一个值&#xff1a;可以为元素设置一个单一的圆角半径&#xff0c;这个半径将应用于元素的四个角。例如&#xff1a; div {border-radius: 10px; }设置四个值&#x…

vue Cesium接入在线地图

Cesium接入在线地图只需在创建时将imageryProvider属性换为在线地图的地址即可。 目录 天地图 OSM地图 ArcGIS 地图 谷歌影像地图 天地图 //矢量服务let imageryProvider new Cesium.WebMapTileServiceImageryProvider({url: "http://t0.tianditu.com/vec_w/wmts?s…