fix afc e-contract
Showing
2 changed files
with
83 additions
and
79 deletions
... | @@ -9,8 +9,23 @@ from .get_char import Finder | ... | @@ -9,8 +9,23 @@ from .get_char import Finder |
9 | 9 | ||
10 | 10 | ||
11 | def predict(pdf_info): | 11 | def predict(pdf_info): |
12 | ocr_results = {} | ||
13 | for pno in pdf_info: | ||
14 | ocr_results[pno] = {} | ||
15 | for key, block in enumerate(pdf_info[pno]['blocks']): | ||
16 | if block['type'] != 0: | ||
17 | continue | ||
18 | for line in block['lines']: | ||
19 | for span in line['spans']: | ||
20 | bbox, text = span['bbox'], span['text'] | ||
21 | # print(text) | ||
22 | xmin, ymin, xmax, ymax = bbox | ||
23 | polygon = [xmin, ymin, xmax, ymin, xmax, ymax, xmin, ymax] | ||
24 | text = text.replace(":", ":").replace(" ", "") | ||
25 | ocr_results[pno][key] = [polygon, text] | ||
26 | |||
12 | # 输入是整个 PDF 中的信息 | 27 | # 输入是整个 PDF 中的信息 |
13 | f = Finder(pdf_info) | 28 | f = Finder(pdf_info, ocr_results=ocr_results) |
14 | results = f.get_info() | 29 | results = f.get_info() |
15 | 30 | ||
16 | return results | 31 | return results | ... | ... |
... | @@ -11,14 +11,13 @@ from fuzzywuzzy import fuzz | ... | @@ -11,14 +11,13 @@ from fuzzywuzzy import fuzz |
11 | 11 | ||
12 | 12 | ||
13 | class Finder: | 13 | class Finder: |
14 | 14 | def __init__(self, pdf_info, ocr_results): | |
15 | def __init__(self, pdf_info): | ||
16 | self.pdf_info = pdf_info | 15 | self.pdf_info = pdf_info |
16 | self.ocr_results = ocr_results | ||
17 | self.is_asp = False | 17 | self.is_asp = False |
18 | self.item = {"words": None, | 18 | self.item = {"words": None, |
19 | "position": None, | 19 | "position": None, |
20 | } | 20 | } |
21 | |||
22 | def gen_init_result(self, is_asp): | 21 | def gen_init_result(self, is_asp): |
23 | # 格式化算法输出 | 22 | # 格式化算法输出 |
24 | self.init_result = {"page_1": {"合同编号": self.item, | 23 | self.init_result = {"page_1": {"合同编号": self.item, |
... | @@ -109,8 +108,10 @@ class Finder: | ... | @@ -109,8 +108,10 @@ class Finder: |
109 | "日期": self.item, | 108 | "日期": self.item, |
110 | }, | 109 | }, |
111 | } | 110 | } |
112 | 111 | def poly_to_rectangle(self, poly): | |
113 | 112 | xmin, ymin, xmax, ymin, xmax, ymax, xmin, ymax = poly | |
113 | bbox = [xmin, ymin, xmax, ymax] | ||
114 | return bbox | ||
114 | def get_contract_no(self, page_num): | 115 | def get_contract_no(self, page_num): |
115 | """传入页码,查看该页码右上角的编号 | 116 | """传入页码,查看该页码右上角的编号 |
116 | 117 | ||
... | @@ -121,47 +122,41 @@ class Finder: | ... | @@ -121,47 +122,41 @@ class Finder: |
121 | sting: | 122 | sting: |
122 | """ | 123 | """ |
123 | contract_no = self.item.copy() | 124 | contract_no = self.item.copy() |
125 | # contract_no['words'] = '' | ||
126 | # contract_no['position'] = [-1, -1, -1, -1] | ||
124 | # 只看第一页 | 127 | # 只看第一页 |
125 | for block in self.pdf_info[page_num]['blocks']: | 128 | for key in self.ocr_results[page_num]: |
126 | if block['type'] != 0: | 129 | bbox, text = self.ocr_results[page_num][key] |
127 | continue | 130 | if '合同编号:' in text: |
128 | for line in block['lines']: | 131 | words = text.split(':')[-1] |
129 | for span in line['spans']: | 132 | location = self.poly_to_rectangle(bbox) |
130 | bbox, text = span['bbox'], span['text'] | ||
131 | if '合同编号:' in text: | ||
132 | words = text.split(':')[-1] | ||
133 | contract_no['position'] = bbox | ||
134 | contract_no['words'] = words | 133 | contract_no['words'] = words |
134 | contract_no['position'] = location | ||
135 | return contract_no | 135 | return contract_no |
136 | |||
137 | def get_vehicle_price(self, page_num='0'): | 136 | def get_vehicle_price(self, page_num='0'): |
138 | vehicle_price = self.item.copy() | 137 | vehicle_price = self.item.copy() |
139 | for block in self.pdf_info[page_num]['blocks']: | 138 | # vehicle_price['words'] = '' |
140 | if block['type'] != 0: | 139 | # vehicle_price['position'] = [-1, -1, -1, -1] |
141 | continue | 140 | for key in self.ocr_results[page_num]: |
142 | for line in block['lines']: | 141 | bbox, text = self.ocr_results[page_num][key] |
143 | for span in line['spans']: | ||
144 | bbox, text = span['bbox'], span['text'] | ||
145 | if '所购车辆价格为人民币' in text: | 142 | if '所购车辆价格为人民币' in text: |
146 | words = text.split('币')[-1] | 143 | words = text.split('币')[-1] |
147 | vehicle_price['position'] = bbox | 144 | location = self.poly_to_rectangle(bbox) |
148 | vehicle_price['words'] = words | 145 | vehicle_price['words'] = words |
146 | vehicle_price['position'] = location | ||
149 | return vehicle_price | 147 | return vehicle_price |
150 | |||
151 | def get_vin(self, page_num='0'): | 148 | def get_vin(self, page_num='0'): |
152 | vin = self.item.copy() | 149 | vin = self.item.copy() |
153 | for block in self.pdf_info[page_num]['blocks']: | 150 | # vin['words'] = '' |
154 | if block['type'] != 0: | 151 | # vin['position'] = [-1, -1, -1, -1] |
155 | continue | 152 | for key in self.ocr_results[page_num]: |
156 | for line in block['lines']: | 153 | bbox, text = self.ocr_results[page_num][key] |
157 | for span in line['spans']: | 154 | if '车架号:' in text: |
158 | bbox, text = span['bbox'], span['text'] | 155 | words = text.split(':')[-1] |
159 | if '车架号:' in text: | 156 | location = self.poly_to_rectangle(bbox) |
160 | words = text.split(':')[-1] | ||
161 | vin['position'] = bbox | ||
162 | vin['words'] = words | 157 | vin['words'] = words |
158 | vin['position'] = location | ||
163 | return vin | 159 | return vin |
164 | |||
165 | def get_loan_principal(self, page_num='0'): | 160 | def get_loan_principal(self, page_num='0'): |
166 | chinese_keywords = ['壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾', | 161 | chinese_keywords = ['壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾', |
167 | '佰', '仟', '万', '亿', '元', '角', '分', '零', '整'] | 162 | '佰', '仟', '万', '亿', '元', '角', '分', '零', '整'] |
... | @@ -202,7 +197,6 @@ class Finder: | ... | @@ -202,7 +197,6 @@ class Finder: |
202 | asp_2['position'] = bbox | 197 | asp_2['position'] = bbox |
203 | asp_2['words'] = words | 198 | asp_2['words'] = words |
204 | return upper, lower, asp_1, asp_2 | 199 | return upper, lower, asp_1, asp_2 |
205 | |||
206 | def get_loan_term(self, page_num='0'): | 200 | def get_loan_term(self, page_num='0'): |
207 | loan_term = self.item.copy() | 201 | loan_term = self.item.copy() |
208 | all_text = '' | 202 | all_text = '' |
... | @@ -226,10 +220,20 @@ class Finder: | ... | @@ -226,10 +220,20 @@ class Finder: |
226 | loan_term['position'] = bbox | 220 | loan_term['position'] = bbox |
227 | loan_term['words'] = words | 221 | loan_term['words'] = words |
228 | return loan_term | 222 | return loan_term |
229 | 223 | def mergelist(self, text_list): | |
224 | pattern = re.compile("[^\u4e00-\u9fa5]") # 匹配不是中文的其他字符 | ||
225 | mergeindex = -1 | ||
226 | for index, i in enumerate(text_list): | ||
227 | if '所购' in i and len(pattern.sub('', pattern.sub('', text_list[index+1]))) != 0: | ||
228 | # if '所购' in i and '.00' not in text_list[index+1]: | ||
229 | mergeindex = index | ||
230 | if mergeindex == -1: | ||
231 | return text_list | ||
232 | else: | ||
233 | new_text_list = text_list[:mergeindex] + [text_list[mergeindex] + text_list[mergeindex+1]] + text_list[mergeindex+2:] | ||
234 | return self.mergelist(new_text_list) | ||
230 | def get_asp_details(self, page_num): | 235 | def get_asp_details(self, page_num): |
231 | asp_details_table_term = self.item.copy() | 236 | asp_details_table_term = self.item.copy() |
232 | |||
233 | asp_details_table = [] | 237 | asp_details_table = [] |
234 | asp_details_text_list = [] | 238 | asp_details_text_list = [] |
235 | table = False | 239 | table = False |
... | @@ -244,26 +248,22 @@ class Finder: | ... | @@ -244,26 +248,22 @@ class Finder: |
244 | if '第二条' in text or '征信管理' in text: | 248 | if '第二条' in text or '征信管理' in text: |
245 | table = False | 249 | table = False |
246 | if table == True: | 250 | if table == True: |
251 | # print(text) | ||
247 | asp_details_text_list.append(text) | 252 | asp_details_text_list.append(text) |
248 | 253 | asp_details_text_list = self.mergelist(asp_details_text_list) | |
249 | for i in range((len(asp_details_text_list)+2)//3): | 254 | for i in range((len(asp_details_text_list)+2)//3): |
250 | |||
251 | line = [] | 255 | line = [] |
252 | if i == 0: | 256 | if i == 0: |
253 | line = [asp_details_text_list[0]] | 257 | line = [asp_details_text_list[0]] |
254 | else: | 258 | else: |
255 | for j in range(3): | 259 | for j in range(3): |
256 | line.append(asp_details_text_list[i*3-2+j]) | 260 | line.append(asp_details_text_list[i*3-2+j]) |
257 | |||
258 | asp_details_table.append(line) | 261 | asp_details_table.append(line) |
259 | |||
260 | if len(asp_details_table) > 0: | 262 | if len(asp_details_table) > 0: |
261 | asp_details_table_term['words'] = asp_details_table | 263 | asp_details_table_term['words'] = asp_details_table |
262 | return asp_details_table_term | 264 | return asp_details_table_term |
263 | |||
264 | def get_signature(self): | 265 | def get_signature(self): |
265 | signature = self.item.copy() | 266 | signature = self.item.copy() |
266 | |||
267 | for block in self.pdf_info['0']['blocks']: | 267 | for block in self.pdf_info['0']['blocks']: |
268 | if block['type'] != 0: | 268 | if block['type'] != 0: |
269 | continue | 269 | continue |
... | @@ -275,7 +275,6 @@ class Finder: | ... | @@ -275,7 +275,6 @@ class Finder: |
275 | signature['words'] = words | 275 | signature['words'] = words |
276 | signature['position'] = bbox | 276 | signature['position'] = bbox |
277 | return signature | 277 | return signature |
278 | |||
279 | def get_somebody(self, top, bottom): | 278 | def get_somebody(self, top, bottom): |
280 | # 指定上下边界后,返回上下边界内的客户信息 | 279 | # 指定上下边界后,返回上下边界内的客户信息 |
281 | _name = self.item.copy() | 280 | _name = self.item.copy() |
... | @@ -300,6 +299,7 @@ class Finder: | ... | @@ -300,6 +299,7 @@ class Finder: |
300 | for span in line['spans']: | 299 | for span in line['spans']: |
301 | bbox, text = span['bbox'], span['text'] | 300 | bbox, text = span['bbox'], span['text'] |
302 | if y_top < bbox[3] < y_bottom: | 301 | if y_top < bbox[3] < y_bottom: |
302 | # print(top, bottom, text) | ||
303 | if '姓名/名称' in text: | 303 | if '姓名/名称' in text: |
304 | words = text.split(':')[-1] | 304 | words = text.split(':')[-1] |
305 | _name['position'] = bbox | 305 | _name['position'] = bbox |
... | @@ -309,7 +309,6 @@ class Finder: | ... | @@ -309,7 +309,6 @@ class Finder: |
309 | _id['position'] = bbox | 309 | _id['position'] = bbox |
310 | _id['words'] = words | 310 | _id['words'] = words |
311 | return _name, _id | 311 | return _name, _id |
312 | |||
313 | def get_seller(self): | 312 | def get_seller(self): |
314 | seller = self.item.copy() | 313 | seller = self.item.copy() |
315 | # 先找到 key | 314 | # 先找到 key |
... | @@ -336,7 +335,6 @@ class Finder: | ... | @@ -336,7 +335,6 @@ class Finder: |
336 | seller['position'] = bbox | 335 | seller['position'] = bbox |
337 | seller['words'] = text | 336 | seller['words'] = text |
338 | return seller | 337 | return seller |
339 | |||
340 | def get_payback_account(self): | 338 | def get_payback_account(self): |
341 | account = self.item.copy() | 339 | account = self.item.copy() |
342 | account_name = self.item.copy() | 340 | account_name = self.item.copy() |
... | @@ -389,7 +387,6 @@ class Finder: | ... | @@ -389,7 +387,6 @@ class Finder: |
389 | account_bank['position'] = bbox | 387 | account_bank['position'] = bbox |
390 | account_bank['words'] = words | 388 | account_bank['words'] = words |
391 | return account, account_name, account_bank | 389 | return account, account_name, account_bank |
392 | |||
393 | def get_repayment_schedule(self): | 390 | def get_repayment_schedule(self): |
394 | repayment_schedule = self.item.copy() | 391 | repayment_schedule = self.item.copy() |
395 | # 只看第二页 | 392 | # 只看第二页 |
... | @@ -408,23 +405,17 @@ class Finder: | ... | @@ -408,23 +405,17 @@ class Finder: |
408 | table = False | 405 | table = False |
409 | if table == True: | 406 | if table == True: |
410 | repayment_schedule_text_list.append(text) | 407 | repayment_schedule_text_list.append(text) |
411 | |||
412 | for i in range(len(repayment_schedule_text_list)//5): | 408 | for i in range(len(repayment_schedule_text_list)//5): |
413 | |||
414 | line = [] | 409 | line = [] |
415 | # 5表示5列的意思 | 410 | # 5表示5列的意思 |
416 | for j in range(5): | 411 | for j in range(5): |
417 | line.append(repayment_schedule_text_list[i*5+j]) | 412 | line.append(repayment_schedule_text_list[i*5+j]) |
418 | |||
419 | if str(i+1) == line[1]: | 413 | if str(i+1) == line[1]: |
420 | break | 414 | break |
421 | |||
422 | repayment_schedule_table.append(line) | 415 | repayment_schedule_table.append(line) |
423 | |||
424 | if len(repayment_schedule_table) > 0: | 416 | if len(repayment_schedule_table) > 0: |
425 | repayment_schedule['words'] = repayment_schedule_table | 417 | repayment_schedule['words'] = repayment_schedule_table |
426 | return repayment_schedule | 418 | return repayment_schedule |
427 | |||
428 | def get_signature_role_1(self): | 419 | def get_signature_role_1(self): |
429 | signature_role_1 = self.init_item.copy() | 420 | signature_role_1 = self.init_item.copy() |
430 | # 先定位签字区域 | 421 | # 先定位签字区域 |
... | @@ -459,7 +450,6 @@ class Finder: | ... | @@ -459,7 +450,6 @@ class Finder: |
459 | signature_role_1['position'] = position | 450 | signature_role_1['position'] = position |
460 | signature_role_1['words'] = words | 451 | signature_role_1['words'] = words |
461 | return signature_role_1 | 452 | return signature_role_1 |
462 | |||
463 | def get_signature_role_2(self): | 453 | def get_signature_role_2(self): |
464 | signature_role_2 = self.init_item.copy() | 454 | signature_role_2 = self.init_item.copy() |
465 | # 先定位签字区域 | 455 | # 先定位签字区域 |
... | @@ -494,7 +484,6 @@ class Finder: | ... | @@ -494,7 +484,6 @@ class Finder: |
494 | signature_role_2['position'] = position | 484 | signature_role_2['position'] = position |
495 | signature_role_2['words'] = words | 485 | signature_role_2['words'] = words |
496 | return signature_role_2 | 486 | return signature_role_2 |
497 | |||
498 | def get_signature_role_3(self): | 487 | def get_signature_role_3(self): |
499 | signature_role_3 = self.init_item.copy() | 488 | signature_role_3 = self.init_item.copy() |
500 | # 先定位签字区域 | 489 | # 先定位签字区域 |
... | @@ -529,7 +518,6 @@ class Finder: | ... | @@ -529,7 +518,6 @@ class Finder: |
529 | signature_role_3['position'] = position | 518 | signature_role_3['position'] = position |
530 | signature_role_3['words'] = words | 519 | signature_role_3['words'] = words |
531 | return signature_role_3 | 520 | return signature_role_3 |
532 | |||
533 | def get_signature_role_4(self): | 521 | def get_signature_role_4(self): |
534 | signature_role_4 = self.init_item.copy() | 522 | signature_role_4 = self.init_item.copy() |
535 | # 先定位签字区域 | 523 | # 先定位签字区域 |
... | @@ -564,7 +552,6 @@ class Finder: | ... | @@ -564,7 +552,6 @@ class Finder: |
564 | signature_role_4['position'] = position | 552 | signature_role_4['position'] = position |
565 | signature_role_4['words'] = words | 553 | signature_role_4['words'] = words |
566 | return signature_role_4 | 554 | return signature_role_4 |
567 | |||
568 | def get_signature_role_5(self): | 555 | def get_signature_role_5(self): |
569 | signature_role_5 = self.init_item.copy() | 556 | signature_role_5 = self.init_item.copy() |
570 | # 先定位签字区域 | 557 | # 先定位签字区域 |
... | @@ -600,7 +587,6 @@ class Finder: | ... | @@ -600,7 +587,6 @@ class Finder: |
600 | signature_role_5['position'] = position | 587 | signature_role_5['position'] = position |
601 | signature_role_5['words'] = words | 588 | signature_role_5['words'] = words |
602 | return signature_role_5 | 589 | return signature_role_5 |
603 | |||
604 | def get_last_page_signature(self, page_num, top, bottom): | 590 | def get_last_page_signature(self, page_num, top, bottom): |
605 | signature_name = self.item.copy() | 591 | signature_name = self.item.copy() |
606 | signature_date = self.item.copy() | 592 | signature_date = self.item.copy() |
... | @@ -616,6 +602,7 @@ class Finder: | ... | @@ -616,6 +602,7 @@ class Finder: |
616 | anchor_top = bbox[1] | 602 | anchor_top = bbox[1] |
617 | if bottom in text: | 603 | if bottom in text: |
618 | anchor_bottom = bbox[1] | 604 | anchor_bottom = bbox[1] |
605 | # print(top, anchor_top, anchor_bottom) | ||
619 | if anchor_top is not None and anchor_bottom is not None: | 606 | if anchor_top is not None and anchor_bottom is not None: |
620 | for block in self.pdf_info[page_num]['blocks']: | 607 | for block in self.pdf_info[page_num]['blocks']: |
621 | if block['type'] != 0: | 608 | if block['type'] != 0: |
... | @@ -629,9 +616,8 @@ class Finder: | ... | @@ -629,9 +616,8 @@ class Finder: |
629 | signature_name['words'] = name | 616 | signature_name['words'] = name |
630 | signature_name['position'] = bbox | 617 | signature_name['position'] = bbox |
631 | signature_date['words'] = date | 618 | signature_date['words'] = date |
632 | signature_name['position'] = bbox | 619 | signature_date['position'] = bbox |
633 | return signature_name, signature_date | 620 | return signature_name, signature_date |
634 | |||
635 | def get_info(self): | 621 | def get_info(self): |
636 | """ | 622 | """ |
637 | block['type'] == 0 : 表示该元素为图片 | 623 | block['type'] == 0 : 表示该元素为图片 |
... | @@ -639,21 +625,22 @@ class Finder: | ... | @@ -639,21 +625,22 @@ class Finder: |
639 | Returns: | 625 | Returns: |
640 | dict: Description | 626 | dict: Description |
641 | """ | 627 | """ |
642 | |||
643 | # 先判断是否为 ASP 产品 | 628 | # 先判断是否为 ASP 产品 |
644 | # 只看第一页,判断是否有 '附加产品融资贷款本金总金额' 这一句话,若有则为 ASP 产品 | 629 | # 只看第一页,判断是否有 '附加产品融资贷款本金总金额' 这一句话,若有则为 ASP 产品 |
645 | # print(self.pdf_info['0']['blocks']) | 630 | # print(self.pdf_info['0']['blocks']) |
646 | for block in self.pdf_info['0']['blocks']: | 631 | # for block in self.pdf_info['0']['blocks']: |
647 | if block['type'] != 0: | 632 | # if block['type'] != 0: |
648 | continue | 633 | # continue |
649 | for line in block['lines']: | 634 | # for line in block['lines']: |
650 | for span in line['spans']: | 635 | # for span in line['spans']: |
651 | bbox, text = span['bbox'], span['text'] | 636 | # bbox, text = span['bbox'], span['text'] |
652 | if '附加产品融资贷款本金总金额' == text: | 637 | # if '附加产品融资贷款本金总金额' == text: |
638 | # self.is_asp = True | ||
639 | for key in self.ocr_results['0']: | ||
640 | bbox, text = self.ocr_results['0'][key] | ||
641 | if '附加产品融资贷款本金总金额' in text: | ||
653 | self.is_asp = True | 642 | self.is_asp = True |
654 | |||
655 | self.gen_init_result(self.is_asp) | 643 | self.gen_init_result(self.is_asp) |
656 | |||
657 | # Page 1 | 644 | # Page 1 |
658 | # 找合同编号 | 645 | # 找合同编号 |
659 | contract_no = self.get_contract_no(page_num='0') | 646 | contract_no = self.get_contract_no(page_num='0') |
... | @@ -663,7 +650,7 @@ class Finder: | ... | @@ -663,7 +650,7 @@ class Finder: |
663 | self.init_result['page_1']['所购车辆价格'] = vehicle_price | 650 | self.init_result['page_1']['所购车辆价格'] = vehicle_price |
664 | # 车架号 | 651 | # 车架号 |
665 | vin = self.get_vin() | 652 | vin = self.get_vin() |
666 | self.init_result['page_1']['车架号'] = vehicle_price | 653 | self.init_result['page_1']['车架号'] = vin |
667 | # 贷款本金金额(如果是 ASP产品)则'贷款本金金额'项目中包含'车辆贷款本金金额'和'附加产品融资贷款本金总金额'两个项目 | 654 | # 贷款本金金额(如果是 ASP产品)则'贷款本金金额'项目中包含'车辆贷款本金金额'和'附加产品融资贷款本金总金额'两个项目 |
668 | upper, lower, asp_1, asp_2 = self.get_loan_principal() | 655 | upper, lower, asp_1, asp_2 = self.get_loan_principal() |
669 | self.init_result['page_1']['贷款本金金额']['大写'] = upper | 656 | self.init_result['page_1']['贷款本金金额']['大写'] = upper |
... | @@ -685,11 +672,14 @@ class Finder: | ... | @@ -685,11 +672,14 @@ class Finder: |
685 | contract_no = self.get_contract_no(page_num='0') | 672 | contract_no = self.get_contract_no(page_num='0') |
686 | self.init_result['page_2']['合同编号'] = contract_no | 673 | self.init_result['page_2']['合同编号'] = contract_no |
687 | # 找借款人及抵押人(地址字段原本有空格) | 674 | # 找借款人及抵押人(地址字段原本有空格) |
675 | borrower_name, borrower_id = self.get_somebody(top='借款人及抵押人:', bottom='共同借款人:') | ||
676 | # 这是为了同时兼容 8.1 版本 | ||
677 | if borrower_name['words'] == None: | ||
688 | borrower_name, borrower_id = self.get_somebody(top='借款人及抵押人:', bottom='共同借款人及共同抵押人:') | 678 | borrower_name, borrower_id = self.get_somebody(top='借款人及抵押人:', bottom='共同借款人及共同抵押人:') |
689 | self.init_result['page_2']['借款人及抵押人']['name'] = borrower_name | 679 | self.init_result['page_2']['借款人及抵押人']['name'] = borrower_name |
690 | self.init_result['page_2']['借款人及抵押人']['id'] = borrower_id | 680 | self.init_result['page_2']['借款人及抵押人']['id'] = borrower_id |
691 | # 找共同借款人及共同抵押人 | 681 | # 找共同借款人及共同抵押人 |
692 | co_borrower_name, co_borrower_id = self.get_somebody(top='共同借款人及共同抵押人:', bottom='保证人1:') | 682 | co_borrower_name, co_borrower_id = self.get_somebody(top='共同借款人:', bottom='保证人1:') |
693 | self.init_result['page_2']['共同借款人及共同抵押人']['name'] = co_borrower_name | 683 | self.init_result['page_2']['共同借款人及共同抵押人']['name'] = co_borrower_name |
694 | self.init_result['page_2']['共同借款人及共同抵押人']['id'] = co_borrower_id | 684 | self.init_result['page_2']['共同借款人及共同抵押人']['id'] = co_borrower_id |
695 | # 保证人1 | 685 | # 保证人1 |
... | @@ -755,11 +745,11 @@ class Finder: | ... | @@ -755,11 +745,11 @@ class Finder: |
755 | contract_no = self.get_contract_no(page_num='6') | 745 | contract_no = self.get_contract_no(page_num='6') |
756 | self.init_result['page_7']['合同编号'] = contract_no | 746 | self.init_result['page_7']['合同编号'] = contract_no |
757 | signature_name, signature_date = self.get_last_page_signature(page_num='6', | 747 | signature_name, signature_date = self.get_last_page_signature(page_num='6', |
758 | top='借款人(抵押人)', bottom='共同借款人(共同抵押人)') | 748 | top='合同编号', bottom='共同借款人') |
759 | self.init_result['page_7']['主借人签字']['签字'] = signature_name | 749 | self.init_result['page_7']['主借人签字']['签字'] = signature_name |
760 | self.init_result['page_7']['主借人签字']['日期'] = signature_date | 750 | self.init_result['page_7']['主借人签字']['日期'] = signature_date |
761 | signature_name, signature_date = self.get_last_page_signature(page_num='6', | 751 | signature_name, signature_date = self.get_last_page_signature(page_num='6', |
762 | top='共同借款人(共同抵押人)', bottom='保证人1') | 752 | top='共同借款人', bottom='保证人1') |
763 | self.init_result['page_7']['共借人签字']['签字'] = signature_name | 753 | self.init_result['page_7']['共借人签字']['签字'] = signature_name |
764 | self.init_result['page_7']['共借人签字']['日期'] = signature_date | 754 | self.init_result['page_7']['共借人签字']['日期'] = signature_date |
765 | signature_name, signature_date = self.get_last_page_signature(page_num='6', | 755 | signature_name, signature_date = self.get_last_page_signature(page_num='6', |
... | @@ -771,7 +761,7 @@ class Finder: | ... | @@ -771,7 +761,7 @@ class Finder: |
771 | self.init_result['page_7']['保证人2签字']['签字'] = signature_name | 761 | self.init_result['page_7']['保证人2签字']['签字'] = signature_name |
772 | self.init_result['page_7']['保证人2签字']['日期'] = signature_date | 762 | self.init_result['page_7']['保证人2签字']['日期'] = signature_date |
773 | signature_name, signature_date = self.get_last_page_signature(page_num='6', | 763 | signature_name, signature_date = self.get_last_page_signature(page_num='6', |
774 | top='在本人面前亲笔签署本合同', bottom='(以下无正文)') | 764 | top='在本人面前亲笔签署本合同', bottom='以下无正文') |
775 | self.init_result['page_7']['见证人签字']['签字'] = signature_name | 765 | self.init_result['page_7']['见证人签字']['签字'] = signature_name |
776 | self.init_result['page_7']['见证人签字']['日期'] = signature_date | 766 | self.init_result['page_7']['见证人签字']['日期'] = signature_date |
777 | else: | 767 | else: |
... | @@ -784,11 +774,11 @@ class Finder: | ... | @@ -784,11 +774,11 @@ class Finder: |
784 | contract_no = self.get_contract_no(page_num='7') | 774 | contract_no = self.get_contract_no(page_num='7') |
785 | self.init_result['page_8']['合同编号'] = contract_no | 775 | self.init_result['page_8']['合同编号'] = contract_no |
786 | signature_name, signature_date = self.get_last_page_signature(page_num='7', | 776 | signature_name, signature_date = self.get_last_page_signature(page_num='7', |
787 | top='借款人(抵押人)', bottom='共同借款人(共同抵押人)') | 777 | top='合同编号', bottom='共同借款人') |
788 | self.init_result['page_8']['主借人签字']['签字'] = signature_name | 778 | self.init_result['page_8']['主借人签字']['签字'] = signature_name |
789 | self.init_result['page_8']['主借人签字']['日期'] = signature_date | 779 | self.init_result['page_8']['主借人签字']['日期'] = signature_date |
790 | signature_name, signature_date = self.get_last_page_signature(page_num='7', | 780 | signature_name, signature_date = self.get_last_page_signature(page_num='7', |
791 | top='共同借款人(共同抵押人)', bottom='保证人1') | 781 | top='共同借款人', bottom='保证人1') |
792 | self.init_result['page_8']['共借人签字']['签字'] = signature_name | 782 | self.init_result['page_8']['共借人签字']['签字'] = signature_name |
793 | self.init_result['page_8']['共借人签字']['日期'] = signature_date | 783 | self.init_result['page_8']['共借人签字']['日期'] = signature_date |
794 | signature_name, signature_date = self.get_last_page_signature(page_num='7', | 784 | signature_name, signature_date = self.get_last_page_signature(page_num='7', |
... | @@ -800,10 +790,9 @@ class Finder: | ... | @@ -800,10 +790,9 @@ class Finder: |
800 | self.init_result['page_8']['保证人2签字']['签字'] = signature_name | 790 | self.init_result['page_8']['保证人2签字']['签字'] = signature_name |
801 | self.init_result['page_8']['保证人2签字']['日期'] = signature_date | 791 | self.init_result['page_8']['保证人2签字']['日期'] = signature_date |
802 | signature_name, signature_date = self.get_last_page_signature(page_num='7', | 792 | signature_name, signature_date = self.get_last_page_signature(page_num='7', |
803 | top='在本人面前亲笔签署本合同', bottom='(以下无正文)') | 793 | top='在本人面前亲笔签署本合同', bottom='以下无正文') |
804 | self.init_result['page_8']['见证人签字']['签字'] = signature_name | 794 | self.init_result['page_8']['见证人签字']['签字'] = signature_name |
805 | self.init_result['page_8']['见证人签字']['日期'] = signature_date | 795 | self.init_result['page_8']['见证人签字']['日期'] = signature_date |
806 | |||
807 | # 重新定制输出 | 796 | # 重新定制输出 |
808 | new_results = {"is_asp": self.is_asp, | 797 | new_results = {"is_asp": self.is_asp, |
809 | "page_info": self.init_result | 798 | "page_info": self.init_result | ... | ... |
-
Please register or sign in to post a comment