This commit is contained in:
liubiren 2026-01-13 22:04:45 +08:00
parent 47968cf5a1
commit 31be8277bf
21 changed files with 160 additions and 184 deletions

View File

@ -90,12 +90,12 @@ def receipt_adjust(
# 初始化理算记录
adjustments = []
# 初始化票据剩余理算金额
remaining_adjustment_amount = masterdata.query_remaining_adjustment_amount(
receipt_number=receipt["number"],
# 初始化票据剩余金额
remaining_amount = masterdata.query_remaining_amount(
number=receipt["number"],
)
if remaining_adjustment_amount is None:
remaining_adjustment_amount = (
if remaining_amount is None:
remaining_amount = (
receipt["personal_self_payment"] # 个人自费金额
+ receipt["non_medical_payment"] # 个人自付金额
+ receipt["reasonable_amount"] # 合理金额
@ -152,7 +152,7 @@ def receipt_adjust(
adjustment_amount = max(
Decimal("0.00"),
min(
remaining_adjustment_amount, # 剩余理算金额
remaining_amount, # 票据剩余金额
remaining_coverage_amount, # 个单剩余保额
adjustable_amount := (
(
@ -198,12 +198,12 @@ def receipt_adjust(
"reasonable_amount": receipt["reasonable_amount"], # 合理金额
"reasonable_ratio": liability["reasonable_ratio"], # 合理理算比例
"reasonable_adjustable_amount": reasonable_adjustable_amount, # 合理可理算金额
"remaining_adjustment_amount": remaining_adjustment_amount, # 剩余理算金额
"remaining_amount": remaining_amount, # 票据剩余金额
"remaining_coverage_amount": remaining_coverage_amount, # 个单剩余保额
"adjustable_amount": adjustable_amount, # 可理算金额
"adjustment_amount": adjustment_amount, # 理算金额
"adjustment_explanation": f"""
1剩余理算金额{remaining_adjustment_amount:.2f}
1票据剩余金额{remaining_amount:.2f}
2个单剩余保额{remaining_coverage_amount:.2f}
3可理算金额{adjustable_amount:.2f}其中
1个人自费可理算金额{personal_self_adjustable_amount:.2f}={receipt['personal_self_payment']:.2f}*{liability['personal_self_ratio']:.2f}%
@ -218,9 +218,9 @@ def receipt_adjust(
}
)
remaining_adjustment_amount -= adjustment_amount
# 若剩余理算金额小于等于0则跳出循环
if remaining_adjustment_amount <= Decimal("0.00"):
remaining_amount -= adjustment_amount
# 若票据剩余金额小于等于0则跳出循环
if remaining_amount <= Decimal("0.00"):
break
if not adjustments:
@ -241,7 +241,7 @@ def receipt_adjust(
"reasonable_amount": receipt["reasonable_amount"], # 合理金额
"reasonable_ratio": None, # 合理理算比例
"reasonable_adjustable_amount": None, # 合理可理算金额
"remaining_adjustment_amount": remaining_adjustment_amount, # 剩余理算金额
"remaining_amount": remaining_amount, # 票据剩余金额
"remaining_coverage_amount": None, # 个单剩余保额
"adjustable_amount": None, # 可理算金额
"adjustment_amount": Decimal("0.00"), # 理算金额
@ -250,9 +250,9 @@ def receipt_adjust(
)
# 新增理算记录
masterdata.add_ajustment(
receipt_number=receipt["number"],
remaining_adjustment_amount=remaining_adjustment_amount,
masterdata.add_receipt_adjustment(
number=receipt["number"],
remaining_amount=remaining_amount,
)
return adjustments

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 216 KiB

View File

Before

Width:  |  Height:  |  Size: 430 KiB

After

Width:  |  Height:  |  Size: 430 KiB

View File

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 223 KiB

View File

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

View File

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 251 KiB

View File

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

View File

Before

Width:  |  Height:  |  Size: 246 KiB

After

Width:  |  Height:  |  Size: 246 KiB

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

Before

Width:  |  Height:  |  Size: 260 KiB

After

Width:  |  Height:  |  Size: 260 KiB

View File

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 254 KiB

View File

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

View File

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 143 KiB

View File

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 321 KiB

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>票据理赔自动化报告</title>
<title>票据理赔自动化</title>
<style>
:root {
--arcoblue-1: #e8f3ff;
@ -116,7 +116,7 @@
position: relative;
}
.header-content {
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
@ -188,11 +188,6 @@
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
transform: translateY(-2px);
box-shadow: var(--box-shadow-hover);
}
.card h3 {
color: var(--color-primary);
font-size: 14px;
@ -379,33 +374,18 @@
color: var(--color-danger);
font-weight: 500;
}
@media (max-width: 768px) {
.header-content {
flex-direction: column;
align-items: flex-start;
}
.insurance-logo {
margin-top: var(--spacing-md);
}
.invoice-details {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<div class="header-content">
<div class="header-container">
<div>
<h1>254728869001理算报告</h1>
<h1>理赔报告</h1>
<div class="header-info">
<p>
保险分公司: 中银保险有限公司苏州分公司 |
报案时间: 2025-07-25 12:00:00
保险分公司名称: 中银保险有限公司苏州分公司 |
报案时间: 2025-07-25 12:00:00 | 赔案号254728869001
</p>
</div>
</div>
@ -429,105 +409,105 @@
<tr>
<td>03</td>
<td>254728869001/insurant_1.jpg</td>
<td>image_03.jpg</td>
<td>居民身份证(国徽、头像面)</td>
<td></td>
</tr>
<tr>
<td>02</td>
<td>254728869001/beneficiary_1.jpg</td>
<td>image_02.jpg</td>
<td>银行卡</td>
<td>否,无需识别</td>
</tr>
<tr>
<td>01</td>
<td>254728869001/application_1.jpg</td>
<td>image_01.jpg</td>
<td>理赔申请书</td>
<td></td>
</tr>
<tr>
<td>04</td>
<td>254728869001/invoice_1.jpg</td>
<td>image_04.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>05</td>
<td>254728869001/invoice_10.jpg</td>
<td>image_13.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>06</td>
<td>254728869001/invoice_11.jpg</td>
<td>image_15.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>07</td>
<td>254728869001/invoice_12.jpg</td>
<td>image_05.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>08</td>
<td>254728869001/invoice_2.jpg</td>
<td>image_06.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>09</td>
<td>254728869001/invoice_3.jpg</td>
<td>image_07.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>10</td>
<td>254728869001/invoice_4.jpg</td>
<td>image_08.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>11</td>
<td>254728869001/invoice_5.jpg</td>
<td>image_09.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>12</td>
<td>254728869001/invoice_6.jpg</td>
<td>image_10.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>13</td>
<td>254728869001/invoice_7.jpg</td>
<td>image_11.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>14</td>
<td>254728869001/invoice_8.jpg</td>
<td>image_12.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
<tr>
<td>15</td>
<td>254728869001/invoice_9.jpg</td>
<td>image_14.jpg</td>
<td>增值税发票</td>
<td></td>
</tr>
@ -618,7 +598,7 @@
</div>
</div>
<div class="card">
<h3>在保个单</h3>
<h3>可理赔责任</h3>
<table>
<thead>
<tr>
@ -672,7 +652,7 @@
<div class="detail-item">
<div class="detail-label">理算金额</div>
<div class="detail-value">
1860.94
0.00
</div>
</div>
<div class="detail-item">
@ -694,9 +674,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_11.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_14.jpg"
target="_blank"
>06</a
>15</a
></span
>
</div>
@ -793,7 +773,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -834,9 +814,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_12.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_15.jpg"
target="_blank"
>07</a
>06</a
></span
>
</div>
@ -942,7 +922,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -983,9 +963,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_8.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_11.jpg"
target="_blank"
>14</a
>13</a
></span
>
</div>
@ -1082,7 +1062,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1123,9 +1103,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_7.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_10.jpg"
target="_blank"
>13</a
>12</a
></span
>
</div>
@ -1222,7 +1202,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1237,22 +1217,22 @@
<tbody>
<tr>
<td>607.00</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>5000.00</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>607.00</td>
<td>607.00</td>
<td>607.00</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 607.00元
理算金额合计: 0.00元
</div>
</div>
@ -1263,9 +1243,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_6.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_09.jpg"
target="_blank"
>12</a
>11</a
></span
>
</div>
@ -1362,7 +1342,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1377,22 +1357,22 @@
<tbody>
<tr>
<td>607.00</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>4393.00</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>607.00</td>
<td>607.00</td>
<td>607.00</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 607.00元
理算金额合计: 0.00元
</div>
</div>
@ -1403,7 +1383,7 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_10.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_13.jpg"
target="_blank"
>05</a
></span
@ -1502,7 +1482,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1517,22 +1497,22 @@
<tbody>
<tr>
<td>119.56</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3786.00</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>119.56</td>
<td>119.56</td>
<td>119.56</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 119.56
理算金额合计: 0.00
</div>
</div>
@ -1543,9 +1523,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_9.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_12.jpg"
target="_blank"
>15</a
>14</a
></span
>
</div>
@ -1642,7 +1622,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1657,22 +1637,22 @@
<tbody>
<tr>
<td>123.48</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3666.44</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>123.48</td>
<td>123.48</td>
<td>123.48</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 123.48
理算金额合计: 0.00
</div>
</div>
@ -1683,7 +1663,7 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_1.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_04.jpg"
target="_blank"
>04</a
></span
@ -1791,7 +1771,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1806,22 +1786,22 @@
<tbody>
<tr>
<td>13.00</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3542.96</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>13.00</td>
<td>13.00</td>
<td>13.00</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 13.00元
理算金额合计: 0.00元
</div>
</div>
@ -1832,9 +1812,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_2.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_05.jpg"
target="_blank"
>08</a
>07</a
></span
>
</div>
@ -1940,7 +1920,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -1958,7 +1938,7 @@
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3529.96</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
@ -1981,9 +1961,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_4.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_07.jpg"
target="_blank"
>10</a
>09</a
></span
>
</div>
@ -2080,7 +2060,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -2095,22 +2075,22 @@
<tbody>
<tr>
<td>131.50</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3529.96</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>131.50</td>
<td>131.50</td>
<td>131.50</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 131.50元
理算金额合计: 0.00元
</div>
</div>
@ -2121,9 +2101,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_5.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_08.jpg"
target="_blank"
>11</a
>10</a
></span
>
</div>
@ -2220,7 +2200,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -2235,22 +2215,22 @@
<tbody>
<tr>
<td>156.20</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3398.46</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>156.20</td>
<td>156.20</td>
<td>156.20</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 156.20元
理算金额合计: 0.00元
</div>
</div>
@ -2261,9 +2241,9 @@
<span class="invoice-reference"
>关联影像件:
<a
href="file:////Users/liubiren/Python/票据理赔自动化/directory/254728869001/invoice_3.jpg"
href="file:///c:/Users/admin/Documents/trae_projects/python/票据理赔自动化/directory/254728869001/image_06.jpg"
target="_blank"
>09</a
>08</a
></span
>
</div>
@ -2360,7 +2340,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -2375,22 +2355,22 @@
<tbody>
<tr>
<td>103.20</td>
<td>0.00</td>
<td>3291120253201000000001</td>
<td>320602197401310029</td>
<td>3242.26</td>
<td>3139.06</td>
<td>药店购药补充</td>
<td>0.00</td>
<td>0.00</td>
<td>103.20</td>
<td>103.20</td>
<td>103.20</td>
<td>0.00</td>
</tr>
</tbody>
</table>
<div class="amount-total">
理算金额合计: 103.20元
理算金额合计: 0.00元
</div>
</div>

View File

@ -118,7 +118,7 @@ def image_classify(image_index: int, image_path: Path, dossier: Dict[str, Any])
# 将已分类影像件添加至影像件层
dossier["images_layer"][f"{image_index:02d}"] = {
"image_path": image_path.as_posix(), # 影像件路径
"image_relative_path": image_path.relative_to(image_path.parent.parent).as_posix(), # 影像件相对路径
"image_name": image_path.name, # 影像件名称
"image_format": image_format, # 影像件格式
"image_guid": image_guid, # 影像件唯一标识
"image_base64": image_base64, # 影像件BASE64编码

View File

@ -161,12 +161,14 @@ class MasterData(SQLite):
# 初始化票据理算表
self.execute(
sql="""
CREATE TABLE IF NOT EXISTS adjustments
CREATE TABLE IF NOT EXISTS receipt_adjustments
(
--理算记录唯一标识
guid TEXT PRIMARY KEY,
--票据号
receipt_number TEXT PRIMARY KEY,
--剩余理算金额
remaining_adjustment_amount TEXT NOT NULL,
number TEXT NOT NULL,
--剩余金额
remaining_amount TEXT NOT NULL,
--理算时间
adjust_time TEXT NOT NULL
)
@ -323,31 +325,31 @@ class MasterData(SQLite):
except Exception as exception:
raise RuntimeError(f"{str(exception)}") from exception
def query_remaining_adjustment_amount(
def query_remaining_amount(
self,
receipt_number: str,
number: str,
) -> Optional[Decimal]:
"""
根据票据号查询剩余理算金额
:param receipt_number: 票据号
:return: 剩余理算金额
根据票据号查询剩余金额
:param number: 票据号
:return: 剩余金额
"""
try:
with self:
result = self.query_one(
sql="""
SELECT remaining_adjustment_amount
FROM adjustments
WHERE receipt_number = ?
SELECT remaining_amount
FROM receipt_adjustments
WHERE number = ?
ORDER BY adjust_time DESC
LIMIT 1;
""",
parameters=(receipt_number,),
parameters=(number,),
)
if not result:
return None
return Decimal(result["remaining_adjustment_amount"]).quantize(
return Decimal(result["remaining_amount"]).quantize(
Decimal("0.00"),
rounding=ROUND_HALF_UP,
)
@ -355,34 +357,47 @@ class MasterData(SQLite):
except Exception as exception:
raise RuntimeError(f"{str(exception)}") from exception
def add_ajustment(
def add_receipt_adjustment(
self,
receipt_number: str,
remaining_adjustment_amount: Decimal,
number: str,
remaining_amount: Decimal,
) -> None:
"""
新增理算记录
:param receipt_number: 票据号
:param remaining_adjustment_amount: 剩余理算金额
新增票据理算记录
:param number: 票据号
:param remaining_amount: 剩余金额
:return:
"""
if remaining_adjustment_amount < Decimal("0.00"):
raise ValueError("剩余理算金额小于0")
if remaining_amount < Decimal("0.00"):
raise ValueError("剩余金额小于0")
# 当前时间
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
# 构建票据理算记录唯一标识
guid = (
md5(
string=f"{number} {remaining_amount:.2f} {current_time}".encode(
"utf-8"
)
)
.hexdigest()
.upper()
)
with self:
if not self.execute(
sql="""
INSERT INTO adjustments
(receipt_number, remaining_adjustment_amount, adjust_time)
INSERT INTO receipt_adjustments
(guid, number, remaining_amount, adjust_time)
VALUES
(?, ?, ?)
(?, ?, ?, ?)
""",
parameters=(
receipt_number,
f"{remaining_adjustment_amount:.2f}",
guid,
number,
f"{remaining_amount:.2f}",
current_time,
),
):

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>票据理赔自动化报告</title>
<title>票据理赔自动化</title>
<style>
:root {
--arcoblue-1: #e8f3ff;
@ -116,7 +116,7 @@
position: relative;
}
.header-content {
.header-container {
display: flex;
justify-content: space-between;
align-items: center;
@ -188,11 +188,6 @@
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
transform: translateY(-2px);
box-shadow: var(--box-shadow-hover);
}
.card h3 {
color: var(--color-primary);
font-size: 14px;
@ -379,34 +374,20 @@
color: var(--color-danger);
font-weight: 500;
}
@media (max-width: 768px) {
.header-content {
flex-direction: column;
align-items: flex-start;
}
.insurance-logo {
margin-top: var(--spacing-md);
}
.invoice-details {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<div class="header-content">
<div class="header-container">
<div>
<h1>{{ obj["report_layer"]["case_number"] }}理算报告</h1>
<h1>理赔报告</h1>
<div class="header-info">
<p>
保险分公司: {{ obj["report_layer"]["insurer_company"] }} |
保险分公司名称: {{ obj["report_layer"]["insurer_company"] }} |
报案时间: {{ obj["report_layer"]["report_time"] |
datetime_to_str }}
datetime_to_str }} | 赔案号:{{
obj["report_layer"]["case_number"] }}
</p>
</div>
</div>
@ -432,7 +413,7 @@
{% for image_index,image in obj["images_layer"].items() %}
<tr>
<td>{{ image_index }}</td>
<td>{{ image["image_relative_path"] }}</td>
<td>{{ image["image_name"] }}</td>
<td>{{ image["image_type"] }}</td>
<td>{{ image["image_recognized"] }}</td>
</tr>
@ -529,7 +510,7 @@
</div>
</div>
<div class="card">
<h3>在保个单</h3>
<h3>可理赔责任</h3>
<table>
<thead>
<tr>
@ -702,7 +683,7 @@
<table>
<thead>
<tr>
<th>剩余理算金额</th>
<th>票据剩余金额</th>
<th>团单号</th>
<th>个单号</th>
<th>个单剩余保额</th>
@ -717,7 +698,7 @@
<tbody>
{% for adjustment in receipt["adjustments"] %}
<tr>
<td>{{ adjustment["remaining_adjustment_amount"] }}</td>
<td>{{ adjustment["remaining_amount"] }}</td>
<td>{{ adjustment["group_policy"] }}</td>
<td>{{ adjustment["person_policy"] }}</td>
<td>{{ adjustment["remaining_coverage_amount"] }}</td>