From 1da757e355b4b83ff5d8629d7a6d5130ba831845 Mon Sep 17 00:00:00 2001 From: 512song Date: Fri, 6 Dec 2024 23:45:13 +0800 Subject: [PATCH] 20241206 --- 体测单位/my_module.py | 8 +- 体测单位/体质检测数据处理.ipynb | 748 +++++++------------------------- 体测单位/北海炼化.ipynb | 241 ++++++++-- 体测单位/新疆.ipynb | 330 ++++++++++++++ 体测单位/长炼医院.ipynb | 34 +- 5 files changed, 715 insertions(+), 646 deletions(-) create mode 100644 体测单位/新疆.ipynb diff --git a/体测单位/my_module.py b/体测单位/my_module.py index fdf2f7d..3139f4a 100644 --- a/体测单位/my_module.py +++ b/体测单位/my_module.py @@ -5,11 +5,11 @@ import json import time filename = 'data/体质检测标准 (1).json' - with open(filename,'r') as fl: - dict1 = json.load(fl) +with open(filename,'r') as fl: + dict1 = json.load(fl) filename = 'data/体质检测标准_BMI.json' - with open(filename,'r') as fl: - dict4 = json.load(fl) +with open(filename,'r') as fl: + dict4 = json.load(fl) def cal_score(data1): person = dict1['person'] diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index 6c3c685..aefb371 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -637,15 +637,15 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 57, "id": "b123ee6b-85d2-4660-b226-321832a6b796", "metadata": { "execution": { - "iopub.execute_input": "2024-12-05T01:54:15.911722Z", - "iopub.status.busy": "2024-12-05T01:54:15.910983Z", - "iopub.status.idle": "2024-12-05T02:00:21.680493Z", - "shell.execute_reply": "2024-12-05T02:00:21.679283Z", - "shell.execute_reply.started": "2024-12-05T01:54:15.911657Z" + "iopub.execute_input": "2024-12-06T14:42:19.023726Z", + "iopub.status.busy": "2024-12-06T14:42:19.023180Z", + "iopub.status.idle": "2024-12-06T14:49:16.425361Z", + "shell.execute_reply": "2024-12-06T14:49:16.424225Z", + "shell.execute_reply.started": "2024-12-06T14:42:19.023678Z" }, "tags": [] }, @@ -654,7 +654,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "738\n" + "757\n" ] } ], @@ -681,7 +681,7 @@ " \n", " id = str(k).rjust(4,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", - " mydata['title'] = '中国石化北海炼化有限责任公司'\n", + " mydata['title'] = '中国石化北海炼化\\n有限责任公司'\n", " mydata['subtitle'] = v['unit']\n", " mydata['id'] = id\n", " mydata['name'] = v['name']\n", @@ -708,8 +708,8 @@ " else:\n", " mark = v[item]['成绩'].split()[0]\n", " mydata['fits'][item] = {'mark':mark,'score':v[item]['score']}\n", - " #if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n", - " if len(mydata['fits']) >2 : \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", @@ -800,9 +800,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 58, "id": "d913a531-51b3-4795-adc3-f4fc858d7401", "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T15:20:32.535010Z", + "iopub.status.busy": "2024-12-06T15:20:32.534411Z", + "iopub.status.idle": "2024-12-06T15:20:32.583820Z", + "shell.execute_reply": "2024-12-06T15:20:32.583328Z", + "shell.execute_reply.started": "2024-12-06T15:20:32.534952Z" + }, "tags": [] }, "outputs": [], @@ -812,12 +819,12 @@ "import glob\n", "from pathlib import Path\n", "\n", - "fi_path = '/home/songyi/pdf-typescript/中石化石油工程设计有限公司1'\n", - "new_path = 'file/中石化石油工程设计有限公司1'\n", + "fi_path = '/home/songyi/pdf-typescript/北海炼化2024'\n", + "new_path = 'file/北海炼化2024'\n", "old = []\n", "dict2 = {}\n", "\n", - "filename = 'data/东营工程设计院2024.json'\n", + "filename = 'data/北海炼化人员2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -841,12 +848,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 59, "id": "02319955-7fb6-4791-ae45-55b03bdadd54", "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T15:23:36.869845Z", + "iopub.status.busy": "2024-12-06T15:23:36.869086Z", + "iopub.status.idle": "2024-12-06T15:23:36.941818Z", + "shell.execute_reply": "2024-12-06T15:23:36.941344Z", + "shell.execute_reply.started": "2024-12-06T15:23:36.869773Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import os,sys,shutil\n", "import json\n", @@ -856,7 +878,7 @@ "\n", "fi_path = '/home/songyi/pdf-typescript/北海炼化2024'\n", "\n", - "filename = 'data/中安联合.json'\n", + "filename = 'data/北海炼化人员2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -872,7 +894,7 @@ " \n", " list1.append(list2)\n", "\n", - "filename = 'data/中安联合体测报告明细表.xlsx'\n", + "filename = 'data/北海炼化2024年体测报告明细表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -893,29 +915,10 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "c464fa11-8a0d-44e9-8af0-8c1f50263ceb", - "metadata": { - "execution": { - "iopub.execute_input": "2024-12-05T02:12:16.971166Z", - "iopub.status.busy": "2024-12-05T02:12:16.970399Z", - "iopub.status.idle": "2024-12-05T02:12:16.991930Z", - "shell.execute_reply": "2024-12-05T02:12:16.991373Z", - "shell.execute_reply.started": "2024-12-05T02:12:16.971124Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "739\n", - "518\n", - "275\n", - "809\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import os,sys,shutil\n", "import json\n", @@ -1547,26 +1550,10 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-07T11:47:37.575532Z", - "iopub.status.busy": "2024-11-07T11:47:37.574781Z", - "iopub.status.idle": "2024-11-07T11:47:37.780926Z", - "shell.execute_reply": "2024-11-07T11:47:37.780418Z", - "shell.execute_reply.started": "2024-11-07T11:47:37.575459Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "4059\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import openpyxl\n", @@ -1641,29 +1628,12 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "63edd636-f034-4aa6-8575-63d5cdb84adb", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:02:47.958778Z", - "iopub.status.busy": "2024-12-04T15:02:47.958038Z", - "iopub.status.idle": "2024-12-04T15:02:47.975696Z", - "shell.execute_reply": "2024-12-04T15:02:47.974632Z", - "shell.execute_reply.started": "2024-12-04T15:02:47.958708Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:2.9551分,男性:598人\n", - "平均成绩:3.1705分,女性:140人\n", - "平均成绩:2.996分,总体:738人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1702,32 +1672,12 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:03:47.530784Z", - "iopub.status.busy": "2024-12-04T15:03:47.530057Z", - "iopub.status.idle": "2024-12-04T15:03:47.570098Z", - "shell.execute_reply": "2024-12-04T15:03:47.569570Z", - "shell.execute_reply.started": "2024-12-04T15:03:47.530717Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:130人,男性:116人,女性:14人\n", - "256~332分人数:368人,男性:306人,女性:62人\n", - "333~367分人数:170人,男性:125人,女性:45人\n", - "368~500分人数:70人,男性:51人,女性:19人\n", - "738\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1773,34 +1723,12 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "2d661ca6-6129-4da1-ac25-51d0156babb2", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:04:19.067670Z", - "iopub.status.busy": "2024-12-04T15:04:19.066925Z", - "iopub.status.idle": "2024-12-04T15:04:19.087808Z", - "shell.execute_reply": "2024-12-04T15:04:19.087242Z", - "shell.execute_reply.started": "2024-12-04T15:04:19.067602Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'不合格': 2, '良好': 6, '优秀': 0, '合格': 8}\n", - "25-29 {'良好': 11, '不合格': 2, '合格': 13, '优秀': 2}\n", - "30-34 {'合格': 8, '良好': 3, '优秀': 4, '不合格': 1}\n", - "35-39 {'优秀': 2, '良好': 7, '合格': 10, '不合格': 6}\n", - "40-44 {'优秀': 1, '良好': 4, '合格': 1, '不合格': 0}\n", - "45-49 {'合格': 20, '优秀': 5, '良好': 8, '不合格': 3}\n", - "50-54 {'合格': 2, '良好': 6, '优秀': 5, '不合格': 0}\n", - "55-80 {'优秀': 0, '合格': 0, '良好': 0, '不合格': 0}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1840,34 +1768,12 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "fc97df37-34ff-4a02-9d26-b5d81b706e46", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:07:08.531067Z", - "iopub.status.busy": "2024-12-04T15:07:08.530357Z", - "iopub.status.idle": "2024-12-04T15:07:08.545126Z", - "shell.execute_reply": "2024-12-04T15:07:08.544536Z", - "shell.execute_reply.started": "2024-12-04T15:07:08.531002Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'不合格': 26, '良好': 9, '优秀': 2, '合格': 35}\n", - "25-29 {'良好': 20, '不合格': 25, '合格': 48, '优秀': 3}\n", - "30-34 {'合格': 24, '良好': 5, '优秀': 2, '不合格': 5}\n", - "35-39 {'优秀': 11, '良好': 23, '合格': 29, '不合格': 10}\n", - "40-44 {'优秀': 6, '良好': 3, '合格': 17, '不合格': 1}\n", - "45-49 {'合格': 37, '优秀': 6, '良好': 16, '不合格': 4}\n", - "50-54 {'合格': 73, '良好': 31, '优秀': 12, '不合格': 28}\n", - "55-80 {'优秀': 9, '合格': 43, '良好': 18, '不合格': 17}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1907,34 +1813,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:07:14.121761Z", - "iopub.status.busy": "2024-12-04T15:07:14.119927Z", - "iopub.status.idle": "2024-12-04T15:07:14.142357Z", - "shell.execute_reply": "2024-12-04T15:07:14.141727Z", - "shell.execute_reply.started": "2024-12-04T15:07:14.121677Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "16~24岁平均成绩:2.73分,人数:88人,男性:72人\n", - "25~29岁平均成绩:2.92分,人数:124人,男性:96人\n", - "30~34岁平均成绩:3.02分,人数:52人,男性:36人\n", - "35~39岁平均成绩:3.1分,人数:98人,男性:73人\n", - "40~44岁平均成绩:3.21分,人数:33人,男性:27人\n", - "45~49岁平均成绩:3.09分,人数:99人,男性:63人\n", - "50~54岁平均成绩:3.04分,人数:157人,男性:144人\n", - "55~69岁平均成绩:2.97分,人数:87人,男性:87人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "\n", @@ -1969,34 +1853,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "347703a1-501b-4800-bd29-16e94f4a6793", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:10:04.572147Z", - "iopub.status.busy": "2024-12-04T15:10:04.571454Z", - "iopub.status.idle": "2024-12-04T15:10:04.596383Z", - "shell.execute_reply": "2024-12-04T15:10:04.595277Z", - "shell.execute_reply.started": "2024-12-04T15:10:04.572082Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.68分,人数:72人\n", - "25~29岁平均成绩:2.86分,人数:96人\n", - "30~34岁平均成绩:2.94分,人数:36人\n", - "35~39岁平均成绩:3.12分,人数:73人\n", - "40~44岁平均成绩:3.15分,人数:27人\n", - "45~49岁平均成绩:3.06分,人数:63人\n", - "50~54岁平均成绩:2.98分,人数:144人\n", - "55~80岁平均成绩:2.97分,人数:87人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -2031,34 +1893,12 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:09:34.523177Z", - "iopub.status.busy": "2024-12-04T15:09:34.522550Z", - "iopub.status.idle": "2024-12-04T15:09:34.543633Z", - "shell.execute_reply": "2024-12-04T15:09:34.542960Z", - "shell.execute_reply.started": "2024-12-04T15:09:34.523123Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.94分,人数:16人\n", - "25~29岁平均成绩:3.13分,人数:28人\n", - "30~34岁平均成绩:3.19分,人数:16人\n", - "35~39岁平均成绩:3.07分,人数:25人\n", - "40~44岁平均成绩:3.49分,人数:6人\n", - "45~49岁平均成绩:3.15分,人数:36人\n", - "50~54岁平均成绩:3.64分,人数:13人\n", - "55~80岁平均成绩:0分,人数:0人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -2091,36 +1931,12 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "ad69c45d-3f62-42df-894d-47424e759029", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:10:44.614467Z", - "iopub.status.busy": "2024-12-04T15:10:44.613711Z", - "iopub.status.idle": "2024-12-04T15:10:44.636541Z", - "shell.execute_reply": "2024-12-04T15:10:44.635981Z", - "shell.execute_reply.started": "2024-12-04T15:10:44.614399Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BMI 3.6 738\n", - "肺活量 3.38 728\n", - "握力 2.55 737\n", - "坐位体前屈 2.73 699\n", - "纵跳 2.53 692\n", - "俯卧撑 3.29 523\n", - "一分钟仰卧起坐 3.82 109\n", - "单脚站立 2.73 726\n", - "选择反应时 3.32 737\n", - "台阶指数 2.79 540\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2145,45 +1961,12 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dcf152e7-bbcc-47d1-9c5f-83854db35412", "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:12:44.516371Z", - "iopub.status.busy": "2024-12-04T15:12:44.515637Z", - "iopub.status.idle": "2024-12-04T15:12:44.537110Z", - "shell.execute_reply": "2024-12-04T15:12:44.536346Z", - "shell.execute_reply.started": "2024-12-04T15:12:44.516304Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "炼油二部 2.96 136\n", - "公用工程部 2.99 53\n", - "储运部 2.9 101\n", - "炼油一部 3.0 122\n", - "炼油三部 2.92 74\n", - "物资采购中心 3.17 16\n", - "科技发展部 3.0 9\n", - "设备工程部 3.1 19\n", - "检验计量中心 3.02 39\n", - "财务资产部 3.4 12\n", - "党群工作部 3.33 6\n", - "恒大化工 2.98 39\n", - "发展计划部 3.23 8\n", - "安全环保部 2.98 16\n", - "生产技术部(总调度室) 3.03 17\n", - "党委组织部(人力资源部) 3.15 12\n", - "电气仪表中心 2.94 37\n", - "综合管理部 3.21 14\n", - "本部 3.34 8\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2212,44 +1995,10 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "d1977ca9-bf12-4f09-ae7b-e8af9eaa82f2", - "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:16:38.052997Z", - "iopub.status.busy": "2024-12-04T15:16:38.052411Z", - "iopub.status.idle": "2024-12-04T15:16:38.070279Z", - "shell.execute_reply": "2024-12-04T15:16:38.069338Z", - "shell.execute_reply.started": "2024-12-04T15:16:38.052942Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "炼油二部 3.17 13\n", - "公用工程部 3.33 11\n", - "储运部 2.98 6\n", - "炼油一部 3.21 15\n", - "炼油三部 2.82 6\n", - "物资采购中心 3.05 5\n", - "科技发展部 2.67 1\n", - "设备工程部 3.72 2\n", - "检验计量中心 2.97 19\n", - "财务资产部 3.46 10\n", - "党群工作部 3.67 2\n", - "恒大化工 2.98 26\n", - "发展计划部 3.61 5\n", - "安全环保部 3.25 2\n", - "生产技术部(总调度室) 3.67 1\n", - "党委组织部(人力资源部) 3.3 7\n", - "电气仪表中心 3.28 2\n", - "综合管理部 3.42 7\n", - "本部 0 0\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2281,44 +2030,10 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "d507c7f7-6a91-4695-b700-5e2f77e6dea3", - "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:17:22.384324Z", - "iopub.status.busy": "2024-12-04T15:17:22.383584Z", - "iopub.status.idle": "2024-12-04T15:17:22.404238Z", - "shell.execute_reply": "2024-12-04T15:17:22.403084Z", - "shell.execute_reply.started": "2024-12-04T15:17:22.384258Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "炼油二部 14 29 67 26\n", - "公用工程部 8 11 25 9\n", - "储运部 8 25 42 26\n", - "炼油一部 7 27 69 19\n", - "炼油三部 5 11 43 15\n", - "物资采购中心 3 3 9 1\n", - "科技发展部 1 0 7 1\n", - "设备工程部 2 5 10 2\n", - "检验计量中心 4 11 18 6\n", - "财务资产部 3 3 5 1\n", - "党群工作部 2 1 3 0\n", - "恒大化工 3 9 20 7\n", - "发展计划部 1 3 3 1\n", - "安全环保部 1 5 7 3\n", - "生产技术部(总调度室) 2 4 9 2\n", - "党委组织部(人力资源部) 0 5 6 1\n", - "电气仪表中心 1 9 19 8\n", - "综合管理部 4 4 4 2\n", - "本部 1 5 2 0\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2355,234 +2070,10 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "90bc66cd-9f01-410e-9abc-e6f15ada293f", - "metadata": { - "execution": { - "iopub.execute_input": "2024-12-04T15:19:48.512361Z", - "iopub.status.busy": "2024-12-04T15:19:48.511640Z", - "iopub.status.idle": "2024-12-04T15:19:48.542915Z", - "shell.execute_reply": "2024-12-04T15:19:48.542354Z", - "shell.execute_reply.started": "2024-12-04T15:19:48.512295Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "炼油二部\n", - "BMI 444 136\n", - "肺活量 478 134\n", - "握力 365 136\n", - "坐位体前屈 345 130\n", - "纵跳 347 133\n", - "俯卧撑 352 106\n", - "一分钟仰卧起坐 50 12\n", - "单脚站立 356 134\n", - "选择反应时 432 136\n", - "台阶指数 284 102\n", - "公用工程部\n", - "BMI 199 53\n", - "肺活量 190 53\n", - "握力 133 53\n", - "坐位体前屈 138 51\n", - "纵跳 127 52\n", - "俯卧撑 120 39\n", - "一分钟仰卧起坐 33 9\n", - "单脚站立 134 53\n", - "选择反应时 186 53\n", - "台阶指数 101 38\n", - "储运部\n", - "BMI 351 101\n", - "肺活量 321 99\n", - "握力 281 101\n", - "坐位体前屈 245 91\n", - "纵跳 220 91\n", - "俯卧撑 238 80\n", - "一分钟仰卧起坐 10 4\n", - "单脚站立 237 97\n", - "选择反应时 324 100\n", - "台阶指数 163 57\n", - "炼油一部\n", - "BMI 408 122\n", - "肺活量 414 121\n", - "握力 313 122\n", - "坐位体前屈 329 117\n", - "纵跳 298 115\n", - "俯卧撑 327 97\n", - "一分钟仰卧起坐 40 10\n", - "单脚站立 336 120\n", - "选择反应时 393 122\n", - "台阶指数 275 97\n", - "炼油三部\n", - "BMI 262 74\n", - "肺活量 246 72\n", - "握力 186 74\n", - "坐位体前屈 188 72\n", - "纵跳 169 70\n", - "俯卧撑 206 63\n", - "一分钟仰卧起坐 15 5\n", - "单脚站立 185 73\n", - "选择反应时 217 74\n", - "台阶指数 183 59\n", - "物资采购中心\n", - "BMI 60 16\n", - "肺活量 50 16\n", - "握力 41 16\n", - "坐位体前屈 54 16\n", - "纵跳 45 16\n", - "俯卧撑 44 11\n", - "一分钟仰卧起坐 21 5\n", - "单脚站立 44 16\n", - "选择反应时 55 16\n", - "台阶指数 36 14\n", - "科技发展部\n", - "BMI 31 9\n", - "肺活量 30 9\n", - "握力 23 9\n", - "坐位体前屈 21 9\n", - "纵跳 26 9\n", - "俯卧撑 19 7\n", - "一分钟仰卧起坐 3 1\n", - "单脚站立 22 9\n", - "选择反应时 38 9\n", - "台阶指数 25 8\n", - "设备工程部\n", - "BMI 87 19\n", - "肺活量 63 19\n", - "握力 45 19\n", - "坐位体前屈 49 18\n", - "纵跳 45 18\n", - "俯卧撑 50 14\n", - "一分钟仰卧起坐 9 2\n", - "单脚站立 54 19\n", - "选择反应时 64 19\n", - "台阶指数 32 13\n", - "检验计量中心\n", - "BMI 153 39\n", - "肺活量 124 39\n", - "握力 80 38\n", - "坐位体前屈 109 35\n", - "纵跳 68 32\n", - "俯卧撑 50 14\n", - "一分钟仰卧起坐 48 13\n", - "单脚站立 111 37\n", - "选择反应时 130 39\n", - "台阶指数 61 23\n", - "财务资产部\n", - "BMI 50 12\n", - "肺活量 44 12\n", - "握力 30 12\n", - "坐位体前屈 33 11\n", - "纵跳 34 12\n", - "俯卧撑 7 2\n", - "一分钟仰卧起坐 22 6\n", - "单脚站立 51 12\n", - "选择反应时 42 12\n", - "台阶指数 16 6\n", - "党群工作部\n", - "BMI 28 6\n", - "肺活量 16 6\n", - "握力 14 6\n", - "坐位体前屈 21 6\n", - "纵跳 17 6\n", - "俯卧撑 15 4\n", - "一分钟仰卧起坐 10 2\n", - "单脚站立 21 6\n", - "选择反应时 21 6\n", - "台阶指数 17 6\n", - "恒大化工\n", - "BMI 157 39\n", - "肺活量 121 38\n", - "握力 89 39\n", - "坐位体前屈 87 35\n", - "纵跳 91 34\n", - "俯卧撑 35 10\n", - "一分钟仰卧起坐 69 19\n", - "单脚站立 105 39\n", - "选择反应时 121 39\n", - "台阶指数 86 29\n", - "发展计划部\n", - "BMI 34 8\n", - "肺活量 24 8\n", - "握力 18 8\n", - "坐位体前屈 24 8\n", - "纵跳 21 8\n", - "俯卧撑 6 3\n", - "一分钟仰卧起坐 22 5\n", - "单脚站立 29 8\n", - "选择反应时 30 8\n", - "台阶指数 18 6\n", - "安全环保部\n", - "BMI 50 16\n", - "肺活量 49 15\n", - "握力 43 16\n", - "坐位体前屈 47 16\n", - "纵跳 41 16\n", - "俯卧撑 38 12\n", - "一分钟仰卧起坐 7 2\n", - "单脚站立 39 16\n", - "选择反应时 62 16\n", - "台阶指数 36 13\n", - "生产技术部(总调度室)\n", - "BMI 63 17\n", - "肺活量 56 17\n", - "握力 46 17\n", - "坐位体前屈 43 17\n", - "纵跳 37 16\n", - "俯卧撑 44 13\n", - "一分钟仰卧起坐 5 1\n", - "单脚站立 54 17\n", - "选择反应时 62 17\n", - "台阶指数 39 15\n", - "党委组织部(人力资源部)\n", - "BMI 44 12\n", - "肺活量 39 12\n", - "握力 29 12\n", - "坐位体前屈 31 11\n", - "纵跳 23 9\n", - "俯卧撑 17 5\n", - "一分钟仰卧起坐 24 6\n", - "单脚站立 36 11\n", - "选择反应时 47 12\n", - "台阶指数 23 9\n", - "电气仪表中心\n", - "BMI 145 37\n", - "肺活量 107 36\n", - "握力 89 37\n", - "坐位体前屈 86 35\n", - "纵跳 92 35\n", - "俯卧撑 106 30\n", - "一分钟仰卧起坐 9 2\n", - "单脚站立 92 37\n", - "选择反应时 133 37\n", - "台阶指数 64 28\n", - "综合管理部\n", - "BMI 56 14\n", - "肺活量 49 14\n", - "握力 31 14\n", - "坐位体前屈 40 13\n", - "纵跳 29 12\n", - "俯卧撑 14 5\n", - "一分钟仰卧起坐 19 5\n", - "单脚站立 47 14\n", - "选择反应时 57 14\n", - "台阶指数 31 10\n", - "本部\n", - "BMI 32 8\n", - "肺活量 36 8\n", - "握力 20 8\n", - "坐位体前屈 18 8\n", - "纵跳 22 8\n", - "俯卧撑 34 8\n", - "一分钟仰卧起坐 0 0\n", - "单脚站立 27 8\n", - "选择反应时 30 8\n", - "台阶指数 19 7\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2774,7 +2265,7 @@ "source": [ "import openpyxl\n", "\n", - "filename = 'data/result_东营工程设计院2024_all.json'\n", + "filename = 'data/result_北海炼化2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -2800,7 +2291,7 @@ " list3.append(item)\n", " list2.append(list3)\n", "print(list2)\n", - "filename = 'data/东营工程设计院中医情况明细表.xlsx'\n", + "filename = 'data/北海炼化中医情况明细表2024.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "\n", @@ -2821,12 +2312,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 50, "id": "ad3078ac-ae53-4bb4-95bd-387631092bf1", "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T14:12:43.778020Z", + "iopub.status.busy": "2024-12-06T14:12:43.777211Z", + "iopub.status.idle": "2024-12-06T14:12:43.913724Z", + "shell.execute_reply": "2024-12-06T14:12:43.913244Z", + "shell.execute_reply.started": "2024-12-06T14:12:43.777944Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "list2 = ['成就感','愉快心境','放松程度','压力应对','体力充沛','情感充沛度']\n", "list3 = [[5,7],[7,4],[7,4],[7,4],[8,1],[6,1]]\n", @@ -2838,11 +2344,13 @@ " 5, 5, 5, 5, 5, 5, 5, 5,\n", " 6, 6, 6, 6, 6, 6\n", " ]\n", - "filename = 'data/result_青海all_2.json'\n", + "filename = 'data/result_北海炼化2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", + "list4 = []\n", "for k, v in dict1.items():\n", " if 'psy' in v.keys():\n", + " list5 = []\n", " psy=v['psy']\n", " for i in range(26,40):\n", " new_valve = psy[i]-1\n", @@ -2854,11 +2362,21 @@ " dict3.setdefault(item,0)\n", " dict3[item] +=psy[i]\n", " i+=1\n", - " print(dict3)\n", - " print(k)\n", + " #print(dict3)\n", + " list5.append(k)\n", " for i in range(0,6):\n", " score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n", - " print(list2[i],score)" + " list5.append(score)\n", + " list4.append(list5)\n", + "filename = 'data/北海炼化心理情况明细表2024.xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "\n", + "for row in list4:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)\n", + "print('ok') " ] }, { @@ -2871,25 +2389,63 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 56, "id": "122f19fb-3531-4074-94e4-e2afdb8af51a", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T14:23:42.730508Z", + "iopub.status.busy": "2024-12-06T14:23:42.729973Z", + "iopub.status.idle": "2024-12-06T14:23:42.794427Z", + "shell.execute_reply": "2024-12-06T14:23:42.793835Z", + "shell.execute_reply.started": "2024-12-06T14:23:42.730459Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n", "list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]\n", - "filename = 'data/result_青海all_2.json'\n", + "filename = 'data/result_北海炼化2024.json'\n", "with open(filename,'r') as fl:\n", - " dict1 = json.load(fl) \n", + " dict1 = json.load(fl)\n", + "list6 = []\n", "for k, v in dict1.items():\n", " if 'spine' in v.keys():\n", + " list7 = []\n", " spine = v['spine']\n", + " list7.append(k)\n", " for i in range(0,4):\n", " score = 0\n", " for ii in range(list5[i][0],list5[i][1]):\n", " score+= spine[ii]\n", - " print(k,list4[i],int(score/list5[i][2]*100)-100)" + " #print(k,list4[i],int(score/list5[i][2]*100)-100)\n", + " list7.append(int(score/list5[i][2]*100)-100)\n", + " list6.append(list7)\n", + "filename = 'data/北海炼化脊柱情况明细表2024.xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "\n", + "for row in list6:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)\n", + "print('ok') " ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5912a87a-7b93-4b79-b708-dd23032e97ae", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/体测单位/北海炼化.ipynb b/体测单位/北海炼化.ipynb index 19865bc..7047ea0 100644 --- a/体测单位/北海炼化.ipynb +++ b/体测单位/北海炼化.ipynb @@ -636,7 +636,6 @@ "cell_type": "markdown", "id": "c103301b-d540-4bf5-861a-0eb2e313e26e", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -2183,15 +2182,15 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 35, "id": "e1a1b329-acf1-4be9-bcf0-736dbe7f8e0b", "metadata": { "execution": { - "iopub.execute_input": "2024-12-04T14:53:01.181252Z", - "iopub.status.busy": "2024-12-04T14:53:01.180490Z", - "iopub.status.idle": "2024-12-04T14:53:01.243823Z", - "shell.execute_reply": "2024-12-04T14:53:01.243252Z", - "shell.execute_reply.started": "2024-12-04T14:53:01.181166Z" + "iopub.execute_input": "2024-12-06T06:33:02.890686Z", + "iopub.status.busy": "2024-12-06T06:33:02.889945Z", + "iopub.status.idle": "2024-12-06T06:33:02.953794Z", + "shell.execute_reply": "2024-12-06T06:33:02.953311Z", + "shell.execute_reply.started": "2024-12-06T06:33:02.890614Z" } }, "outputs": [ @@ -2267,9 +2266,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 36, "id": "17ebb0fd-9a45-47a4-bbe9-f4fb0a3481f6", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T06:33:08.201679Z", + "iopub.status.busy": "2024-12-06T06:33:08.200968Z", + "iopub.status.idle": "2024-12-06T06:33:08.367295Z", + "shell.execute_reply": "2024-12-06T06:33:08.366715Z", + "shell.execute_reply.started": "2024-12-06T06:33:08.201614Z" + } + }, "outputs": [], "source": [ "import json\n", @@ -2330,15 +2337,15 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 37, "id": "dd89efe8-13b9-4db8-8c39-2a48888dd635", "metadata": { "execution": { - "iopub.execute_input": "2024-12-04T14:53:17.474923Z", - "iopub.status.busy": "2024-12-04T14:53:17.474146Z", - "iopub.status.idle": "2024-12-04T14:53:18.915899Z", - "shell.execute_reply": "2024-12-04T14:53:18.915258Z", - "shell.execute_reply.started": "2024-12-04T14:53:17.474853Z" + "iopub.execute_input": "2024-12-06T06:34:03.871370Z", + "iopub.status.busy": "2024-12-06T06:34:03.870707Z", + "iopub.status.idle": "2024-12-06T06:34:05.280791Z", + "shell.execute_reply": "2024-12-06T06:34:05.280240Z", + "shell.execute_reply.started": "2024-12-06T06:34:03.871312Z" } }, "outputs": [ @@ -2386,6 +2393,119 @@ "print('ok!') " ] }, + { + "cell_type": "markdown", + "id": "b57447d9-ac3c-47c2-9592-3878c6845918", + "metadata": {}, + "source": [ + "## 导入问卷" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "9563c47b-94e4-44f7-98e1-7d284ad3841c", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T13:25:18.037788Z", + "iopub.status.busy": "2024-12-06T13:25:18.037123Z", + "iopub.status.idle": "2024-12-06T13:25:18.169186Z", + "shell.execute_reply": "2024-12-06T13:25:18.168612Z", + "shell.execute_reply.started": "2024-12-06T13:25:18.037728Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "filename = 'data/result_北海炼化2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/北海炼化人员2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict3 = json.load(fl)\n", + "\n", + "phone = {}\n", + "for k,v in dict3.items():\n", + " if 'phone' in v.keys():\n", + " phone[v['phone']] = k\n", + "list1 = []\n", + "filename = 'data/Survey_20241206.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " list1.append(line)\n", + "#print(list1)\n", + "dict2 = {}\n", + "psy =[]\n", + "tcm = []\n", + "spine = []\n", + "for i in range(0,45):\n", + " psy.append(0)\n", + "psy[44] = []\n", + "for i in range(0,60):\n", + " tcm.append(0)\n", + "for i in range(0,26):\n", + " spine.append(0)\n", + "\n", + "for item in list1:\n", + " if item[2] in phone.keys():\n", + " psy =[]\n", + " tcm = []\n", + " spine = []\n", + " for i in range(0,45):\n", + " psy.append(0)\n", + " psy[44] = []\n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " for i in range(0,26):\n", + " spine.append(0)\n", + " \n", + " content = json.loads(item[5])\n", + " if phone[item[2]] not in dict1.keys():\n", + " dict1[phone[item[2]]] = dict3[phone[item[2]]]\n", + " rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " for k, v in content.items():\n", + " if 'psy' in k:\n", + " i = int(k[3:])\n", + " psy[i-1] = int(v)\n", + " if 'tcm' in k:\n", + " i = int(k[3:])\n", + " tcm[i-1] = int(v)\n", + " if 'spine' in k:\n", + " i = int(k[5:])\n", + " spine[i-1] = int(v)\n", + " if 'psy' in item[5]:\n", + " #for i in range(5,26):\n", + " # new_valve = 5-psy[i]\n", + " # psy[i] = new_valve\n", + " for i in range(26,40):\n", + " new_valve = 1+psy[i]\n", + " psy[i] = new_valve\n", + " \n", + " dict1[phone[item[2]]]['psy'] = psy\n", + " if 'tcm' in item[5]:\n", + " dict1[phone[item[2]]]['tcm'] = tcm\n", + " if 'spine' in item[5]:\n", + " dict1[phone[item[2]]]['spine'] = spine\n", + " birth = date.fromisoformat(dict3[phone[item[2]]]['birth'].replace('/','-'))\n", + " \n", + " days = (rq-birth).days \n", + " dict1[phone[item[2]]]['age'] = int(days/365)\n", + " dict1[phone[item[2]]]['month'] = int(days/365*12)\n", + "filename = 'data/result_北海炼化2024.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) " + ] + }, { "cell_type": "markdown", "id": "378982cd-8f4a-4b61-a87c-a138eb891342", @@ -2396,10 +2516,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "id": "a1a12409-aab8-47af-b10d-7ecb20b3b332", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T13:41:57.576034Z", + "iopub.status.busy": "2024-12-06T13:41:57.575284Z", + "iopub.status.idle": "2024-12-06T13:41:57.808661Z", + "shell.execute_reply": "2024-12-06T13:41:57.808089Z", + "shell.execute_reply.started": "2024-12-06T13:41:57.575964Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "import openpyxl\n", @@ -2419,11 +2555,10 @@ " list2.append(dict1[k]['name']) \n", " list2.append(dict1[k]['sex'])\n", " list2.append(dict1[k]['unit'])\n", - " #list2.append(dict1[k]['phone'])\n", " i = 0\n", " if 'bmi' in dict1[k].keys():\n", - " list2.append(dict1[k]['height']['成绩'])\n", - " list2.append(dict1[k]['weight']['成绩'])\n", + " list2.append(dict1[k]['bmi']['成绩'].split(',')[0])\n", + " list2.append(dict1[k]['bmi']['成绩'].split(',')[1])\n", " list2.append(dict1[k]['bmi']['score'])\n", " i+=1\n", " else:\n", @@ -2444,7 +2579,7 @@ " list2.append('') \n", " if i>2:\n", " list1.append(list2)\n", - "filename = 'data/北海炼化体测情况表.xlsx'\n", + "filename = 'data/北海炼化体测情况明细表(2024年).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -2567,15 +2702,15 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 39, "id": "6d8a345d-39e0-40cd-9bed-ac4e144b426c", "metadata": { "execution": { - "iopub.execute_input": "2024-12-04T15:01:40.945578Z", - "iopub.status.busy": "2024-12-04T15:01:40.944820Z", - "iopub.status.idle": "2024-12-04T15:01:40.998222Z", - "shell.execute_reply": "2024-12-04T15:01:40.997687Z", - "shell.execute_reply.started": "2024-12-04T15:01:40.945506Z" + "iopub.execute_input": "2024-12-06T07:47:19.162940Z", + "iopub.status.busy": "2024-12-06T07:47:19.162185Z", + "iopub.status.idle": "2024-12-06T07:47:19.214132Z", + "shell.execute_reply": "2024-12-06T07:47:19.213530Z", + "shell.execute_reply.started": "2024-12-06T07:47:19.162868Z" } }, "outputs": [ @@ -2655,8 +2790,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 58, "id": "6cba8d5e-92fd-4afd-94d2-0dcf42e2e22e", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T14:55:55.316383Z", + "iopub.status.busy": "2024-12-06T14:55:55.315888Z", + "iopub.status.idle": "2024-12-06T14:55:55.397708Z", + "shell.execute_reply": "2024-12-06T14:55:55.397100Z", + "shell.execute_reply.started": "2024-12-06T14:55:55.316334Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "757\n", + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "\n", + "filename = 'data/result_北海炼化2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list2 = []\n", + "for k,v in dict1.items():\n", + " #list2 = []\n", + " list2.append([k,v['name'],v['sex'],v['age'],v['unit']])\n", + " \n", + "filename = 'data/北海人员基本情况2024.xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "\n", + "for row in list2:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)\n", + "print(len(dict1))\n", + "print('ok') " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "712572b1-7a9b-4022-93de-13166508a307", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/新疆.ipynb b/体测单位/新疆.ipynb new file mode 100644 index 0000000..d66d1a7 --- /dev/null +++ b/体测单位/新疆.ipynb @@ -0,0 +1,330 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "eaf32c48-d935-4780-9272-8f5ddddf80e5", + "metadata": {}, + "source": [ + "## 体测人员导入" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "3d5ddc7a-a331-438d-aa8d-1ad74c7250d0", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T11:58:52.021888Z", + "iopub.status.busy": "2024-12-06T11:58:52.021240Z", + "iopub.status.idle": "2024-12-06T11:58:52.246798Z", + "shell.execute_reply": "2024-12-06T11:58:52.245884Z", + "shell.execute_reply.started": "2024-12-06T11:58:52.021830Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "from datetime import date\n", + "\n", + "wb = openpyxl.load_workbook('data/新疆体测人员.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = int(sheet.cell(n, 1).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 2).value\n", + " dict1['sex'] = sheet.cell(n, 3).value\n", + " dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0] \n", + " \n", + " person[code] = dict1\n", + "filename = 'data/新疆人员.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "faf346a5-3b0e-414e-ab64-dbde3b8c3dbd", + "metadata": {}, + "source": [ + "## 获取人员测试成绩" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "72ec680f-ec0d-44f9-919c-17c8e614b885", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T12:00:30.883983Z", + "iopub.status.busy": "2024-12-06T12:00:30.883111Z", + "iopub.status.idle": "2024-12-06T12:00:30.895148Z", + "shell.execute_reply": "2024-12-06T12:00:30.894116Z", + "shell.execute_reply.started": "2024-12-06T12:00:30.883907Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3\n" + ] + } + ], + "source": [ + "import json\n", + "import datetime\n", + "import csv\n", + "from datetime import date\n", + "\n", + "\n", + "re_ta = {}\n", + "list1 = []\n", + "filename = 'data/新疆人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/marks_20241206.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " list1.append(line)\n", + "\n", + "for result in list1:\n", + " user = str(result[2])\n", + " rq = date.fromisoformat(result[5].replace('/','-'))\n", + " if user in dict1.keys():\n", + " l_xm = []\n", + " m_item = str(result[3]) \n", + " re_ta.setdefault(user,{}) \n", + " re_ta[user]['name'] = dict1[user]['name']\n", + " re_ta[user]['sex'] = dict1[user]['sex']\n", + " if 'phone' in dict1[user].keys():\n", + " re_ta[user]['phone'] = dict1[user]['phone']\n", + " if dict1[user]['sex'] == '男':\n", + " l_xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step']\n", + " else:\n", + " l_xm = ['bmi','lung','grip','flexion','jump','balance','reaction','step','situp']\n", + " #re_ta[user]['unit'] = dict1[user]['unit']\n", + " birth = date.fromisoformat(dict1[user]['birth'].replace('/','-'))\n", + " item_name = result[3] \n", + " if item_name in l_xm: \n", + " days = (rq-birth).days \n", + " re_ta[user]['age'] = int(days/365)\n", + " re_ta[user]['month'] = int(days/365*12)\n", + " re_ta[user]['rq'] = result[5]\n", + " re_ta[user].setdefault(item_name,{}) \n", + " score = result[4] \n", + " re_ta[user][item_name]['成绩'] = score\n", + "\n", + "filename = 'data/result_新疆人员.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(re_ta, fl, ensure_ascii=False) \n", + "print(len(re_ta))" + ] + }, + { + "cell_type": "markdown", + "id": "a68d4f7f-d23a-4649-99eb-ce13b6027414", + "metadata": {}, + "source": [ + "## 生成测试得分" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "8f459ed3-fc14-404f-998b-5ed2a15958c3", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T12:04:22.231686Z", + "iopub.status.busy": "2024-12-06T12:04:22.230937Z", + "iopub.status.idle": "2024-12-06T12:04:22.249578Z", + "shell.execute_reply": "2024-12-06T12:04:22.248603Z", + "shell.execute_reply.started": "2024-12-06T12:04:22.231616Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], + "source": [ + "import json\n", + "import time\n", + "import my_module as My\n", + "\n", + "#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n", + "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", + "filename = 'data/result_新疆人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl) \n", + "for k, v in dict2.items():\n", + " #print(k)\n", + " if v['sex'] == '男':\n", + " sex = 'M'\n", + " else:\n", + " sex = 'F' \n", + " if 'bmi' in v.keys():\n", + " #bmi_data = v['height']['成绩'].split()[0]+','+ v['weight']['成绩'].split()[0]\n", + " bmi_data = v['bmi']['成绩']\n", + " data1 = {'code':k,'sex':sex,'age':v['age'],'item':'HeightWeight','result':bmi_data}\n", + " dict2[k]['bmi'] = {}\n", + " dict2[k]['bmi']['成绩'] = bmi_data\n", + " dict2[k]['bmi']['score'] = My.cal_bmi(data1)\n", + " for item_en in list_item:\n", + " if item_en in v.keys(): \n", + " data1 = {'code':k,'sex':sex,'age':v['age'],'item':item_en,'result':float(v[item_en]['成绩'].split()[0])}\n", + " #print(k,v['name'])\n", + " dict2[k][item_en]['score'] = My.cal_score(data1)\n", + " #print(k,v[item_en]['成绩'],cal_score(data1))\n", + "\n", + "filename = f'data/result_新疆人员.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict2,fl , ensure_ascii=False) \n", + "print('ok!') " + ] + }, + { + "cell_type": "markdown", + "id": "f86b0f59-c1f6-4523-aefd-854f04305ec9", + "metadata": {}, + "source": [ + "## 生成报告" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "9e843585-fef3-4f5c-baae-76e711f2a42f", + "metadata": { + "execution": { + "iopub.execute_input": "2024-12-06T12:06:46.424162Z", + "iopub.status.busy": "2024-12-06T12:06:46.422960Z", + "iopub.status.idle": "2024-12-06T12:06:49.016373Z", + "shell.execute_reply": "2024-12-06T12:06:49.015210Z", + "shell.execute_reply.started": "2024-12-06T12:06:46.424089Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3\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_新疆人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "file_path ='./新疆/'\n", + "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", + "i=0\n", + "list2 = []\n", + "for k, v in dict1.items():\n", + " list1 = []\n", + " mydata = {}\n", + " \n", + " id = str(k).rjust(4,\"0\")\n", + " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", + " mydata['title'] = '新疆'\n", + " mydata['subtitle'] = ''#v['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", + " survey_list = ['tcm','psy','spine']\n", + " for item in survey_list:\n", + " if item in v.keys():\n", + " mydata.setdefault('surveys',{})\n", + " mydata['surveys'][item] = v[item]\n", + " \n", + " \n", + " #mydata['fits'] = {}\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", + " mydata['fits'][item] = {'mark':mark,'score':v[item]['score']}\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": "code", + "execution_count": null, + "id": "13722e88-9f6a-421e-8fb3-2fccd0741452", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/体测单位/长炼医院.ipynb b/体测单位/长炼医院.ipynb index 40400a8..1c32e76 100644 --- a/体测单位/长炼医院.ipynb +++ b/体测单位/长炼医院.ipynb @@ -2414,15 +2414,15 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 20, "id": "1e2d586e-6ff5-4fd1-a909-278d23e54561", "metadata": { "execution": { - "iopub.execute_input": "2024-12-05T01:38:43.355077Z", - "iopub.status.busy": "2024-12-05T01:38:43.354336Z", - "iopub.status.idle": "2024-12-05T01:38:43.429440Z", - "shell.execute_reply": "2024-12-05T01:38:43.428824Z", - "shell.execute_reply.started": "2024-12-05T01:38:43.355007Z" + "iopub.execute_input": "2024-12-06T06:27:42.919559Z", + "iopub.status.busy": "2024-12-06T06:27:42.918788Z", + "iopub.status.idle": "2024-12-06T06:27:42.945858Z", + "shell.execute_reply": "2024-12-06T06:27:42.945012Z", + "shell.execute_reply.started": "2024-12-06T06:27:42.919489Z" } }, "outputs": [ @@ -2430,8 +2430,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "377\n", - "377\n" + "80\n", + "80\n" ] } ], @@ -2450,11 +2450,11 @@ "re_ta = {}\n", "dict1 = {}\n", "list1 = []\n", - "filename = 'data/长炼医院人员2024(汇总).json'\n", + "filename = 'data/湖南石化青年体质检测.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "\n", - "filename = 'data/places_result_20240929.csv'\n", + "filename = 'data/places_result_20241205-1.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -2492,15 +2492,15 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 21, "id": "64c6e1e3-801c-4573-b78f-5a9e842597a9", "metadata": { "execution": { - "iopub.execute_input": "2024-12-05T01:39:11.222107Z", - "iopub.status.busy": "2024-12-05T01:39:11.221349Z", - "iopub.status.idle": "2024-12-05T01:39:11.314666Z", - "shell.execute_reply": "2024-12-05T01:39:11.314133Z", - "shell.execute_reply.started": "2024-12-05T01:39:11.222034Z" + "iopub.execute_input": "2024-12-06T06:28:00.400775Z", + "iopub.status.busy": "2024-12-06T06:28:00.400061Z", + "iopub.status.idle": "2024-12-06T06:28:00.445938Z", + "shell.execute_reply": "2024-12-06T06:28:00.445528Z", + "shell.execute_reply.started": "2024-12-06T06:28:00.400712Z" } }, "outputs": [], @@ -2535,7 +2535,7 @@ " else:\n", " list2.append('') \n", " list1.append(list2)\n", - "filename = 'data/长炼医院人员检测情况表(20240930).xlsx'\n", + "filename = 'data/长炼医院人员检测情况表(湖南青年).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n",