优化命名,类与模块最好不要重名
This commit is contained in:
@@ -23,7 +23,7 @@ from photo_review import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_E
|
||||
ADMISSION_ID, SETTLEMENT_ID, AGE, OCR, SETTLEMENT_IE, DISCHARGE_IE, COST_IE, PHHD_BATCH_SIZE, SLEEP_MINUTES, \
|
||||
UPPERCASE_MEDICAL_EXPENSES, HOSPITAL_ALIAS, HOSPITAL_FILTER, DEPARTMENT_ALIAS, DEPARTMENT_FILTER
|
||||
from ucloud import ufile
|
||||
from util import image_util, util, html_util
|
||||
from util import image_util, common_util, html_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, \
|
||||
parse_hospital
|
||||
@@ -42,7 +42,7 @@ def ie_temp_image(ie, ocr, image):
|
||||
|
||||
ie_result = []
|
||||
try:
|
||||
layout = util.get_ocr_layout(ocr, temp_file.name)
|
||||
layout = common_util.get_ocr_layout(ocr, temp_file.name)
|
||||
if not layout:
|
||||
# 无识别结果
|
||||
ie_result = []
|
||||
@@ -103,7 +103,7 @@ def get_better_image_from_qrcode(image, image_id, dpi=150):
|
||||
if pdf_file:
|
||||
pdf_file.close()
|
||||
if local_pdf_path:
|
||||
util.delete_temp_file(local_pdf_path)
|
||||
common_util.delete_temp_file(local_pdf_path)
|
||||
|
||||
jsczt_base_url = 'http://einvoice.jsczt.cn'
|
||||
try:
|
||||
@@ -168,7 +168,7 @@ def information_extraction(ie, phrecs, identity):
|
||||
info_extract = ie_temp_image(ie, OCR, image)
|
||||
ie_result = {'result': info_extract, 'angle': '0'}
|
||||
|
||||
now = util.get_default_datetime()
|
||||
now = common_util.get_default_datetime()
|
||||
if not ie_result['result']:
|
||||
continue
|
||||
|
||||
@@ -202,7 +202,7 @@ def information_extraction(ie, phrecs, identity):
|
||||
if not ie_results[0]['result'] or len(ie_results[0]['result']) < len(ie.kwargs.get('schema')):
|
||||
rotated_img = image_util.rotate(split_result['img'], int(angles[1]))
|
||||
ie_results.append({'result': ie_temp_image(ie, OCR, rotated_img), 'angle': angles[1]})
|
||||
now = util.get_default_datetime()
|
||||
now = common_util.get_default_datetime()
|
||||
best_angle = ['0', 0]
|
||||
for ie_result in ie_results:
|
||||
if not ie_result['result']:
|
||||
@@ -242,7 +242,7 @@ def information_extraction(ie, phrecs, identity):
|
||||
except Exception as e:
|
||||
logging.error(f'上传图片({phrec.cfjaddress})失败', exc_info=e)
|
||||
finally:
|
||||
util.delete_temp_file(temp_file.name)
|
||||
common_util.delete_temp_file(temp_file.name)
|
||||
|
||||
session = MysqlSession()
|
||||
session.add_all(zx_ie_results)
|
||||
@@ -289,7 +289,7 @@ def save_or_update_ie(table, pk_phhd, data):
|
||||
obj = table(**data)
|
||||
session = MysqlSession()
|
||||
db_data = session.query(table).filter_by(pk_phhd=pk_phhd).one_or_none()
|
||||
now = util.get_default_datetime()
|
||||
now = common_util.get_default_datetime()
|
||||
if db_data:
|
||||
# 更新
|
||||
db_data.update_time = now
|
||||
@@ -536,7 +536,7 @@ def main():
|
||||
update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd == pk_phhd).values(
|
||||
exsuccess_flag="8",
|
||||
ref_id1=HOSTNAME,
|
||||
checktime=util.get_default_datetime(),
|
||||
checktime=common_util.get_default_datetime(),
|
||||
fFSYLFY=time.time() - start_time))
|
||||
session.execute(update_flag)
|
||||
session.commit()
|
||||
|
||||
@@ -6,7 +6,7 @@ from sqlalchemy.sql.functions import count
|
||||
|
||||
from db import MysqlSession
|
||||
from db.mysql import ZxPhhd, ViewErrorReview
|
||||
from util import util
|
||||
from util import common_util
|
||||
|
||||
|
||||
def handle_reason(reason):
|
||||
@@ -95,5 +95,5 @@ if __name__ == '__main__':
|
||||
print(result)
|
||||
with open("photo_review_error_report.txt", 'w', encoding='utf-8') as file:
|
||||
file.write(json.dumps(result, indent=4, ensure_ascii=False))
|
||||
file.write(util.get_default_datetime())
|
||||
file.write(common_util.get_default_datetime())
|
||||
print("结果已保存。")
|
||||
|
||||
Reference in New Issue
Block a user