def kpi(cntxt, data, param):
def _achi(k, v):
k = float(k)
v = float(v)
if v == 0:
return 0
else:
return k / v
def achieving_rate(ar):
if ar < 0.8:
return 0
elif 0.8 <= ar < 1:
return 0.6 + (ar - 0.8) * 2
elif 1 <= ar < 1.2:
return 1 + (ar - 1) * 1
elif ar >= 1.2:
return 1.2
# 汇总KPI不合格人员名单
kpi_unqualified = {}
for c in data["Compliance-KPI-汇总表"]:
post = c["HR编码"]
if post not in kpi_unqualified:
kpi_unqualified[post] = {
"产品组": c["产品组"],
"9大类别": c["9大类别"],
"备注": c["备注"],
"HR编码": c["HR编码"],
"HR姓名": c["HR姓名"]
}
# 汇总2020KPI基数+奖金封顶值
ceiling_bonuses_kpi = {}
for b in data["KPI基数和奖金封顶值"]:
bouns = b["员工编号"]
ceiling_bonuses_kpi[bouns] = {
"员工编号": b["员工编号"],
"员工姓名": b["员工姓名"],
"职务(中文)": b["职务(中文)"],
"负责产品": b["负责产品"],
"奖金封顶值": b["2020 Q3 Sales Incentive保留两位小数"],
"行为合规奖金基数": b["2020 Q3 Compliance Bonus保留两位小数"]
}
dai_entry = {}
# 在岗员工异动/假期天数
entry = {}
# 汇总工作日历信息
working_calendar = {}
for w in data["工作日历"]:
wc = w["日期"]
if wc not in working_calendar:
working_calendar[wc] = {
"日期": w["日期"],
"是否工作日": w["是否工作日"],
"星期": w["星期"],
"工作时间-正": w["工作时间-正"],
"工作时间-反": w["工作时间-反"]
}
# 汇总休假信息产假
maternity_leave = {}
for m in data["休假信息产假"]:
# if m["First Day"] in working_calendar or m["Estimated Last Day"] in working_calendar or m["Actual Last Day"] in working_calendar:
p = m["Employee ID"]
if p not in maternity_leave:
maternity_leave[p] = {
"HR编码": m["Employee ID"],
"姓名": m["CF_Chinese Full Name_CN"],
"休假类型(含家庭假期)": m["Leave Type (Including Family)"],
"最后一天工作时间": m["Last Day of Work"],
"第一天假期时间": m["First Day"],
"估计最后一天假期时间": m["Estimated Last Day"],
"真正最后一天假期时间": m["Actual Last Day"],
"Q3休假天数": m["Q3休假天数"],
"休假天数": m["Total Days"],
"备注": m["备注"]
}
for m in maternity_leave:
if m not in entry:
entry[m] = {
"HR编码": maternity_leave[m]["HR编码"],
"休假工作日总天数": float(maternity_leave[m]["Q3休假天数"])
}
# 汇总休假信息不含产假(病假)
holiday = {}
for l in data["休假信息不含产假"]:
if l["Time Off Date"] in working_calendar:
d = l["Employee ID"]
if d not in holiday:
holiday[d] = {
"HR编码": l["Employee ID"],
"姓名": l["CF_Chinese Full Name_CN"],
"休假类型": l["Type"],
"休假日期": l["Time Off Date"],
"休假工作日总天数": 0
}
if float(l["Approved"]) < 12:
holiday[d]["休假工作日总天数"] = 0
else:
holiday[d]["休假工作日总天数"] = l["Approved"]
for h in holiday:
if h not in entry:
entry[h] = {
"HR编码": holiday[h]["HR编码"],
"休假工作日总天数": float(holiday[h]["休假工作日总天数"])
}
else:
entry[h] = {
"HR编码": holiday[h]["HR编码"],
"休假工作日总天数": float(entry[h]["休假工作日总天数"]) + float(holiday[h]["休假工作日总天数"])
}
# 汇总人员信息入离职
dimission = {}
for i in data["人岗关系"]:
if i["入职日期"] in working_calendar or i["离职日期"] in working_calendar:
r = i["员工编号"]
if r not in dimission:
dimission[r] = {
"HR编码": i["员工编号"],
"员工姓名": i["员工姓名"],
"入职日期": i["入职日期"],
"离职日期": i["离职日期"],
"入岗时间是否是工作日": "1",
"离岗时间是否是工作日": "1",
"入岗工作时间-正": 1,
"离岗工作时间-正": 1,
"休假工作日总天数": 0
}
if i["入职日期"] in working_calendar and i["离职日期"] in working_calendar:
dimission[r]["入岗工作时间-正"] = working_calendar[i["入职日期"]]["工作时间-正"]
dimission[r]["离岗工作时间-正"] = working_calendar[i["离职日期"]]["工作时间-反"]
dimission[r]["入岗时间是否是工作日"] = working_calendar[i["入职日期"]]["是否工作日"]
dimission[r]["离岗时间是否是工作日"] = working_calendar[i["离职日期"]]["是否工作日"]
if i["入职日期"] in working_calendar and i["离职日期"] not in working_calendar:
dimission[r]["入岗工作时间-正"] = working_calendar[i["入职日期"]]["工作时间-正"]
dimission[r]["入岗时间是否是工作日"] = working_calendar[i["入职日期"]]["是否工作日"]
if i["入职日期"] not in working_calendar and i["离职日期"] in working_calendar:
dimission[r]["离岗工作时间-正"] = working_calendar[i["离职日期"]]["工作时间-反"]
dimission[r]["离岗时间是否是工作日"] = working_calendar[i["离职日期"]]["是否工作日"]
if dimission[r]["入岗时间是否是工作日"] == "1" and dimission[r]["离岗时间是否是工作日"] == "1":
dimission[r]["休假工作日总天数"] = int(dimission[r]["入岗工作时间-正"]) + int(dimission[r]["离岗工作时间-正"]) - 2
if dimission[r]["入岗时间是否是工作日"] == "1" and dimission[r]["离岗时间是否是工作日"] == "0":
dimission[r]["休假工作日总天数"] = int(dimission[r]["入岗工作时间-正"]) + int(dimission[r]["离岗工作时间-正"]) - 1
if dimission[r]["入岗时间是否是工作日"] == "0" and dimission[r]["离岗时间是否是工作日"] == "1":
dimission[r]["休假工作日总天数"] = int(dimission[r]["入岗工作时间-正"]) + int(dimission[r]["离岗工作时间-正"]) - 1
if dimission[r]["入岗时间是否是工作日"] == "0" and dimission[r]["离岗时间是否是工作日"] == "0":
dimission[r]["休假工作日总天数"] = int(dimission[r]["入岗工作时间-正"]) + int(dimission[r]["离岗工作时间-正"])
# sdk.util.console_log(cntxt["task_id"], "info", dimission[r])
for n in dimission:
if n not in entry:
entry[n] = {
"HR编码": dimission[n]["HR编码"],
"休假工作日总天数": float(dimission[n]["休假工作日总天数"])
}
else:
entry[n] = {
"HR编码": dimission[n]["HR编码"],
"休假工作日总天数": float(entry[n]["休假工作日总天数"]) + float(dimission[n]["休假工作日总天数"])
}
# for n in dimission:
# if n not in entry:
# if dimission[n]["休假工作日总天数"] < 12:
# entry[n] = {
# "HR编码": dimission[n]["HR编码"],
# "休假工作日总天数": 0
# }
# else:
# # sdk.util.console_log(cntxt["task_id"], "info", dimission[n])
# entry[n] = {
# "HR编码": dimission[n]["HR编码"],
# "休假工作日总天数": float(dimission[n]["休假工作日总天数"])
# }
# else:
# # sdk.util.console_log(cntxt["task_id"], "info", entry[n])
# if dimission[n]["休假工作日总天数"] >= 12:
# entry[n] = {
# "HR编码": dimission[n]["HR编码"],
# "休假工作日总天数": float(entry[n]["休假工作日总天数"]) + float(dimission[n]["休假工作日总天数"])
# }
# else:
# entry[n] = {
# "HR编码": dimission[n]["HR编码"],
# "休假工作日总天数": 0
# }
# # sdk.util.console_log(cntxt["task_id"], "info", entry[n])
data["人岗关系"].rewind()
# 汇总人员信息
dimission1 = {}
for i in data["人岗关系"]:
r = i["员工编号"]
if r not in dimission1:
dimission1[r] = {
"HR编码": i["员工编号"],
"员工姓名": i["员工姓名"],
"入职日期": i["入职日期"],
"离职日期": i["离职日期"],
"部门": i["部门"],
"部门中文名称": i["部门中文名称"],
"区域": i["区域"],
"地区中文名称": i["地区中文名称"],
"职务": i["职务"],
"职务中文名称": i["职务中文名称"]
}
# 汇总代岗信息
generation = {}
for ge in data["代岗信息"]:
e = ge["岗位编码-代理岗位"]
if e not in generation:
generation[e] = {
"岗位编码-代理岗位": ge["岗位编码-代理岗位"],
"岗位编码-本岗位": ge["岗位编码-本岗位"],
"HR姓名": ge["HR姓名"],
"HR编码": ge["HR编码"],
"入岗时间": ge["开始时间-代岗"],
"离岗时间": ge["结束时间-代岗"],
"入岗时间是否是工作日": "1",
"离岗时间是否是工作日": "1",
"入岗工作时间-正": 1,
"离岗工作时间-正": 1,
"休假工作日总天数": 0
}
# sdk.util.console_log(cntxt["task_id"], "info", generation[e])
if ge["开始时间-代岗"] in working_calendar and ge["结束时间-代岗"] in working_calendar:
generation[e]["入岗工作时间-正"] = working_calendar[ge["开始时间-代岗"]]["工作时间-正"]
generation[e]["离岗工作时间-正"] = working_calendar[ge["结束时间-代岗"]]["工作时间-反"]
generation[e]["入岗时间是否是工作日"] = working_calendar[ge["开始时间-代岗"]]["是否工作日"]
generation[e]["离岗时间是否是工作日"] = working_calendar[ge["结束时间-代岗"]]["是否工作日"]
if ge["开始时间-代岗"] in working_calendar and ge["结束时间-代岗"] not in working_calendar:
generation[e]["入岗工作时间-正"] = working_calendar[ge["开始时间-代岗"]]["工作时间-正"]
generation[e]["入岗时间是否是工作日"] = working_calendar[ge["开始时间-代岗"]]["是否工作日"]
if ge["开始时间-代岗"] not in working_calendar and ge["结束时间-代岗"] in working_calendar:
generation[e]["离岗工作时间-正"] = working_calendar[ge["结束时间-代岗"]]["工作时间-反"]
generation[e]["离岗时间是否是工作日"] = working_calendar[ge["结束时间-代岗"]]["是否工作日"]
if generation[e]["入岗时间是否是工作日"] == "1" and generation[e]["离岗时间是否是工作日"] == "1":
generation[e]["休假工作日总天数"] = int(generation[e]["入岗工作时间-正"]) + int(generation[e]["离岗工作时间-正"]) - 2
if generation[e]["入岗时间是否是工作日"] == "1" and generation[e]["离岗时间是否是工作日"] == "0":
generation[e]["休假工作日总天数"] = int(generation[e]["入岗工作时间-正"]) + int(generation[e]["离岗工作时间-正"]) - 1
if generation[e]["入岗时间是否是工作日"] == "0" and generation[e]["离岗时间是否是工作日"] == "1":
generation[e]["休假工作日总天数"] = int(generation[e]["入岗工作时间-正"]) + int(generation[e]["离岗工作时间-正"]) - 1
if generation[e]["入岗时间是否是工作日"] == "0" and generation[e]["离岗时间是否是工作日"] == "0":
generation[e]["休假工作日总天数"] = int(generation[e]["入岗工作时间-正"]) + int(generation[e]["离岗工作时间-正"])
# sdk.util.console_log(cntxt["task_id"], "info", generation[e])
data["代岗信息"].rewind()
# 汇总代岗信息
generation_main = {}
for ge in data["代岗信息"]:
e = ge["HR编码"]
if e not in generation_main:
generation_main[e] = {
"岗位编码-代理岗位": ge["岗位编码-代理岗位"],
"岗位编码-本岗位": ge["岗位编码-本岗位"],
"HR姓名": ge["HR姓名"],
"HR编码": ge["HR编码"],
"入岗时间": ge["开始时间-代岗"],
"离岗时间": ge["结束时间-代岗"]
}
transaction = {}
for t in data["异动"]:
if t["Movement Effective Date"] in working_calendar:
ts = t["Employee ID"]
if ts not in transaction:
transaction[ts] = {
"员工编号": t["Employee ID"],
"员工姓名": t["CHN Name"],
"生效日期": t["Movement Effective Date"],
"入职日期": t["Hire Date"],
"异动情况": t["Change Content"],
"变动前": t["Previous"],
"变动后": t["New"],
"基础工作地点": t["Base Work Location"],
"地区": t["Region"],
"部门": t["Department"],
"经理姓名": t["Manager Full Name"],
"入岗时间是否是工作日": "1",
"离岗时间是否是工作日": "1",
"入岗工作时间-正": 1,
"离岗工作时间-正": 1,
"休假工作日总天数": 0
}
# sdk.util.console_log(cntxt["task_id"], "info", generation[e])
if t["Hire Date"] in working_calendar and t["Movement Effective Date"] in working_calendar:
transaction[ts]["入岗工作时间-正"] = working_calendar[t["Hire Date"]]["工作时间-正"]
transaction[ts]["离岗工作时间-正"] = working_calendar[t["Movement Effective Date"]]["工作时间-反"]
transaction[ts]["入岗时间是否是工作日"] = working_calendar[t["Hire Date"]]["是否工作日"]
transaction[ts]["离岗时间是否是工作日"] = working_calendar[t["Movement Effective Date"]]["是否工作日"]
if t["Hire Date"] in working_calendar and t["Movement Effective Date"] not in working_calendar:
transaction[ts]["入岗工作时间-正"] = working_calendar[t["Hire Date"]]["工作时间-正"]
transaction[ts]["入岗时间是否是工作日"] = working_calendar[t["Hire Date"]]["是否工作日"]
if t["Hire Date"] not in working_calendar and t["Movement Effective Date"] in working_calendar:
transaction[ts]["离岗工作时间-正"] = working_calendar[t["Movement Effective Date"]]["工作时间-反"]
transaction[ts]["离岗时间是否是工作日"] = working_calendar[t["Movement Effective Date"]]["是否工作日"]
if transaction[ts]["入岗时间是否是工作日"] == "1" and transaction[ts]["离岗时间是否是工作日"] == "1":
transaction[ts]["休假工作日总天数"] = int(transaction[ts]["入岗工作时间-正"]) + int(transaction[ts]["离岗工作时间-正"]) - 1
if transaction[ts]["入岗时间是否是工作日"] == "1" and transaction[ts]["离岗时间是否是工作日"] == "0":
transaction[ts]["休假工作日总天数"] = int(transaction[ts]["入岗工作时间-正"]) + int(transaction[ts]["离岗工作时间-正"])
if transaction[ts]["入岗时间是否是工作日"] == "0" and transaction[ts]["离岗时间是否是工作日"] == "1":
transaction[ts]["休假工作日总天数"] = int(transaction[ts]["入岗工作时间-正"]) + int(transaction[ts]["离岗工作时间-正"])
if transaction[ts]["入岗时间是否是工作日"] == "0" and transaction[ts]["离岗时间是否是工作日"] == "0":
transaction[ts]["休假工作日总天数"] = int(transaction[ts]["入岗工作时间-正"]) + int(transaction[ts]["离岗工作时间-正"]) + 1
# sdk.util.console_log(cntxt["task_id"], "info", transaction[ts])
business_architecture = {}
for b in data["2020Q3全产品商业架构"]:
jg = b["省区经理岗位编码"]
if jg not in business_architecture:
business_architecture[jg] = {
"省区经理负责省份":[]
}
if b["机构省份1"] not in business_architecture[jg]["省区经理负责省份"]:
business_architecture[jg]["省区经理负责省份"].append(b["机构省份1"])
# 汇总双倍扣减数据
deduction = {}
for i in data["双倍扣减数据商业"]:
group = i["省份"]
if group not in deduction:
deduction[group] = {
"销售额": 0
}
deduction[group]["销售额"] += float(i["销售额"])
# sdk.util.console_log(cntxt["task_id"], "info", deduction[group])
# 汇总商业销售指标数据(指标汇总,划分省份和产品)
business_sell = {}
for bs in data["商业销售数据"]:
if bs["记帐日期"] in ["2020-01", "2020-02", "2020-03", "2020-04", "2020-05", "2020-06"]:
continue
b = bs["省份"]
if b not in business_sell:
business_sell[b] = {
"销售日期": bs["销售日期"],
"省份": bs["省份"],
"省份代码": bs["省份代码"],
"产品": bs["产品"],
"销售类型": bs["销售类型"],
"销量归属城市经理商业ID": bs["销量归属城市经理商业ID"],
"销量归属城市经理商业名称": bs["销量归属城市经理商业名称"],
"城市": bs["城市"],
"城市经理岗位": bs["城市经理岗位"],
"城市经理": bs["城市经理"],
"省区经理岗位": bs["省区经理岗位"],
"省区经理": bs["省区经理"],
"大区经理": bs["大区经理"],
"季度商业销售金额": 0
}
business_sell[b]["季度商业销售金额"] += float(bs["销售额"])
# 加上双倍扣减数据
for u in business_sell:
if deduction.get(u, ""):
business_sell[u]['季度商业销售金额'] += deduction[u]["销售额"]
business_index = {}
for bi in data["2020Q3商务指标-分省"]:
b = bi["省份"]
if b not in business_index:
business_index[b] = {
"年": bi["年"],
"季度": bi["季度"],
"产品": bi["产品"],
"省份": bi["省份"],
"季度商业指标金额": 0,
"季度商业销售金额": business_sell[b]["季度商业销售金额"] if business_sell.get(b, 0) else 0,
}
business_index[b]["季度商业指标金额"] += float(bi["指标金额"])
hospital_performance = {}
for hp in data["全产品组Q3奖金测算"]:
if hp["省区经理岗位编码"] == None:
continue
h = hp["省区经理岗位编码"]
# h = (hp["省区经理岗位编码"],hp["省区经理工号"])
if h not in hospital_performance:
hospital_performance[h] = {
"大区经理岗位编码": hp["大区经理岗位编码"],
"大区经理岗位": hp["大区经理岗位"],
"大区经理工号": hp["大区经理工号"],
"大区经理姓名": hp["大区经理姓名"],
"省区经理岗位编码":hp["省区经理岗位编码"],
"省区经理岗位": hp["省区经理岗位"],
"省区经理工号": hp["省区经理工号"],
"省区经理姓名": hp["省区经理姓名"],
"省区经理负责省份":[],
# "省区经理负责省份": business_architecture[hp["省区经理岗位编码"]]["省区经理负责省份"] if business_architecture.get(hp["省区经理岗位编码"], "") else "",
# "sf_set":[],
"医院指标": 0,
"医院销售": 0,
"医院达成率":0,
"商业指标": 0,
"商业销售": 0,
"商业达成率":0,
"下属岗位医院业绩奖金":0,
"下属岗位商业业绩奖金":0,
"医院岗位业绩奖金":0,
"商业岗位业绩奖金":0,
"岗位业绩奖金合计":0,
"下属岗位数":0,
"行为合规奖金基数":0,
"行为合规成绩是否合格":"合格",
"行为合规奖金": 0,
"岗位状态":"在岗",
"异动/休假天数": entry[hp["省区经理工号"]]["休假工作日总天数"] if entry.get(hp["省区经理工号"], 0) else 0,
"季度考核比例": 0,
"入职/岗日期": dimission1[hp["省区经理工号"]]["入职日期"] if dimission1.get(hp["省区经理工号"], "") else "",
"离职/岗日期": dimission1[hp["省区经理工号"]]["离职日期"] if dimission1.get(hp["省区经理工号"], "") else "",
"2020 Q3 Sales Incentive-MAX":ceiling_bonuses_kpi[hp["省区经理工号"]]["奖金封顶值"] if ceiling_bonuses_kpi.get(hp["省区经理工号"], 0) else 0,
"实际岗位业绩奖金":0,
"销售奖金合计":0,
"季度实际发放":0,
"留存下季度奖金":0
}
# hospital_performance[h]["sq_set"].append(hp["sy_set"])
hospital_performance[h]["医院指标"] += float(hp["季度医院指标金额"])
hospital_performance[h]["医院销售"] += float(hp["季度医院销售金额"])
hospital_performance[h]["下属岗位数"] += 1
hospital_performance[h]["下属岗位医院业绩奖金"] += float(hp["岗位业绩达成奖-医院"])
hospital_performance[h]["下属岗位商业业绩奖金"] += float(hp["岗位业绩达成奖-商业"])
hospital_performance[h]["医院达成率"] = _achi(hospital_performance[h]["医院销售"],hospital_performance[h]["医院指标"])
if hospital_performance[h]["医院达成率"] >= 0.85:
hospital_performance[h]["医院岗位业绩奖金"] = hospital_performance[h]["下属岗位医院业绩奖金"] * 0.33
else:
hospital_performance[h]["医院岗位业绩奖金"] = 0
# sdk.util.console_log(cntxt["task_id"], "info", hospital_performance[h])
# for s in hospital_performance[h]["城市经理负责省份"]:
for s in hp["城市经理负责省份"]:
if s in business_index and s not in hospital_performance[h]["省区经理负责省份"]:
# if s in business_index and s not in hospital_performance[h]["省区经理负责省份"]:
hospital_performance[h]["省区经理负责省份"].append(s)
hospital_performance[h]["商业指标"] += business_index.get(s, "")["季度商业指标金额"]
hospital_performance[h]["商业销售"] += business_index.get(s, "")["季度商业销售金额"]
# for s in hospital_performance[h]["省区经理负责省份"]:
# if s in business_index and s not in hospital_performance[h]["sf_set"]:
# hospital_performance[h]["sf_set"].append(s)
# hospital_performance[h]["商业指标"] += business_index.get(s, "")["季度商业指标金额"]
# hospital_performance[h]["商业销售"] += business_index.get(s, "")["季度商业销售金额"]
hospital_performance[h]["商业达成率"] = _achi(hospital_performance[h]["商业销售"], hospital_performance[h]["商业指标"])
if hospital_performance[h]["商业达成率"] >= 0.85:
hospital_performance[h]["商业岗位业绩奖金"] = hospital_performance[h]["下属岗位商业业绩奖金"] * 0.33
else:
hospital_performance[h]["商业岗位业绩奖金"] = 0
hospital_performance[h]["岗位业绩奖金合计"] = hospital_performance[h]["商业岗位业绩奖金"] + hospital_performance[h]["医院岗位业绩奖金"]
for u in hospital_performance:
# 异动人员
if hospital_performance[u]["省区经理工号"] in transaction and hospital_performance[u]["岗位状态"] != "代岗":
hospital_performance[u]["岗位状态"] = "异动"
hospital_performance[u]["入职/岗日期"] = transaction.get(hospital_performance[u]["省区经理工号"],"")["入职日期"]
hospital_performance[u]["离职/岗日期"] = transaction.get(hospital_performance[u]["省区经理工号"],"")["生效日期"]
hospital_performance[u]["异动/休假天数"] = transaction.get(hospital_performance[u]["省区经理工号"],"")["休假工作日总天数"]
to = hospital_performance[u]["省区经理岗位编码"]
if "TBA" in str(hospital_performance[u]["省区经理姓名"]) or hospital_performance[u]["省区经理姓名"] == "(空白)":
hospital_performance[u]["岗位状态"] = "空岗"
if to in generation:
import copy
dai_entry[to] = copy.deepcopy(hospital_performance[u])
for d in dai_entry:
if generation.get(dai_entry[d]["省区经理岗位编码"], ""):
dai_entry[d]["省区经理姓名"] = generation.get(dai_entry[d]["省区经理岗位编码"], "")["省区经理姓名"]
dai_entry[d]["省区经理工号"] = generation.get(dai_entry[d]["省区经理岗位编码"], "")["省区经理工号"]
dai_entry[d]["入职/岗日期"] = generation.get(dai_entry[d]["省区经理岗位编码"], "")["入岗时间"]
dai_entry[d]["离职/岗日期"] = generation.get(dai_entry[d]["省区经理岗位编码"], "")["离岗时间"]
dai_entry[d]["异动/休假天数"] = generation.get(dai_entry[d]["省区经理岗位编码"], "")["休假工作日总天数"]
dai_entry[d]["岗位状态"] = "代岗"
for i in dai_entry:
de = dai_entry[i]["省区经理岗位编码"]
if de in hospital_performance and hospital_performance.get(de,"")["岗位状态"] != "在岗":
hospital_performance[de] = dai_entry[i]
else:
hospital_performance[de].update(dai_entry[i])
# 代岗人的的主岗小于百分之80
generation_main1 = {}
for c in hospital_performance:
if hospital_performance[c]["省区经理工号"] in kpi_unqualified and kpi_unqualified.get(hospital_performance[c]["省区经理工号"], "")["9大类别"] != "合规":
# sdk.util.console_log(cntxt["task_id"], "info", Total_data[c])
hospital_performance[c]["行为合规成绩是否合格"] = "不合格"
else:
hospital_performance[c]["行为合规成绩是否合格"] = "合格"
if ceiling_bonuses_kpi.get(hospital_performance[c]["省区经理工号"], 0) and hospital_performance[c]["岗位状态"] == "在岗" or hospital_performance[c]["岗位状态"] == "异动":
hospital_performance[c]["行为合规奖金基数"] = float(ceiling_bonuses_kpi[hospital_performance[c]["省区经理工号"]]["行为合规奖金基数"])
else:
hospital_performance[c]["行为合规奖金基数"] = 0
if hospital_performance[c]["岗位状态"] == "空岗":
hospital_performance[c]["季度考核比例"] = 0
else:
hospital_performance[c]['季度考核比例'] = (67 - hospital_performance[c]["异动/休假天数"]) / 67
return [hospital_performance[t] for t in hospital_performance]