This commit is contained in:
512song committed 2022-11-13 21:55:03 +08:00
1 parent b5f1df8102
commit 78a0714c22
2 files changed
+79 -4312

No files matched your search

+73 -3
View File
@@ -218,6 +218,76 @@
" \n"
]
},
{
"cell_type": "markdown",
"id": "3c282594-4be4-4321-ae0b-c183ab844518",
"metadata": {},
"source": [
"### 根据报告统计人员成绩得分"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "7102f36a-f92d-4896-b7c7-ef57f88c2f3e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-11-13T13:03:33.452053Z",
"iopub.status.busy": "2022-11-13T13:03:33.450867Z",
"iopub.status.idle": "2022-11-13T13:03:45.193825Z",
"shell.execute_reply": "2022-11-13T13:03:45.191843Z",
"shell.execute_reply.started": "2022-11-13T13:03:33.451939Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','部门','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n",
"filename = 'data/result_巴陵.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"filename = 'data/巴陵石化人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"fn = []\n",
"m_path = os.getcwd()+'/file/137'\n",
"fls = glob.glob(f'file/137/*.pdf')\n",
"for fl in fls:\n",
" fn.append(os.path.basename(fl).split('.')[0])\n",
"for k in fn:\n",
" #print(k,dict2[str(k)]['name'])\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(dict2[k]['name']) \n",
" list2.append(dict1[k]['sex'])\n",
" list2.append(dict1[k]['unit']) \n",
" \n",
" for item in items:\n",
" if item in dict2[k].keys():\n",
" list2.append(dict2[k][item]['成绩'])\n",
" list2.append(dict2[k][item]['得分']) \n",
" elif item =='name':\n",
" list2.append(dict2[k][item])\n",
" else:\n",
" list2.append('') \n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/巴陵石化体检报告人员体测情况表.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)\n",
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "19947e33-64f8-4855-8b28-60e2a8c3543c",
@@ -240,7 +310,7 @@
"import math\n",
"import glob\n",
"\n",
"fi_path = os.getcwd()+'/file/137'\n",
"fi_path = os.getcwd()+'/file/137/20221111'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
@@ -255,8 +325,8 @@
" dict2[int(k)] = [m_name,m_depart]\n",
"\n",
"\n",
"m_path = os.getcwd()+'/file/137'\n",
"fls = glob.glob(f'file/137/*.pdf')\n",
"m_path = os.getcwd()+'/file/137/20221111'\n",
"fls = glob.glob(f'file/137/20221111/*.pdf')\n",
"\n",
"for fn in fls:\n",
" old.append(os.path.basename(fn).split('.')[0])\n",