添加医院名的分析处理
This commit is contained in:
@@ -19,7 +19,8 @@ from photo_review import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_E
|
||||
from ucloud import ufile
|
||||
from util import image_util, util
|
||||
from util.data_util import handle_date, handle_decimal, parse_department, handle_name, \
|
||||
handle_insurance_type, handle_original_data, handle_hospital, handle_department, handle_id, handle_age, parse_money
|
||||
handle_insurance_type, handle_original_data, handle_hospital, handle_department, handle_id, handle_age, parse_money, \
|
||||
parse_hospital
|
||||
|
||||
|
||||
# 合并信息抽取结果
|
||||
@@ -242,11 +243,13 @@ def discharge_task(pk_phhd, discharge_record, identity):
|
||||
if hospitals:
|
||||
hospital_like_conditions = []
|
||||
for hospital in hospitals:
|
||||
if hospital in HOSPITAL_ALIAS:
|
||||
for hospital_alias in HOSPITAL_ALIAS[hospital]:
|
||||
parsed_hospitals = parse_hospital(hospital)
|
||||
for parsed_hospital in parsed_hospitals:
|
||||
if parsed_hospital in HOSPITAL_ALIAS:
|
||||
for hospital_alias in HOSPITAL_ALIAS[parsed_hospital]:
|
||||
hospital_like_conditions.append(BdYljg.name.like(f'%{hospital_alias}%'))
|
||||
else:
|
||||
hospital_like_conditions.append(BdYljg.name.like(f'%{hospital}%'))
|
||||
hospital_like_conditions.append(BdYljg.name.like(f'%{parsed_hospital}%'))
|
||||
session = MysqlSession()
|
||||
yljg = session.query(BdYljg.pk_yljg, BdYljg.name).filter(or_(*hospital_like_conditions)).limit(1).one_or_none()
|
||||
session.close()
|
||||
|
||||
@@ -173,3 +173,16 @@ def handle_age(string):
|
||||
string = string.split("岁")[0]
|
||||
num = re.sub(r'\D', '', string)
|
||||
return num[-3:]
|
||||
|
||||
|
||||
# 分析医院
|
||||
def parse_hospital(string):
|
||||
result = []
|
||||
if not string:
|
||||
return result
|
||||
|
||||
string_without_brackets = string.replace(")", "").replace(")", "").replace("(", " ").replace("(", " ")
|
||||
string_without_company = string_without_brackets.replace("有限公司", "")
|
||||
simple_chinese_string = string_without_company.replace("醫", "医")
|
||||
result += simple_chinese_string.split(" ")
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user