修正全局变量的获取

This commit is contained in:
2024-10-15 13:27:55 +08:00
parent b332aa00dd
commit c28fc62d3f
3 changed files with 18 additions and 7 deletions

View File

@@ -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 global BATCH_ID
BATCH_ID = batch_id BATCH_ID = batch_id

View File

@@ -19,7 +19,7 @@ from db import MysqlSession
from db.mysql import BdYljg, BdYlks, ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxPhrec, ZxIeReview, ZxIeResult from db.mysql import BdYljg, BdYlks, ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxPhrec, ZxIeReview, ZxIeResult
from log import HOSTNAME from log import HOSTNAME
from photo_review import PHHD_BATCH_SIZE, SLEEP_MINUTES, HOSPITAL_ALIAS, HOSPITAL_FILTER, DEPARTMENT_ALIAS, \ 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 services.paddle_services import IE_KEY
from ucloud import ufile from ucloud import ufile
from util import image_util, common_util, html_util, model_util 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() now = common_util.get_default_datetime()
session = MysqlSession() 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, cfjaddress=phrec.cfjaddress, content=result_json, create_time=now,
creator=HOSTNAME, update_time=now, updater=HOSTNAME)) creator=HOSTNAME, update_time=now, updater=HOSTNAME))
session.commit() session.commit()
@@ -439,7 +439,7 @@ def photo_review(pk_phhd, name):
).all() ).all()
session.close() session.close()
# 同一批图的标识 # 同一批图的标识
modify_batch_id(uuid.uuid4().hex) set_batch_id(uuid.uuid4().hex)
discharge_text = '' discharge_text = ''
for phrec in phrecs: for phrec in phrecs:
processed_img_dir = common_util.get_processed_img_path('') processed_img_dir = common_util.get_processed_img_path('')

View File

@@ -7,7 +7,7 @@ from opencc import OpenCC
from tenacity import retry, stop_after_attempt, wait_random from tenacity import retry, stop_after_attempt, wait_random
from log import PROJECT_ROOT 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 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): 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): def parse_save_path(img_path):