修正细节错误
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()
|
||||
|
||||
# 同一批图的标识
|
||||
@@ -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']:
|
||||
|
||||
@@ -16,7 +16,7 @@ COST = Taskflow('information_extraction', schema=COST_LIST_SCHEMA, model='uie-x-
|
||||
task_path='model/cost_list_model', layout_analysis=False, precision='fp16')
|
||||
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
@app.route('/', methods=['POST'], endpoint='cost')
|
||||
@process_request
|
||||
def main():
|
||||
img_path = request.form.get('img_path')
|
||||
|
||||
@@ -16,7 +16,7 @@ DISCHARGE = Taskflow('information_extraction', schema=DISCHARGE_RECORD_SCHEMA, m
|
||||
task_path='model/discharge_record_model', layout_analysis=False, precision='fp16')
|
||||
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
@app.route('/', methods=['POST'], endpoint='discharge')
|
||||
@process_request
|
||||
def main():
|
||||
img_path = request.form.get('img_path')
|
||||
|
||||
@@ -18,7 +18,7 @@ SETTLEMENT_IE = Taskflow('information_extraction', schema=SETTLEMENT_LIST_SCHEMA
|
||||
task_path='model/settlement_list_model', layout_analysis=False, precision='fp16')
|
||||
|
||||
|
||||
@app.route('/', methods=['POST'])
|
||||
@app.route('/', methods=['POST'], endpoint='settlement')
|
||||
@process_request
|
||||
def main():
|
||||
img_path = request.form.get('img_path')
|
||||
|
||||
Reference in New Issue
Block a user