明确限制好各字段长度
This commit is contained in:
@@ -27,8 +27,8 @@ from photo_review.entity.zx_ie_settlement import ZxIeSettlement
|
|||||||
from photo_review.entity.zx_ocr import ZxOcr
|
from photo_review.entity.zx_ocr import ZxOcr
|
||||||
from photo_review.entity.zx_phhd import ZxPhhd
|
from photo_review.entity.zx_phhd import ZxPhhd
|
||||||
from photo_review.entity.zx_phrec import ZxPhrec
|
from photo_review.entity.zx_phrec import ZxPhrec
|
||||||
from photo_review.util.data_util import handle_date, handle_decimal, handle_department, handle_name, \
|
from photo_review.util.data_util import handle_date, handle_decimal, parse_department, handle_name, \
|
||||||
handle_insurance_type, handle_original_data
|
handle_insurance_type, handle_original_data, handle_hospital, handle_department
|
||||||
from photo_review.util.util import get_default_datetime
|
from photo_review.util.util import get_default_datetime
|
||||||
from ucloud import ucloud
|
from ucloud import ucloud
|
||||||
|
|
||||||
@@ -278,8 +278,8 @@ def photo_review(pk_phhd):
|
|||||||
discharge_record_ie_result = information_extraction(DISCHARGE_IE, discharge_record)
|
discharge_record_ie_result = information_extraction(DISCHARGE_IE, discharge_record)
|
||||||
discharge_data = {
|
discharge_data = {
|
||||||
"pk_phhd": pk_phhd,
|
"pk_phhd": pk_phhd,
|
||||||
"hospital": get_best_value_in_keys(discharge_record_ie_result, HOSPITAL),
|
"hospital": handle_hospital(get_best_value_in_keys(discharge_record_ie_result, HOSPITAL)),
|
||||||
"department": get_best_value_in_keys(discharge_record_ie_result, DEPARTMENT),
|
"department": handle_department(get_best_value_in_keys(discharge_record_ie_result, DEPARTMENT)),
|
||||||
"name": handle_name(get_best_value_in_keys(discharge_record_ie_result, PATIENT_NAME)),
|
"name": handle_name(get_best_value_in_keys(discharge_record_ie_result, PATIENT_NAME)),
|
||||||
"admission_date_str": handle_original_data(get_best_value_in_keys(discharge_record_ie_result, ADMISSION_DATE)),
|
"admission_date_str": handle_original_data(get_best_value_in_keys(discharge_record_ie_result, ADMISSION_DATE)),
|
||||||
"discharge_date_str": handle_original_data(get_best_value_in_keys(discharge_record_ie_result, DISCHARGE_DATE)),
|
"discharge_date_str": handle_original_data(get_best_value_in_keys(discharge_record_ie_result, DISCHARGE_DATE)),
|
||||||
@@ -300,7 +300,7 @@ def photo_review(pk_phhd):
|
|||||||
if department_value:
|
if department_value:
|
||||||
department_values = []
|
department_values = []
|
||||||
for dept in department_value:
|
for dept in department_value:
|
||||||
department_values += handle_department(dept)
|
department_values += parse_department(dept)
|
||||||
department_values = list(set(department_values))
|
department_values = list(set(department_values))
|
||||||
if department_values:
|
if department_values:
|
||||||
session = MysqlSession()
|
session = MysqlSession()
|
||||||
|
|||||||
@@ -62,21 +62,32 @@ def handle_date(string):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def handle_hospital(string):
|
||||||
|
if not string:
|
||||||
|
return ""
|
||||||
|
return string[:255]
|
||||||
|
|
||||||
|
|
||||||
def handle_department(string):
|
def handle_department(string):
|
||||||
|
if not string:
|
||||||
|
return ""
|
||||||
|
return string[:255]
|
||||||
|
|
||||||
|
|
||||||
|
def parse_department(string):
|
||||||
result = []
|
result = []
|
||||||
max_length = 255
|
|
||||||
if not string:
|
if not string:
|
||||||
return result
|
return result
|
||||||
result.append(string[:max_length])
|
result.append(handle_department(string))
|
||||||
string_without_num = re.sub(r'\d|一|二|三|四|五|六|七|八|九|十', '', string)
|
string_without_num = re.sub(r'\d|一|二|三|四|五|六|七|八|九|十', '', string)
|
||||||
if string_without_num != string:
|
if string_without_num != string:
|
||||||
result.append(string_without_num[:max_length])
|
result.append(handle_department(string_without_num))
|
||||||
string_without_brackets = re.sub(r'\([^()]*\)|\[[^\[\]]*\]|\{[^\{\}]*\}|([^()]*)', "", string_without_num)
|
string_without_brackets = re.sub(r'\([^()]*\)|\[[^\[\]]*\]|\{[^\{\}]*\}|([^()]*)', "", string_without_num)
|
||||||
if string_without_brackets != string_without_num:
|
if string_without_brackets != string_without_num:
|
||||||
result.append(string_without_brackets[:max_length])
|
result.append(handle_department(string_without_brackets))
|
||||||
pure_string = string_without_brackets.split("科")[0] + "科"
|
pure_string = string_without_brackets.split("科")[0] + "科"
|
||||||
if pure_string != string_without_brackets:
|
if pure_string != string_without_brackets:
|
||||||
result.append(pure_string[:max_length])
|
result.append(handle_department(pure_string))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user