From 3c756eda13cc8aee9bf1691871ee63fc6a4a1a3d Mon Sep 17 00:00:00 2001 From: 512song Date: Fri, 5 Dec 2025 22:47:40 +0800 Subject: [PATCH] 20251205 --- 体测单位/体质检测数据处理.ipynb | 636 +++----------------------------- 体测单位/天津石化.ipynb | 489 +++++++++++++++++++----- 文件管理.ipynb | 32 +- 3 files changed, 470 insertions(+), 687 deletions(-) diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index 16b22c5..d339e23 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -391,26 +391,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d6498431-2103-4d27-bba9-f1669b710361", - "metadata": { - "execution": { - "iopub.execute_input": "2025-12-03T14:03:11.519074Z", - "iopub.status.busy": "2025-12-03T14:03:11.518752Z", - "iopub.status.idle": "2025-12-03T14:03:11.537309Z", - "shell.execute_reply": "2025-12-03T14:03:11.536828Z", - "shell.execute_reply.started": "2025-12-03T14:03:11.519047Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('769530','185','bmi','165.0,67.0','2025-12-03'),('769530','186','bmi','178.0,81.0','2025-12-03'),('769530','187','bmi','171.0,68.0','2025-12-03'),('769530','188','bmi','168.0,65.0','2025-12-03'),('769530','189','bmi','167.0,69.0','2025-12-03'),('769530','191','bmi','183.0,75.0','2025-12-03'),('769530','192','bmi','170.0,78.0','2025-12-03'),('769530','193','bmi','178.0,78.0','2025-12-03'),('769530','194','bmi','153.0,52.0','2025-12-03'),('769530','195','bmi','166.0,69.0','2025-12-03'),('769530','196','bmi','155.0,59.0','2025-12-03'),('769530','198','bmi','162.0,59.0','2025-12-03'),('769530','185','grip','36.0','2025-12-03'),('769530','186','grip','41.4','2025-12-03'),('769530','187','grip','58.0','2025-12-03'),('769530','188','grip','26.7','2025-12-03'),('769530','189','grip','31.0','2025-12-03'),('769530','190','grip','49.0','2025-12-03'),('769530','191','grip','39.0','2025-12-03'),('769530','192','grip','42.0','2025-12-03'),('769530','193','grip','43.7','2025-12-03'),('769530','194','grip','22.5','2025-12-03'),('769530','195','grip','29.0','2025-12-03'),('769530','196','grip','31.2','2025-12-03'),('769530','197','grip','30.0','2025-12-03'),('769530','198','grip','39.7','2025-12-03'),('769530','185','balance','7.47','2025-12-03'),('769530','186','balance','82','2025-12-03'),('769530','187','balance','30','2025-12-03'),('769530','188','balance','9.51','2025-12-03'),('769530','189','balance','21','2025-12-03'),('769530','190','balance','24','2025-12-03'),('769530','192','balance','35','2025-12-03'),('769530','193','balance','25','2025-12-03'),('769530','194','balance','20.55','2025-12-03'),('769530','195','balance','24','2025-12-03'),('769530','196','balance','15','2025-12-03'),('769530','197','balance','34','2025-12-03'),('769530','198','balance','28','2025-12-03'),('769530','185','lung','3130','2025-12-03'),('769530','186','lung','4035','2025-12-03'),('769530','187','lung','4040','2025-12-03'),('769530','188','lung','2252','2025-12-03'),('769530','189','lung','3417','2025-12-03'),('769530','190','lung','4693','2025-12-03'),('769530','191','lung','4254','2025-12-03'),('769530','192','lung','4031','2025-12-03'),('769530','193','lung','4849','2025-12-03'),('769530','194','lung','2259','2025-12-03'),('769530','195','lung','4106','2025-12-03'),('769530','196','lung','2399','2025-12-03'),('769530','197','lung','3100','2025-12-03'),('769530','198','lung','3310','2025-12-03'),('769530','187','flexion','10.0','2025-12-03'),('769530','188','flexion','10.1','2025-12-03'),('769530','189','flexion','19.8','2025-12-03'),('769530','190','flexion','-0.4','2025-12-03'),('769530','191','flexion','0.4','2025-12-03'),('769530','192','flexion','-12.4','2025-12-03'),('769530','193','flexion','3.8','2025-12-03'),('769530','194','flexion','0.6','2025-12-03'),('769530','195','flexion','6.8','2025-12-03'),('769530','196','flexion','7.8','2025-12-03'),('769530','197','flexion','-1.7','2025-12-03'),('769530','198','flexion','7.2','2025-12-03'),('769530','188','reaction','0.431','2025-12-03'),('769530','189','reaction','0.411','2025-12-03'),('769530','190','reaction','0.416','2025-12-03'),('769530','191','reaction','0.461','2025-12-03'),('769530','192','reaction','0.426','2025-12-03'),('769530','193','reaction','0.454','2025-12-03'),('769530','194','reaction','0.414','2025-12-03'),('769530','195','reaction','0.414','2025-12-03'),('769530','196','reaction','0.463','2025-12-03'),('769530','197','reaction','0.450','2025-12-03'),('769530','198','reaction','0.457','2025-12-03')\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -1648,26 +1632,10 @@ }, { "cell_type": "code", - "execution_count": 151, + "execution_count": null, "id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:44:17.370454Z", - "iopub.status.busy": "2025-11-24T14:44:17.369923Z", - "iopub.status.idle": "2025-11-24T14:44:17.446158Z", - "shell.execute_reply": "2025-11-24T14:44:17.445652Z", - "shell.execute_reply.started": "2025-11-24T14:44:17.370404Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1221\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import openpyxl\n", @@ -1741,29 +1709,12 @@ }, { "cell_type": "code", - "execution_count": 154, + "execution_count": null, "id": "63edd636-f034-4aa6-8575-63d5cdb84adb", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:02.470995Z", - "iopub.status.busy": "2025-11-24T14:48:02.470445Z", - "iopub.status.idle": "2025-11-24T14:48:02.669216Z", - "shell.execute_reply": "2025-11-24T14:48:02.668674Z", - "shell.execute_reply.started": "2025-11-24T14:48:02.470943Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:2.7312分,男性:997人\n", - "平均成绩:3.2382分,女性:224人\n", - "平均成绩:2.8242分,总体:1221人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1802,32 +1753,12 @@ }, { "cell_type": "code", - "execution_count": 155, + "execution_count": null, "id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:04.750451Z", - "iopub.status.busy": "2025-11-24T14:48:04.749903Z", - "iopub.status.idle": "2025-11-24T14:48:04.814681Z", - "shell.execute_reply": "2025-11-24T14:48:04.814131Z", - "shell.execute_reply.started": "2025-11-24T14:48:04.750403Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:383人,男性:358人,女性:25人\n", - "256~332分人数:551人,男性:458人,女性:93人\n", - "333~367分人数:195人,男性:130人,女性:65人\n", - "368~500分人数:92人,男性:51人,女性:41人\n", - "1221\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1873,34 +1804,12 @@ }, { "cell_type": "code", - "execution_count": 156, + "execution_count": null, "id": "2d661ca6-6129-4da1-ac25-51d0156babb2", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:07.278548Z", - "iopub.status.busy": "2025-11-24T14:48:07.277877Z", - "iopub.status.idle": "2025-11-24T14:48:07.309085Z", - "shell.execute_reply": "2025-11-24T14:48:07.308611Z", - "shell.execute_reply.started": "2025-11-24T14:48:07.278486Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'合格': 2, '不合格': 1, '良好': 1, '优秀': 0}\n", - "25-29 {'合格': 9, '不合格': 3, '良好': 7, '优秀': 2}\n", - "30-34 {'合格': 5, '不合格': 0, '优秀': 3, '良好': 2}\n", - "35-39 {'合格': 5, '不合格': 4, '良好': 4, '优秀': 5}\n", - "40-44 {'合格': 10, '不合格': 5, '优秀': 5, '良好': 11}\n", - "45-49 {'不合格': 12, '良好': 29, '合格': 48, '优秀': 15}\n", - "50-54 {'合格': 14, '不合格': 0, '优秀': 10, '良好': 11}\n", - "55-80 {'合格': 0, '不合格': 0, '良好': 0, '优秀': 1}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1940,34 +1849,12 @@ }, { "cell_type": "code", - "execution_count": 157, + "execution_count": null, "id": "fc97df37-34ff-4a02-9d26-b5d81b706e46", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:10.182242Z", - "iopub.status.busy": "2025-11-24T14:48:10.181626Z", - "iopub.status.idle": "2025-11-24T14:48:10.208838Z", - "shell.execute_reply": "2025-11-24T14:48:10.208242Z", - "shell.execute_reply.started": "2025-11-24T14:48:10.182182Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'合格': 15, '不合格': 9, '良好': 3, '优秀': 2}\n", - "25-29 {'合格': 31, '不合格': 22, '良好': 3, '优秀': 1}\n", - "30-34 {'合格': 22, '不合格': 8, '优秀': 0, '良好': 4}\n", - "35-39 {'合格': 65, '不合格': 27, '良好': 21, '优秀': 6}\n", - "40-44 {'合格': 56, '不合格': 50, '优秀': 5, '良好': 16}\n", - "45-49 {'不合格': 49, '良好': 23, '合格': 68, '优秀': 6}\n", - "50-54 {'合格': 118, '不合格': 99, '优秀': 21, '良好': 31}\n", - "55-80 {'合格': 83, '不合格': 94, '良好': 29, '优秀': 10}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -2007,34 +1894,12 @@ }, { "cell_type": "code", - "execution_count": 158, + "execution_count": null, "id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:12.941585Z", - "iopub.status.busy": "2025-11-24T14:48:12.941037Z", - "iopub.status.idle": "2025-11-24T14:48:12.968568Z", - "shell.execute_reply": "2025-11-24T14:48:12.967973Z", - "shell.execute_reply.started": "2025-11-24T14:48:12.941536Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "16~24岁平均成绩:2.79分,人数:33人,男性:29人\n", - "25~29岁平均成绩:2.78分,人数:78人,男性:57人\n", - "30~34岁平均成绩:2.86分,人数:44人,男性:34人\n", - "35~39岁平均成绩:2.92分,人数:137人,男性:119人\n", - "40~44岁平均成绩:2.8分,人数:158人,男性:127人\n", - "45~49岁平均成绩:2.93分,人数:250人,男性:146人\n", - "50~54岁平均成绩:2.83分,人数:304人,男性:269人\n", - "55~69岁平均成绩:2.67分,人数:217人,男性:216人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "\n", @@ -2069,34 +1934,12 @@ }, { "cell_type": "code", - "execution_count": 159, + "execution_count": null, "id": "347703a1-501b-4800-bd29-16e94f4a6793", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:15.372851Z", - "iopub.status.busy": "2025-11-24T14:48:15.372157Z", - "iopub.status.idle": "2025-11-24T14:48:15.394637Z", - "shell.execute_reply": "2025-11-24T14:48:15.394035Z", - "shell.execute_reply.started": "2025-11-24T14:48:15.372789Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.77分,人数:29人\n", - "25~29岁平均成绩:2.63分,人数:57人\n", - "30~34岁平均成绩:2.69分,人数:34人\n", - "35~39岁平均成绩:2.86分,人数:119人\n", - "40~44岁平均成绩:2.7分,人数:127人\n", - "45~49岁平均成绩:2.75分,人数:146人\n", - "50~54岁平均成绩:2.75分,人数:269人\n", - "55~80岁平均成绩:2.66分,人数:216人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -2131,34 +1974,12 @@ }, { "cell_type": "code", - "execution_count": 160, + "execution_count": null, "id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:17.652548Z", - "iopub.status.busy": "2025-11-24T14:48:17.651903Z", - "iopub.status.idle": "2025-11-24T14:48:17.677973Z", - "shell.execute_reply": "2025-11-24T14:48:17.677393Z", - "shell.execute_reply.started": "2025-11-24T14:48:17.652491Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.94分,人数:4人\n", - "25~29岁平均成绩:3.19分,人数:21人\n", - "30~34岁平均成绩:3.44分,人数:10人\n", - "35~39岁平均成绩:3.28分,人数:18人\n", - "40~44岁平均成绩:3.18分,人数:31人\n", - "45~49岁平均成绩:3.18分,人数:104人\n", - "50~54岁平均成绩:3.44分,人数:35人\n", - "55~80岁平均成绩:4.12分,人数:1人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -2191,37 +2012,13 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": null, "id": "ad69c45d-3f62-42df-894d-47424e759029", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:20.700694Z", - "iopub.status.busy": "2025-11-24T14:48:20.699169Z", - "iopub.status.idle": "2025-11-24T14:48:20.724432Z", - "shell.execute_reply": "2025-11-24T14:48:20.723863Z", - "shell.execute_reply.started": "2025-11-24T14:48:20.700633Z" - }, "scrolled": true, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BMI 3.04 1212\n", - "肺活量 3.23 1202\n", - "握力 2.56 1211\n", - "坐位体前屈 3.26 1144\n", - "纵跳 2.17 1152\n", - "俯卧撑 2.5 955\n", - "一分钟仰卧起坐 3.8 202\n", - "单脚站立 2.58 1184\n", - "选择反应时 3.26 1204\n", - "台阶指数 2.72 768\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2246,46 +2043,12 @@ }, { "cell_type": "code", - "execution_count": 152, + "execution_count": null, "id": "dcf152e7-bbcc-47d1-9c5f-83854db35412", "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:44:34.448484Z", - "iopub.status.busy": "2025-11-24T14:44:34.447872Z", - "iopub.status.idle": "2025-11-24T14:44:34.473938Z", - "shell.execute_reply": "2025-11-24T14:44:34.473308Z", - "shell.execute_reply.started": "2025-11-24T14:44:34.448431Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "应急救援中心 2.9 82\n", - "质量计量中心 2.94 125\n", - "公用工程部 2.77 164\n", - "财务资产部 3.1 15\n", - "炼油一部 2.74 163\n", - "炼油二部 2.8 145\n", - "炼油三部 2.88 144\n", - "储运部 2.68 139\n", - "行政事务中心 2.65 90\n", - "总经理办公室 3.1 9\n", - "安全环保部 3.03 14\n", - "计划经营部 2.96 12\n", - "党群工作部 3.31 14\n", - "物资采购中心 3.02 24\n", - "生产技术部 2.95 19\n", - "设备工程部 2.99 22\n", - "监督审计部 2.88 10\n", - "党委组织部 2.95 10\n", - "发展规划部 3.15 7\n", - "企管法律部 2.98 13\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2314,45 +2077,10 @@ }, { "cell_type": "code", - "execution_count": 167, + "execution_count": null, "id": "d1977ca9-bf12-4f09-ae7b-e8af9eaa82f2", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:53:54.924386Z", - "iopub.status.busy": "2025-11-24T14:53:54.923677Z", - "iopub.status.idle": "2025-11-24T14:53:54.952891Z", - "shell.execute_reply": "2025-11-24T14:53:54.952311Z", - "shell.execute_reply.started": "2025-11-24T14:53:54.924307Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "应急救援中心 2.9 82\n", - "质量计量中心 2.94 125\n", - "公用工程部 2.77 164\n", - "财务资产部 3.1 15\n", - "炼油一部 2.74 163\n", - "炼油二部 2.8 145\n", - "炼油三部 2.88 144\n", - "储运部 2.68 139\n", - "行政事务中心 2.65 90\n", - "总经理办公室 3.1 9\n", - "安全环保部 3.03 14\n", - "计划经营部 2.96 12\n", - "党群工作部 3.31 14\n", - "物资采购中心 3.02 24\n", - "生产技术部 2.95 19\n", - "设备工程部 2.99 22\n", - "监督审计部 2.88 10\n", - "党委组织部 2.95 10\n", - "发展规划部 3.15 7\n", - "企管法律部 2.98 13\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2384,45 +2112,10 @@ }, { "cell_type": "code", - "execution_count": 163, + "execution_count": null, "id": "d507c7f7-6a91-4695-b700-5e2f77e6dea3", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:48:33.771404Z", - "iopub.status.busy": "2025-11-24T14:48:33.770838Z", - "iopub.status.idle": "2025-11-24T14:48:33.790371Z", - "shell.execute_reply": "2025-11-24T14:48:33.789671Z", - "shell.execute_reply.started": "2025-11-24T14:48:33.771338Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "应急救援中心 5 18 39 20\n", - "质量计量中心 13 21 63 28\n", - "公用工程部 10 25 69 60\n", - "财务资产部 3 3 7 2\n", - "炼油一部 5 17 85 56\n", - "炼油二部 10 25 61 49\n", - "炼油三部 16 25 59 44\n", - "储运部 11 12 57 59\n", - "行政事务中心 4 9 41 36\n", - "总经理办公室 0 4 3 2\n", - "安全环保部 3 2 6 3\n", - "计划经营部 2 2 5 3\n", - "党群工作部 2 6 6 0\n", - "物资采购中心 4 4 12 4\n", - "生产技术部 1 3 12 3\n", - "设备工程部 0 8 8 6\n", - "监督审计部 0 3 5 2\n", - "党委组织部 0 3 5 2\n", - "发展规划部 2 1 3 1\n", - "企管法律部 1 4 5 3\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2459,245 +2152,10 @@ }, { "cell_type": "code", - "execution_count": 168, + "execution_count": null, "id": "90bc66cd-9f01-410e-9abc-e6f15ada293f", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-24T14:55:54.386010Z", - "iopub.status.busy": "2025-11-24T14:55:54.385455Z", - "iopub.status.idle": "2025-11-24T14:55:54.420009Z", - "shell.execute_reply": "2025-11-24T14:55:54.419528Z", - "shell.execute_reply.started": "2025-11-24T14:55:54.385957Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "应急救援中心\n", - "BMI 228 82\n", - "肺活量 240 82\n", - "握力 212 82\n", - "坐位体前屈 246 78\n", - "纵跳 189 77\n", - "俯卧撑 280 76\n", - "一分钟仰卧起坐 7 2\n", - "单脚站立 179 77\n", - "选择反应时 275 82\n", - "台阶指数 159 53\n", - "质量计量中心\n", - "BMI 427 123\n", - "肺活量 426 125\n", - "握力 302 124\n", - "坐位体前屈 371 115\n", - "纵跳 251 116\n", - "俯卧撑 135 62\n", - "一分钟仰卧起坐 195 51\n", - "单脚站立 330 120\n", - "选择反应时 410 123\n", - "台阶指数 207 74\n", - "公用工程部\n", - "BMI 505 163\n", - "肺活量 520 160\n", - "握力 406 161\n", - "坐位体前屈 467 149\n", - "纵跳 335 158\n", - "俯卧撑 327 137\n", - "一分钟仰卧起坐 61 15\n", - "单脚站立 370 158\n", - "选择反应时 511 160\n", - "台阶指数 280 98\n", - "财务资产部\n", - "BMI 57 15\n", - "肺活量 48 15\n", - "握力 27 15\n", - "坐位体前屈 55 13\n", - "纵跳 33 14\n", - "俯卧撑 19 5\n", - "一分钟仰卧起坐 37 9\n", - "单脚站立 43 14\n", - "选择反应时 52 15\n", - "台阶指数 24 10\n", - "炼油一部\n", - "BMI 491 161\n", - "肺活量 505 163\n", - "握力 430 163\n", - "坐位体前屈 492 157\n", - "纵跳 315 154\n", - "俯卧撑 307 139\n", - "一分钟仰卧起坐 67 19\n", - "单脚站立 406 160\n", - "选择反应时 523 161\n", - "台阶指数 271 102\n", - "炼油二部\n", - "BMI 402 144\n", - "肺活量 463 144\n", - "握力 380 144\n", - "坐位体前屈 466 139\n", - "纵跳 321 142\n", - "俯卧撑 233 112\n", - "一分钟仰卧起坐 110 29\n", - "单脚站立 368 143\n", - "选择反应时 462 143\n", - "台阶指数 288 98\n", - "炼油三部\n", - "BMI 462 142\n", - "肺活量 463 138\n", - "握力 364 144\n", - "坐位体前屈 471 131\n", - "纵跳 247 131\n", - "俯卧撑 335 124\n", - "一分钟仰卧起坐 61 15\n", - "单脚站立 348 141\n", - "选择反应时 476 143\n", - "台阶指数 230 84\n", - "储运部\n", - "BMI 392 138\n", - "肺活量 416 137\n", - "握力 360 136\n", - "坐位体前屈 428 133\n", - "纵跳 256 131\n", - "俯卧撑 283 126\n", - "一分钟仰卧起坐 28 9\n", - "单脚站立 334 136\n", - "选择反应时 415 138\n", - "台阶指数 213 74\n", - "行政事务中心\n", - "BMI 248 90\n", - "肺活量 263 85\n", - "握力 222 88\n", - "坐位体前屈 259 80\n", - "纵跳 143 82\n", - "俯卧撑 171 72\n", - "一分钟仰卧起坐 26 9\n", - "单脚站立 200 83\n", - "选择反应时 278 86\n", - "台阶指数 115 44\n", - "总经理办公室\n", - "BMI 25 9\n", - "肺活量 31 9\n", - "握力 24 9\n", - "坐位体前屈 24 8\n", - "纵跳 24 8\n", - "俯卧撑 9 3\n", - "一分钟仰卧起坐 20 5\n", - "单脚站立 34 9\n", - "选择反应时 28 9\n", - "台阶指数 21 8\n", - "安全环保部\n", - "BMI 38 14\n", - "肺活量 48 14\n", - "握力 40 14\n", - "坐位体前屈 40 13\n", - "纵跳 36 13\n", - "俯卧撑 24 10\n", - "一分钟仰卧起坐 11 3\n", - "单脚站立 45 13\n", - "选择反应时 50 13\n", - "台阶指数 36 13\n", - "计划经营部\n", - "BMI 38 12\n", - "肺活量 39 11\n", - "握力 32 12\n", - "坐位体前屈 32 11\n", - "纵跳 30 11\n", - "俯卧撑 15 6\n", - "一分钟仰卧起坐 20 5\n", - "单脚站立 30 12\n", - "选择反应时 45 12\n", - "台阶指数 23 11\n", - "党群工作部\n", - "BMI 58 14\n", - "肺活量 51 14\n", - "握力 36 14\n", - "坐位体前屈 45 14\n", - "纵跳 41 14\n", - "俯卧撑 19 6\n", - "一分钟仰卧起坐 32 7\n", - "单脚站立 51 14\n", - "选择反应时 50 14\n", - "台阶指数 27 13\n", - "物资采购中心\n", - "BMI 72 24\n", - "肺活量 89 24\n", - "握力 65 24\n", - "坐位体前屈 88 24\n", - "纵跳 56 23\n", - "俯卧撑 45 15\n", - "一分钟仰卧起坐 33 8\n", - "单脚站立 61 24\n", - "选择反应时 76 24\n", - "台阶指数 41 16\n", - "生产技术部\n", - "BMI 57 19\n", - "肺活量 67 19\n", - "握力 47 19\n", - "坐位体前屈 56 18\n", - "纵跳 42 17\n", - "俯卧撑 45 17\n", - "一分钟仰卧起坐 3 1\n", - "单脚站立 61 19\n", - "选择反应时 68 19\n", - "台阶指数 32 14\n", - "设备工程部\n", - "BMI 74 22\n", - "肺活量 71 22\n", - "握力 53 22\n", - "坐位体前屈 71 22\n", - "纵跳 67 22\n", - "俯卧撑 62 17\n", - "一分钟仰卧起坐 18 5\n", - "单脚站立 60 22\n", - "选择反应时 68 22\n", - "台阶指数 49 22\n", - "监督审计部\n", - "BMI 28 10\n", - "肺活量 32 10\n", - "握力 19 10\n", - "坐位体前屈 28 10\n", - "纵跳 27 10\n", - "俯卧撑 22 7\n", - "一分钟仰卧起坐 12 3\n", - "单脚站立 35 10\n", - "选择反应时 31 10\n", - "台阶指数 22 9\n", - "党委组织部\n", - "BMI 26 10\n", - "肺活量 37 10\n", - "握力 25 10\n", - "坐位体前屈 29 10\n", - "纵跳 30 10\n", - "俯卧撑 14 6\n", - "一分钟仰卧起坐 12 4\n", - "单脚站立 34 10\n", - "选择反应时 37 10\n", - "台阶指数 22 10\n", - "发展规划部\n", - "BMI 19 7\n", - "肺活量 28 7\n", - "握力 18 7\n", - "坐位体前屈 23 7\n", - "纵跳 22 6\n", - "俯卧撑 20 6\n", - "一分钟仰卧起坐 5 1\n", - "单脚站立 19 6\n", - "选择反应时 28 7\n", - "台阶指数 11 6\n", - "企管法律部\n", - "BMI 37 13\n", - "肺活量 45 13\n", - "握力 36 13\n", - "坐位体前屈 37 12\n", - "纵跳 32 13\n", - "俯卧撑 25 9\n", - "一分钟仰卧起坐 9 2\n", - "单脚站立 42 13\n", - "选择反应时 44 13\n", - "台阶指数 21 9\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2852,9 +2310,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-04T01:12:54.320249Z", + "iopub.status.busy": "2025-12-04T01:12:54.319633Z", + "iopub.status.idle": "2025-12-04T01:12:54.339019Z", + "shell.execute_reply": "2025-12-04T01:12:54.337721Z", + "shell.execute_reply.started": "2025-12-04T01:12:54.320195Z" + } + }, "outputs": [], "source": [ "import json\n", @@ -3206,15 +2672,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-04T01:13:55.931481Z", + "iopub.status.busy": "2025-12-04T01:13:55.930100Z", + "iopub.status.idle": "2025-12-04T01:13:55.996588Z", + "shell.execute_reply": "2025-12-04T01:13:55.996041Z", + "shell.execute_reply.started": "2025-12-04T01:13:55.931411Z" + } + }, "outputs": [], "source": [ "import openpyxl\n", "\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", - "filename = 'data/result_沧州炼化-1.json'\n", + "filename = 'data/result_新疆油田采油工艺研究院2511.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "data_list = []\n", @@ -3296,7 +2770,7 @@ " list6.append('')\n", " i+=1\n", " data_list.append(list6)\n", - "filename = 'data/沧州炼化2025年体质检测明细表.xlsx'\n", + "filename = 'data/新疆油田采油工艺研究院体质检测明细表(2025年11月).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "title = ['编号', '姓名', '性别', '单位/部门', '年龄', '身高', '体重', 'bmi', '肺活量', '得分', '握力', '得分', '坐位体前屈', '得分', '纵跳', '得分', '俯卧撑', '得分', '单脚站立', '得分', '选择反应时', '得分', '台阶指数', '得分', '一分钟仰卧起坐', '得分', '中医体质', '是否倾向', '平和', '气虚', '阳虚', '阴虚', '痰湿', '湿热', '血瘀', '气郁', '特禀', '成就感', '愉快心理', '放松程度', '压力应对', '体力充沛', '情感充沛度', '颈椎', '胸椎', '腰椎', '骶尾椎']\n", diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index 94c8feb..0abc31c 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -2793,7 +2793,9 @@ { "cell_type": "markdown", "id": "08bcbf58-4356-4f30-850f-0d0ff0e2528b", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "# 第三次体测(2024年10月)" ] @@ -3247,27 +3249,12 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "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": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import os,sys,shutil\n", "import json\n", @@ -3832,34 +3819,10 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "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" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -3978,15 +3941,15 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 66, "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" + "iopub.execute_input": "2025-12-04T12:11:07.227210Z", + "iopub.status.busy": "2025-12-04T12:11:07.226601Z", + "iopub.status.idle": "2025-12-04T12:11:08.296200Z", + "shell.execute_reply": "2025-12-04T12:11:08.295131Z", + "shell.execute_reply.started": "2025-12-04T12:11:07.227149Z" } }, "outputs": [ @@ -4018,7 +3981,7 @@ "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi','wh']\n", "i=0\n", "list2 = []\n", - "person = ['03603316']\n", + "person = ['01738966']\n", "bumen =['南港乙烯项目管理部']\n", "for k, v in dict1.items():\n", " list1 = []\n", @@ -4074,35 +4037,10 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "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" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import os,sys,shutil\n", "import json\n", @@ -4138,17 +4076,9 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "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" - } - }, + "metadata": {}, "outputs": [], "source": [ "import os,sys,shutil\n", @@ -4175,6 +4105,385 @@ " shutil.copyfile(fn,n_name)" ] }, + { + "cell_type": "markdown", + "id": "d4950051-c196-461a-a862-758ad014923d", + "metadata": {}, + "source": [ + "## 获得报告数据" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "id": "d5ec9835-0f8d-4755-8fa1-b0a1f7f35bfc", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-04T01:42:19.668220Z", + "iopub.status.busy": "2025-12-04T01:42:19.667596Z", + "iopub.status.idle": "2025-12-04T01:46:02.421978Z", + "shell.execute_reply": "2025-12-04T01:46:02.421489Z", + "shell.execute_reply.started": "2025-12-04T01:42:19.668162Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0\n" + ] + } + ], + "source": [ + "import pdfplumber\n", + "import os,sys,shutil\n", + "import json\n", + "import glob\n", + "from pathlib import Path\n", + "\n", + "dict1 = {}\n", + "\n", + "fi_path = '/home/songyi/pdf-typescript-fit2023/天津石化2025'\n", + "fls = glob.glob(f'{fi_path}/*.pdf')\n", + "for fn in fls:\n", + " code = Path(fn).stem.split('-')[0]\n", + " dict1.setdefault(code,{})\n", + " pdf = pdfplumber.open(fn)\n", + " text = pdf.pages[1].extract_text()#######页码从0开始计数\n", + " #print(text)\n", + " list1 = text.split('\\n')\n", + " for item in list1:\n", + " if '测试标准 国民体质测定标准' in item:\n", + " list_min = list1.index(item)\n", + " if '请注意:以上测试项目' in item or '感谢您完成测试' in item:\n", + " list_max = list1.index(item)\n", + " #print(code,list_min,list_max)\n", + " for i in range(list_min+1,list_max):\n", + " #dict2 = {}\n", + " xm = list1[i].split(' ')[0]\n", + " dict1[code][xm] = ','.join(list1[i].split(' ')[1:])\n", + "filename = 'data/天津石化体测报告提取数据.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) \n", + "print(len(dict1)) \n", + " \n" + ] + }, + { + "cell_type": "markdown", + "id": "c3dca4b9-cc70-4e29-8848-97c8e2044219", + "metadata": {}, + "source": [ + "## 获得报告中得分及等级" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "e48afdab-13f5-492a-9c14-72e00a883cdd", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-05T04:28:27.297909Z", + "iopub.status.busy": "2025-12-05T04:28:27.297070Z", + "iopub.status.idle": "2025-12-05T04:32:11.169088Z", + "shell.execute_reply": "2025-12-05T04:32:11.168527Z", + "shell.execute_reply.started": "2025-12-05T04:28:27.297834Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3740\n" + ] + } + ], + "source": [ + "import pdfplumber\n", + "import os,sys,shutil\n", + "import json\n", + "import glob\n", + "from pathlib import Path\n", + "import re\n", + "\n", + "dict1 = {}\n", + "\n", + "fi_path = '/home/songyi/pdf-typescript-fit2023/天津石化2025'\n", + "fls = glob.glob(f'{fi_path}/*.pdf')\n", + "for fn in fls:\n", + " code = Path(fn).stem.split('-')[0]\n", + " dict1.setdefault(code,{})\n", + " pdf = pdfplumber.open(fn)\n", + " text = pdf.pages[1].extract_text()#######页码从0开始计数\n", + " #print(text)\n", + " list1 = text.split('\\n')\n", + " for item in list1:\n", + " if '感谢您完成测试' in item:\n", + " score_pattern = r\"分为(\\d+)\"\n", + " score_match = re.search(score_pattern, text)\n", + " if score_match:\n", + " average_score = score_match.group(1)\n", + " else:\n", + " average_score = ''\n", + "\n", + "# 提取等级信息(包括括号内的内容)\n", + " grade_pattern = r\"等级为([^,]+)\"\n", + " grade_match = re.search(grade_pattern, text)\n", + " if grade_match:\n", + " grade = grade_match.group(1) \n", + " else:\n", + " grade = ''\n", + " dict1[code]['平均分'] = average_score\n", + " dict1[code]['等级'] = grade.split('(')[0] \n", + " \n", + " \n", + "filename = 'data/天津石化体测报告提取数据(得分及等级).json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) \n", + "print(len(dict1)) " + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "c624a091-4851-4f3a-83c9-83520b20603b", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-05T06:39:21.668327Z", + "iopub.status.busy": "2025-12-05T06:39:21.667654Z", + "iopub.status.idle": "2025-12-05T06:39:21.677684Z", + "shell.execute_reply": "2025-12-05T06:39:21.676710Z", + "shell.execute_reply.started": "2025-12-05T06:39:21.668269Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/天津石化体测报告提取数据(得分及等级).json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "for k, v in dict1.items():\n", + " if not v['平均分'].isdigit:\n", + " print(k)" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "e40caa62-9f50-4480-964e-177e88549425", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-04T01:50:28.395443Z", + "iopub.status.busy": "2025-12-04T01:50:28.394915Z", + "iopub.status.idle": "2025-12-04T01:50:28.426527Z", + "shell.execute_reply": "2025-12-04T01:50:28.425998Z", + "shell.execute_reply.started": "2025-12-04T01:50:28.395395Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'纵跳', '请注意:以上测试项目及格线为60分。列表中红色项目需重点关注,建议在专家指导下进行科学锻炼,', '选择反应时', '肺活量', '俯卧撑', '闭眼单脚站立', '坐位体前屈', '1分钟仰卧起坐', '腰臀比', '减少潜在的运动风险。', '握力', '身高体重指数', '台阶指数'}\n" + ] + } + ], + "source": [ + "filename = 'data/天津石化体测报告提取数据.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "set1 = set()\n", + "for k, v in dict1.items():\n", + " for item in v.keys():\n", + " set1.add(item)\n", + "print(set1)" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "id": "1edd3188-e28f-459c-a7f3-369393e43b47", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-04T12:18:14.866809Z", + "iopub.status.busy": "2025-12-04T12:18:14.866039Z", + "iopub.status.idle": "2025-12-04T12:18:15.086401Z", + "shell.execute_reply": "2025-12-04T12:18:15.085861Z", + "shell.execute_reply.started": "2025-12-04T12:18:14.866737Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3740\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", + "filename = 'data/天津石化人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict4 = json.load(fl)\n", + " \n", + "filename = 'data/天津石化体测报告提取数据.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "items = ['纵跳','选择反应时','肺活量','俯卧撑','闭眼单脚站立','坐位体前屈','1分钟仰卧起坐','握力','台阶指数']\n", + "items_1 = ['腰臀比','身高体重指数']\n", + "dict3 = {}\n", + "for k, v in dict2.items():\n", + " dict3.setdefault(k,{})\n", + " dict3[k]['name'] = dict4[k]['name']\n", + " dict3[k]['sex'] = dict4[k]['sex']\n", + " dict3[k]['unit'] = dict4[k]['unit']\n", + " dict3[k]['sub_unit'] = dict4[k]['sub_unit']\n", + " dict3[k]['age'] = dict1[k]['age']\n", + " for item in items:\n", + " if item in v.keys():\n", + " #print(k,item)\n", + " dict3[k].setdefault(item,{})\n", + " dict3[k][item]['mark'] = v[item].split(',')[0]\n", + " dict3[k][item]['score'] = v[item].split(',')[2].replace('分','')\n", + " for item in items_1:\n", + " if item in v.keys():\n", + " dict3[k].setdefault(item,{})\n", + " dict3[k][item]['mark'] = v[item].split(',')[0]\n", + " dict3[k][item]['score'] = v[item].split(',')[1].replace('分','')\n", + " \n", + "filename = 'data/data_天津石化2025.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict3, fl, ensure_ascii=False) \n", + "print(len(dict3)) \n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "6694af03-76f3-4d7f-8f80-3bf755f94aa8", + "metadata": {}, + "source": [ + "## 合并整理报告数据" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "ed42e2f1-c024-4d29-86c3-b47edb97724f", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-05T06:51:04.517628Z", + "iopub.status.busy": "2025-12-05T06:51:04.516907Z", + "iopub.status.idle": "2025-12-05T06:51:04.714115Z", + "shell.execute_reply": "2025-12-05T06:51:04.713629Z", + "shell.execute_reply.started": "2025-12-05T06:51:04.517561Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3740\n" + ] + } + ], + "source": [ + "filename = 'data/data_天津石化2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "filename = 'data/天津石化体测报告提取数据(得分及等级).json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "items = ['纵跳','选择反应时','肺活量','俯卧撑','闭眼单脚站立','坐位体前屈','1分钟仰卧起坐','握力','台阶指数','身高体重指数']\n", + "for k, v in dict1.items():\n", + " for item in items:\n", + " if item in v.keys():\n", + " score = int(v[item]['score'])\n", + " v[item]['score'] = score\n", + " v['平均分'] = dict2[k]['平均分']\n", + " v['等级'] = dict2[k]['等级']\n", + "\n", + "filename = 'data/data_天津石化2025.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) \n", + "print(len(dict1)) " + ] + }, + { + "cell_type": "markdown", + "id": "aa8a5641-d5dc-4452-8c8a-8d2c161e9b9a", + "metadata": {}, + "source": [ + "## 导出报告数据" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "id": "5f7cbf7c-ad59-4c84-8592-34ae71c10e26", + "metadata": { + "execution": { + "iopub.execute_input": "2025-12-05T07:11:47.233380Z", + "iopub.status.busy": "2025-12-05T07:11:47.232806Z", + "iopub.status.idle": "2025-12-05T07:11:48.772073Z", + "shell.execute_reply": "2025-12-05T07:11:48.771510Z", + "shell.execute_reply.started": "2025-12-05T07:11:47.233324Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "title = ['编号', '姓名', '性别', '部门', '车间','年龄', '身高体重指数', '肺活量', '得分', '握力', '得分', '坐位体前屈', '得分', '纵跳', '得分', '俯卧撑', '得分', '单脚站立', '得分', '选择反应时', '得分', '一分钟仰卧起坐', '得分','台阶指数', '得分','腰臀比','状态','平均分','等级']\n", + "items = ['身高体重指数','肺活量','握力','坐位体前屈','纵跳','俯卧撑','闭眼单脚站立','选择反应时','1分钟仰卧起坐','台阶指数','腰臀比']\n", + "\n", + "list1 = []\n", + "filename = 'data/data_天津石化2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "for k, v in dict1.items():\n", + " list2 = []\n", + " list2.append(k)\n", + " list2.append(v['name'])\n", + " list2.append(v['sex'])\n", + " list2.append(v['unit'])\n", + " list2.append(v['sub_unit'])\n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['mark'])\n", + " list2.append(v[item]['score'])\n", + " else:\n", + " list2.append('')\n", + " list2.append('') \n", + " list2.append(v['平均分'])\n", + " list2.append(v['等级'])\n", + " list1.append(list2)\n", + " \n", + "\n", + "\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) \n" + ] + }, { "cell_type": "markdown", "id": "85a03b00-9624-4ae9-aa6d-386798d457df", diff --git a/文件管理.ipynb b/文件管理.ipynb index 358d485..d28f5d6 100644 --- a/文件管理.ipynb +++ b/文件管理.ipynb @@ -1424,15 +1424,15 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 31, "id": "04dd6436-8374-4096-a2a3-d79f4d93a360", "metadata": { "execution": { - "iopub.execute_input": "2025-12-03T06:25:24.215544Z", - "iopub.status.busy": "2025-12-03T06:25:24.214765Z", - "iopub.status.idle": "2025-12-03T06:25:24.280529Z", - "shell.execute_reply": "2025-12-03T06:25:24.280065Z", - "shell.execute_reply.started": "2025-12-03T06:25:24.215449Z" + "iopub.execute_input": "2025-12-04T01:29:08.571756Z", + "iopub.status.busy": "2025-12-04T01:29:08.571003Z", + "iopub.status.idle": "2025-12-04T01:29:08.644466Z", + "shell.execute_reply": "2025-12-04T01:29:08.643884Z", + "shell.execute_reply.started": "2025-12-04T01:29:08.571687Z" } }, "outputs": [ @@ -1442,15 +1442,15 @@ "text": [ "['北体乾元健康管理中心', '姓名 邵希强', '中石化(天津)石油化工 编号 01730823', '有限公司 性别 男', '年龄 53', '国民体质检测结果与健康处方', '肺活量', '握力 身高体重指数', '坐位体前屈 选择反应时', '纵跳 闭眼单脚站立', '俯卧撑', '测试标准 国民体质测定标准', '闭眼单脚站立 2.8 秒 10分', '身高体重指数 26.02 60分', '坐位体前屈 13.5 厘米 90分', '握力 33.5 千克 50分', '纵跳 18.0 厘米 30分', '肺活量 3050 毫升 70分', '俯卧撑 5 次 50分', '选择反应时 0.572 秒 75分', '腰臀比 0.90 正常', '请注意:以上测试项目及格线为3分。列表中红色项目需重点关注,建议在专家指导下进行科学锻炼,', '减少潜在的运动风险。', '感谢您完成测试,以《国民体质测定标准》综合评级,您的总分为58分,等级为四级(不合格)。', '(其中项目纵跳因超出年龄范围得分仅供参考,不计入总分)', '北体乾元体质监测报告']\n", "11 21\n", - "闭眼单脚站立 2.8 秒 10分\n", - "身高体重指数 26.02 60分\n", - "坐位体前屈 13.5 厘米 90分\n", - "握力 33.5 千克 50分\n", - "纵跳 18.0 厘米 30分\n", - "肺活量 3050 毫升 70分\n", - "俯卧撑 5 次 50分\n", - "选择反应时 0.572 秒 75分\n", - "腰臀比 0.90 正常\n" + "闭眼单脚站立\n", + "身高体重指数\n", + "坐位体前屈\n", + "握力\n", + "纵跳\n", + "肺活量\n", + "俯卧撑\n", + "选择反应时\n", + "腰臀比\n" ] } ], @@ -1469,7 +1469,7 @@ " list_max = list1.index(item)\n", "print(list_min,list_max)\n", "for i in range(list_min+1,list_max):\n", - " print(list1[i])\n" + " print(list1[i].split(' ')[0])\n" ] }, {