diff --git a/photo_review/__init__.py b/photo_review/__init__.py index ebc6ca2..ccec50a 100644 --- a/photo_review/__init__.py +++ b/photo_review/__init__.py @@ -60,7 +60,18 @@ DISCHARGE_KEY = { } -def modify_batch_id(batch_id): - # 修改批号的接口 +def get_batch_id(): + """ + 获取处理批号 + :return: 处理批号 + """ + return BATCH_ID + + +def set_batch_id(batch_id): + """ + 修改处理批号哦 + :param batch_id: 新批号 + """ global BATCH_ID BATCH_ID = batch_id diff --git a/photo_review/auto_photo_review.py b/photo_review/auto_photo_review.py index 709197b..9c815a4 100644 --- a/photo_review/auto_photo_review.py +++ b/photo_review/auto_photo_review.py @@ -19,7 +19,7 @@ from db import MysqlSession from db.mysql import BdYljg, BdYlks, ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxPhrec, ZxIeReview, ZxIeResult from log import HOSTNAME from photo_review import PHHD_BATCH_SIZE, SLEEP_MINUTES, HOSPITAL_ALIAS, HOSPITAL_FILTER, DEPARTMENT_ALIAS, \ - DEPARTMENT_FILTER, DISCHARGE_KEY, modify_batch_id, BATCH_ID + DEPARTMENT_FILTER, DISCHARGE_KEY, set_batch_id, get_batch_id from services.paddle_services import IE_KEY from ucloud import ufile from util import image_util, common_util, html_util, model_util @@ -171,7 +171,7 @@ def information_extraction(phrec, pk_phhd): now = common_util.get_default_datetime() session = MysqlSession() - session.add(ZxIeResult(pk_phhd=pk_phhd, pk_phrec=phrec.pk_phrec, id=BATCH_ID, + session.add(ZxIeResult(pk_phhd=pk_phhd, pk_phrec=phrec.pk_phrec, id=get_batch_id(), cfjaddress=phrec.cfjaddress, content=result_json, create_time=now, creator=HOSTNAME, update_time=now, updater=HOSTNAME)) session.commit() @@ -439,7 +439,7 @@ def photo_review(pk_phhd, name): ).all() session.close() # 同一批图的标识 - modify_batch_id(uuid.uuid4().hex) + set_batch_id(uuid.uuid4().hex) discharge_text = '' for phrec in phrecs: processed_img_dir = common_util.get_processed_img_path('') diff --git a/util/common_util.py b/util/common_util.py index ab06c0c..31e957f 100644 --- a/util/common_util.py +++ b/util/common_util.py @@ -7,7 +7,7 @@ from opencc import OpenCC from tenacity import retry, stop_after_attempt, wait_random from log import PROJECT_ROOT -from photo_review import BATCH_ID +from photo_review import get_batch_id from util import string_util, model_util @@ -300,7 +300,7 @@ def get_tmp_img_path(img_full_name): def get_processed_img_path(img_full_name): - return os.path.join(str(get_tmp_img_path(BATCH_ID)), img_full_name) + return os.path.join(str(get_tmp_img_path(get_batch_id())), img_full_name) def parse_save_path(img_path):