shZhang_HuaWeiMatebookD пре 3 недеља
родитељ
комит
e9cb1583f3
2 измењених фајлова са 181 додато и 181 уклоњено
  1. 177 177
      partReport.py
  2. 4 4
      rongzhong.py

+ 177 - 177
partReport.py

@@ -213,14 +213,14 @@ def makeInfoTable(data, doc):
 
 # 生成子报告: 物理指标 常规养分指标 一般化学性指标 重金属指标
 indexClassificationList = {
-    '物理指标': ['pH', '土壤质地', '土壤容重1(g/cm³)', '土壤容重2(g/cm³)', '土壤容重3(g/cm³)',	'土壤容重4(g/cm³)',	'土壤容重平均值(g/cm³)',
+    '物理指标': ['土壤质地', '土壤容重1(g/cm³)', '土壤容重2(g/cm³)', '土壤容重3(g/cm³)',	'土壤容重4(g/cm³)',	'土壤容重平均值(g/cm³)',
                  '2~0.2mm颗粒含量', '0.2~0.02mm颗粒含量',	'0.02~0.002mm颗粒含量',	'0.002mm以下颗粒含量', '水稳>5mm(%)',	'水稳3mm~5mm(%)',
                  '水稳2mm~3mm(%)',	'水稳1mm~2mm(%)',	'水稳0.5mm~1mm(%)',	'水稳0.25mm~0.5mm(%)',	'水稳性大团聚体总和(%)', '洗失量(吸管法需填)', '风干试样含水量(分析基)'],
-    '常规养分指标': ['pH','有机质', '全氮', '全磷', '全钾', '有效磷', '速效钾', '有效硫', '有效硼', '有效铁', '有效锰', '有效铜', '有效锌', '有效钼', '有效硅', '缓效钾'],
+    '常规养分指标': ['有机质', '全氮', '全磷', '全钾', '有效磷', '速效钾', '有效硫', '有效硼', '有效铁', '有效锰', '有效铜', '有效锌', '有效钼', '有效硅', '缓效钾'],
     '一般化学性指标': ['pH','阳离子交换量', '交换性盐基总量', '交换性钙', '交换性镁', '交换性钠', '交换性钾', '全盐量', '电导率',
                        '水溶性Na⁺含量', '水溶性K⁺含量',	'水溶性Ca²⁺含量',	'水溶性Mg²⁺含量',	'水溶性Cl⁻含量', '水溶性CO₃²⁻含量','水溶性HCO₃⁻含量',
                        '水溶性SO₄²⁻含量', '离子总量', '碳酸钙'],
-    '重金属指标': ['pH', '总汞', '总砷', '总铅', '总镉', '总铬', '总镍']
+    '重金属指标': [ '总汞', '总砷', '总铅', '总镉', '总铬', '总镍']
 }
 # 生成物理指标审核报告
 def  getphysicsReport(originData,data,type, changeFileUrl, saveFileUrl, check_1_data,
@@ -324,7 +324,7 @@ def  getphysicsReport(originData,data,type, changeFileUrl, saveFileUrl, check_1_
         table_7_data.to_excel(writer, index=False, sheet_name='超阈值数据')
 
     # 表8数据
-    table_8_data = report.getPHData(physicsData, mkdir_path)
+    #table_8_data = report.getPHData(physicsData, mkdir_path)
 
     # 表13 所有存疑数据
     with pd.ExcelWriter(f'{mkdir_path}/数据审核过程存疑数据一览表.xlsx', engine='openpyxl') as writer:
@@ -547,65 +547,65 @@ def  getphysicsReport(originData,data,type, changeFileUrl, saveFileUrl, check_1_
     # 写入数据 点击查看数据 这里也不一定写的下 最好是嵌入链接
     doc.add_heading('为避免数据量过多无法显示,请至数据保存文件夹中查看数据表:超阈值样品统计表.xlsx', level=4)
     # todo 合并所有数据 审核结果不为空的数据 写入表格保存到指定文件夹
-    doc.add_heading('2、极值法审核', level=2)
-    doc.add_heading('(1)pH', level=3)
+    #doc.add_heading('2、极值法审核', level=2)
+    #doc.add_heading('(1)pH', level=3)
     # 插入ph分布图
-    if os.path.isfile(f'{mkdir_path}/PH值分布图.png'):
-        doc.add_picture(f'{mkdir_path}/PH值分布图.png', width=Inches(6.0))
-    paragraph_t_1 = doc.add_paragraph()
-    paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
-    paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # if os.path.isfile(f'{mkdir_path}/PH值分布图.png'):
+    #     doc.add_picture(f'{mkdir_path}/PH值分布图.png', width=Inches(6.0))
+    # paragraph_t_1 = doc.add_paragraph()
+    # paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
+    # paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
 
     # 插入频度统计表
-    paragraph_8 = doc.add_paragraph()
-    paragraph_8.add_run('表8:pH数据统计表').bold = True
-    table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
-    t_8 = table_8_data['频度分析']
-
-    t_8 = t_8.reset_index()
-    t_8.columns = ['指标', '数据']
-    paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
-    table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
-    for i, row in enumerate(table_8.rows):
-        for j, cell in enumerate(row.cells):
-            # 获取单元格中的段落对象
-            paragraph = cell.paragraphs[0]
-            if i == 0:
-                r = paragraph.add_run(str(t_8.columns[j]))
-                r.font.bold = True
-            else:
-                r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
-            r.font.size = Pt(10.5)
-            r.font.name = 'Times New Roman'
-            r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-            paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-            paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    # paragraph_8 = doc.add_paragraph()
+    # paragraph_8.add_run('表8:pH数据统计表').bold = True
+    # table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
+    # t_8 = table_8_data['频度分析']
+
+    # t_8 = t_8.reset_index()
+    # t_8.columns = ['指标', '数据']
+    # paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
+    # for i, row in enumerate(table_8.rows):
+    #     for j, cell in enumerate(row.cells):
+    #         # 获取单元格中的段落对象
+    #         paragraph = cell.paragraphs[0]
+    #         if i == 0:
+    #             r = paragraph.add_run(str(t_8.columns[j]))
+    #             r.font.bold = True
+    #         else:
+    #             r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
+    #         r.font.size = Pt(10.5)
+    #         r.font.name = 'Times New Roman'
+    #         r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #         paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #         paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #         paragraph.paragraph_format.line_spacing = 1  # 段落行间距
 
     # 插入异常数据提取表格 todo 这里数据多的话也可能写不下 最好是嵌入一下
-    if not table_8_data['异常数据'].empty:
-        paragraph_9 = doc.add_paragraph()
-        paragraph_9.add_run('表9:pH异常数据统计表').bold = True
-        table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
-        t_9 = table_8_data['异常数据']
-
-        paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
-        table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
-        for i, row in enumerate(table_9.rows):
-            for j, cell in enumerate(row.cells):
-                # 获取单元格中的段落对象
-                paragraph = cell.paragraphs[0]
-                if i == 0:
-                    r = paragraph.add_run(str(t_9.columns[j]))
-                    r.font.bold = True
-                else:
-                    r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
-                r.font.size = Pt(10.5)
-                r.font.name = 'Times New Roman'
-                r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-                paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-                paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-                paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    # if not table_8_data['异常数据'].empty:
+    #     paragraph_9 = doc.add_paragraph()
+    #     paragraph_9.add_run('表9:pH异常数据统计表').bold = True
+    #     table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
+    #     t_9 = table_8_data['异常数据']
+    #
+    #     paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    #     table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
+    #     for i, row in enumerate(table_9.rows):
+    #         for j, cell in enumerate(row.cells):
+    #             # 获取单元格中的段落对象
+    #             paragraph = cell.paragraphs[0]
+    #             if i == 0:
+    #                 r = paragraph.add_run(str(t_9.columns[j]))
+    #                 r.font.bold = True
+    #             else:
+    #                 r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
+    #             r.font.size = Pt(10.5)
+    #             r.font.name = 'Times New Roman'
+    #             r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #             paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #             paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #             paragraph.paragraph_format.line_spacing = 1  # 段落行间距
     doc.add_heading('四、审核存疑数据', level=1)
     paragraph_12 = doc.add_paragraph()
     paragraph_12.add_run(f'表10:数据审核过程存疑数据一览表').bold = True
@@ -819,7 +819,7 @@ def getConventionalNutrientIndicators(originData,data,type, changeFileUrl, saveF
         table_7_data.to_excel(writer, index=False, sheet_name='超阈值数据')
 
     # 表8数据
-    table_8_data = report.getPHData(ConventionalNutrientData, mkdir_path)
+    #table_8_data = report.getPHData(ConventionalNutrientData, mkdir_path)
 
     # 表10 数据
     table_10_data = report.getNAndC(ConventionalNutrientData, mkdir_path)
@@ -1049,65 +1049,65 @@ def getConventionalNutrientIndicators(originData,data,type, changeFileUrl, saveF
     # 写入数据 点击查看数据 这里也不一定写的下 最好是嵌入链接
     doc.add_heading('为避免数据量过多无法显示,请至数据保存文件夹中查看数据表:数据审核过程存疑数据一览表.xlsx', level=4)
     # todo 合并所有数据 审核结果不为空的数据 写入表格保存到指定文件夹
-    doc.add_heading('2、极值法审核', level=2)
-    doc.add_heading('(1)pH', level=3)
+    #doc.add_heading('2、极值法审核', level=2)
+    #doc.add_heading('(1)pH', level=3)
     # 插入ph分布图
-    if os.path.isfile(f'{mkdir_path}/PH值分布图.png'):
-        doc.add_picture(f'{mkdir_path}/PH值分布图.png', width=Inches(6.0))
-    paragraph_t_1 = doc.add_paragraph()
-    paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
-    paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
-
-    # 插入频度统计表
-    paragraph_8 = doc.add_paragraph()
-    paragraph_8.add_run('表7:pH数据统计表').bold = True
-    table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
-    t_8 = table_8_data['频度分析']
-
-    t_8 = t_8.reset_index()
-    t_8.columns = ['指标', '数据']
-    paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
-    table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
-    for i, row in enumerate(table_8.rows):
-        for j, cell in enumerate(row.cells):
-            # 获取单元格中的段落对象
-            paragraph = cell.paragraphs[0]
-            if i == 0:
-                r = paragraph.add_run(str(t_8.columns[j]))
-                r.font.bold = True
-            else:
-                r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
-            r.font.size = Pt(10.5)
-            r.font.name = 'Times New Roman'
-            r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-            paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-            paragraph.paragraph_format.line_spacing = 1  # 段落行间距
-
-    # 插入异常数据提取表格 todo 这里数据多的话也可能写不下 最好是嵌入一下
-    if not table_8_data['异常数据'].empty:
-        paragraph_9 = doc.add_paragraph()
-        paragraph_9.add_run('表8:pH异常数据统计表').bold = True
-        table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
-        t_9 = table_8_data['异常数据']
-
-        paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
-        table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
-        for i, row in enumerate(table_9.rows):
-            for j, cell in enumerate(row.cells):
-                # 获取单元格中的段落对象
-                paragraph = cell.paragraphs[0]
-                if i == 0:
-                    r = paragraph.add_run(str(t_9.columns[j]))
-                    r.font.bold = True
-                else:
-                    r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
-                r.font.size = Pt(10.5)
-                r.font.name = 'Times New Roman'
-                r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-                paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-                paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-                paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    # if os.path.isfile(f'{mkdir_path}/PH值分布图.png'):
+    #     doc.add_picture(f'{mkdir_path}/PH值分布图.png', width=Inches(6.0))
+    # paragraph_t_1 = doc.add_paragraph()
+    # paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
+    # paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    #
+    # # 插入频度统计表
+    # paragraph_8 = doc.add_paragraph()
+    # paragraph_8.add_run('表7:pH数据统计表').bold = True
+    # table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
+    # t_8 = table_8_data['频度分析']
+    #
+    # t_8 = t_8.reset_index()
+    # t_8.columns = ['指标', '数据']
+    # paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
+    # for i, row in enumerate(table_8.rows):
+    #     for j, cell in enumerate(row.cells):
+    #         # 获取单元格中的段落对象
+    #         paragraph = cell.paragraphs[0]
+    #         if i == 0:
+    #             r = paragraph.add_run(str(t_8.columns[j]))
+    #             r.font.bold = True
+    #         else:
+    #             r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
+    #         r.font.size = Pt(10.5)
+    #         r.font.name = 'Times New Roman'
+    #         r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #         paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #         paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #         paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    #
+    # # 插入异常数据提取表格 todo 这里数据多的话也可能写不下 最好是嵌入一下
+    # if not table_8_data['异常数据'].empty:
+    #     paragraph_9 = doc.add_paragraph()
+    #     paragraph_9.add_run('表8:pH异常数据统计表').bold = True
+    #     table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
+    #     t_9 = table_8_data['异常数据']
+    #
+    #     paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    #     table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
+    #     for i, row in enumerate(table_9.rows):
+    #         for j, cell in enumerate(row.cells):
+    #             # 获取单元格中的段落对象
+    #             paragraph = cell.paragraphs[0]
+    #             if i == 0:
+    #                 r = paragraph.add_run(str(t_9.columns[j]))
+    #                 r.font.bold = True
+    #             else:
+    #                 r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
+    #             r.font.size = Pt(10.5)
+    #             r.font.name = 'Times New Roman'
+    #             r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #             paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #             paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #             paragraph.paragraph_format.line_spacing = 1  # 段落行间距
 
     doc.add_heading('3、关联分析法审核', level=2)
     if os.path.isfile(f'{mkdir_path}/有机质与全氮相关性散点图.png'):
@@ -1948,7 +1948,7 @@ def getHeavyMetalIndicators(originData, data, type, changeFileUrl, saveFileUrl,
         table_7_data.to_excel(writer, index=False, sheet_name='超阈值数据')
 
     # 表8数据
-    table_8_data = report.getPHData(heavyMetaData, mkdir_path)
+    #table_8_data = report.getPHData(heavyMetaData, mkdir_path)
 
 
     # 表12数据 重金属超标
@@ -2187,65 +2187,65 @@ def getHeavyMetalIndicators(originData, data, type, changeFileUrl, saveFileUrl,
     # 写入数据 点击查看数据 这里也不一定写的下 最好是嵌入链接
     doc.add_heading('为避免数据量过多无法显示,请至数据保存文件夹中查看数据表:数据审核过程存疑数据一览表.xlsx', level=4)
     # todo 合并所有数据 审核结果不为空的数据 写入表格保存到指定文件夹
-    doc.add_heading('2、极值法审核', level=2)
-    doc.add_heading('(1)pH', level=3)
-    # 插入ph分布图
-    if os.path.isfile(f'{mkdir_path}/pH值分布图.png'):
-        doc.add_picture(f'{mkdir_path}/pH值分布图.png', width=Inches(6.0))
-    paragraph_t_1 = doc.add_paragraph()
-    paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
-    paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
-
-    # 插入频度统计表
-    paragraph_8 = doc.add_paragraph()
-    paragraph_8.add_run('表7:pH数据统计表').bold = True
-    table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
-    t_8 = table_8_data['频度分析']
-
-    t_8 = t_8.reset_index()
-    t_8.columns = ['指标', '数据']
-    paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
-    table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
-    for i, row in enumerate(table_8.rows):
-        for j, cell in enumerate(row.cells):
-            # 获取单元格中的段落对象
-            paragraph = cell.paragraphs[0]
-            if i == 0:
-                r = paragraph.add_run(str(t_8.columns[j]))
-                r.font.bold = True
-            else:
-                r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
-            r.font.size = Pt(10.5)
-            r.font.name = 'Times New Roman'
-            r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-            paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-            paragraph.paragraph_format.line_spacing = 1  # 段落行间距
-
-    # 插入异常数据提取表格 todo 这里数据多的话也可能写不下 最好是嵌入一下
-    if not table_8_data['异常数据'].empty:
-        paragraph_9 = doc.add_paragraph()
-        paragraph_9.add_run('表8:pH异常数据统计表').bold = True
-        table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
-        t_9 = table_8_data['异常数据']
-
-        paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
-        table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
-        for i, row in enumerate(table_9.rows):
-            for j, cell in enumerate(row.cells):
-                # 获取单元格中的段落对象
-                paragraph = cell.paragraphs[0]
-                if i == 0:
-                    r = paragraph.add_run(str(t_9.columns[j]))
-                    r.font.bold = True
-                else:
-                    r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
-                r.font.size = Pt(10.5)
-                r.font.name = 'Times New Roman'
-                r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
-                paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
-                paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
-                paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    # doc.add_heading('2、极值法审核', level=2)
+    # doc.add_heading('(1)pH', level=3)
+    # # 插入ph分布图
+    # if os.path.isfile(f'{mkdir_path}/pH值分布图.png'):
+    #     doc.add_picture(f'{mkdir_path}/pH值分布图.png', width=Inches(6.0))
+    # paragraph_t_1 = doc.add_paragraph()
+    # paragraph_t_1.add_run(f'图1:pH值分布情况').bold = True
+    # paragraph_t_1.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    #
+    # # 插入频度统计表
+    # paragraph_8 = doc.add_paragraph()
+    # paragraph_8.add_run('表7:pH数据统计表').bold = True
+    # table_8 = doc.add_table(rows=6, cols=2, style='Light Shading Accent 1')
+    # t_8 = table_8_data['频度分析']
+    #
+    # t_8 = t_8.reset_index()
+    # t_8.columns = ['指标', '数据']
+    # paragraph_8.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    # table_8.alignment = WD_TABLE_ALIGNMENT.CENTER
+    # for i, row in enumerate(table_8.rows):
+    #     for j, cell in enumerate(row.cells):
+    #         # 获取单元格中的段落对象
+    #         paragraph = cell.paragraphs[0]
+    #         if i == 0:
+    #             r = paragraph.add_run(str(t_8.columns[j]))
+    #             r.font.bold = True
+    #         else:
+    #             r = paragraph.add_run(str(t_8.iloc[i - 1, j]))
+    #         r.font.size = Pt(10.5)
+    #         r.font.name = 'Times New Roman'
+    #         r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #         paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #         paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #         paragraph.paragraph_format.line_spacing = 1  # 段落行间距
+    #
+    # # 插入异常数据提取表格 todo 这里数据多的话也可能写不下 最好是嵌入一下
+    # if not table_8_data['异常数据'].empty:
+    #     paragraph_9 = doc.add_paragraph()
+    #     paragraph_9.add_run('表8:pH异常数据统计表').bold = True
+    #     table_9 = doc.add_table(rows=len(table_8_data['异常数据']) + 1, cols=6, style='Light Shading Accent 1')
+    #     t_9 = table_8_data['异常数据']
+    #
+    #     paragraph_9.alignment = WD_ALIGN_PARAGRAPH.CENTER
+    #     table_9.alignment = WD_TABLE_ALIGNMENT.CENTER
+    #     for i, row in enumerate(table_9.rows):
+    #         for j, cell in enumerate(row.cells):
+    #             # 获取单元格中的段落对象
+    #             paragraph = cell.paragraphs[0]
+    #             if i == 0:
+    #                 r = paragraph.add_run(str(t_9.columns[j]))
+    #                 r.font.bold = True
+    #             else:
+    #                 r = paragraph.add_run(str(t_9.iloc[i - 1, j]))
+    #             r.font.size = Pt(10.5)
+    #             r.font.name = 'Times New Roman'
+    #             r.element.rPr.rFonts.set(qn('w:eastAsia'), u'仿宋_GB2312')
+    #             paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
+    #             paragraph.paragraph_format.alignment = WD_TABLE_ALIGNMENT.CENTER  # 对齐
+    #             paragraph.paragraph_format.line_spacing = 1  # 段落行间距
 
 
     doc.add_heading('4、指标综合分析', level=2)

+ 4 - 4
rongzhong.py

@@ -308,8 +308,8 @@ def checkData(fileUrl):
                         simpleData[i] = pd.to_numeric(simpleData[i], errors='coerce')
                 # 处理重复样品
 
-                res = getRepeat(simpleData)
-                simpleData = simpleData._append(res).drop_duplicates(subset=['原样品编号'], keep='last')
+                #res = getRepeat(simpleData)
+                #simpleData = simpleData._append(res).drop_duplicates(subset=['原样品编号'], keep='last')
                 jCData = simpleData[['土壤容重1(g/cm³)', '土壤容重2(g/cm³)', '土壤容重3(g/cm³)', '土壤容重4(g/cm³)']]
                 # 计算土壤容重均值
                 rZMean = round(simpleData[['土壤容重1(g/cm³)', '土壤容重2(g/cm³)', '土壤容重3(g/cm³)', '土壤容重4(g/cm³)']].mean(
@@ -1579,8 +1579,8 @@ def dealData(data):
         if i not in strList:
             simpleData[i] = pd.to_numeric(simpleData[i], errors='coerce')
     # 处理重复样品
-    res = getRepeat(simpleData)
-    simpleData = simpleData._append(res).drop_duplicates(subset=['原样品编号'], keep='last')
+    #res = getRepeat(simpleData)
+    #simpleData = simpleData._append(res).drop_duplicates(subset=['原样品编号'], keep='last')
 
     return simpleData