content = text.replace("\f", "").split("\n")
count=1
ss=[images_path.count("") for x in images_path]
# while count <= len([images_path.count("") for x in images_path]):
print(type(len(ss)))
ll=len(ss)
print(len(ss))
txt = []
for c in content:
if len(c) > 0:
print(c)
h, w, c = image.shape
boxes = tess.image_to_boxes(image)
for c in content:
if len(c) > 0:
txt.append(c)
for i in txt:
if i[0] == '检' and i[1] == '测' and i[2] == '时' and i[3] == '间':
ret = i
break
else:
ret = False
# 拿到姓名
xingming = []
for c in content:
if len(c) > 0:
xingming.append(c)
for i in xingming:
if i[0] == '姓' and i[1] == '名':
xing = i
break
else:
xing = False
print(xing) # 姓名
print(ret)
time = ret[10:]
ceshi = xing[10:]
# 拿到阴性阳性
yin = []
for c in content:
if len(c) > 0:
yin.append(c)
for i in yin:
if i[0] == '检' and i[1] == '测' and i[2] == '结' and i[3] == '果':
yinyin = i
break
else:
yinyin = False
yina = yinyin[10:]
print(yina)
yinaa = yina.lstrip()
ok = yinaa[1:-1]
print('----------------')
print(ok) # 阴性
# --------------
aaa = ceshi.lstrip()
print(aaa) # 最终姓名
aa = [];
zuizhongshijian = time.lstrip()
print(time.lstrip()) # 最终时间
shijianaa = time.lstrip()
print(datetime.now())
date = datetime.strptime(time.lstrip(), '%Y-%m-%d %H:%M:%S')
delta = datetime.now() - date
print(delta.days)
santiannei = ""
if (delta.days <= 3):
santiannei = '核酸报告在三天之内'
print("核酸报告在三天之内")
else:
santiannei = "核酸报告不在三天之内"
print("核酸报告不在三天之内")
print(santiannei)
book = xlwt.Workbook(encoding='utf-8', style_compression=0)
sheet = book.add_sheet('zhaoceshi1', cell_overwrite_ok=True)
col = ('姓名', '阴性/阳性', '检测时间', '是否在72小时')
for i in range(0, 4):
sheet.write(0, i, col)
datalist = [[aaa, ok, shijianaa, santiannei]]
for i in range(0, 1):
data = datalist
for j in range(0, 4):
sheet.write(i + 1, j, data[j])