From 9ec7907bde2f38a6a650380fdb00fbdf796ca398 Mon Sep 17 00:00:00 2001 From: 512song Date: Thu, 30 Oct 2025 08:24:56 +0800 Subject: [PATCH] 20251030 --- 体测单位/体质检测数据处理.ipynb | 391 ++------- 体测单位/南京化工.ipynb | 269 ++++-- 体测单位/胜利采油厂.ipynb | 837 +++++-------------- 体测单位/镇海.ipynb | 1358 ++++++++++++++----------------- 4 files changed, 1062 insertions(+), 1793 deletions(-) diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index 79afeb0..c53424c 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -391,32 +391,16 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "d6498431-2103-4d27-bba9-f1669b710361", - "metadata": { - "execution": { - "iopub.execute_input": "2025-07-02T07:57:16.226394Z", - "iopub.status.busy": "2025-07-02T07:57:16.225723Z", - "iopub.status.idle": "2025-07-02T07:57:16.244956Z", - "shell.execute_reply": "2025-07-02T07:57:16.244165Z", - "shell.execute_reply.started": "2025-07-02T07:57:16.226327Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('345321','1787376','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787128','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789517','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786135','pushup','3','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789748','pushup','3','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3530344','pushup','4','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786084','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788859','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783509','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782462','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788929','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789072','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782596','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780972','pushup','7','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786095','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788116','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783917','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786562','pushup','9','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787804','pushup','9','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782395','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782049','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783534','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783827','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783263','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540299','pushup','11','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789560','pushup','11','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786102','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788660','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780017','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789307','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788676','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788744','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786234','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3530368','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789685','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1785410','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783124','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788788','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788120','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1795937','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786639','pushup','16','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540355','pushup','18','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788685','pushup','19','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3470775','pushup','20','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786153','pushup','21','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566780','pushup','22','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3438972','pushup','28','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566790','pushup','29','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566668','pushup','29','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786252','pushup','30','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783259','pushup','31','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3219236','pushup','34','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788226','pushup','40','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788113','pushup','40','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540363','pushup','47','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786183','pushup','52','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3502448','pushup','62','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786259','pushup','101','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787741','situp','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1784476','situp','17','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788718','situp','19','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1785742','situp','24','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787496','bmi','155.0,65.0','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780280','bmi','173.0,85.0','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786451','bmi','173.0,104.5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788784','bmi','174,89.9','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788120','bmi','187,105.0','2025-07-02','2025-07-02 16:00:00.000 +0800')\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import openpyxl\n", "import json\n", "\n", "\n", - "wb = openpyxl.load_workbook('data/手工数据4.xlsx',data_only=True)\n", + "wb = openpyxl.load_workbook('data/镇海手工数据.xlsx',data_only=True)\n", "sheet = wb.active\n", "s = ''\n", "list1 = []\n", @@ -428,7 +412,7 @@ " list2.append(\"'\"+str(sheet.cell(n, 3).value)+\"'\")\n", " list2.append(\"'\"+str(sheet.cell(n, 4).value)+\"'\")\n", " list2.append(\"'\"+str(sheet.cell(n, 5).value)+\"'\")\n", - " list2.append(\"'\"+str(sheet.cell(n, 6).value)+\"'\")\n", + " #list2.append(\"'\"+str(sheet.cell(n, 6).value)+\"'\")\n", " ss = ','.join(list2)\n", " list1.append(\"(\"+ss+\")\")\n", "s = ','.join(list1)\n", @@ -706,11 +690,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_长炼医院人员2024(湖南青年).json'\n", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./长炼医院2024(湖南青年)/'\n", + "file_path ='./胜利采油厂/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -718,9 +702,9 @@ " list1 = []\n", " mydata = {}\n", " \n", - " id = str(k).rjust(4,\"0\")\n", + " id = str(k).rjust(8,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", - " mydata['title'] = '中石化长岭分公司'\n", + " mydata['title'] = '东营胜利采油厂'\n", " mydata['subtitle'] = v['unit']\n", " mydata['id'] = id\n", " mydata['name'] = v['name']\n", @@ -776,11 +760,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_东营工程设计院2024_all.json'\n", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./中石化石油工程设计有限公司/'\n", + "file_path ='./胜利采油厂/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -790,7 +774,7 @@ " \n", " id = str(k).rjust(4,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", - " mydata['title'] = '中石化石油工程设计有限公司'\n", + " mydata['title'] = '东营胜利采油厂'\n", " mydata['subtitle'] = v['unit']\n", " mydata['id'] = id\n", " mydata['name'] = v['name']\n", @@ -851,12 +835,12 @@ "import glob\n", "from pathlib import Path\n", "\n", - "fi_path = '/home/songyi/pdf-typescript-old2/东营胜利宾馆'\n", - "new_path = 'file/东营胜利宾馆'\n", + "fi_path = '/home/songyi/pdf-typescript-old2/胜利采油厂'\n", + "new_path = 'file/胜利采油厂'\n", "old = []\n", "dict2 = {}\n", "\n", - "filename = 'data/result_东营胜利宾馆.json'\n", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -882,27 +866,12 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "02319955-7fb6-4791-ae45-55b03bdadd54", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T02:26:40.883312Z", - "iopub.status.busy": "2025-06-30T02:26:40.882740Z", - "iopub.status.idle": "2025-06-30T02:26:40.906024Z", - "shell.execute_reply": "2025-06-30T02:26:40.905551Z", - "shell.execute_reply.started": "2025-06-30T02:26:40.883256Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import os,sys,shutil\n", "import json\n", @@ -910,9 +879,9 @@ "from pathlib import Path\n", "import openpyxl\n", "\n", - "fi_path = '/home/songyi/pdf-typescript-old2/东营胜利宾馆'\n", + "fi_path = '/home/songyi/pdf-typescript-old2/胜利采油厂'\n", "\n", - "filename = 'data/result_东营胜利宾馆.json'\n", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -928,7 +897,7 @@ " \n", " list1.append(list2)\n", "\n", - "filename = 'data/东营胜利宾馆体测报告明细表.xlsx'\n", + "filename = 'data/胜利采油厂体测报告明细表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -1583,32 +1552,16 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842", - "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:25:50.554226Z", - "iopub.status.busy": "2025-06-30T03:25:50.553608Z", - "iopub.status.idle": "2025-06-30T03:25:50.575194Z", - "shell.execute_reply": "2025-06-30T03:25:50.574507Z", - "shell.execute_reply.started": "2025-06-30T03:25:50.554173Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "70\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import openpyxl\n", "\n", "\n", - "filename = 'data/result_东营胜利宾馆.json'\n", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -1661,7 +1614,7 @@ " mydata['score'] = round(score/len(mydata['fits']),2)\n", " if len(mydata['fits']) >2:\n", " dict2[str(k)] = mydata\n", - "filename = f'data/data_东营胜利宾馆.json'\n", + "filename = f'data/data_胜利采油厂.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print(len(dict2)) " @@ -1677,34 +1630,17 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "63edd636-f034-4aa6-8575-63d5cdb84adb", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:25:56.345990Z", - "iopub.status.busy": "2025-06-30T03:25:56.345178Z", - "iopub.status.idle": "2025-06-30T03:25:56.355811Z", - "shell.execute_reply": "2025-06-30T03:25:56.354676Z", - "shell.execute_reply.started": "2025-06-30T03:25:56.345906Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:2.8165分,男性:34人\n", - "平均成绩:3.0694分,女性:36人\n", - "平均成绩:2.9466分,总体:70人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", - "filename = 'data/data_东营胜利宾馆.json'\n", + "filename = 'data/data_胜利采油厂.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -1738,32 +1674,12 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:26:28.871704Z", - "iopub.status.busy": "2025-06-30T03:26:28.871155Z", - "iopub.status.idle": "2025-06-30T03:26:28.887396Z", - "shell.execute_reply": "2025-06-30T03:26:28.886702Z", - "shell.execute_reply.started": "2025-06-30T03:26:28.871647Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:12人,男性:9人,女性:3人\n", - "256~332分人数:38人,男性:19人,女性:19人\n", - "333~367分人数:16人,男性:5人,女性:11人\n", - "368~500分人数:4人,男性:1人,女性:3人\n", - "70\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1809,34 +1725,12 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "2d661ca6-6129-4da1-ac25-51d0156babb2", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:27:10.453095Z", - "iopub.status.busy": "2025-06-30T03:27:10.452579Z", - "iopub.status.idle": "2025-06-30T03:27:10.463588Z", - "shell.execute_reply": "2025-06-30T03:27:10.462674Z", - "shell.execute_reply.started": "2025-06-30T03:27:10.453043Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {}\n", - "25-29 {}\n", - "30-34 {'合格': 1}\n", - "35-39 {'合格': 5, '良好': 1, '不合格': 1}\n", - "40-44 {'良好': 4, '不合格': 2, '优秀': 1, '合格': 3}\n", - "45-49 {'合格': 9, '优秀': 2, '良好': 5, '不合格': 0}\n", - "50-54 {'合格': 1, '不合格': 0, '优秀': 0, '良好': 1}\n", - "55-80 {'良好': 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", @@ -1876,34 +1770,12 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "fc97df37-34ff-4a02-9d26-b5d81b706e46", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:28:43.794940Z", - "iopub.status.busy": "2025-06-30T03:28:43.794179Z", - "iopub.status.idle": "2025-06-30T03:28:43.804569Z", - "shell.execute_reply": "2025-06-30T03:28:43.803453Z", - "shell.execute_reply.started": "2025-06-30T03:28:43.794866Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {}\n", - "25-29 {}\n", - "30-34 {'合格': 1}\n", - "35-39 {'合格': 2, '良好': 0, '不合格': 0}\n", - "40-44 {'良好': 1, '不合格': 0, '优秀': 0, '合格': 2}\n", - "45-49 {'合格': 6, '优秀': 0, '良好': 1, '不合格': 5}\n", - "50-54 {'合格': 6, '不合格': 2, '优秀': 1, '良好': 2}\n", - "55-80 {'良好': 1, '不合格': 2, '合格': 2}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1943,34 +1815,12 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:31:08.238140Z", - "iopub.status.busy": "2025-06-30T03:31:08.237468Z", - "iopub.status.idle": "2025-06-30T03:31:08.249928Z", - "shell.execute_reply": "2025-06-30T03:31:08.248854Z", - "shell.execute_reply.started": "2025-06-30T03:31:08.238077Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "16~24岁平均成绩:0分,人数:0人,男性:0人\n", - "25~29岁平均成绩:0分,人数:0人,男性:0人\n", - "30~34岁平均成绩:2.73分,人数:2人,男性:1人\n", - "35~39岁平均成绩:2.94分,人数:9人,男性:2人\n", - "40~44岁平均成绩:3.04分,人数:13人,男性:3人\n", - "45~49岁平均成绩:2.95分,人数:28人,男性:12人\n", - "50~54岁平均成绩:3.01分,人数:13人,男性:11人\n", - "55~69岁平均成绩:2.64分,人数:5人,男性:5人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "\n", @@ -2005,34 +1855,12 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "347703a1-501b-4800-bd29-16e94f4a6793", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:33:02.816587Z", - "iopub.status.busy": "2025-06-30T03:33:02.815993Z", - "iopub.status.idle": "2025-06-30T03:33:02.824768Z", - "shell.execute_reply": "2025-06-30T03:33:02.823787Z", - "shell.execute_reply.started": "2025-06-30T03:33:02.816525Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:0分,人数:0人\n", - "25~29岁平均成绩:0分,人数:0人\n", - "30~34岁平均成绩:2.56分,人数:1人\n", - "35~39岁平均成绩:3.24分,人数:2人\n", - "40~44岁平均成绩:3.18分,人数:3人\n", - "45~49岁平均成绩:2.62分,人数:12人\n", - "50~54岁平均成绩:2.96分,人数:11人\n", - "55~80岁平均成绩:2.64分,人数:5人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -2067,34 +1895,12 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:34:15.938497Z", - "iopub.status.busy": "2025-06-30T03:34:15.937943Z", - "iopub.status.idle": "2025-06-30T03:34:15.949638Z", - "shell.execute_reply": "2025-06-30T03:34:15.948577Z", - "shell.execute_reply.started": "2025-06-30T03:34:15.938442Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:0分,人数:0人\n", - "25~29岁平均成绩:0分,人数:0人\n", - "30~34岁平均成绩:2.89分,人数:1人\n", - "35~39岁平均成绩:2.86分,人数:7人\n", - "40~44岁平均成绩:3.0分,人数:10人\n", - "45~49岁平均成绩:3.19分,人数:16人\n", - "50~54岁平均成绩:3.28分,人数:2人\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", @@ -2127,36 +1933,12 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "ad69c45d-3f62-42df-894d-47424e759029", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:38:18.058882Z", - "iopub.status.busy": "2025-06-30T03:38:18.058174Z", - "iopub.status.idle": "2025-06-30T03:38:18.070777Z", - "shell.execute_reply": "2025-06-30T03:38:18.069764Z", - "shell.execute_reply.started": "2025-06-30T03:38:18.058815Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BMI 3.66 70\n", - "肺活量 3.67 70\n", - "握力 2.64 69\n", - "坐位体前屈 2.69 68\n", - "纵跳 2.6 67\n", - "俯卧撑 2.93 28\n", - "一分钟仰卧起坐 3.65 34\n", - "单脚站立 2.19 70\n", - "选择反应时 3.41 70\n", - "台阶指数 2.48 63\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2181,43 +1963,12 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "dcf152e7-bbcc-47d1-9c5f-83854db35412", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-30T03:39:23.962598Z", - "iopub.status.busy": "2025-06-30T03:39:23.961860Z", - "iopub.status.idle": "2025-06-30T03:39:23.970708Z", - "shell.execute_reply": "2025-06-30T03:39:23.969751Z", - "shell.execute_reply.started": "2025-06-30T03:39:23.962527Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "安全(QHSE)管理督查部 3.06 2\n", - "综合保障服务部 3.04 6\n", - "餐饮部 2.86 21\n", - "市场营销部 3.18 5\n", - "后勤服务技能鉴定站 3.17 2\n", - "综合管理部 2.81 5\n", - "展厅服务部 3.0 1\n", - "经理、党委副书记 3.33 1\n", - "安全总监 3.78 1\n", - "信息化服务部 3.11 5\n", - "人力资源总监 3.0 1\n", - "人力资源(组织)部 2.56 1\n", - "副经理 2.56 2\n", - "协理员 1.71 1\n", - "经营管理部 2.82 3\n", - "客房部 2.89 10\n", - "会务部 3.4 3\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2376,17 +2127,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19", - "metadata": { - "execution": { - "iopub.execute_input": "2025-09-22T12:52:59.350814Z", - "iopub.status.busy": "2025-09-22T12:52:59.350137Z", - "iopub.status.idle": "2025-09-22T12:52:59.367870Z", - "shell.execute_reply": "2025-09-22T12:52:59.366720Z", - "shell.execute_reply.started": "2025-09-22T12:52:59.350750Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -2525,32 +2268,16 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "1acaf159-637e-4101-9881-f6bb79400136", "metadata": { - "execution": { - "iopub.execute_input": "2025-07-27T15:45:48.440829Z", - "iopub.status.busy": "2025-07-27T15:45:48.440078Z", - "iopub.status.idle": "2025-07-27T15:45:48.629122Z", - "shell.execute_reply": "2025-07-27T15:45:48.628652Z", - "shell.execute_reply.started": "2025-07-27T15:45:48.440759Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[['48', '气虚', False, 65, 53, 28, 15, 0, 0, 10, 3, 0], ['24', '痰湿', False, 59, 43, 25, 37, 53, 50, 17, 32, 25], ['30', '平和', False, 78, 15, 7, 6, 6, 0, 7, 3, 7], ['49', '气虚', False, 62, 43, 21, 31, 31, 25, 3, 10, 0], ['61', '平和', False, 84, 9, 28, 21, 25, 29, 28, 21, 3], ['17', '阳虚', False, 62, 31, 50, 40, 25, 25, 21, 7, 14], ['50', '气虚', False, 62, 40, 25, 25, 34, 29, 32, 39, 25], ['51', '平和', False, 96, 9, 0, 0, 12, 8, 3, 0, 3], ['59', '气虚', False, 43, 43, 32, 31, 31, 16, 17, 39, 35], ['52', '阳虚', False, 37, 50, 64, 28, 31, 50, 35, 28, 10], ['60', '湿热', False, 43, 65, 53, 43, 68, 70, 53, 46, 53], ['19', '阴虚', True, 93, 18, 28, 37, 21, 37, 28, 10, 17], ['29', '平和', False, 68, 12, 7, 0, 12, 12, 10, 14, 3], ['18', '气虚', False, 65, 50, 32, 28, 21, 12, 32, 7, 46], ['16', '气虚', True, 75, 34, 21, 25, 25, 25, 25, 25, 21], ['14', '平和', False, 93, 3, 0, 0, 0, 0, 0, 0, 0], ['71', '阳虚', False, 59, 40, 75, 50, 56, 62, 39, 32, 21], ['70', '平和', False, 78, 18, 0, 0, 0, 8, 0, 0, 21], ['73', '平和', False, 68, 28, 0, 6, 15, 16, 14, 17, 17], ['36', '痰湿', False, 62, 37, 35, 31, 43, 37, 25, 35, 21], ['13', '血瘀', False, 40, 65, 64, 62, 68, 75, 82, 60, 57], ['53', '痰湿', True, 84, 18, 3, 28, 31, 16, 14, 3, 0], ['57', '气虚', False, 53, 43, 25, 9, 34, 25, 10, 21, 21], ['56', '气虚', False, 43, 59, 57, 28, 43, 37, 35, 32, 32], ['58', '阳虚', False, 43, 53, 57, 53, 46, 45, 42, 46, 42], ['10', '平和', False, 100, 9, 0, 0, 0, 4, 0, 0, 7], ['26', '阴虚', False, 62, 34, 21, 46, 34, 33, 35, 42, 46], ['8', '湿热', False, 62, 43, 25, 31, 37, 54, 28, 35, 32], ['55', '阳虚', False, 56, 37, 50, 50, 50, 45, 42, 42, 46], ['54', '平和', False, 71, 9, 14, 18, 28, 29, 14, 25, 10], ['3', '特禀', False, 68, 37, 28, 28, 43, 41, 14, 39, 46], ['4', '湿热', False, 56, 40, 53, 37, 34, 54, 14, 7, 14], ['38', '湿热', False, 84, 15, 0, 0, 18, 41, 7, 14, 0], ['39', '痰湿', False, 75, 34, 39, 43, 56, 45, 17, 28, 7], ['40', '湿热', False, 50, 21, 0, 12, 18, 29, 7, 21, 17], ['35', '平和', False, 90, 15, 0, 6, 15, 12, 3, 0, 3], ['33', '湿热', True, 71, 28, 28, 28, 34, 37, 32, 25, 14], ['41', '痰湿', False, 78, 21, 14, 31, 53, 33, 17, 32, 50], ['34', '平和', False, 93, 18, 21, 15, 12, 4, 0, 0, 0], ['22', '气虚', False, 71, 43, 25, 18, 9, 33, 25, 28, 17], ['23', '气虚', False, 50, 46, 32, 31, 34, 16, 32, 21, 3], ['32', '平和', False, 75, 12, 7, 25, 15, 8, 7, 10, 0], ['72', '气虚', False, 50, 46, 46, 31, 40, 41, 35, 39, 28], ['21', '气虚', True, 68, 31, 17, 21, 18, 16, 17, 0, 0], ['20', '特禀', False, 71, 31, 14, 40, 37, 41, 28, 21, 42], ['74', '平和', False, 78, 25, 7, 28, 28, 25, 10, 21, 0], ['31', '湿热', False, 71, 46, 7, 31, 46, 50, 46, 7, 17], ['43', '气郁', False, 37, 43, 35, 21, 53, 45, 21, 71, 32], ['44', '阳虚', False, 75, 37, 60, 34, 50, 50, 10, 14, 46], ['45', '阴虚', False, 84, 25, 14, 56, 43, 50, 3, 17, 3], ['64', '特禀', False, 65, 40, 32, 34, 34, 41, 32, 25, 42], ['47', '湿热', False, 59, 37, 35, 28, 40, 54, 28, 14, 14], ['28', '湿热', False, 62, 50, 35, 46, 50, 54, 42, 28, 42], ['12', '阳虚', False, 53, 46, 50, 50, 43, 50, 35, 42, 32]]\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import openpyxl\n", "\n", - "filename = 'data/result_新疆油田采油工艺研究院-1.json'\n", + "filename = 'data/result_南京化工-3.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -2570,13 +2297,15 @@ " #i+=1\n", " list3 = []\n", " list3.append(k)\n", + " list3.append(v['name'])\n", + " list3.append(v['sex'])\n", " list3.append(kinds[kind])\n", " list3.append(near)\n", " for item in score:\n", " list3.append(item)\n", " list2.append(list3)\n", "print(list2)\n", - "filename = 'data/新疆油田采油工艺研究院中医情况明细表.xlsx'\n", + "filename = 'data/南京化工中医情况明细表(202510).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "\n", @@ -2752,23 +2481,15 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4", - "metadata": { - "execution": { - "iopub.execute_input": "2025-09-22T12:54:30.458387Z", - "iopub.status.busy": "2025-09-22T12:54:30.457853Z", - "iopub.status.idle": "2025-09-22T12:54:30.653511Z", - "shell.execute_reply": "2025-09-22T12:54:30.653048Z", - "shell.execute_reply.started": "2025-09-22T12:54:30.458336Z" - } - }, + "metadata": {}, "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_南京化工-3.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "data_list = []\n", @@ -2850,7 +2571,7 @@ " list6.append('')\n", " i+=1\n", " data_list.append(list6)\n", - "filename = 'data/通用技术中国医药.xlsx'\n", + "filename = 'data/南京化工中医情况明细表(202510).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "#sheet.append(title)\n", diff --git a/体测单位/南京化工.ipynb b/体测单位/南京化工.ipynb index 693e1ec..83b2652 100644 --- a/体测单位/南京化工.ipynb +++ b/体测单位/南京化工.ipynb @@ -10,48 +10,33 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "bbba6efc-73cd-4db6-bae7-014724fee731", "metadata": { - "execution": { - "iopub.execute_input": "2025-10-21T02:05:09.966940Z", - "iopub.status.busy": "2025-10-21T02:05:09.966195Z", - "iopub.status.idle": "2025-10-21T02:05:10.249499Z", - "shell.execute_reply": "2025-10-21T02:05:10.248277Z", - "shell.execute_reply.started": "2025-10-21T02:05:09.966870Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "270 ok\n" - ] - } - ], + "outputs": [], "source": [ "import openpyxl\n", "import json\n", "\n", "\n", - "wb = openpyxl.load_workbook('data/胜利采油厂人员名单.xlsx',data_only=True)\n", + "wb = openpyxl.load_workbook('data/南化人员信息表.xlsx',data_only=True)\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, 2).value)\n", + " code = int(sheet.cell(n, 4).value)\n", " person.setdefault(code, {})\n", " dict1 = {}\n", - " dict1['name'] = sheet.cell(n, 4).value\n", + " dict1['name'] = sheet.cell(n, 3).value\n", " dict1['sex'] = sheet.cell(n, 5).value\n", - " dict1['unit'] = sheet.cell(n, 3).value \n", + " dict1['unit'] = sheet.cell(n, 2).value \n", " dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0]\n", - " #dict1['phone'] = sheet.cell(n, 12).value \n", + " dict1['phone'] = sheet.cell(n, 12).value \n", " person[code] = dict1\n", - "filename = 'data/胜利采油厂人员.json'\n", + "filename = 'data/南京化工人员.json'\n", "with open(filename, 'w') as fl:\n", " json.dump(person, fl, ensure_ascii=False)\n", "print(len(person),'ok')" @@ -67,31 +52,16 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f", "metadata": { - "execution": { - "iopub.execute_input": "2025-10-21T02:05:49.362922Z", - "iopub.status.busy": "2025-10-21T02:05:49.362143Z", - "iopub.status.idle": "2025-10-21T02:05:49.376741Z", - "shell.execute_reply": "2025-10-21T02:05:49.375761Z", - "shell.execute_reply.started": "2025-10-21T02:05:49.362862Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", - "filename = 'data/胜利采油厂人员.json'\n", + "filename = 'data/南京化工人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", @@ -105,7 +75,7 @@ "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", "\n", "# 将 json 数据写入文件\n", - "with open(\"data/data_胜利采油厂人员.json\", \"w\",encoding = 'utf-8') as file:\n", + "with open(\"data/data_南京化工人员.json\", \"w\",encoding = 'utf-8') as file:\n", " file.write(json_data) \n", "print('ok')" ] @@ -465,26 +435,10 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "9b801085-ca98-4958-8dcc-bcd9985fcd4b", - "metadata": { - "execution": { - "iopub.execute_input": "2025-09-01T07:20:37.177771Z", - "iopub.status.busy": "2025-09-01T07:20:37.177055Z", - "iopub.status.idle": "2025-09-01T07:20:37.198841Z", - "shell.execute_reply": "2025-09-01T07:20:37.198253Z", - "shell.execute_reply.started": "2025-09-01T07:20:37.177707Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "83\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -550,6 +504,120 @@ "print(len(dict1))" ] }, + { + "cell_type": "markdown", + "id": "acfc1736-9185-4217-bd05-a83b7e292725", + "metadata": {}, + "source": [ + "## 导入问卷信息(20251027)" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "4b6cf9bc-fe84-4cf6-b762-8c30f8dd7953", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-28T02:58:31.746734Z", + "iopub.status.busy": "2025-10-28T02:58:31.746060Z", + "iopub.status.idle": "2025-10-28T02:58:31.786856Z", + "shell.execute_reply": "2025-10-28T02:58:31.786112Z", + "shell.execute_reply.started": "2025-10-28T02:58:31.746685Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "81\n" + ] + } + ], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "\n", + "dict1 = {}\n", + "list1 = []\n", + "filename = 'data/sql_20251028.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", + "nn = 0\n", + "for item in list1:\n", + " dict2 = {}\n", + " \n", + " phone = str(item[0])[2:]\n", + " content = json.loads(json.loads(item[1]))\n", + " tcm = []\n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " for k, v in content.items(): \n", + " if 'tcm' not in k:\n", + " dict2[k] = v\n", + " else:\n", + " i = int(k[3:])\n", + " tcm[i-1] = int(v)\n", + " \n", + " code = dict2['code']\n", + " dict1.setdefault(code,{})\n", + " dict1[code]['name'] = dict2['name']\n", + " if dict2['gender'] == 'male':\n", + " dict1[code]['sex'] = '男'\n", + " else:\n", + " dict1[code]['sex'] = '女'\n", + " dict1[code]['birth'] = str(dict2['birth'])+'-01'\n", + " dict1[code]['unit'] = '南京化工'\n", + " dict1[code]['phone'] = phone\n", + " dict1[code]['weight'] = dict2['weight']\n", + " dict1[code]['waist'] = dict2['waist']\n", + " dict1[code]['hip'] = dict2['hip']\n", + " dict1[code]['tcm'] = tcm\n", + "filename = 'data/result_南京化工-3.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print(len(dict1))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7392d5bf-c6a8-4cdf-8653-0fb4961f1405", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "\n", + "dict1 = {}\n", + "list1 = []\n", + "filename = 'data/sql_20251027.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", + "nn = 0\n", + "for item in list1:\n", + " dict2 = {}\n", + " \n", + " phone = str(item[0])[2:]\n", + " content = json.loads(item[1])\n", + " print(type(json.loads(content)))" + ] + }, { "cell_type": "markdown", "id": "89689b86-3fae-402e-a456-a646f0c7201f", @@ -603,10 +671,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "e233e6c3-9c3f-42c7-8057-012bbcfe8b26", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-28T02:58:52.451889Z", + "iopub.status.busy": "2025-10-28T02:58:52.451452Z", + "iopub.status.idle": "2025-10-28T02:58:52.546239Z", + "shell.execute_reply": "2025-10-28T02:58:52.545487Z", + "shell.execute_reply.started": "2025-10-28T02:58:52.451850Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import openpyxl\n", "import json\n", @@ -721,7 +805,7 @@ " }\n", "\n", "\n", - "filename = 'data/result_南京化工-2.json'\n", + "filename = 'data/result_南京化工-3.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -743,16 +827,17 @@ " list3.append(k)\n", " list3.append(v['name'])\n", " list3.append(v['sex'])\n", + " list3.append(v['phone'])\n", " list3.append(v['weight'])\n", - " list3.append(v['yao'])\n", - " list3.append(v['tun'])\n", + " list3.append(v['waist'])\n", + " list3.append(v['hip'])\n", " list3.append(kinds[kind])\n", " list3.append(near)\n", " for item in score:\n", " list3.append(item)\n", " list2.append(list3)\n", "\n", - "filename = 'data/南化第二次问卷明细表(截至20250831).xlsx'\n", + "filename = 'data/南化第三次问卷明细表(截至20251028).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "\n", @@ -863,10 +948,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-27T06:11:24.661422Z", + "iopub.status.busy": "2025-10-27T06:11:24.660908Z", + "iopub.status.idle": "2025-10-27T06:11:24.977141Z", + "shell.execute_reply": "2025-10-27T06:11:24.975637Z", + "shell.execute_reply.started": "2025-10-27T06:11:24.661386Z" + } + }, + "outputs": [ + { + "ename": "KeyError", + "evalue": "'month'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[18], line 32\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 30\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mgender\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfemale\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m---> 32\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmonth\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mv\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmonth\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 33\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfits\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m {}\n\u001b[1;32m 34\u001b[0m survey_list \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtcm\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpsy57\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mspine\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", + "\u001b[0;31mKeyError\u001b[0m: 'month'" + ] + } + ], "source": [ "import requests\n", "import json\n", @@ -876,11 +981,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_南京化工-2.json'\n", + "filename = 'data/result_南京化工-3.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./南京化工第二批问卷/'\n", + "file_path ='./南京化工第三批问卷(251021)/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -939,15 +1044,15 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 19, "id": "fc2bfab2-7f56-4abf-b2c4-0fb49a0da563", "metadata": { "execution": { - "iopub.execute_input": "2025-09-01T07:20:49.606201Z", - "iopub.status.busy": "2025-09-01T07:20:49.605939Z", - "iopub.status.idle": "2025-09-01T07:21:08.746449Z", - "shell.execute_reply": "2025-09-01T07:21:08.745281Z", - "shell.execute_reply.started": "2025-09-01T07:20:49.606179Z" + "iopub.execute_input": "2025-10-27T06:12:04.742517Z", + "iopub.status.busy": "2025-10-27T06:12:04.738837Z", + "iopub.status.idle": "2025-10-27T06:12:30.134155Z", + "shell.execute_reply": "2025-10-27T06:12:30.133408Z", + "shell.execute_reply.started": "2025-10-27T06:12:04.742463Z" } }, "outputs": [ @@ -955,7 +1060,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "83\n" + "72\n" ] } ], @@ -968,11 +1073,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_南京化工-2.json'\n", + "filename = 'data/result_南京化工-3.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./南京化工第二批问卷/'\n", + "file_path ='./南京化工第三批问卷/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", diff --git a/体测单位/胜利采油厂.ipynb b/体测单位/胜利采油厂.ipynb index 3874abd..5941eb4 100644 --- a/体测单位/胜利采油厂.ipynb +++ b/体测单位/胜利采油厂.ipynb @@ -10,33 +10,48 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "bbba6efc-73cd-4db6-bae7-014724fee731", "metadata": { + "execution": { + "iopub.execute_input": "2025-10-23T04:40:11.186792Z", + "iopub.status.busy": "2025-10-23T04:40:11.186527Z", + "iopub.status.idle": "2025-10-23T04:40:11.243321Z", + "shell.execute_reply": "2025-10-23T04:40:11.242693Z", + "shell.execute_reply.started": "2025-10-23T04:40:11.186767Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "412 ok\n" + ] + } + ], "source": [ "import openpyxl\n", "import json\n", "\n", "\n", - "wb = openpyxl.load_workbook('data/南化人员信息表.xlsx',data_only=True)\n", + "wb = openpyxl.load_workbook('data/胜利采油厂人员名单.xlsx',data_only=True)\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, 4).value)\n", + " code = int(sheet.cell(n, 2).value)\n", " person.setdefault(code, {})\n", " dict1 = {}\n", - " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['name'] = sheet.cell(n, 4).value\n", " dict1['sex'] = sheet.cell(n, 5).value\n", - " dict1['unit'] = sheet.cell(n, 2).value \n", + " dict1['unit'] = sheet.cell(n, 3).value \n", " dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0]\n", - " dict1['phone'] = sheet.cell(n, 12).value \n", + " #dict1['phone'] = sheet.cell(n, 12).value \n", " person[code] = dict1\n", - "filename = 'data/南京化工人员.json'\n", + "filename = 'data/胜利采油厂人员.json'\n", "with open(filename, 'w') as fl:\n", " json.dump(person, fl, ensure_ascii=False)\n", "print(len(person),'ok')" @@ -52,16 +67,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f", "metadata": { + "execution": { + "iopub.execute_input": "2025-10-22T05:36:04.807935Z", + "iopub.status.busy": "2025-10-22T05:36:04.807038Z", + "iopub.status.idle": "2025-10-22T05:36:04.823769Z", + "shell.execute_reply": "2025-10-22T05:36:04.822605Z", + "shell.execute_reply.started": "2025-10-22T05:36:04.807861Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "\n", - "filename = 'data/南京化工人员.json'\n", + "filename = 'data/胜利采油厂人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", @@ -75,11 +105,78 @@ "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", "\n", "# 将 json 数据写入文件\n", - "with open(\"data/data_南京化工人员.json\", \"w\",encoding = 'utf-8') as file:\n", + "with open(\"data/data_胜利采油厂人员.json\", \"w\",encoding = 'utf-8') as file:\n", " file.write(json_data) \n", "print('ok')" ] }, + { + "cell_type": "markdown", + "id": "a627e5b1-15c7-405b-9c81-2022e1173ed3", + "metadata": {}, + "source": [ + "## 合并读卡系统文件" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "82526579-8902-458d-a097-c2446983fa3f", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-23T04:40:17.340605Z", + "iopub.status.busy": "2025-10-23T04:40:17.339457Z", + "iopub.status.idle": "2025-10-23T04:40:17.357806Z", + "shell.execute_reply": "2025-10-23T04:40:17.356944Z", + "shell.execute_reply.started": "2025-10-23T04:40:17.340544Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "496834 李继升 QHSE监督中心\n", + "3532664 谭嘉辰 人力资源(组织)部\n", + "496657 张秀成 企业管理部(三基工作办公室)\n", + "495136 闫福霞 公共事业服务中心\n", + "494062 赵霞 公共事业服务中心\n", + "495293 赵振华 \n", + "689404 马科 胜利采油厂\n", + "498782 封莹 胜利采油厂\n", + "999999 孙振峰 \n", + "445607 王大明 \n", + "490000 陆岩玮 信息化服务中心\n", + "000000 焦瀛 胜利采油厂\n", + "424 ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/胜利采油厂人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/data_胜利采油厂人员(1).json'\n", + "with open(filename,'r') as fl:\n", + " list1 = json.load(fl)\n", + "for item in list1:\n", + " code = item['id']\n", + " if code not in dict1.keys():\n", + " print(code,item['name'],item['unit'])\n", + " dict1.setdefault(code,{})\n", + " dict1[code]['name'] = item['name']\n", + " dict1[code]['sex'] = item['gender']\n", + " dict1[code]['unit'] = item['unit']\n", + " dict1[code]['birth'] = item['birth']\n", + "filename = 'data/胜利采油厂人员.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print(len(dict1),'ok')" + ] + }, { "cell_type": "markdown", "id": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f", @@ -90,12 +187,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "id": "970e171e-1360-448f-a28c-520ccb8f314a", "metadata": { + "execution": { + "iopub.execute_input": "2025-10-23T04:40:34.626526Z", + "iopub.status.busy": "2025-10-23T04:40:34.625771Z", + "iopub.status.idle": "2025-10-23T04:40:34.653754Z", + "shell.execute_reply": "2025-10-23T04:40:34.653195Z", + "shell.execute_reply.started": "2025-10-23T04:40:34.626453Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "216\n" + ] + } + ], "source": [ "import json\n", "import datetime\n", @@ -103,14 +215,14 @@ "from datetime import date\n", "import my_module as My\n", "\n", - "filename = 'data/南京化工人员.json'\n", + "filename = 'data/胜利采油厂人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", - "filename = 'data/marks_20250703.csv'\n", + "filename = 'data/marks_20251023.csv'\n", "re_ta = My.get_result(filename,dict1)\n", "\n", "\n", - "filename = 'data/result_南京化工.json'\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))" @@ -128,8 +240,21 @@ "cell_type": "code", "execution_count": null, "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-27T01:50:10.738997Z", + "iopub.status.busy": "2025-10-27T01:50:10.738633Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], "source": [ "import json\n", "import time\n", @@ -137,7 +262,7 @@ "\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", + "filename = 'data/result_胜利采油厂1.json'\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl) \n", "for k, v in dict2.items():\n", @@ -160,12 +285,73 @@ " 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", + "filename = f'data/result_胜利采油厂1.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print('ok!') " ] }, + { + "cell_type": "markdown", + "id": "3f7a810e-2a5f-4856-8119-bfe299b71f92", + "metadata": {}, + "source": [ + "## 补充人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "9c3b7195-b7f3-4355-90bc-9f1ae322641d", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-27T01:22:18.116597Z", + "iopub.status.busy": "2025-10-27T01:22:18.116000Z", + "iopub.status.idle": "2025-10-27T01:22:18.187150Z", + "shell.execute_reply": "2025-10-27T01:22:18.186557Z", + "shell.execute_reply.started": "2025-10-27T01:22:18.116559Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/胜利采油厂测试情况明细表(补充人员信息).xlsx',data_only=True)\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "dict1 = {}\n", + "\n", + "filename = 'data/result_胜利采油厂.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl) \n", + "list1 = []\n", + "for n in range(2, sheet.max_row+1):\n", + " code = int(sheet.cell(n, 1).value)\n", + " unit = sheet.cell(n, 4).value\n", + " dict1[code] = unit\n", + "for k, v in dict2.items():\n", + " if int(k) not in dict1.keys():\n", + " list1.append(k)\n", + " else:\n", + " dict2[k]['unit'] = dict1[int(k)]\n", + "for item in list1:\n", + " del dict2[item]\n", + "filename = f'data/result_胜利采油厂1.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict2,fl , ensure_ascii=False) \n", + "print('ok!') \n" + ] + }, { "cell_type": "markdown", "id": "d034a61d-1fbd-417b-99bd-277e43ebb678", @@ -176,9 +362,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", "metadata": { + "execution": { + "iopub.execute_input": "2025-10-23T04:41:25.970953Z", + "iopub.status.busy": "2025-10-23T04:41:25.969895Z", + "iopub.status.idle": "2025-10-23T04:41:26.058240Z", + "shell.execute_reply": "2025-10-23T04:41:26.057610Z", + "shell.execute_reply.started": "2025-10-23T04:41:25.970875Z" + }, "tags": [] }, "outputs": [], @@ -189,18 +382,18 @@ "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "\n", - "filename = 'data/result_南京化工.json'\n", + "filename = 'data/result_胜利采油厂.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", - "filename = 'data/南京化工人员.json'\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", " list2 = []\n", - " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(str(k).rjust(8,'0'))\n", " list2.append(v['name']) \n", " list2.append(dict2[k]['sex'])\n", " list2.append(dict2[k]['unit'])\n", @@ -221,7 +414,7 @@ " list2.append('')\n", " \n", " list1.append(list2)\n", - "filename = 'data/南京化工测试情况明细表(截至20250630).xlsx'\n", + "filename = 'data/胜利采油厂测试情况明细表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -231,598 +424,6 @@ "wb.save(filename)" ] }, - { - "cell_type": "markdown", - "id": "699c6a40-a6ae-4300-9646-708cb85aa5e8", - "metadata": {}, - "source": [ - "## 统计问卷人员情况" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "def3f47a-24ef-4815-b63b-2a16b79b4c15", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "import json\n", - "import csv\n", - "import openpyxl\n", - "import time\n", - "from datetime import date\n", - "\n", - "\n", - "filename = 'data/南京化工人员.json'\n", - "with open(filename,'r') as fl:\n", - " dict1 = json.load(fl)\n", - "\n", - "phone1 = set()\n", - "phone2 = set()\n", - "for k,v in dict1.items():\n", - " phone1.add(v['phone'])\n", - "list1 = []\n", - "filename = 'data/survey_records_20250813.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", - "\n", - "i =1\n", - "list2 = []\n", - "for item in list1:\n", - " content = json.loads(item[4])\n", - " code = int(content['phone'])\n", - " for k, v in dict1.items():\n", - " list3 = []\n", - " if v['phone'] == code: \n", - " list3.append(k)\n", - " list3.append(v['name'])\n", - " list3.append(v['sex'])\n", - " list3.append(v['unit'])\n", - " list3.append(code)\n", - " list2.append(list3)\n", - "filename = 'data/南化问卷情况表(第二批).xlsx'\n", - "wb = openpyxl.Workbook()\n", - "sheet = wb.active\n", - "#sheet.append(title)\n", - "for row in list2:\n", - " sheet.append(row)\n", - " \n", - "wb.save(filename) " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8b7c0528-17b6-4469-b15f-3c4b794e286e", - "metadata": {}, - "outputs": [], - "source": [ - "import json\n", - "import csv\n", - "import openpyxl\n", - "import time\n", - "from datetime import date\n", - "\n", - "\n", - "\n", - "filename = 'data/survey_records_20250813.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", - "\n", - "i =1\n", - "list2 = []\n", - "for item in list1:\n", - " list3 = []\n", - " content = json.loads(item[4])\n", - " phone = int(content['phone'])\n", - " name = content['name']\n", - " sex = content['gender']\n", - " list3.append(name)\n", - " list3.append(sex)\n", - " list3.append(phone)\n", - " list2.append(list3)\n", - "filename = 'data/南化问卷情况表(第二批).xlsx'\n", - "wb = openpyxl.Workbook()\n", - "sheet = wb.active\n", - "#sheet.append(title)\n", - "for row in list2:\n", - " sheet.append(row)\n", - " \n", - "wb.save(filename) " - ] - }, - { - "cell_type": "markdown", - "id": "797717d5-47b9-4d47-be6c-8d54bede67d4", - "metadata": {}, - "source": [ - "## 导入问卷信息" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9d9dd574-9fbf-4d0a-96fd-9b55d98021d2", - "metadata": {}, - "outputs": [], - "source": [ - "import json\n", - "import csv\n", - "import openpyxl\n", - "import time\n", - "from datetime import date\n", - "\n", - "dict1 = {}\n", - "\n", - "filename = 'data/result_南京化工.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", - " 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", - "\n", - "list1 = []\n", - "filename = 'data/survey_records_20250812.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", - "\n", - "\n", - "\n", - "nn = 0\n", - "for item in list1:\n", - " if int(item[3]) in phone.keys(): \n", - " tcm = []\n", - " code = phone[int(item[3])]\n", - " \n", - " for i in range(0,60):\n", - " tcm.append(0)\n", - " \n", - " \n", - " content = json.loads(item[4])\n", - " if code not in dict1.keys():\n", - " dict1[code] = dict3[code]\n", - " rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n", - " dict1[code]['rq'] = str(date.fromisoformat(item[5].replace('/','-').split(' ')[0]))\n", - " #dict1[code]['rq'] = item[5].replace('/','-').split(' ')[0]\n", - " else:\n", - " rq=date.fromisoformat('2025-07-01')\n", - " dict1[code]['rq'] = '2025-07-01'\n", - " for k, v in content.items():\n", - " \n", - " if 'tcm' in k:\n", - " i = int(k[3:])\n", - " tcm[i-1] = int(v) \n", - " \n", - " if 'tcm' in item[4]: \n", - " dict1[code]['tcm'] = tcm\n", - " \n", - " birth = date.fromisoformat(dict3[code]['birth'].replace('/','-'))\n", - " \n", - " days = (rq-birth).days \n", - " dict1[code]['age'] = int(days/365)\n", - " dict1[code]['month'] = int(days/365*12)\n", - " #print(phone[item[2]])\n", - " nn+=1\n", - "filename = 'data/result_南京化工-2.json'\n", - "\n", - "with open(filename,'w') as fl:\n", - " json.dump(dict1, fl, ensure_ascii=False)\n" - ] - }, - { - "cell_type": "markdown", - "id": "4930b4cb-2114-4432-a8ae-e6d2cde69b5c", - "metadata": {}, - "source": [ - "## 导入问卷信息(新)" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "9b801085-ca98-4958-8dcc-bcd9985fcd4b", - "metadata": { - "execution": { - "iopub.execute_input": "2025-09-01T07:20:37.177771Z", - "iopub.status.busy": "2025-09-01T07:20:37.177055Z", - "iopub.status.idle": "2025-09-01T07:20:37.198841Z", - "shell.execute_reply": "2025-09-01T07:20:37.198253Z", - "shell.execute_reply.started": "2025-09-01T07:20:37.177707Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "83\n" - ] - } - ], - "source": [ - "import json\n", - "import csv\n", - "import openpyxl\n", - "import time\n", - "from datetime import date\n", - "\n", - "\n", - "filename = 'data/南京化工人员.json'\n", - "with open(filename,'r') as fl:\n", - " dict3 = json.load(fl)\n", - "\n", - "\n", - "list1 = []\n", - "filename = 'data/survey_records_20250901.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", - "\n", - "\n", - "dict1 = {}\n", - "nn = 0\n", - "for item in list1: \n", - " tcm = [] \n", - " for i in range(0,60):\n", - " tcm.append(0)\n", - " \n", - " content = json.loads(item[4]) \n", - " phone = content['phone']\n", - " name = content['name']\n", - " for k,v in dict3.items():\n", - " if name == v['name']:\n", - " code = k\n", - " unit = v['unit']\n", - " sex = v['sex']\n", - " dict1.setdefault(code,{})\n", - " \n", - " #rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n", - " #dict1[phone]['rq'] = str(date.fromisoformat(item[5].replace('/','-').split(' ')[0]))\n", - " \n", - " for k, v in content.items(): \n", - " if 'tcm' in k:\n", - " i = int(k[3:])\n", - " tcm[i-1] = int(v) \n", - " \n", - " if 'tcm' in item[4]: \n", - " dict1[code]['tcm'] = tcm\n", - " \n", - " dict1[code]['name'] = content['name']\n", - " dict1[code]['unit'] = unit\n", - " dict1[code]['sex'] = sex\n", - " dict1[code]['weight'] = content['weight']\n", - " dict1[code]['tun'] = content['hip']\n", - " dict1[code]['yao'] = content['waist']\n", - " #print(phone[item[2]])\n", - " nn+=1\n", - "filename = 'data/result_南京化工-2.json'\n", - "\n", - "with open(filename,'w') as fl:\n", - " json.dump(dict1, fl, ensure_ascii=False)\n", - "print(len(dict1))" - ] - }, - { - "cell_type": "markdown", - "id": "89689b86-3fae-402e-a456-a646f0c7201f", - "metadata": {}, - "source": [ - "## 导入腰臀数据" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4a0678c6-0c64-4314-bb03-24b10a3d695a", - "metadata": {}, - "outputs": [], - "source": [ - "import json\n", - "import csv\n", - "import openpyxl\n", - "import time\n", - "from datetime import date\n", - "\n", - "dict1 = {}\n", - "\n", - "filename = 'data/result_南京化工-1.json'\n", - "with open(filename,'r') as fl:\n", - " dict1 = json.load(fl)\n", - "wb = openpyxl.load_workbook('data/南化腰臀数据.xlsx',data_only=True)\n", - "sheet = wb.active\n", - "# sheets = wb.sheetnames\n", - "person = {}\n", - "\n", - "for n in range(2, sheet.max_row+1):\n", - " code = str(sheet.cell(n, 1).value)\n", - " if code in dict1.keys():\n", - " yao = str(sheet.cell(n, 2).value)\n", - " tun = str(sheet.cell(n, 3).value)\n", - " dict1[code]['腰臀比'] = yao+','+tun\n", - "filename = 'data/result_南京化工-1.json'\n", - "\n", - "with open(filename,'w') as fl:\n", - " json.dump(dict1, fl, ensure_ascii=False)\n" - ] - }, - { - "cell_type": "markdown", - "id": "19c6e8b6-2663-447d-884b-a22af3944c71", - "metadata": {}, - "source": [ - "## 计算中医体质并导出" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e233e6c3-9c3f-42c7-8057-012bbcfe8b26", - "metadata": {}, - "outputs": [], - "source": [ - "import openpyxl\n", - "import json\n", - "\n", - "questions = [\n", - " [1],\n", - " [-1, 2],\n", - " [-1, 2],\n", - " [-1, 8],\n", - " [-1, 3],\n", - " [1],\n", - " [-1],\n", - " [-1, 7],\n", - " [2],\n", - " [2],\n", - " [2],\n", - " [2, 3],\n", - " [2],\n", - " [2],\n", - " [3],\n", - " [3],\n", - " [3],\n", - " [3],\n", - " [3],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [4],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [5],\n", - " [6],\n", - " [6],\n", - " [6],\n", - " [6],\n", - " [6],\n", - " [6],\n", - " [7],\n", - " [7],\n", - " [7],\n", - " [7],\n", - " [7],\n", - " [7],\n", - " [8],\n", - " [8],\n", - " [8],\n", - " [8],\n", - " [8],\n", - " [8],\n", - " [9],\n", - " [9],\n", - " [9],\n", - " [9],\n", - " [9],\n", - " [9],\n", - " [9]\n", - "]\n", - "\n", - "kinds = [\n", - " '平和',\n", - " '气虚',\n", - " '阳虚',\n", - " '阴虚',\n", - " '痰湿',\n", - " '湿热',\n", - " '血瘀',\n", - " '气郁',\n", - " '特禀'\n", - "]\n", - "\n", - "def tcm_calc(arr):\n", - " qa = [8, 8, 7, 8, 8, 6, 7, 7, 7]\n", - " # 成绩数组\n", - " s = [0] * 9\n", - " # 遍历五进制\n", - " for i in range(len(questions)):\n", - " m = arr[i] - 1\n", - " for v in questions[i]:\n", - " if v < 0:\n", - " s[-v - 1] += 4 - m\n", - " else:\n", - " s[v - 1] += m\n", - " return [int((v / qa[i]) * 25) for i, v in enumerate(s)]\n", - "\n", - "def tcm_kind(score):\n", - " kind = 0\n", - " near = False\n", - " max_kind = 0\n", - " max_score = 0\n", - " for i in range(1, 9):\n", - " if score[i] > max_score:\n", - " max_kind = i\n", - " max_score = score[i]\n", - " if score[0] >= 60 and max_score < 40:\n", - " if max_score >= 30:\n", - " near = True\n", - " kind = max_kind\n", - " else:\n", - " kind = max_kind\n", - " return {\n", - " \"kind\": kind,\n", - " \"near\": near\n", - " }\n", - "\n", - "\n", - "filename = 'data/result_南京化工-2.json'\n", - "with open(filename,'r') as fl:\n", - " dict1 = json.load(fl) \n", - "i = 1\n", - "list2 = []\n", - "for k, v in dict1.items():\n", - " if 'tcm' in v.keys():\n", - " list1 = []\n", - " tcm =v['tcm']\n", - " for item in tcm:\n", - " list1.append(item)\n", - " score = tcm_calc(list1)\n", - "\n", - " result = tcm_kind(score)\n", - " kind = result['kind']\n", - " near = result['near']\n", - " #print(i,k,kinds[kind], near, score)\n", - " #i+=1\n", - " list3 = []\n", - " list3.append(k)\n", - " list3.append(v['name'])\n", - " list3.append(v['sex'])\n", - " list3.append(v['weight'])\n", - " list3.append(v['yao'])\n", - " list3.append(v['tun'])\n", - " list3.append(kinds[kind])\n", - " list3.append(near)\n", - " for item in score:\n", - " list3.append(item)\n", - " list2.append(list3)\n", - "\n", - "filename = 'data/南化第二次问卷明细表(截至20250831).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('ok') " - ] - }, - { - "cell_type": "markdown", - "id": "caf77c95-3090-4fa1-bcec-c9e8a38d4ca9", - "metadata": {}, - "source": [ - "## 体检报告汇总" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b815a478-d178-4b87-9080-a779d397d945", - "metadata": {}, - "outputs": [], - "source": [ - "from pathlib import Path\n", - "import json\n", - "import shutil\n", - "\n", - "\n", - "target_directory = Path('./file/南化体重')\n", - "new_path = './file/南化体重/new'\n", - "filename = 'data/南京化工人员.json'\n", - "with open(filename,'r') as fl:\n", - " dict1 = json.load(fl)\n", - "# 遍历目标目录及其子目录获取所有文件\n", - "\n", - "for fl in target_directory.rglob('*.pdf'):\n", - " if fl.is_file():\n", - " fl_name = fl.stem\n", - " name = fl_name[12:] \n", - " for k, v in dict1.items(): \n", - " if name == v['name']:\n", - " n_name = Path(new_path,str(k)+'-'+name+'.pdf')\n", - " shutil.copyfile(fl,n_name)\n", - " print(n_name)\n", - " \n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4f192b79-5dc7-4517-b7f3-409e30d60dad", - "metadata": {}, - "outputs": [], - "source": [ - "from pathlib import Path\n", - "import json\n", - "import shutil\n", - "import pymupdf4llm\n", - "#md_text = pymupdf4llm.to_markdown(\"data/1782596-唐荣.pdf\")\n", - "llama_reader = pymupdf4llm.LlamaMarkdownReader()\n", - "#llama_docs = llama_reader.load_data(\"data/1782596-唐荣.pdf\")\n", - "\n", - "\n", - "target_directory = Path('./file/北海体检报告')\n", - "new_path = './file/北海体检报告/md'\n", - "\n", - "\n", - "for fl in target_directory.rglob('*.pdf'):\n", - " if fl.is_file():\n", - " fl_name = fl.stem\n", - " llama_lists = pymupdf4llm.to_markdown(fl,page_chunks=True)\n", - " list1 = []\n", - " for item in llama_lists:\n", - " list1.append(item['text'])\n", - " llama_docs = '\\n'.join(list1)\n", - " Path(new_path,fl_name+'.md').write_bytes(llama_docs.encode())\n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e5863760-0d11-45b0-acb3-1a38c78d4fc7", - "metadata": {}, - "outputs": [], - "source": [ - "from pathlib import Path\n", - "import json\n", - "import shutil\n", - "import pymupdf4llm\n", - "#md_text = pymupdf4llm.to_markdown(\"data/1782596-唐荣.pdf\")\n", - "llama_reader = pymupdf4llm.LlamaMarkdownReader()\n", - "llama_docs = llama_reader.load_data(\"data/1782596-唐荣.pdf\",page_chunks=True)\n", - "print(llama_docs)\n", - "\n" - ] - }, { "cell_type": "markdown", "id": "8d5f4103-0d1e-4711-b324-ece360f8dcd3", diff --git a/体测单位/镇海.ipynb b/体测单位/镇海.ipynb index 75eeeff..63916af 100644 --- a/体测单位/镇海.ipynb +++ b/体测单位/镇海.ipynb @@ -3,9 +3,11 @@ { "cell_type": "markdown", "id": "92891af2-e909-4b8e-a08a-b5b5e4a1c732", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ - "# 体质测试" + "# 体质测试2024年" ] }, { @@ -18,26 +20,10 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "ba24132c-133f-4508-8fe7-e68d1908b6e9", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:50:51.333490Z", - "iopub.status.busy": "2024-11-05T05:50:51.333249Z", - "iopub.status.idle": "2024-11-05T05:50:51.533334Z", - "shell.execute_reply": "2024-11-05T05:50:51.532707Z", - "shell.execute_reply.started": "2024-11-05T05:50:51.333467Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -77,10 +63,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "63ab2d5b-3a0a-4ac7-a3e7-b3a34e621e98", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-27T12:38:36.648112Z", + "iopub.status.busy": "2025-10-27T12:38:36.647778Z", + "iopub.status.idle": "2025-10-27T12:38:36.692128Z", + "shell.execute_reply": "2025-10-27T12:38:36.691382Z", + "shell.execute_reply.started": "2025-10-27T12:38:36.648082Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "\n", @@ -98,7 +100,7 @@ "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", "\n", "# 将 json 数据写入文件\n", - "with open(\"data/data_镇海.json\", \"w\",encoding = 'utf-8') as file:\n", + "with open(\"data/card_镇海.json\", \"w\",encoding = 'utf-8') as file:\n", " file.write(json_data) \n", "print('ok')" ] @@ -113,27 +115,10 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "5d864909-d10f-461d-8e6e-dc5c43613576", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:50:57.671950Z", - "iopub.status.busy": "2024-11-05T05:50:57.669968Z", - "iopub.status.idle": "2024-11-05T05:50:57.814421Z", - "shell.execute_reply": "2024-11-05T05:50:57.813860Z", - "shell.execute_reply.started": "2024-11-05T05:50:57.671867Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1365\n", - "1365\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import time\n", @@ -336,27 +321,10 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "7f038e8d-dd57-4880-8726-6dfa86fbc4a2", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:51:04.272284Z", - "iopub.status.busy": "2024-11-05T05:51:04.271551Z", - "iopub.status.idle": "2024-11-05T05:51:04.391755Z", - "shell.execute_reply": "2024-11-05T05:51:04.391153Z", - "shell.execute_reply.started": "2024-11-05T05:51:04.272213Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1365\n", - "1365\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import datetime\n", @@ -448,26 +416,10 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "763aa68a-da54-4745-a759-4399aba10f7e", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:51:27.308482Z", - "iopub.status.busy": "2024-11-05T05:51:27.307713Z", - "iopub.status.idle": "2024-11-05T05:51:27.406446Z", - "shell.execute_reply": "2024-11-05T05:51:27.405880Z", - "shell.execute_reply.started": "2024-11-05T05:51:27.308411Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok!\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import time\n", @@ -1055,7 +1007,9 @@ { "cell_type": "markdown", "id": "6b521daf-f9dc-4579-9400-d8ab857bb166", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "# 体质测试综合报告数据分析" ] @@ -1070,26 +1024,10 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "cccc2e43-7a73-48ec-8540-06b4d59f8ceb", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:52:29.953308Z", - "iopub.status.busy": "2024-11-05T05:52:29.952999Z", - "iopub.status.idle": "2024-11-05T05:52:30.049510Z", - "shell.execute_reply": "2024-11-05T05:52:30.048811Z", - "shell.execute_reply.started": "2024-11-05T05:52:29.953281Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok!\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import openpyxl\n", @@ -1246,28 +1184,10 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "d5721244-b5f5-4577-bae8-2e6c5bd8e4da", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:52:48.379274Z", - "iopub.status.busy": "2024-11-05T05:52:48.378455Z", - "iopub.status.idle": "2024-11-05T05:52:48.403648Z", - "shell.execute_reply": "2024-11-05T05:52:48.403090Z", - "shell.execute_reply.started": "2024-11-05T05:52:48.379196Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:3.1739分,男性:1074人\n", - "平均成绩:3.3303分,女性:291人\n", - "平均成绩:3.2072分,总体:1365人\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "filename = 'data/data_镇海(合并).json'\n", @@ -1304,31 +1224,10 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "cff50f06-3221-4340-950f-3a24073b8565", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:52:54.954047Z", - "iopub.status.busy": "2024-11-05T05:52:54.952637Z", - "iopub.status.idle": "2024-11-05T05:52:55.017683Z", - "shell.execute_reply": "2024-11-05T05:52:55.017112Z", - "shell.execute_reply.started": "2024-11-05T05:52:54.953966Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:134人,男性:118人,女性:16人\n", - "256~332分人数:585人,男性:472人,女性:113人\n", - "333~367分人数:431人,男性:333人,女性:98人\n", - "368~500分人数:215人,男性:151人,女性:64人\n", - "1365\n", - "ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -1374,33 +1273,10 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "6baf0ff2-cdfa-4396-bcf8-3e23a18670dc", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:52:59.630256Z", - "iopub.status.busy": "2024-11-05T05:52:59.629491Z", - "iopub.status.idle": "2024-11-05T05:52:59.656868Z", - "shell.execute_reply": "2024-11-05T05:52:59.656319Z", - "shell.execute_reply.started": "2024-11-05T05:52:59.630184Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'良好': 29, '合格': 60, '优秀': 22, '不合格': 8}\n", - "25-29 {'良好': 24, '合格': 32, '不合格': 3, '优秀': 14}\n", - "30-34 {'不合格': 3, '优秀': 6, '合格': 11, '良好': 15}\n", - "35-39 {'合格': 5, '不合格': 2, '良好': 13, '优秀': 6}\n", - "40-44 {'良好': 6, '合格': 1, '优秀': 1, '不合格': 0}\n", - "45-49 {'良好': 8, '合格': 4, '优秀': 12, '不合格': 0}\n", - "50-54 {'良好': 3, '不合格': 0, '合格': 0, '优秀': 2}\n", - "55-80 {'优秀': 1, '合格': 0, '良好': 0, '不合格': 0}\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1440,33 +1316,10 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "2979cf80-5268-4754-ab8a-11a539315e92", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:03.265936Z", - "iopub.status.busy": "2024-11-05T05:53:03.265166Z", - "iopub.status.idle": "2024-11-05T05:53:03.286342Z", - "shell.execute_reply": "2024-11-05T05:53:03.285817Z", - "shell.execute_reply.started": "2024-11-05T05:53:03.265865Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'良好': 97, '合格': 177, '优秀': 38, '不合格': 53}\n", - "25-29 {'良好': 57, '合格': 97, '不合格': 21, '优秀': 21}\n", - "30-34 {'不合格': 15, '优秀': 13, '合格': 43, '良好': 29}\n", - "35-39 {'合格': 57, '不合格': 11, '良好': 45, '优秀': 22}\n", - "40-44 {'良好': 27, '合格': 18, '优秀': 12, '不合格': 2}\n", - "45-49 {'良好': 26, '合格': 28, '优秀': 17, '不合格': 1}\n", - "50-54 {'良好': 33, '不合格': 10, '合格': 29, '优秀': 16}\n", - "55-80 {'优秀': 12, '合格': 23, '良好': 19, '不合格': 5}\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1506,33 +1359,10 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "id": "8a7cb3b0-d7be-44ac-a1ec-40bdcf29e83b", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:06.224468Z", - "iopub.status.busy": "2024-11-05T05:53:06.223694Z", - "iopub.status.idle": "2024-11-05T05:53:06.252031Z", - "shell.execute_reply": "2024-11-05T05:53:06.251436Z", - "shell.execute_reply.started": "2024-11-05T05:53:06.224396Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "16~24岁平均成绩:3.11分,人数:484人,男性:365人\n", - "25~29岁平均成绩:3.16分,人数:269人,男性:196人\n", - "30~34岁平均成绩:3.15分,人数:135人,男性:100人\n", - "35~39岁平均成绩:3.3分,人数:161人,男性:135人\n", - "40~44岁平均成绩:3.39分,人数:67人,男性:59人\n", - "45~49岁平均成绩:3.48分,人数:96人,男性:72人\n", - "50~54岁平均成绩:3.29分,人数:93人,男性:88人\n", - "55~69岁平均成绩:3.27分,人数:60人,男性:59人\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "\n", @@ -1567,33 +1397,10 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "c5bb03ca-b7ee-4564-b425-8513e1bff081", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:09.675597Z", - "iopub.status.busy": "2024-11-05T05:53:09.674880Z", - "iopub.status.idle": "2024-11-05T05:53:09.702379Z", - "shell.execute_reply": "2024-11-05T05:53:09.701740Z", - "shell.execute_reply.started": "2024-11-05T05:53:09.675531Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:3.08分,人数:365人\n", - "25~29岁平均成绩:3.1分,人数:196人\n", - "30~34岁平均成绩:3.1分,人数:100人\n", - "35~39岁平均成绩:3.27分,人数:135人\n", - "40~44岁平均成绩:3.39分,人数:59人\n", - "45~49岁平均成绩:3.4分,人数:72人\n", - "50~54岁平均成绩:3.27分,人数:88人\n", - "55~80岁平均成绩:3.25分,人数:59人\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -1628,33 +1435,10 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": null, "id": "bf333998-230c-4365-aadc-b0d1be073b39", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:12.871382Z", - "iopub.status.busy": "2024-11-05T05:53:12.870644Z", - "iopub.status.idle": "2024-11-05T05:53:12.898189Z", - "shell.execute_reply": "2024-11-05T05:53:12.897568Z", - "shell.execute_reply.started": "2024-11-05T05:53:12.871316Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:3.21分,人数:119人\n", - "25~29岁平均成绩:3.32分,人数:73人\n", - "30~34岁平均成绩:3.32分,人数:35人\n", - "35~39岁平均成绩:3.44分,人数:26人\n", - "40~44岁平均成绩:3.4分,人数:8人\n", - "45~49岁平均成绩:3.73分,人数:24人\n", - "50~54岁平均成绩:3.71分,人数:5人\n", - "55~80岁平均成绩:4.0分,人数:1人\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1687,35 +1471,10 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": null, "id": "352c6c29-8929-4210-84c5-8dbc3d5ffeee", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:17.234892Z", - "iopub.status.busy": "2024-11-05T05:53:17.234077Z", - "iopub.status.idle": "2024-11-05T05:53:17.258666Z", - "shell.execute_reply": "2024-11-05T05:53:17.258170Z", - "shell.execute_reply.started": "2024-11-05T05:53:17.234829Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BMI 4.0 1364\n", - "肺活量 3.52 1364\n", - "握力 3.25 1361\n", - "坐位体前屈 2.93 1346\n", - "纵跳 3.4 1316\n", - "俯卧撑 3.65 1047\n", - "一分钟仰卧起坐 4.27 240\n", - "单脚站立 2.6 1356\n", - "选择反应时 2.88 1317\n", - "台阶指数 2.5 1286\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -1740,52 +1499,10 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": null, "id": "97f5a1cf-341e-4b99-9549-b6a3fb165849", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T05:53:21.152478Z", - "iopub.status.busy": "2024-11-05T05:53:21.151702Z", - "iopub.status.idle": "2024-11-05T05:53:21.181419Z", - "shell.execute_reply": "2024-11-05T05:53:21.180858Z", - "shell.execute_reply.started": "2024-11-05T05:53:21.152407Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "采购中心 3.39 20\n", - "炼油三部 3.2 30\n", - "烯烃一部 3.21 156\n", - "炼油五部 3.25 73\n", - "公用工程二部 3.26 72\n", - "合成材料部 3.12 55\n", - "质管中心 3.24 56\n", - "储运一部 3.1 82\n", - "氢能制造部 3.18 59\n", - "电气中心 3.14 45\n", - "公用工程一部 3.12 81\n", - "仪表和计量中心 3.29 81\n", - "港储部 3.13 36\n", - "炼油二部 3.28 60\n", - "消防支队 3.35 25\n", - "烯烃二部 3.03 42\n", - "炼油一部 3.29 42\n", - "事务中心 3.17 35\n", - "公司机关 3.26 113\n", - "化学制品部 3.31 43\n", - "项目管理部 3.38 19\n", - "新材料研究院 3.31 15\n", - "炼油四部 3.08 27\n", - "油库中心 3.22 25\n", - "炼油六部 3.08 34\n", - "储运二部 3.12 13\n", - "炼油七部 3.25 26\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -1817,52 +1534,10 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": null, "id": "3beaab27-ca90-4e09-b2d2-590fd7bac51d", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T06:04:56.213828Z", - "iopub.status.busy": "2024-11-05T06:04:56.213049Z", - "iopub.status.idle": "2024-11-05T06:04:56.234107Z", - "shell.execute_reply": "2024-11-05T06:04:56.233502Z", - "shell.execute_reply.started": "2024-11-05T06:04:56.213755Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "采购中心 3.22 12\n", - "炼油三部 3.09 23\n", - "烯烃一部 3.2 128\n", - "炼油五部 3.3 56\n", - "公用工程二部 3.24 57\n", - "合成材料部 3.05 44\n", - "质管中心 3.19 43\n", - "储运一部 3.06 67\n", - "氢能制造部 3.15 46\n", - "电气中心 3.13 36\n", - "公用工程一部 3.1 63\n", - "仪表和计量中心 3.23 64\n", - "港储部 3.1 28\n", - "炼油二部 3.24 49\n", - "消防支队 3.4 21\n", - "烯烃二部 2.98 35\n", - "炼油一部 3.26 36\n", - "事务中心 3.06 28\n", - "公司机关 3.22 87\n", - "化学制品部 3.26 34\n", - "项目管理部 3.31 9\n", - "新材料研究院 3.29 12\n", - "炼油四部 3.06 23\n", - "油库中心 3.19 18\n", - "炼油六部 3.08 27\n", - "储运二部 3.06 11\n", - "炼油七部 3.21 17\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -1894,322 +1569,10 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "a959c1b8-86fc-4fca-8595-4278135e95b8", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T06:14:31.595277Z", - "iopub.status.busy": "2024-11-05T06:14:31.594514Z", - "iopub.status.idle": "2024-11-05T06:14:31.631931Z", - "shell.execute_reply": "2024-11-05T06:14:31.631345Z", - "shell.execute_reply.started": "2024-11-05T06:14:31.595202Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "采购中心\n", - "BMI 86 20\n", - "肺活量 72 20\n", - "握力 59 20\n", - "坐位体前屈 63 20\n", - "纵跳 71 20\n", - "俯卧撑 47 12\n", - "一分钟仰卧起坐 35 8\n", - "单脚站立 47 20\n", - "选择反应时 68 20\n", - "台阶指数 62 20\n", - "炼油三部\n", - "BMI 116 30\n", - "肺活量 99 30\n", - "握力 91 30\n", - "坐位体前屈 84 30\n", - "纵跳 92 29\n", - "俯卧撑 92 22\n", - "一分钟仰卧起坐 29 7\n", - "单脚站立 78 30\n", - "选择反应时 85 29\n", - "台阶指数 86 29\n", - "烯烃一部\n", - "BMI 584 156\n", - "肺活量 547 156\n", - "握力 517 156\n", - "坐位体前屈 461 153\n", - "纵跳 541 147\n", - "俯卧撑 454 123\n", - "一分钟仰卧起坐 84 21\n", - "单脚站立 401 156\n", - "选择反应时 430 151\n", - "台阶指数 363 145\n", - "炼油五部\n", - "BMI 297 73\n", - "肺活量 261 73\n", - "握力 240 73\n", - "坐位体前屈 208 72\n", - "纵跳 265 72\n", - "俯卧撑 206 56\n", - "一分钟仰卧起坐 48 12\n", - "单脚站立 184 73\n", - "选择反应时 210 69\n", - "台阶指数 173 69\n", - "公用工程二部\n", - "BMI 296 72\n", - "肺活量 238 72\n", - "握力 243 72\n", - "坐位体前屈 212 71\n", - "纵跳 226 69\n", - "俯卧撑 204 55\n", - "一分钟仰卧起坐 54 12\n", - "单脚站立 189 72\n", - "选择反应时 206 68\n", - "台阶指数 191 68\n", - "合成材料部\n", - "BMI 217 55\n", - "肺活量 186 55\n", - "握力 178 53\n", - "坐位体前屈 149 55\n", - "纵跳 180 55\n", - "俯卧撑 164 44\n", - "一分钟仰卧起坐 43 10\n", - "单脚站立 137 55\n", - "选择反应时 146 54\n", - "台阶指数 129 55\n", - "质管中心\n", - "BMI 248 56\n", - "肺活量 197 56\n", - "握力 177 56\n", - "坐位体前屈 149 55\n", - "纵跳 172 52\n", - "俯卧撑 141 39\n", - "一分钟仰卧起坐 49 11\n", - "单脚站立 136 56\n", - "选择反应时 151 50\n", - "台阶指数 141 51\n", - "储运一部\n", - "BMI 324 82\n", - "肺活量 278 82\n", - "握力 263 82\n", - "坐位体前屈 219 80\n", - "纵跳 239 78\n", - "俯卧撑 218 64\n", - "一分钟仰卧起坐 45 10\n", - "单脚站立 201 81\n", - "选择反应时 227 81\n", - "台阶指数 209 78\n", - "氢能制造部\n", - "BMI 231 59\n", - "肺活量 214 59\n", - "握力 190 59\n", - "坐位体前屈 180 59\n", - "纵跳 188 58\n", - "俯卧撑 160 45\n", - "一分钟仰卧起坐 52 13\n", - "单脚站立 160 59\n", - "选择反应时 145 55\n", - "台阶指数 147 58\n", - "电气中心\n", - "BMI 185 45\n", - "肺活量 158 44\n", - "握力 137 45\n", - "坐位体前屈 132 44\n", - "纵跳 130 42\n", - "俯卧撑 129 36\n", - "一分钟仰卧起坐 24 6\n", - "单脚站立 109 45\n", - "选择反应时 136 44\n", - "台阶指数 92 42\n", - "公用工程一部\n", - "BMI 307 81\n", - "肺活量 286 81\n", - "握力 268 81\n", - "坐位体前屈 226 80\n", - "纵跳 262 77\n", - "俯卧撑 223 63\n", - "一分钟仰卧起坐 64 16\n", - "单脚站立 194 81\n", - "选择反应时 211 77\n", - "台阶指数 173 73\n", - "仪表和计量中心\n", - "BMI 323 81\n", - "肺活量 302 81\n", - "握力 273 81\n", - "坐位体前屈 242 79\n", - "纵跳 302 81\n", - "俯卧撑 231 63\n", - "一分钟仰卧起坐 51 12\n", - "单脚站立 221 81\n", - "选择反应时 230 79\n", - "台阶指数 186 80\n", - "港储部\n", - "BMI 142 36\n", - "肺活量 133 36\n", - "握力 119 36\n", - "坐位体前屈 100 36\n", - "纵跳 114 36\n", - "俯卧撑 98 28\n", - "一分钟仰卧起坐 15 4\n", - "单脚站立 86 36\n", - "选择反应时 94 35\n", - "台阶指数 88 33\n", - "炼油二部\n", - "BMI 250 60\n", - "肺活量 211 60\n", - "握力 196 60\n", - "坐位体前屈 169 60\n", - "纵跳 203 57\n", - "俯卧撑 184 49\n", - "一分钟仰卧起坐 47 11\n", - "单脚站立 163 60\n", - "选择反应时 183 59\n", - "台阶指数 145 58\n", - "消防支队\n", - "BMI 99 25\n", - "肺活量 81 25\n", - "握力 87 25\n", - "坐位体前屈 76 25\n", - "纵跳 92 25\n", - "俯卧撑 87 20\n", - "一分钟仰卧起坐 14 3\n", - "单脚站立 70 25\n", - "选择反应时 69 25\n", - "台阶指数 72 25\n", - "烯烃二部\n", - "BMI 154 42\n", - "肺活量 149 42\n", - "握力 133 42\n", - "坐位体前屈 114 42\n", - "纵跳 132 41\n", - "俯卧撑 115 34\n", - "一分钟仰卧起坐 32 7\n", - "单脚站立 102 42\n", - "选择反应时 105 41\n", - "台阶指数 95 41\n", - "炼油一部\n", - "BMI 176 42\n", - "肺活量 140 42\n", - "握力 141 42\n", - "坐位体前屈 127 41\n", - "纵跳 129 37\n", - "俯卧撑 133 36\n", - "一分钟仰卧起坐 16 5\n", - "单脚站立 117 42\n", - "选择反应时 116 41\n", - "台阶指数 103 36\n", - "事务中心\n", - "BMI 149 35\n", - "肺活量 115 35\n", - "握力 103 35\n", - "坐位体前屈 106 34\n", - "纵跳 105 34\n", - "俯卧撑 83 27\n", - "一分钟仰卧起坐 30 6\n", - "单脚站立 99 34\n", - "选择反应时 100 33\n", - "台阶指数 72 30\n", - "公司机关\n", - "BMI 439 113\n", - "肺活量 405 113\n", - "握力 361 113\n", - "坐位体前屈 335 112\n", - "纵跳 394 111\n", - "俯卧撑 332 86\n", - "一分钟仰卧起坐 88 19\n", - "单脚站立 297 107\n", - "选择反应时 322 107\n", - "台阶指数 232 104\n", - "化学制品部\n", - "BMI 171 43\n", - "肺活量 158 43\n", - "握力 149 43\n", - "坐位体前屈 132 42\n", - "纵跳 150 42\n", - "俯卧撑 131 34\n", - "一分钟仰卧起坐 32 7\n", - "单脚站立 104 43\n", - "选择反应时 116 42\n", - "台阶指数 114 41\n", - "项目管理部\n", - "BMI 85 19\n", - "肺活量 68 19\n", - "握力 57 19\n", - "坐位体前屈 60 19\n", - "纵跳 57 18\n", - "俯卧撑 29 7\n", - "一分钟仰卧起坐 44 10\n", - "单脚站立 57 18\n", - "选择反应时 59 19\n", - "台阶指数 46 18\n", - "新材料研究院\n", - "BMI 61 15\n", - "肺活量 56 15\n", - "握力 47 15\n", - "坐位体前屈 48 15\n", - "纵跳 56 15\n", - "俯卧撑 39 12\n", - "一分钟仰卧起坐 14 3\n", - "单脚站立 45 15\n", - "选择反应时 43 15\n", - "台阶指数 37 15\n", - "炼油四部\n", - "BMI 103 27\n", - "肺活量 83 27\n", - "握力 86 27\n", - "坐位体前屈 75 27\n", - "纵跳 77 27\n", - "俯卧撑 83 23\n", - "一分钟仰卧起坐 12 3\n", - "单脚站立 78 27\n", - "选择反应时 84 27\n", - "台阶指数 61 26\n", - "油库中心\n", - "BMI 113 25\n", - "肺活量 90 25\n", - "握力 67 23\n", - "坐位体前屈 73 25\n", - "纵跳 66 23\n", - "俯卧撑 54 15\n", - "一分钟仰卧起坐 32 7\n", - "单脚站立 70 25\n", - "选择反应时 71 24\n", - "台阶指数 50 21\n", - "炼油六部\n", - "BMI 139 33\n", - "肺活量 118 34\n", - "握力 109 34\n", - "坐位体前屈 93 33\n", - "纵跳 109 32\n", - "俯卧撑 93 27\n", - "一分钟仰卧起坐 29 7\n", - "单脚站立 78 34\n", - "选择反应时 86 33\n", - "台阶指数 67 32\n", - "储运二部\n", - "BMI 45 13\n", - "肺活量 49 13\n", - "握力 45 13\n", - "坐位体前屈 39 12\n", - "纵跳 41 13\n", - "俯卧撑 37 11\n", - "一分钟仰卧起坐 8 2\n", - "单脚站立 33 13\n", - "选择反应时 35 13\n", - "台阶指数 29 13\n", - "炼油七部\n", - "BMI 112 26\n", - "肺活量 102 26\n", - "握力 92 26\n", - "坐位体前屈 75 25\n", - "纵跳 82 25\n", - "俯卧撑 59 16\n", - "一分钟仰卧起坐 33 8\n", - "单脚站立 68 26\n", - "选择反应时 71 26\n", - "台阶指数 52 25\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2251,52 +1614,10 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": null, "id": "81195537-5a43-4822-a1b9-a08b7baee05e", - "metadata": { - "execution": { - "iopub.execute_input": "2024-11-05T06:08:58.060156Z", - "iopub.status.busy": "2024-11-05T06:08:58.059475Z", - "iopub.status.idle": "2024-11-05T06:08:58.086227Z", - "shell.execute_reply": "2024-11-05T06:08:58.085428Z", - "shell.execute_reply.started": "2024-11-05T06:08:58.060082Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "采购中心 5 7 8 0\n", - "炼油三部 3 9 18 0\n", - "烯烃一部 31 36 74 15\n", - "炼油五部 15 22 26 10\n", - "公用工程二部 10 29 28 5\n", - "合成材料部 3 20 25 7\n", - "质管中心 8 24 17 7\n", - "储运一部 8 23 38 13\n", - "氢能制造部 10 16 27 6\n", - "电气中心 1 20 21 3\n", - "公用工程一部 12 22 34 13\n", - "仪表和计量中心 18 25 32 6\n", - "港储部 6 5 24 1\n", - "炼油二部 7 25 26 2\n", - "消防支队 6 10 7 2\n", - "烯烃二部 7 10 15 10\n", - "炼油一部 7 12 22 1\n", - "事务中心 6 10 14 5\n", - "公司机关 22 38 42 11\n", - "化学制品部 9 13 19 2\n", - "项目管理部 3 8 8 0\n", - "新材料研究院 2 8 5 0\n", - "炼油四部 3 6 14 4\n", - "油库中心 4 11 7 3\n", - "炼油六部 3 9 17 5\n", - "储运二部 1 4 7 1\n", - "炼油七部 5 9 10 2\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -2323,10 +1644,531 @@ " print(k,v['优秀'],v['良好'],v['合格'],v['不合格'])" ] }, + { + "cell_type": "markdown", + "id": "4df1e70c-e359-4b4a-b2ae-2900ae25ded2", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-25T08:36:22.140778Z", + "iopub.status.busy": "2025-10-25T08:36:22.140431Z", + "iopub.status.idle": "2025-10-25T08:36:22.145537Z", + "shell.execute_reply": "2025-10-25T08:36:22.144522Z", + "shell.execute_reply.started": "2025-10-25T08:36:22.140742Z" + } + }, + "source": [ + "# 体质测试2025年" + ] + }, + { + "cell_type": "markdown", + "id": "0dbcde66-5a57-4b6d-97d3-30159b606807", + "metadata": {}, + "source": [ + "## 体测人员导入" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "8fa4c148-3bba-4bb5-b140-a6f1642c42a0", + "id": "0a6a661d-3780-4ae4-a975-821eae376f7a", + "metadata": {}, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "from datetime import date\n", + "\n", + "wb = openpyxl.load_workbook('data/镇海人员2025.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = sheet.cell(n, 5).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, 6).value).replace('/','-').split(' ')[0] \n", + " dict1['unit'] = sheet.cell(n, 7).value\n", + " dict1['phone'] = sheet.cell(n, 4).value\n", + " person[code] = dict1\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print(len(person),'ok')" + ] + }, + { + "cell_type": "markdown", + "id": "c938346f-711c-4cd7-b2f1-3776df5a00b8", + "metadata": {}, + "source": [ + "## 生成读卡系统文件" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "da037e81-96a8-475e-9ad7-21ab92285b85", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-27T12:41:31.242485Z", + "iopub.status.busy": "2025-10-27T12:41:31.240445Z", + "iopub.status.idle": "2025-10-27T12:41:31.282456Z", + "shell.execute_reply": "2025-10-27T12:41:31.281601Z", + "shell.execute_reply.started": "2025-10-27T12:41:31.242428Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1383 ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "for k, v in dict1.items():\n", + " dict2 = {}\n", + " #if dict1['sex'] =='男':\n", + " # sex = 1\n", + " \n", + " dict2 = {'id':k,'name':v['name'],'gender':v['sex'],'birth':v['birth'],'unit':v['unit']}\n", + " list1.append(dict2)\n", + "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", + "\n", + "# 将 json 数据写入文件\n", + "with open(\"data/card_镇海2025.json\", \"w\",encoding = 'utf-8') as file:\n", + " file.write(json_data) \n", + "print(len(list1),'ok')" + ] + }, + { + "cell_type": "markdown", + "id": "165f14d8-a973-463c-87cd-8c0c0de6a177", + "metadata": {}, + "source": [ + "## 合并读卡系统文件" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "505fce63-ed92-4f63-82da-7207b015dab4", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-29T08:42:44.713490Z", + "iopub.status.busy": "2025-10-29T08:42:44.709542Z", + "iopub.status.idle": "2025-10-29T08:42:44.770204Z", + "shell.execute_reply": "2025-10-29T08:42:44.769358Z", + "shell.execute_reply.started": "2025-10-29T08:42:44.713433Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "019698 张毅 公用工程二部\n", + "019210 张雨婷 公用工程二部\n", + "022238 赵若程 电气中心\n", + "019810 孟玫 油库中心\n", + "021551 朱浩 炼油一部\n", + "010517 胡明 烯烃一部\n", + "015967 牛姗 烯烃一部\n", + "012920 娄形宇 电气中心\n", + "019130 魏巍 电气中心\n", + "012233 方健 烯烃一部\n", + "014585 杨恒平 质管中心\n", + "012785 乐幸 烯烃一部\n", + "021124 吴焕妍 炼油二部\n", + "021532 范展鹏 储运一部\n", + "011878 王可 公用工程一部\n", + "020838 王安东 电气中心\n", + "021429 张博伟 电气中心\n", + "016333 姜媚媚 公司机关\n", + "015474 万忠荣 化学制品部\n", + "015869 李萌萌 炼油四部\n", + "007608 汪海渊 储运一部\n", + "010250 王国维 氢能制造部\n", + "019332 严偲浩 公司机关\n", + "015859 罗信 采购中心\n", + "018940 李云鹏 炼油四部\n", + "012240 邵晓 采购中心\n", + "010536 陈炜敏 采购中心\n", + "015693 邵金燕 公司机关\n", + "019268 邹兆宁 公司机关\n", + "020208 孙书伟 采购中心\n", + "019167 吴涵华 新材料研究院\n", + "012067 阮继春 炼油五部\n", + "021192 舒润发 化学制品部\n", + "015086 王东伟 公司机关\n", + "019042 李刚 储运一部\n", + "011455 任奇伟 炼油四部\n", + "014748 王静 公用工程一部\n", + "015669 周慧芬 公用工程一部\n", + "021804 蓝海涛 储运一部\n", + "020138 牛丙波 新材料研究院\n", + "023552 李宇 烯烃二部\n", + "012802 胡庆球 公司机关\n", + "019017 周靖 烯烃一部\n", + "016056 于海 储运一部\n", + "015919 冯辉 烯烃二部\n", + "019764 曹华林 油库中心\n", + "019668 覃江宜 电气中心\n", + "023169 王武 电气中心\n", + "018979 林冠宇 合成材料部\n", + "023027 邓孜瑶 炼油一部\n", + "015512 王娜 烯烃一部\n", + "020194 徐梦莹 油库中心\n", + "019760 常亚男 油库中心\n", + "020801 陈冲 炼油三部\n", + "1464 ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/data_镇海2025.json'\n", + "with open(filename,'r') as fl:\n", + " list1 = json.load(fl)\n", + "for item in list1:\n", + " code = item['id'].lower()\n", + " if code not in dict1.keys():\n", + " print(code,item['name'],item['unit'])\n", + " code = code.lower()\n", + " dict1.setdefault(code,{})\n", + " dict1[code]['name'] = item['name']\n", + " dict1[code]['sex'] = item['gender']\n", + " dict1[code]['unit'] = item['unit']\n", + " dict1[code]['birth'] = item['birth']\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print(len(dict1),'ok')" + ] + }, + { + "cell_type": "markdown", + "id": "0e9316d6-7f54-4c12-898f-11d635377059", + "metadata": {}, + "source": [ + "## 规范人员编号" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7f4df663-4767-4a1b-9e2f-14c97a2926f7", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "dict2 = {}\n", + "for k, v in dict1.items():\n", + " new_k = k.lower()\n", + " dict2[new_k] = v\n", + "filename = 'data/镇海人员2025-1.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(dict2, fl, ensure_ascii=False)\n", + "print(len(dict1),'ok')" + ] + }, + { + "cell_type": "markdown", + "id": "065cb133-3c61-46bd-bf81-7afa2c9be9e0", + "metadata": {}, + "source": [ + "## 获取人员测试成绩" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "289e4e1d-c80d-46f9-9015-fc4c139bc99d", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-29T08:50:32.458008Z", + "iopub.status.busy": "2025-10-29T08:50:32.455735Z", + "iopub.status.idle": "2025-10-29T08:50:32.674774Z", + "shell.execute_reply": "2025-10-29T08:50:32.672087Z", + "shell.execute_reply.started": "2025-10-29T08:50:32.457968Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1025\n" + ] + } + ], + "source": [ + "import json\n", + "import datetime\n", + "import csv\n", + "from datetime import date\n", + "import my_module1 as My\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "filename = 'data/marks_20251029.csv'\n", + "re_ta = My.get_result(filename,dict1)\n", + "\n", + "\n", + "filename = 'data/result_镇海2025.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": "09c60f09-e35b-424a-85a8-804dd3644a0f", + "metadata": {}, + "source": [ + "## 获取人员测试成绩(上午)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9a6a8ce6-5c8b-47c4-a597-cd0c9eb8a9fb", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import datetime\n", + "import csv\n", + "from datetime import date\n", + "import my_module1 as My\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "filename = 'data/marks_20251027-1.csv'\n", + "re_ta = My.get_result(filename,dict1)\n", + "\n", + "\n", + "filename = 'data/result_镇海2025.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": "15d7fae0-76a3-4443-8c2c-94ec7b8f052c", + "metadata": {}, + "source": [ + "## 生成测试得分" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "49d15e27-6029-4557-a17a-7e7a426f7e5f", + "metadata": {}, + "outputs": [], + "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_镇海2025.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_镇海2025.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict2,fl , ensure_ascii=False) \n", + "print('ok!') " + ] + }, + { + "cell_type": "markdown", + "id": "c1ef03ac-6970-4d33-9d30-fc2ffe4e7c52", + "metadata": {}, + "source": [ + "## 导出测试人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ed6705e-b4f6-419e-b94b-4c391fed4551", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "\n", + "filename = 'data/result_镇海2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + " \n", + "list1 = []\n", + "for k, v in dict1.items():\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(v['name']) \n", + " list2.append(dict2[k]['sex'])\n", + " list2.append(dict2[k]['unit']) \n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['成绩']) \n", + " elif item =='name':\n", + " list2.append(v[item])\n", + " else:\n", + " list2.append('')\n", + " #list2.append(dict2[k]['gwxl'])\n", + " #list2.append(dict2[k]['gzz'])\n", + " list1.append(list2)\n", + "filename = 'data/镇海体测情况表(截至20251027)-1.xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(title)\n", + "for row in list1:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "markdown", + "id": "d6d6b47e-386c-4cee-a4d6-6dbe4f415490", + "metadata": {}, + "source": [ + "## 统计各部门测试情况" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "a0c85107-7c75-462c-8f77-aea787d2100f", + "metadata": { + "execution": { + "iopub.execute_input": "2025-10-29T08:51:39.051506Z", + "iopub.status.busy": "2025-10-29T08:51:39.048537Z", + "iopub.status.idle": "2025-10-29T08:51:39.126940Z", + "shell.execute_reply": "2025-10-29T08:51:39.122609Z", + "shell.execute_reply.started": "2025-10-29T08:51:39.051458Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/result_镇海2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/镇海人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "\n", + "dict3 = {}\n", + "for k, v in dict2.items():\n", + " unit = v['unit']\n", + " #sub_unit = v['sub_unit']\n", + " dict3.setdefault(unit,{})\n", + " dict3[unit].setdefault('人数',0)\n", + " dict3[unit].setdefault('体测人数',0)\n", + " #dict3[unit].setdefault(sub_unit,0)\n", + " #dict3[unit][sub_unit] = dict3[unit][sub_unit] + 1\n", + " dict3[unit]['人数'] = dict3[unit]['人数'] + 1\n", + "\n", + "title =['单位','体测人数']\n", + "list1 = []\n", + "for k,v in dict1.items(): \n", + " unit = v['unit']\n", + " #sub_unit = v['sub_unit']\n", + " #dict3[unit][sub_unit] = dict3[unit][sub_unit] - 1\n", + " dict3[unit].setdefault('体测人数',0)\n", + " dict3[unit]['体测人数'] = dict3[unit]['体测人数'] + 1\n", + "for k, v in dict3.items():\n", + " list2 = [k,v['人数'],v['体测人数']]\n", + " list1.append(list2)\n", + "\n", + "filename = 'data/镇海部门测试情况(截至20251029).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(title)\n", + "for row in list1:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bea9e53e-96e7-4006-9674-48c91e8ab0c7", + "metadata": {}, + "outputs": [], + "source": [ + "filename = 'data/result_镇海2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl) \n", + "i = 1\n", + "for k, v in dict2.items():\n", + " if 'bmi' in v.keys():\n", + " print(i,k,v['name'])\n", + " i+=1" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7b538b1b-9f02-4f77-82bf-f8084066003f", "metadata": {}, "outputs": [], "source": []