补充存表

This commit is contained in:
2024-08-08 16:14:11 +08:00
parent 2b6ba7b71e
commit a8d40eba22
3 changed files with 22 additions and 7 deletions

View File

@@ -19,7 +19,6 @@ 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
from util.util import get_default_datetime
# 合并信息抽取结果
@@ -86,7 +85,7 @@ def information_extraction(ie, phrecs):
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 = get_default_datetime()
now = util.get_default_datetime()
for ie_result in ie_results:
result_json = json.dumps(ie_result["result"], ensure_ascii=False)
if len(result_json) > 5000:
@@ -142,7 +141,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 = get_default_datetime()
now = util.get_default_datetime()
if db_data:
# 更新
db_data.update_time = now
@@ -282,7 +281,7 @@ def main():
.distinct().limit(PHHD_BATCH_SIZE).all())
# 将状态改为正在识别中
pk_phhd_values = [phhd.pk_phhd for phhd in phhds]
update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd.in_(pk_phhd_values)).values(exsuccess_flag=2))
update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd.in_(pk_phhd_values)).values(exsuccess_flag="2"))
session.execute(update_flag)
session.commit()
session.close()
@@ -294,7 +293,10 @@ def main():
# 识别完成更新标识
session = MysqlSession()
update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd == pk_phhd).values(exsuccess_flag=8))
update_flag = (update(ZxPhhd).where(ZxPhhd.pk_phhd == pk_phhd).values(
exsuccess_flag="8",
ref_id1=HOSTNAME,
check_time=util.get_default_datetime()))
session.execute(update_flag)
session.commit()
session.close()