From ce2d1bfdbc61d2f4c4257cac8f70800231877c7d Mon Sep 17 00:00:00 2001 From: "zhuchenwu@chenwuzhu.cn" Date: Wed, 13 May 2026 07:09:39 +0000 Subject: [PATCH] 20260513_dingban --- CHPA/01 dwd_update.sql | 111 ++++++++++++++++++ EC/03 ec_load_data.ipynb | 13 +- UNIONALL/DM_TF_EXT_UNIONALL_SALES_MAPPING.sql | 5 +- 3 files changed, 119 insertions(+), 10 deletions(-) diff --git a/CHPA/01 dwd_update.sql b/CHPA/01 dwd_update.sql index 756c7fa..97c4ae1 100644 --- a/CHPA/01 dwd_update.sql +++ b/CHPA/01 dwd_update.sql @@ -89,6 +89,117 @@ SET PACK_COD = if( PACK_COD REGEXP '^[0-9]',right(concat('000000000000',PACK_COD -- COMMAND ---------- +INSERT OVERWRITE TABLE dwd.DWD_gnd_ext_retail_tblmarket ( + market_no, + market, + bu, + atc1_code, + atc2_code, + atc3_code, + atc4_code, + nfc1_code, + nfc2_code, + nfc3_code, + pack_code, + pack_desc, + strength, + product_code, + product_desc, + molecule_code, + molecule_desc, + not_in_flag, + extend_market, + extend_market_ratio, + corporation_code, + corporation_desc, + manufacturer_code, + manufacturer_desc +) + select distinct + market_no, + market, + bu, + atc1_code, + atc2_code, + atc3_code, + atc4_code, + nfc1_code, + nfc2_code, + nfc3_code, + pack_code, + pack_desc, + strength, + product_code, + product_desc, + molecule_code, + molecule_desc, + not_in_flag, + extend_market, + extend_market_ratio, + corporation_code, + corporation_desc, + manufacturer_code, + manufacturer_desc + from + dwd.dwd_gnd_retail_tblmarket_bymonth; + + +INSERT OVERWRITE TABLE DWD.dwd_gnd_dtp_tblmarket ( + market_no, + market, + bu, + atc1_code, + atc2_code, + atc3_code, + atc4_code, + nfc1_code, + nfc2_code, + nfc3_code, + pack_code, + pack_desc, + strength, + product_code, + product_desc, + molecule_code, + molecule_desc, + not_in_flag, + extend_market, + extend_market_ratio, + corporation_code, + corporation_desc, + manufacturer_code, + manufacturer_desc +) + select distinct + market_no, + market, + bu, + atc1_code, + atc2_code, + atc3_code, + atc4_code, + nfc1_code, + nfc2_code, + nfc3_code, + pack_code, + pack_desc, + strength, + product_code, + product_desc, + molecule_code, + molecule_desc, + not_in_flag, + extend_market, + extend_market_ratio, + corporation_code, + corporation_desc, + manufacturer_code, + manufacturer_desc + from + dwd.dwd_gnd_dtp_tblmarket_bymonth; + +-- COMMAND ---------- + update DWD.dwd_gnd_tblmarket_bymonth set starttime = '200001' where starttime is null or starttime='' or starttime='All'; diff --git a/EC/03 ec_load_data.ipynb b/EC/03 ec_load_data.ipynb index bb9aa71..9ce790a 100644 --- a/EC/03 ec_load_data.ipynb +++ b/EC/03 ec_load_data.ipynb @@ -477,12 +477,12 @@ "byteLimit": 2048000, "rowLimit": 10000 }, - "finishTime": 1778478993866, + "finishTime": 1778655803909, "inputWidgets": {}, "nuid": "85453796-9385-4a5a-bf20-6bfd459580ae", "showTitle": false, - "startTime": 1778478991550, - "submitTime": 1778478972052, + "startTime": 1778655745740, + "submitTime": 1778655744617, "tableResultSettingsMap": {}, "title": "" } @@ -494,7 +494,7 @@ "select\n", "iqvia_lineno,iqvia_pack_code,prod_cod,iqvia_notes,new_pack_flag,is_exists_chpa,product_id,prescription_nature,medicine_type,zk_medicine_tier1,zk_medicine_tier2,zk_medicine_tier3,zk_medicine_tier4,common_name,dosage_form,user_type,category_name,product_name,brand_name,zk_manu_des,zk_corp_des,zk_pack_des,counting_unit_a,dosage_unit_a,unit_a,app1_cod,app1_des,app1_des_c,app2_cod,app2_des,app2_des_c,app3_cod,app3_des,app3_des_c,atc1_cod,atc1_des,atc1_des_c,atc2_cod,atc2_des,atc2_des_c,atc3_cod,atc3_des,atc3_des_c,atc4_cod,atc4_des,atc4_des_c,bio_desc,cmps_cod,cmps_des,cmps_des_c,corp_cod,corp_des,corp_des_c,edl_desc,eth_otc_desc,gene_orig_desc,gqce_desc,manu_cod,manu_des,manu_des_c,mnfl_cod,mnfl_des,nrdl_desc,pack_des,stgh_des,pack_lch,paed_desc,prod_des,prod_des_c,tcm_desc,vbp_desc,unit,counting_unit,dosage_unit,NRDL_ENTRY_DATE,t2.Market,t2.bu,nvl(t2.extend_market_ratio,1) as extend_market_ratio,is_az\n", "from tmp.tmp_ec_temp_market t1\n", - "left join (select Market,BU,Extend_Market,Extend_Market_Ratio from dwd.dwd_gnd_ec_retail_tblmarket_rule where Extend_Market is not null )t2\n", + "left join (select Market,BU,Extend_Market,MAX(Extend_Market_Ratio) from DWD.dwd_gnd_ec_tblmarket_bymonth where Extend_Market is not null group by 1,2)t2\n", "on t1.Market = t2.Extend_Market\n", "where t2.Market is not null" ] @@ -2336,10 +2336,7 @@ "cell_type": "markdown", "metadata": { "application/vnd.databricks.v1+cell": { - "cellMetadata": { - "byteLimit": 2048000, - "rowLimit": 10000 - }, + "cellMetadata": {}, "inputWidgets": {}, "nuid": "dc2bbed1-223b-4610-a55f-334e63050e68", "showTitle": false, diff --git a/UNIONALL/DM_TF_EXT_UNIONALL_SALES_MAPPING.sql b/UNIONALL/DM_TF_EXT_UNIONALL_SALES_MAPPING.sql index f06612b..d9ff07b 100644 --- a/UNIONALL/DM_TF_EXT_UNIONALL_SALES_MAPPING.sql +++ b/UNIONALL/DM_TF_EXT_UNIONALL_SALES_MAPPING.sql @@ -478,7 +478,8 @@ FROM -- COMMAND ---------- --- delete from dm.DM_TF_EXT_UNIONALL_SALES_MAPPING where DATA_SOURCE IN ( 'AIA(Monthly)')--'Retail(Quarterly)','EC(Monthly)' +-- DBTITLE 1,测试代码 +-- delete from dm.DM_TF_EXT_UNIONALL_SALES_MAPPING where DATA_SOURCE IN ( 'CHC(Quarterly)','THC(Quarterly)','Retail(Quarterly)')--'Retail(Quarterly)','EC(Monthly)' -- COMMAND ---------- @@ -536,5 +537,5 @@ SELECT FROM DM_TF_EXT_UNIONALL_SALES_MAPPING --- WHERE DATA_SOURCE IN ( 'AIA(Monthly)')--'', +-- WHERE DATA_SOURCE IN ( 'CHC(Quarterly)','THC(Quarterly)','Retail(Quarterly)')--'', -- AND yyyymm>=202501