20251203
This commit is contained in:
1 parent
7b02657d6d
commit
1036605b50
6 files changed
+761
-281
No files matched your search
+483
-164
@@ -2793,9 +2793,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "08bcbf58-4356-4f30-850f-0d0ff0e2528b",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 第三次体测(2024年10月)"
|
||||
]
|
||||
@@ -3205,26 +3203,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "98d2da23-cfd4-461a-890a-4533f0409712",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-11-12T03:00:45.476616Z",
|
||||
"iopub.status.busy": "2024-11-12T03:00:45.475867Z",
|
||||
"iopub.status.idle": "2024-11-12T03:00:48.668118Z",
|
||||
"shell.execute_reply": "2024-11-12T03:00:48.667607Z",
|
||||
"shell.execute_reply.started": "2024-11-12T03:00:45.476543Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
@@ -3265,12 +3247,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 48,
|
||||
"id": "9dcbc866-2481-4cf6-a563-df4bb6596dfd",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-03T13:04:55.617841Z",
|
||||
"iopub.status.busy": "2025-12-03T13:04:55.617249Z",
|
||||
"iopub.status.idle": "2025-12-03T13:04:56.054475Z",
|
||||
"shell.execute_reply": "2025-12-03T13:04:56.053478Z",
|
||||
"shell.execute_reply.started": "2025-12-03T13:04:55.617812Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
@@ -3318,26 +3315,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"id": "e92d76a8-6841-4a1b-8529-caa5e37d624a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-11-22T02:08:10.643448Z",
|
||||
"iopub.status.busy": "2024-11-22T02:08:10.642748Z",
|
||||
"iopub.status.idle": "2024-11-22T02:08:12.178978Z",
|
||||
"shell.execute_reply": "2024-11-22T02:08:12.178427Z",
|
||||
"shell.execute_reply.started": "2024-11-22T02:08:10.643386Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
@@ -3415,26 +3396,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": null,
|
||||
"id": "c101eccb-a2f3-4404-9583-682cec049160",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-21T13:09:40.491935Z",
|
||||
"iopub.status.busy": "2025-11-21T13:09:40.491689Z",
|
||||
"iopub.status.idle": "2025-11-21T13:09:41.068111Z",
|
||||
"shell.execute_reply": "2025-11-21T13:09:41.067547Z",
|
||||
"shell.execute_reply.started": "2025-11-21T13:09:40.491915Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"5057 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -3471,26 +3436,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"id": "85bae94e-f480-4c0b-a120-e516e6a5c14d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-10T10:34:12.756830Z",
|
||||
"iopub.status.busy": "2025-11-10T10:34:12.756579Z",
|
||||
"iopub.status.idle": "2025-11-10T10:34:12.798482Z",
|
||||
"shell.execute_reply": "2025-11-10T10:34:12.797837Z",
|
||||
"shell.execute_reply.started": "2025-11-10T10:34:12.756807Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"5053 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -3523,28 +3472,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"id": "0bebc944-ffa0-4bc9-8ae5-5643fe1015dd",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-25T09:08:42.753636Z",
|
||||
"iopub.status.busy": "2025-11-25T09:08:42.752981Z",
|
||||
"iopub.status.idle": "2025-11-25T09:08:42.813419Z",
|
||||
"shell.execute_reply": "2025-11-25T09:08:42.812811Z",
|
||||
"shell.execute_reply.started": "2025-11-25T09:08:42.753578Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"03603055 赵文远 电仪部-电气作业一区\n",
|
||||
"03603051 李英豪 电仪部-电气作业一区\n",
|
||||
"5060 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -3584,26 +3515,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"id": "52de3ba0-f430-444b-87e9-1f13c3e2dcc2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-29T12:48:41.369858Z",
|
||||
"iopub.status.busy": "2025-11-29T12:48:41.369285Z",
|
||||
"iopub.status.idle": "2025-11-29T12:48:41.616095Z",
|
||||
"shell.execute_reply": "2025-11-29T12:48:41.615602Z",
|
||||
"shell.execute_reply.started": "2025-11-29T12:48:41.369808Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"3749\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -3615,7 +3530,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20251129.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"re_ta = My.get_result_2023(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_天津石化2025.json'\n",
|
||||
@@ -3634,17 +3549,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"id": "04990b9f-a8f9-4442-935e-d223fde24e72",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-30T09:11:15.004533Z",
|
||||
"iopub.status.busy": "2025-11-30T09:11:15.003858Z",
|
||||
"iopub.status.idle": "2025-11-30T09:11:15.536091Z",
|
||||
"shell.execute_reply": "2025-11-30T09:11:15.535622Z",
|
||||
"shell.execute_reply.started": "2025-11-30T09:11:15.004455Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -3686,23 +3593,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"id": "fcb3c816-5260-4807-9536-b8203680ed1c",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-26T12:46:57.881794Z",
|
||||
"iopub.status.busy": "2025-11-26T12:46:57.881481Z",
|
||||
"iopub.status.idle": "2025-11-26T12:46:57.922877Z",
|
||||
"shell.execute_reply": "2025-11-26T12:46:57.922323Z",
|
||||
"shell.execute_reply.started": "2025-11-26T12:46:57.881771Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/result_天津石化2025.json'\n",
|
||||
"filename = 'data/result_天津石化2025-2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
@@ -3733,7 +3632,7 @@
|
||||
" list2 = [k,v['人数'],v['体测人数']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"\n",
|
||||
"filename = 'data/天津石化部门测试情况(截至20241126).xlsx'\n",
|
||||
"filename = 'data/天津石化部门测试情况(截至20241130).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -3753,17 +3652,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"id": "df8b9405-a2d9-413d-bcf4-205704b0243a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-26T12:47:05.652854Z",
|
||||
"iopub.status.busy": "2025-11-26T12:47:05.652259Z",
|
||||
"iopub.status.idle": "2025-11-26T12:47:05.810426Z",
|
||||
"shell.execute_reply": "2025-11-26T12:47:05.809906Z",
|
||||
"shell.execute_reply.started": "2025-11-26T12:47:05.652799Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -3806,17 +3697,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"id": "06979464-2285-4862-94de-84e772f44bbf",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-29T13:28:01.451927Z",
|
||||
"iopub.status.busy": "2025-11-29T13:28:01.451274Z",
|
||||
"iopub.status.idle": "2025-11-29T13:28:02.297890Z",
|
||||
"shell.execute_reply": "2025-11-29T13:28:02.297407Z",
|
||||
"shell.execute_reply.started": "2025-11-29T13:28:01.451868Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
@@ -3856,6 +3739,442 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d4bd8a8f-6326-4568-8417-abb62e35fe00",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入手工数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "97150a5f-9fcd-4b0a-aed9-61b10b26f2da",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/天津石化手工数据2025.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"filename = 'data/result_天津石化2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" item = sheet.cell(n, 2).value\n",
|
||||
" mark = str(sheet.cell(n, 3).value)\n",
|
||||
" rq = str(sheet.cell(n, 3).value)\n",
|
||||
" if code in dict2.keys():\n",
|
||||
" dict2[code].setdefault(item,{})\n",
|
||||
" dict2[code][item]['成绩'] = mark\n",
|
||||
" else:\n",
|
||||
" print(code)\n",
|
||||
" \n",
|
||||
"filename = 'data/result_天津石化2025-1.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2, fl, ensure_ascii=False) \n",
|
||||
"print(len(re_ta)) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "58336a12-561b-4af7-be00-71c6d0a8ef75",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入腰臀数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f50b8f39-0311-4537-8eae-9a84af01702d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/天津石化腰围臀围数据.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"filename = 'data/result_天津石化2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" item = 'wh'\n",
|
||||
" mark = str(sheet.cell(n, 2).value)+','+str(sheet.cell(n, 3).value)\n",
|
||||
" if code in dict2.keys():\n",
|
||||
" dict2[code].setdefault(item,{})\n",
|
||||
" dict2[code][item]['成绩'] = mark\n",
|
||||
" else:\n",
|
||||
" print(code)\n",
|
||||
" \n",
|
||||
"filename = 'data/result_天津石化2025-2.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2, fl, ensure_ascii=False) \n",
|
||||
"print(len(dict2)) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "43d2d7dd-b747-4177-80df-5ca36bea8541",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计体测人员项目数"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"id": "227b2b23-1eb4-4da9-896f-5db070228f5b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-03T11:08:04.377758Z",
|
||||
"iopub.status.busy": "2025-12-03T11:08:04.377114Z",
|
||||
"iopub.status.idle": "2025-12-03T11:08:04.744096Z",
|
||||
"shell.execute_reply": "2025-12-03T11:08:04.743518Z",
|
||||
"shell.execute_reply.started": "2025-12-03T11:08:04.377699Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"01738573 曹志玲 研究院 2\n",
|
||||
"01730621 张敬东 电仪部 2\n",
|
||||
"01733160 王金江 烯烃部 2\n",
|
||||
"01736847 章洪 热电部 2\n",
|
||||
"01736378 杨桂强 热电部 1\n",
|
||||
"01737731 徐欣 运输销售部 1\n",
|
||||
"01736804 李振江 热电部 2\n",
|
||||
"01737858 于学宁 运输销售部 2\n",
|
||||
"01737542 刘呈健 水务部 1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/result_天津石化2025-2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
|
||||
"list3 = []\n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" list1 = []\n",
|
||||
" for item in v.keys():\n",
|
||||
" if item in xm:\n",
|
||||
" list1.append(item)\n",
|
||||
" if len(list1) <3:\n",
|
||||
" print(k,v['name'],v['unit'],len(list1))\n",
|
||||
" list3.append(k)\n",
|
||||
"filename = 'data/天津石化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"\n",
|
||||
"i = 1\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" if k not in list3:\n",
|
||||
" list2 = [i,k,v['name'],v['unit'],dict2[k]['sub_unit'],v['rq'],]\n",
|
||||
" i+=1\n",
|
||||
" list1.append(list2)\n",
|
||||
"#print(list1)\n",
|
||||
"filename = f'data/天津石化体测人员名单(可出报告).xlsx'\n",
|
||||
"title = ['序号','员工编号','姓名','部门','车间','体测日期']\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row) \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "620b0be5-0651-4f62-9b4d-8cc590168a61",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导出测试人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d2900f9b-573e-41b1-aeae-8cec37a52826",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_天津石化2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/天津石化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(dict2[k]['sex'])\n",
|
||||
" list2.append(dict2[k]['unit'])\n",
|
||||
" list2.append(dict2[k]['birth'])\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" list2.append(dict2[k]['phone'])\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" if 'bmi' in v.keys():\n",
|
||||
" height = v['bmi']['成绩'].split(',')[0]\n",
|
||||
" weight = v['bmi']['成绩'].split(',')[1]\n",
|
||||
" list2.append(height)\n",
|
||||
" list2.append(weight)\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" list2.append('')\n",
|
||||
" for item in items:\n",
|
||||
" if item in v.keys():\n",
|
||||
" list2.append(v[item]['成绩']) \n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(v[item])\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/天津石化体测情况表(2025年).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3df27e2f-55c0-446a-af01-074e85461bab",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 生成报告(按照编号)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"id": "d0368e0f-270b-47fd-aec0-cae3cadd68b2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-03T11:31:43.458591Z",
|
||||
"iopub.status.busy": "2025-12-03T11:31:43.458312Z",
|
||||
"iopub.status.idle": "2025-12-03T11:31:44.427029Z",
|
||||
"shell.execute_reply": "2025-12-03T11:31:44.426528Z",
|
||||
"shell.execute_reply.started": "2025-12-03T11:31:43.458563Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_天津石化2025-2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"filename = 'data/天津石化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./天津石化2025/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi','wh']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
"person = ['03603316']\n",
|
||||
"bumen =['南港乙烯项目管理部']\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" \n",
|
||||
" #id = str(k).rjust(8,\"0\")\n",
|
||||
" id = str(k)\n",
|
||||
" #if v['unit'] in bumen:\n",
|
||||
" if id in person:\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
" mydata['title'] = '中石化(天津)石油化工\\n有限公司'\n",
|
||||
" mydata['subtitle'] = v['unit'] + ' '+dict2[k]['sub_unit']\n",
|
||||
" mydata['id'] = id\n",
|
||||
" mydata['name'] = v['name']\n",
|
||||
" if v['sex'] == '男':\n",
|
||||
" mydata['gender'] = 'male'\n",
|
||||
" else:\n",
|
||||
" mydata['gender'] = 'female'\n",
|
||||
" \n",
|
||||
" mydata['month'] = v['month']\n",
|
||||
" mydata['fits'] = {}\n",
|
||||
" \n",
|
||||
" for item in list_item:\n",
|
||||
" if item in v.keys():\n",
|
||||
" mydata.setdefault('fits',{})\n",
|
||||
" if item in ['lung','pushup','step','situp']:\n",
|
||||
" mark = v[item]['成绩'].split()[0].split('.')[0]\n",
|
||||
" else:\n",
|
||||
" mark = v[item]['成绩'].split()[0]\n",
|
||||
" if item == 'bmi':\n",
|
||||
" mydata['fits']['heightWeight'] = {'mark':mark,'score':-1}\n",
|
||||
" else:\n",
|
||||
" mydata['fits'][item] = {'mark':mark,'score':-1}\n",
|
||||
" #if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n",
|
||||
" if len(mydata['fits']) >2 : \n",
|
||||
" list1.append(mydata)\n",
|
||||
" list2.append([k,v['name']])\n",
|
||||
" i+=1\n",
|
||||
" x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\n",
|
||||
" #print(id,v['name'],x.text)\n",
|
||||
" #print(mydata)\n",
|
||||
" x.close()\n",
|
||||
"print(i)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "428ff4de-5c44-4f13-bfd0-3ccca2d2aff4",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 核对报告人员"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 41,
|
||||
"id": "8467b539-c5ca-4db3-8231-f634b70dff88",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-03T11:13:39.490227Z",
|
||||
"iopub.status.busy": "2025-12-03T11:13:39.489101Z",
|
||||
"iopub.status.idle": "2025-12-03T11:13:39.648115Z",
|
||||
"shell.execute_reply": "2025-12-03T11:13:39.647529Z",
|
||||
"shell.execute_reply.started": "2025-12-03T11:13:39.490158Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"03603316 马新淼 炼油部\n",
|
||||
"01738573 曹志玲 研究院\n",
|
||||
"01730621 张敬东 电仪部\n",
|
||||
"01733160 王金江 烯烃部\n",
|
||||
"01736847 章洪 热电部\n",
|
||||
"01736378 杨桂强 热电部\n",
|
||||
"01737731 徐欣 运输销售部\n",
|
||||
"01736804 李振江 热电部\n",
|
||||
"01737858 于学宁 运输销售部\n",
|
||||
"01737542 刘呈健 水务部\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import glob\n",
|
||||
"from pathlib import Path\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/result_天津石化2025-2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-fit2023/天津石化2025'\n",
|
||||
"\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"list1 = []\n",
|
||||
"title = ['测试编号','姓名','性别','部门']\n",
|
||||
"for fn in fls:\n",
|
||||
" list2 = []\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0] \n",
|
||||
" list1.append(fi_name)\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" if k not in list1:\n",
|
||||
" print(k,v['name'],v['unit'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1620d417-e80c-473a-81f8-f4e705ae6982",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 体测报告按部门、车间分类"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
"id": "b9f88d36-e72a-4f26-8357-62c7b0e2128d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-12-03T12:03:30.161578Z",
|
||||
"iopub.status.busy": "2025-12-03T12:03:30.161039Z",
|
||||
"iopub.status.idle": "2025-12-03T12:03:31.205217Z",
|
||||
"shell.execute_reply": "2025-12-03T12:03:31.204754Z",
|
||||
"shell.execute_reply.started": "2025-12-03T12:03:30.161525Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import glob\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-fit2023/天津石化2025'\n",
|
||||
"new_path = 'file/天津石化2025'\n",
|
||||
"old = []\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/天津石化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"for fn in fls:\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" code = fi_name\n",
|
||||
" unit_path = Path(new_path,dict1[str(code)]['unit'],dict1[str(code)]['sub_unit'])\n",
|
||||
" unit_path.mkdir(parents = True, exist_ok = True)\n",
|
||||
" n_name = Path(unit_path,Path(fn).stem+'.pdf')\n",
|
||||
" if not os.path.exists(n_name):\n",
|
||||
" shutil.copyfile(fn,n_name)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "85a03b00-9624-4ae9-aa6d-386798d457df",
|
||||
|
||||
Reference in new issue
Block a user