添加医保类型的区分
This commit is contained in:
@@ -23,7 +23,8 @@ class ZxIeSettlement(Base):
|
||||
personal_account_payment = Column(DECIMAL(18, 2), comment='个人账户支付')
|
||||
personal_funded_amount_str = Column(String(255), comment='自费金额字符串')
|
||||
personal_funded_amount = Column(DECIMAL(18, 2), comment='自费金额')
|
||||
medical_insurance_type = Column(String(255), comment='医保类型')
|
||||
medical_insurance_type_str = Column(String(255), comment='医保类型字符串')
|
||||
medical_insurance_type = Column(String(40), comment='医保类型')
|
||||
admission_id = Column(String(50), comment='住院号')
|
||||
settlement_id = Column(String(50), comment='医保结算单号码')
|
||||
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
||||
|
||||
@@ -321,7 +321,7 @@ def settlement_task(pk_phhd, settlement_list):
|
||||
get_best_value_in_keys(settlement_list_ie_result, PERSONAL_ACCOUNT_PAYMENT)),
|
||||
"personal_funded_amount_str": handle_original_data(
|
||||
get_best_value_in_keys(settlement_list_ie_result, PERSONAL_FUNDED_AMOUNT)),
|
||||
"medical_insurance_type": handle_insurance_type(
|
||||
"medical_insurance_type_str": handle_original_data(
|
||||
get_best_value_in_keys(settlement_list_ie_result, MEDICAL_INSURANCE_TYPE)),
|
||||
"admission_id": handle_id(get_best_value_in_keys(settlement_list_ie_result, ADMISSION_ID)),
|
||||
"settlement_id": handle_id(get_best_value_in_keys(settlement_list_ie_result, SETTLEMENT_ID)),
|
||||
@@ -333,6 +333,7 @@ def settlement_task(pk_phhd, settlement_list):
|
||||
settlement_data["personal_cash_payment"] = handle_decimal(settlement_data["personal_cash_payment_str"])
|
||||
settlement_data["personal_account_payment"] = handle_decimal(settlement_data["personal_account_payment_str"])
|
||||
settlement_data["personal_funded_amount"] = handle_decimal(settlement_data["personal_funded_amount_str"])
|
||||
settlement_data["medical_insurance_type"] = handle_insurance_type(settlement_data["medical_insurance_type_str"])
|
||||
save_or_update_ie(ZxIeSettlement, pk_phhd, settlement_data)
|
||||
|
||||
|
||||
|
||||
@@ -85,16 +85,25 @@ def parse_department(string):
|
||||
result = []
|
||||
if not string:
|
||||
return result
|
||||
result.append(handle_department(string))
|
||||
string = re.sub(r'\([^()]*\)|\[[^\[\]]*\]|\{[^\{\}]*\}|([^()]*)|[^⺀-鿿]', '', string)[:255]
|
||||
if string == "科":
|
||||
return result
|
||||
result.append(string)
|
||||
string_without_num = re.sub(r'\d|一|二|三|四|五|六|七|八|九|十', '', string)
|
||||
if string == "科":
|
||||
return result
|
||||
if string_without_num != string:
|
||||
result.append(handle_department(string_without_num))
|
||||
string_without_brackets = re.sub(r'\([^()]*\)|\[[^\[\]]*\]|\{[^\{\}]*\}|([^()]*)', "", string_without_num)
|
||||
if string_without_brackets != string_without_num:
|
||||
result.append(handle_department(string_without_brackets))
|
||||
pure_string = string_without_brackets.split("科")[0] + "科"
|
||||
if pure_string != string_without_brackets:
|
||||
result.append(handle_department(pure_string))
|
||||
result.append(string_without_num)
|
||||
pure_string = string_without_num.split("科")[0] + "科"
|
||||
if string == "科":
|
||||
return result
|
||||
if pure_string != string_without_num:
|
||||
result.append(pure_string)
|
||||
pure_string_without_io = pure_string.replace("内", "").replace("外", "")
|
||||
if string == "科":
|
||||
return result
|
||||
if pure_string_without_io != pure_string:
|
||||
result.append(pure_string)
|
||||
return result
|
||||
|
||||
|
||||
@@ -109,7 +118,19 @@ def handle_name(string):
|
||||
def handle_insurance_type(string):
|
||||
if not string:
|
||||
return ""
|
||||
return string.replace(":", "").replace(":", "")[:255]
|
||||
worker_insurance_keys = ["社保", "城保", "职"]
|
||||
villager_insurance_keys = ["农保", "居民"]
|
||||
migrant_worker_insurance_keys = ["农民工"]
|
||||
no_insurance_keys = ["自费", "全费"]
|
||||
if any(key in string for key in worker_insurance_keys):
|
||||
return "职工医保"
|
||||
if any(key in string for key in villager_insurance_keys):
|
||||
return "居民医保"
|
||||
if any(key in string for key in migrant_worker_insurance_keys):
|
||||
return "农民工医保"
|
||||
if any(key in string for key in no_insurance_keys):
|
||||
return "无医保"
|
||||
return ""
|
||||
|
||||
|
||||
# 处理原始数据
|
||||
|
||||
Reference in New Issue
Block a user