调整zx_ocr表名为zx_ie_result,更符合表的实际作用
This commit is contained in:
@@ -9,7 +9,7 @@ import requests
|
|||||||
from PIL import ImageDraw, Image, ImageFont
|
from PIL import ImageDraw, Image, ImageFont
|
||||||
|
|
||||||
from db import MysqlSession
|
from db import MysqlSession
|
||||||
from db.mysql import ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxOcr, ZxPhrec
|
from db.mysql import ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxIeResult, ZxPhrec
|
||||||
from ucloud import ufile
|
from ucloud import ufile
|
||||||
from util import image_util
|
from util import image_util
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ def check_ie_result(pk_phhd):
|
|||||||
font_size = image.width * image.height / 200000
|
font_size = image.width * image.height / 200000
|
||||||
font = ImageFont.truetype("./font/simfang.ttf", size=font_size)
|
font = ImageFont.truetype("./font/simfang.ttf", size=font_size)
|
||||||
|
|
||||||
ocr = session.query(ZxOcr.id, ZxOcr.content, ZxOcr.rotation_angle, ZxOcr.x_offset, ZxOcr.y_offset).filter(
|
ocr = session.query(ZxIeResult.id, ZxIeResult.content, ZxIeResult.rotation_angle, ZxIeResult.x_offset,
|
||||||
ZxOcr.pk_phrec == phrec.pk_phrec).all()
|
ZxIeResult.y_offset).filter(ZxIeResult.pk_phrec == phrec.pk_phrec).all()
|
||||||
if not ocr:
|
if not ocr:
|
||||||
os.makedirs(f"./check_result/{pk_phhd}/0", exist_ok=True)
|
os.makedirs(f"./check_result/{pk_phhd}/0", exist_ok=True)
|
||||||
image.save(f"./check_result/{pk_phhd}/0/{img_name}")
|
image.save(f"./check_result/{pk_phhd}/0/{img_name}")
|
||||||
|
|||||||
38
db/mysql.py
38
db/mysql.py
@@ -114,6 +114,25 @@ class ZxIeDischarge(Base):
|
|||||||
updater = Column(String(255), comment='修改人')
|
updater = Column(String(255), comment='修改人')
|
||||||
|
|
||||||
|
|
||||||
|
class ZxIeResult(Base):
|
||||||
|
__tablename__ = 'zx_ie_result'
|
||||||
|
|
||||||
|
pk_ocr = Column(INTEGER(11), primary_key=True, comment='图片OCR识别主键')
|
||||||
|
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销单主键')
|
||||||
|
pk_phrec = Column(INTEGER(11), nullable=False, comment='图片主键')
|
||||||
|
id = Column(INTEGER(11), nullable=False, comment='识别批次')
|
||||||
|
cfjaddress = Column(String(200), nullable=False, comment='云存储文件名')
|
||||||
|
content = Column(String(5000), comment='OCR识别内容')
|
||||||
|
rotation_angle = Column(INTEGER(11), comment='旋转角度')
|
||||||
|
x_offset = Column(INTEGER(11), comment='x轴偏移量')
|
||||||
|
y_offset = Column(INTEGER(11), comment='y轴偏移量')
|
||||||
|
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
||||||
|
creator = Column(String(30), comment='创建人')
|
||||||
|
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
||||||
|
comment='修改时间')
|
||||||
|
updater = Column(String(30), comment='修改人')
|
||||||
|
|
||||||
|
|
||||||
class ZxIeSettlement(Base):
|
class ZxIeSettlement(Base):
|
||||||
__tablename__ = 'zx_ie_settlement'
|
__tablename__ = 'zx_ie_settlement'
|
||||||
|
|
||||||
@@ -143,25 +162,6 @@ class ZxIeSettlement(Base):
|
|||||||
updater = Column(String(255), comment='修改人')
|
updater = Column(String(255), comment='修改人')
|
||||||
|
|
||||||
|
|
||||||
class ZxOcr(Base):
|
|
||||||
__tablename__ = 'zx_ocr'
|
|
||||||
|
|
||||||
pk_ocr = Column(INTEGER(11), primary_key=True, comment='图片OCR识别主键')
|
|
||||||
pk_phhd = Column(INTEGER(11), nullable=False, comment='报销单主键')
|
|
||||||
pk_phrec = Column(INTEGER(11), nullable=False, comment='图片主键')
|
|
||||||
id = Column(INTEGER(11), nullable=False, comment='识别批次')
|
|
||||||
cfjaddress = Column(String(200), nullable=False, comment='云存储文件名')
|
|
||||||
content = Column(String(5000), comment='OCR识别内容')
|
|
||||||
rotation_angle = Column(INTEGER(11), comment='旋转角度')
|
|
||||||
x_offset = Column(INTEGER(11), comment='x轴偏移量')
|
|
||||||
y_offset = Column(INTEGER(11), comment='y轴偏移量')
|
|
||||||
create_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
|
|
||||||
creator = Column(String(30), comment='创建人')
|
|
||||||
update_time = Column(DateTime, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
|
|
||||||
comment='修改时间')
|
|
||||||
updater = Column(String(30), comment='修改人')
|
|
||||||
|
|
||||||
|
|
||||||
class ZxPhhd(Base):
|
class ZxPhhd(Base):
|
||||||
__tablename__ = 'zx_phhd'
|
__tablename__ = 'zx_phhd'
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
x-env:
|
x-env:
|
||||||
&default-image
|
&default-image
|
||||||
image: fcb_photo_review:1.10.3
|
image: fcb_photo_review:1.10.4
|
||||||
|
|
||||||
services:
|
services:
|
||||||
photo_review_1:
|
photo_review_1:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import requests
|
|||||||
from sqlalchemy import update
|
from sqlalchemy import update
|
||||||
|
|
||||||
from db import MysqlSession
|
from db import MysqlSession
|
||||||
from db.mysql import BdYljg, BdYlks, ZxOcr, ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxPhrec
|
from db.mysql import BdYljg, BdYlks, ZxIeResult, ZxIeCost, ZxIeDischarge, ZxIeSettlement, ZxPhhd, ZxPhrec
|
||||||
from photo_review import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_EXPENSES, PERSONAL_CASH_PAYMENT, \
|
from photo_review import PATIENT_NAME, ADMISSION_DATE, DISCHARGE_DATE, MEDICAL_EXPENSES, PERSONAL_CASH_PAYMENT, \
|
||||||
PERSONAL_ACCOUNT_PAYMENT, PERSONAL_FUNDED_AMOUNT, MEDICAL_INSURANCE_TYPE, HOSPITAL, DEPARTMENT, DOCTOR, \
|
PERSONAL_ACCOUNT_PAYMENT, PERSONAL_FUNDED_AMOUNT, MEDICAL_INSURANCE_TYPE, HOSPITAL, DEPARTMENT, DOCTOR, \
|
||||||
ADMISSION_ID, SETTLEMENT_ID, AGE, OCR, SETTLEMENT_IE, DISCHARGE_IE, COST_IE, PHHD_BATCH_SIZE, SLEEP_MINUTES, \
|
ADMISSION_ID, SETTLEMENT_ID, AGE, OCR, SETTLEMENT_IE, DISCHARGE_IE, COST_IE, PHHD_BATCH_SIZE, SLEEP_MINUTES, \
|
||||||
@@ -91,10 +91,10 @@ def information_extraction(ie, phrecs):
|
|||||||
if len(result_json) > 5000:
|
if len(result_json) > 5000:
|
||||||
result_json = result_json[:5000]
|
result_json = result_json[:5000]
|
||||||
session = MysqlSession()
|
session = MysqlSession()
|
||||||
zx_ocr = ZxOcr(pk_phhd=phrec.pk_phhd, pk_phrec=phrec.pk_phrec, id=identity, cfjaddress=phrec.cfjaddress,
|
zx_ocr = ZxIeResult(pk_phhd=phrec.pk_phhd, pk_phrec=phrec.pk_phrec, id=identity,
|
||||||
content=result_json, rotation_angle=ie_result["angle"],
|
cfjaddress=phrec.cfjaddress, content=result_json, rotation_angle=ie_result["angle"],
|
||||||
x_offset=split_result["x_offset"], y_offset=split_result["y_offset"], create_time=now,
|
x_offset=split_result["x_offset"], y_offset=split_result["y_offset"],
|
||||||
creator=HOSTNAME, update_time=now, updater=HOSTNAME)
|
create_time=now, creator=HOSTNAME, update_time=now, updater=HOSTNAME)
|
||||||
session.add(zx_ocr)
|
session.add(zx_ocr)
|
||||||
session.commit()
|
session.commit()
|
||||||
session.close()
|
session.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user