diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index 40abdf1..e360af1 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -10,12 +10,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-22T11:15:25.211385Z", + "iopub.status.busy": "2022-11-22T11:15:25.211078Z", + "iopub.status.idle": "2022-11-22T11:15:26.072431Z", + "shell.execute_reply": "2022-11-22T11:15:26.071541Z", + "shell.execute_reply.started": "2022-11-22T11:15:25.211360Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import openpyxl\n", "import json\n", @@ -53,12 +68,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "a57ebb22-543c-4804-8d44-89984058ec1d", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-24T05:37:24.783810Z", + "iopub.status.busy": "2022-11-24T05:37:24.783502Z", + "iopub.status.idle": "2022-11-24T05:37:25.128566Z", + "shell.execute_reply": "2022-11-24T05:37:25.127750Z", + "shell.execute_reply.started": "2022-11-24T05:37:24.783783Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "import time\n", @@ -72,7 +102,7 @@ "for k,v in dict1.items():\n", " item[k] = v\n", "#SQL语句为:\n", - "# SELECT a.item_id,a.performance,a.score,a.date AS DATE1,a.avatar_id,b.unit,b.name FROM places_result AS a,_zgshhgxs AS b WHERE a.place_id=135 AND a.avatar_id=b.id AND a.avatar_id < 4999\n", + "#SELECT a.item_id,a.performance,a.score,a.date AS DATE1,a.avatar_id,b.unit,b.name,a.date_joined FROM places_result AS a,_tianjin AS b WHERE a.place_id=134 AND a.avatar_id=b.id\n", "\n", "re_ta = {}\n", "dict1 = {}\n", @@ -113,9 +143,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "38397ad4-2bb3-4b5e-8ece-9ea11e801890", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-22T11:15:35.472641Z", + "iopub.status.busy": "2022-11-22T11:15:35.472362Z", + "iopub.status.idle": "2022-11-22T11:15:36.491702Z", + "shell.execute_reply": "2022-11-22T11:15:36.490980Z", + "shell.execute_reply.started": "2022-11-22T11:15:35.472615Z" + }, "tags": [] }, "outputs": [], @@ -152,7 +189,7 @@ " list2.append('') \n", " \n", " list1.append(list2)\n", - "filename = 'data/天津石化体测情况表(截至20221110).xlsx'\n", + "filename = 'data/天津石化体测情况表(截至20221122).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -162,6 +199,81 @@ "wb.save(filename)" ] }, + { + "cell_type": "markdown", + "id": "239ceb76-f690-4dae-991c-62c38d617c85", + "metadata": {}, + "source": [ + "## 导出测试成绩(带得分)" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "27529013-f3de-4e23-980d-f62203e4df88", + "metadata": { + "execution": { + "iopub.execute_input": "2022-11-24T05:37:32.938028Z", + "iopub.status.busy": "2022-11-24T05:37:32.937781Z", + "iopub.status.idle": "2022-11-24T05:37:34.623378Z", + "shell.execute_reply": "2022-11-24T05:37:34.622584Z", + "shell.execute_reply.started": "2022-11-24T05:37:32.938006Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','单位/部门','车间/科室','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n", + "filename = 'data/result_天津.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/天津石化人员名单.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + " \n", + "list1 = []\n", + "for k, v in dict1.items():\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(dict2[k]['sex'])\n", + " list2.append(dict2[k]['unit']) \n", + " list2.append(dict2[k]['sub_unit']) \n", + " for item in items:\n", + " if item in dict1[k].keys():\n", + " list2.append(dict1[k][item]['成绩'])\n", + " list2.append(dict1[k][item]['得分']) \n", + " elif item =='name':\n", + " list2.append(dict1[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": "1c7b219f-43cd-4bf0-971f-2c398f8db8ed", @@ -269,7 +381,7 @@ "id": "838ec7d3-137c-4ccd-9f16-7b6312d1ffa6", "metadata": {}, "source": [ - "### PDF文件压缩" + "## PDF文件压缩" ] }, { @@ -328,12 +440,72 @@ "\n" ] }, + { + "cell_type": "markdown", + "id": "a0cc9662-4171-4c2a-828d-f58c327ec8c1", + "metadata": {}, + "source": [ + "## 统计未测试人员名单" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "daef91be-1b58-4fb1-b182-64f43c07c90f", + "metadata": { + "execution": { + "iopub.execute_input": "2022-11-22T12:27:28.133048Z", + "iopub.status.busy": "2022-11-22T12:27:28.132742Z", + "iopub.status.idle": "2022-11-22T12:27:28.320603Z", + "shell.execute_reply": "2022-11-22T12:27:28.319820Z", + "shell.execute_reply.started": "2022-11-22T12:27:28.133020Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "title = ['编号','姓名','性别','单位/部门','车间/科室']\n", + "filename = 'data/天津石化人员名单.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "filename = 'data/result_天津.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", + " if k not in dict2.keys(): \n", + " list2 = [k,dict1[k]['name'],dict1[k]['sex'],dict1[k]['unit'],dict1[k]['sub_unit'],] \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": "72c693e1-dd7c-40fa-8948-4fd6fbea8ddc", "metadata": {}, "source": [ - "### 区分新文件" + "## 区分新文件" ] }, { @@ -363,8 +535,45 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "32b61559-4495-4fbe-8eb6-2614e6225b5c", + "metadata": { + "execution": { + "iopub.execute_input": "2022-11-22T12:25:04.603031Z", + "iopub.status.busy": "2022-11-22T12:25:04.602768Z", + "iopub.status.idle": "2022-11-22T12:25:04.677363Z", + "shell.execute_reply": "2022-11-22T12:25:04.676559Z", + "shell.execute_reply.started": "2022-11-22T12:25:04.603008Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4741 6493\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "title = ['编号','姓名','性别','单位/部门','车间/科室']\n", + "filename = 'data/天津石化人员名单.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "filename = 'data/result_天津.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "print(len(dict2),len(dict1),)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e7d4e4b4-a44c-44c2-9c21-7f1d4f8ac6bd", "metadata": {}, "outputs": [], "source": []