Commit 5fefeae5 authored by 张彦钊's avatar 张彦钊

add

parent b654ec10
...@@ -93,12 +93,10 @@ def hospital(): ...@@ -93,12 +93,10 @@ def hospital():
sql = "select api.id," \ sql = "select api.id," \
"h.hospital_id,h.hospital_exposure_pv_30,h.service_exposure_pv_30,h.expert_exposure_pv_30," \ "h.hospital_id,h.hospital_exposure_pv_30,h.service_exposure_pv_30,h.expert_exposure_pv_30," \
"h.service_ctr_30,h.hospital_ctr_30,h.expert_ctr_30," \ "h.service_ctr_30,h.hospital_ctr_30,h.expert_ctr_30," \
"b.merchant_id,budan.budan_payment_30_days " \ "b.merchant_id " \
"from api_doctor api left join statistic_hospital_rank_factor h on api.hospital_id = h.hospital_id " \ "from api_doctor api left join statistic_hospital_rank_factor h on api.hospital_id = h.hospital_id " \
"left join hippo_merchantrelevance b on api.id = b.doctor_id " \ "left join hippo_merchantrelevance b on api.id = b.doctor_id " \
"left join al_meigou_service_smart_rank_budan_payment budan on b.merchant_id = budan.merchant_id " \ "where api.doctor_type = 1 and h.date = '{}';".format(date_str)
"where api.doctor_type = 1 and h.date = '{}' " \
"and budan.stat_date = '{}';".format(date_str, date_tmp)
db = pymysql.connect(host='172.16.30.143', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing') db = pymysql.connect(host='172.16.30.143', port=3306, user='work', passwd='BJQaT9VzDcuPBqkd', db='zhengxing')
cursor = db.cursor() cursor = db.cursor()
...@@ -106,8 +104,7 @@ def hospital(): ...@@ -106,8 +104,7 @@ def hospital():
result = cursor.fetchall() result = cursor.fetchall()
df = pd.DataFrame(list(result)) df = pd.DataFrame(list(result))
name = ["doctor_id","hospital_id","hospital_exposure_pv_30","service_exposure_pv_30", name = ["doctor_id","hospital_id","hospital_exposure_pv_30","service_exposure_pv_30",
"expert_exposure_pv_30","service_ctr_30","hospital_ctr_30","expert_ctr_30","merchant_id", "expert_exposure_pv_30","service_ctr_30","hospital_ctr_30","expert_ctr_30","merchant_id"]
"budan_payment_30_days"]
df = df.rename(columns=dict(zip(list(range(len(name))), name))) df = df.rename(columns=dict(zip(list(range(len(name))), name)))
...@@ -130,7 +127,7 @@ def hospital(): ...@@ -130,7 +127,7 @@ def hospital():
df = pd.merge(df, tmp, on='merchant_id') df = pd.merge(df, tmp, on='merchant_id')
for i in ["hospital_exposure_pv_30","service_exposure_pv_30","expert_exposure_pv_30", for i in ["hospital_exposure_pv_30","service_exposure_pv_30","expert_exposure_pv_30",
"service_ctr_30","hospital_ctr_30","expert_ctr_30","budan_payment_30_days", "service_ctr_30","hospital_ctr_30","expert_ctr_30",
"doctor_discount_30_days","service_pv_30","mexpert_pv_30","organization_pv_30", "doctor_discount_30_days","service_pv_30","mexpert_pv_30","organization_pv_30",
"expand_rechange_amount_30"]: "expand_rechange_amount_30"]:
df[i] = df[i].astype("float") df[i] = df[i].astype("float")
...@@ -163,7 +160,7 @@ def hospital(): ...@@ -163,7 +160,7 @@ def hospital():
columns = ["doctor_id","score","ctr","commission","cpt","hospital_id","hospital_exposure_pv_30", columns = ["doctor_id","score","ctr","commission","cpt","hospital_id","hospital_exposure_pv_30",
"service_exposure_pv_30","expert_exposure_pv_30", "service_exposure_pv_30","expert_exposure_pv_30",
"service_ctr_30","hospital_ctr_30","expert_ctr_30","merchant_id","budan_payment_30_days", "service_ctr_30","hospital_ctr_30","expert_ctr_30","merchant_id",
"doctor_discount_30_days","service_pv_30","mexpert_pv_30","organization_pv_30", "doctor_discount_30_days","service_pv_30","mexpert_pv_30","organization_pv_30",
"expand_rechange_amount_30"] "expand_rechange_amount_30"]
data = df.loc[:, columns] data = df.loc[:, columns]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment