修正细节错误
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -115,6 +116,14 @@ def information_extraction(phrec, pk_phhd):
|
||||
:return:记录类型,信息抽取结果
|
||||
"""
|
||||
img_path = common_util.get_processed_img_path(phrec.cfjaddress)
|
||||
if not os.path.exists(img_path):
|
||||
original_img_path = common_util.get_img_path(phrec.cfjaddress)
|
||||
if not original_img_path:
|
||||
img_url = ufile.get_private_url(phrec.cfjaddress)
|
||||
if not img_url:
|
||||
return None, None, None
|
||||
original_img_path = common_util.save_to_local(img_url)
|
||||
shutil.copy2(original_img_path, img_path)
|
||||
if image_util.is_photo(img_path):
|
||||
book_img_path = model_util.det_book(img_path) # 识别文档区域并裁剪
|
||||
dewarped_img_path = model_util.dewarp(book_img_path) # 去扭曲
|
||||
@@ -433,9 +442,9 @@ def parse_pdf_text(settlement_text):
|
||||
'医保类型', '住院号', '医保结算单号码']
|
||||
discharge_key = ['科室', '患者姓名', '入院日期', '出院日期', '住院号']
|
||||
cost_key = ['患者姓名', '入院日期', '出院日期', '费用总额']
|
||||
settlement_result = {key: results[key] for key in settlement_key if key in results}
|
||||
discharge_result = {key: results[key] for key in discharge_key if key in results}
|
||||
cost_result = {key: results[key] for key in cost_key if key in results}
|
||||
settlement_result = {key: copy.copy(results[key]) for key in settlement_key if key in results}
|
||||
discharge_result = {key: copy.copy(results[key]) for key in discharge_key if key in results}
|
||||
cost_result = {key: copy.copy(results[key]) for key in cost_key if key in results}
|
||||
return settlement_result, discharge_result, cost_result
|
||||
|
||||
|
||||
@@ -452,7 +461,7 @@ def photo_review(pk_phhd, name):
|
||||
session = MysqlSession()
|
||||
phrecs = session.query(ZxPhrec.pk_phrec, ZxPhrec.cRectype, ZxPhrec.cfjaddress).filter(
|
||||
ZxPhrec.pk_phhd == pk_phhd
|
||||
).order_by(ZxPhrec.cRectype).all()
|
||||
).order_by(ZxPhrec.cRectype, ZxPhrec.rowno).all()
|
||||
session.close()
|
||||
|
||||
# 同一批图的标识
|
||||
@@ -527,9 +536,9 @@ def photo_review(pk_phhd, name):
|
||||
for key, value in ie_result.items():
|
||||
rec_result[key].append(value)
|
||||
|
||||
# 删除多余图片
|
||||
if os.path.exists(processed_img_dir) and os.path.isdir(processed_img_dir):
|
||||
shutil.rmtree(processed_img_dir)
|
||||
# 删除多余图片
|
||||
if os.path.exists(processed_img_dir) and os.path.isdir(processed_img_dir):
|
||||
shutil.rmtree(processed_img_dir)
|
||||
|
||||
settlement_data = settlement_task(pk_phhd, settlement_result)
|
||||
discharge_data = discharge_task(pk_phhd, discharge_result)
|
||||
@@ -549,6 +558,9 @@ def photo_review(pk_phhd, name):
|
||||
float(settlement_data['personal_account_payment']) + float(settlement_data['personal_cash_payment'])
|
||||
< float(settlement_data['medical_expenses'])
|
||||
)
|
||||
if has_pdf:
|
||||
review_result['has_discharge'] &= discharge_text
|
||||
|
||||
# 三项资料缺页判断
|
||||
page_description = []
|
||||
if review_result['has_discharge']:
|
||||
|
||||
Reference in New Issue
Block a user