From 31ddcb887f31f14e9544f16d163d3b39a659f5bc Mon Sep 17 00:00:00 2001 From: 512song Date: Mon, 17 Nov 2025 22:46:37 +0800 Subject: [PATCH] 20251117 --- 体测单位/my_module.py | 2 +- 体测单位/体质检测数据处理.ipynb | 74 ++--- 体测单位/北海炼化.ipynb | 344 ++++++++++++++++--- 体测单位/天津石化.ipynb | 102 ++++++ 体测单位/宁夏能化.ipynb | 455 +++++++++++++++++++++----- 体测单位/新疆油田采油工艺研究院.ipynb | 72 ++-- 体测单位/沧州炼化.ipynb | 286 ++++++++++++---- 体测单位/镇海.ipynb | 26 +- 高考数据导入.ipynb | 4 +- 9 files changed, 1089 insertions(+), 276 deletions(-) diff --git a/体测单位/my_module.py b/体测单位/my_module.py index fd55f3c..f33ff8c 100644 --- a/体测单位/my_module.py +++ b/体测单位/my_module.py @@ -138,7 +138,7 @@ def get_result(filename,dict1): list1.append(line) for result in list1: - user = str(int(result[2])) + user = str(int(result[2])).strip() rq = date.fromisoformat(result[5].replace('/','-')) if user in dict1.keys(): l_xm = [] diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index 32b1acc..1f417ec 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -690,11 +690,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_镇海2025-1.json'\n", + "filename = 'data/result_北海2025-1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./镇海石化2025/'\n", + "file_path ='./北海炼化2025-1/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -703,9 +703,9 @@ " mydata = {}\n", " \n", " #id = str(k).rjust(8,\"0\")\n", - " id = str(k)\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", @@ -732,8 +732,8 @@ " else:\n", " mark = v[item]['成绩'].split()[0]\n", " mydata['fits'][item] = {'mark':mark,'score':v[item]['score']}\n", - " #if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n", - " if len(mydata['fits']) >2 : \n", + " if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n", + " #if len(mydata['fits']) >2 : \n", " list1.append(mydata)\n", " list2.append([k,v['name']])\n", " i+=1\n", @@ -915,19 +915,19 @@ "import glob\n", "from pathlib import Path\n", "\n", - "fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n", - "new_path = 'file/镇海石化2025'\n", + "fi_path = '/home/songyi/pdf-typescript-old2/北海炼化2025'\n", + "new_path = 'file/北海炼化2025'\n", "old = []\n", "dict2 = {}\n", "\n", - "filename = 'data/result_镇海2025-1.json'\n", + "filename = 'data/result_北海2025-1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", "print(len(fls))\n", "for fn in fls:\n", " fi_name =Path(fn).stem.split('-')[0]\n", - " code = fi_name \n", + " code = str(int(fi_name)) \n", " unit_path = Path(new_path,dict1[str(code)]['unit'])\n", " unit_path.mkdir(parents = True, exist_ok = True)\n", " n_name = Path(unit_path,Path(fn).stem+'.pdf')\n", @@ -946,15 +946,15 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 18, "id": "02319955-7fb6-4791-ae45-55b03bdadd54", "metadata": { "execution": { - "iopub.execute_input": "2025-11-07T06:31:33.947472Z", - "iopub.status.busy": "2025-11-07T06:31:33.946853Z", - "iopub.status.idle": "2025-11-07T06:31:34.095980Z", - "shell.execute_reply": "2025-11-07T06:31:34.095388Z", - "shell.execute_reply.started": "2025-11-07T06:31:33.947411Z" + "iopub.execute_input": "2025-11-17T14:25:08.413467Z", + "iopub.status.busy": "2025-11-17T14:25:08.412602Z", + "iopub.status.idle": "2025-11-17T14:25:08.498336Z", + "shell.execute_reply": "2025-11-17T14:25:08.497785Z", + "shell.execute_reply.started": "2025-11-17T14:25:08.413400Z" }, "tags": [] }, @@ -974,9 +974,9 @@ "from pathlib import Path\n", "import openpyxl\n", "\n", - "fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n", + "fi_path = '/home/songyi/pdf-typescript-old2/北海炼化2025'\n", "\n", - "filename = 'data/result_镇海2025-1.json'\n", + "filename = 'data/result_北海2025-1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -985,14 +985,14 @@ "for fn in fls:\n", " list2 = []\n", " fi_name =Path(fn).stem.split('-')[0] \n", - " code = fi_name\n", + " code = str(int(fi_name))\n", " sex = dict1[str(code)]['sex']\n", " unit = dict1[str(code)]['unit']\n", " list2 = [fi_name,Path(fn).stem.split('-')[1],sex,unit]\n", " \n", " list1.append(list2)\n", "\n", - "filename = 'data/2025年镇海石化体测报告明细表.xlsx'\n", + "filename = 'data/2025年北海炼化体测报告明细表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -1656,7 +1656,7 @@ "import openpyxl\n", "\n", "\n", - "filename = 'data/result_胜利采油厂1.json'\n", + "filename = 'data/result_镇海2025.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -1709,7 +1709,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_镇海2025.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print(len(dict2)) " @@ -1735,7 +1735,7 @@ "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_镇海2025.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -2108,7 +2108,7 @@ " score = 0\n", " n = 0\n", " for k, v in dict1.items():\n", - " if item == v['unit'] and v['sex'] == '男':\n", + " if item == v['unit'] and v['sex'] == '女':\n", " score = score + v['score']\n", " n = n +1 \n", " if n>0:\n", @@ -2175,7 +2175,7 @@ "import json\n", "\n", "items = ['BMI','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数'] \n", - "filename = 'data/data_宁夏能化人员.json'\n", + "filename = 'data/data_镇海2025.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -2222,17 +2222,9 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-14T05:36:30.068876Z", - "iopub.status.busy": "2025-11-14T05:36:30.068084Z", - "iopub.status.idle": "2025-11-14T05:36:30.079053Z", - "shell.execute_reply": "2025-11-14T05:36:30.078052Z", - "shell.execute_reply.started": "2025-11-14T05:36:30.068800Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -2584,17 +2576,9 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-14T05:36:39.675837Z", - "iopub.status.busy": "2025-11-14T05:36:39.675165Z", - "iopub.status.idle": "2025-11-14T05:36:39.706916Z", - "shell.execute_reply": "2025-11-14T05:36:39.706427Z", - "shell.execute_reply.started": "2025-11-14T05:36:39.675772Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import openpyxl\n", diff --git a/体测单位/北海炼化.ipynb b/体测单位/北海炼化.ipynb index cc0e9ab..6f28cb9 100644 --- a/体测单位/北海炼化.ipynb +++ b/体测单位/北海炼化.ipynb @@ -2165,9 +2165,7 @@ { "cell_type": "markdown", "id": "76c5c17a-462d-4a7b-95a5-6b895f5a25dc", - "metadata": { - "jp-MarkdownHeadingCollapsed": true - }, + "metadata": {}, "source": [ "# 2024年体质检测" ] @@ -3042,10 +3040,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "58f6dbab-9ea2-4295-ae78-36951b67c2d3", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T07:32:41.466054Z", + "iopub.status.busy": "2025-11-17T07:32:41.465351Z", + "iopub.status.idle": "2025-11-17T07:32:41.591984Z", + "shell.execute_reply": "2025-11-17T07:32:41.591337Z", + "shell.execute_reply.started": "2025-11-17T07:32:41.465990Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "880 ok\n" + ] + } + ], "source": [ "import openpyxl\n", "import json\n", @@ -3186,15 +3200,15 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 14, "id": "7b79c7bb-ce87-44b2-95b1-01e9cb66d5f0", "metadata": { "execution": { - "iopub.execute_input": "2025-11-13T05:44:27.934101Z", - "iopub.status.busy": "2025-11-13T05:44:27.933541Z", - "iopub.status.idle": "2025-11-13T05:44:27.991293Z", - "shell.execute_reply": "2025-11-13T05:44:27.990805Z", - "shell.execute_reply.started": "2025-11-13T05:44:27.934053Z" + "iopub.execute_input": "2025-11-17T07:32:53.282654Z", + "iopub.status.busy": "2025-11-17T07:32:53.281905Z", + "iopub.status.idle": "2025-11-17T07:32:53.332471Z", + "shell.execute_reply": "2025-11-17T07:32:53.331897Z", + "shell.execute_reply.started": "2025-11-17T07:32:53.282586Z" } }, "outputs": [ @@ -3236,15 +3250,15 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 15, "id": "458725a6-3b5b-48a1-af90-cd4d0bda3635", "metadata": { "execution": { - "iopub.execute_input": "2025-11-13T05:51:01.753768Z", - "iopub.status.busy": "2025-11-13T05:51:01.752925Z", - "iopub.status.idle": "2025-11-13T05:51:01.812931Z", - "shell.execute_reply": "2025-11-13T05:51:01.812381Z", - "shell.execute_reply.started": "2025-11-13T05:51:01.753692Z" + "iopub.execute_input": "2025-11-17T07:33:02.993633Z", + "iopub.status.busy": "2025-11-17T07:33:02.993053Z", + "iopub.status.idle": "2025-11-17T07:33:03.110653Z", + "shell.execute_reply": "2025-11-17T07:33:03.109552Z", + "shell.execute_reply.started": "2025-11-17T07:33:02.993579Z" } }, "outputs": [ @@ -3278,6 +3292,72 @@ "print('ok')" ] }, + { + "cell_type": "markdown", + "id": "aff5b1b6-a6af-44dd-beb0-cb2b68999496", + "metadata": {}, + "source": [ + "## 生成测试得分" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "ef655e34-635b-4baa-97c3-925022f45949", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T10:47:57.459196Z", + "iopub.status.busy": "2025-11-17T10:47:57.458528Z", + "iopub.status.idle": "2025-11-17T10:47:57.506947Z", + "shell.execute_reply": "2025-11-17T10:47:57.506509Z", + "shell.execute_reply.started": "2025-11-17T10:47:57.459138Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], + "source": [ + "import json\n", + "import time\n", + "import my_module as My\n", + "\n", + "#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n", + "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", + "filename = 'data/result_北海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": "12b33ee8-2b4e-4b85-9301-4fbcadf4129c", @@ -3407,15 +3487,15 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": 16, "id": "0bbf2cb6-e7d9-4d0d-beba-77ac50082f05", "metadata": { "execution": { - "iopub.execute_input": "2025-11-13T06:17:23.628451Z", - "iopub.status.busy": "2025-11-13T06:17:23.627881Z", - "iopub.status.idle": "2025-11-13T06:17:23.729071Z", - "shell.execute_reply": "2025-11-13T06:17:23.728586Z", - "shell.execute_reply.started": "2025-11-13T06:17:23.628397Z" + "iopub.execute_input": "2025-11-17T07:33:16.521656Z", + "iopub.status.busy": "2025-11-17T07:33:16.520913Z", + "iopub.status.idle": "2025-11-17T07:33:16.617830Z", + "shell.execute_reply": "2025-11-17T07:33:16.617274Z", + "shell.execute_reply.started": "2025-11-17T07:33:16.521587Z" } }, "outputs": [], @@ -3427,7 +3507,7 @@ "from datetime import date\n", "\n", "list1 = []\n", - "filename = 'data/sql_20251113.csv'\n", + "filename = 'data/sql_20251117.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -3452,7 +3532,72 @@ " list2 = [code,dict3[code]['name'],dict3[code]['unit'],phone_num]\n", " list3.append(list2)\n", "title =['测试编号','姓名','部门','手机号码']\n", - "filename = 'data/北海炼化问卷人员(截至20251113).xlsx'\n", + "filename = 'data/北海炼化问卷人员(截至20251116).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(title)\n", + "for row in list3:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "markdown", + "id": "60d7de83-75aa-44bf-99da-492627032ca1", + "metadata": {}, + "source": [ + "## 问卷不符合信息人员" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d3c0061f-fc24-483e-8e93-08872c77547f", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T01:29:17.936230Z", + "iopub.status.busy": "2025-11-17T01:29:17.935493Z", + "iopub.status.idle": "2025-11-17T01:29:17.974203Z", + "shell.execute_reply": "2025-11-17T01:29:17.973659Z", + "shell.execute_reply.started": "2025-11-17T01:29:17.936162Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "list1 = []\n", + "filename = 'data/sql_20251117.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", + "filename = 'data/北海炼化人员2025.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[str(v['phone'])] = k\n", + "dict2 = {}\n", + "list3 = []\n", + "for item in list1: \n", + " phone_num = str(item[0])[2:] \n", + " if phone_num not in phone:\n", + " list2 = []\n", + " content = json.loads(json.loads(item[1])) \n", + " code = phone_num\n", + " list2 = [code,content['name'],content['birth'],content['gender']]\n", + " list3.append(list2)\n", + "title =['测试编号','姓名','部门','手机号码']\n", + "filename = 'data/北海炼化问卷信息不符合人员(截至20251116).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -3464,15 +3609,15 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 8, "id": "277fce35-2f95-4d52-8cab-4e27c9acd7b8", "metadata": { "execution": { - "iopub.execute_input": "2025-11-10T09:40:12.759033Z", - "iopub.status.busy": "2025-11-10T09:40:12.758367Z", - "iopub.status.idle": "2025-11-10T09:40:12.843476Z", - "shell.execute_reply": "2025-11-10T09:40:12.842924Z", - "shell.execute_reply.started": "2025-11-10T09:40:12.758969Z" + "iopub.execute_input": "2025-11-17T01:22:21.248136Z", + "iopub.status.busy": "2025-11-17T01:22:21.247270Z", + "iopub.status.idle": "2025-11-17T01:22:21.339031Z", + "shell.execute_reply": "2025-11-17T01:22:21.338544Z", + "shell.execute_reply.started": "2025-11-17T01:22:21.248063Z" } }, "outputs": [], @@ -3487,7 +3632,7 @@ "dict1 = {}\n", "list1 = []\n", "list2 = set()\n", - "filename = 'data/sql_20251110.csv'\n", + "filename = 'data/sql_20251117.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -3530,7 +3675,7 @@ " list4 = [phone,v['name'],v['unit']]\n", " list3.append(list4)\n", "title =['手机号码','姓名','部门']\n", - "filename = 'data/北海炼化未参加问卷人员(截至20251110).xlsx'\n", + "filename = 'data/北海炼化未参加问卷人员(截至20251116).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -3552,15 +3697,15 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 6, "id": "f67f63d1-be8a-47ef-b95f-bdfca9725838", "metadata": { "execution": { - "iopub.execute_input": "2025-11-13T06:00:49.916395Z", - "iopub.status.busy": "2025-11-13T06:00:49.915561Z", - "iopub.status.idle": "2025-11-13T06:00:50.043798Z", - "shell.execute_reply": "2025-11-13T06:00:50.043247Z", - "shell.execute_reply.started": "2025-11-13T06:00:49.916323Z" + "iopub.execute_input": "2025-11-17T01:19:30.426467Z", + "iopub.status.busy": "2025-11-17T01:19:30.425891Z", + "iopub.status.idle": "2025-11-17T01:19:30.551084Z", + "shell.execute_reply": "2025-11-17T01:19:30.550545Z", + "shell.execute_reply.started": "2025-11-17T01:19:30.426412Z" } }, "outputs": [], @@ -3574,7 +3719,7 @@ "\n", "dict1 = {}\n", "list1 = []\n", - "filename = 'data/sql_20251110.csv'\n", + "filename = 'data/sql_20251117.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -3615,7 +3760,7 @@ " list2 = [k,v['name'],v['sex'],v['birth']]\n", " list1.append(list2)\n", "title =['手机号码','姓名','性别','出生年月']\n", - "filename = 'data/北海炼化问卷人员(截至20251110).xlsx'\n", + "filename = 'data/北海炼化问卷人员(截至20251116).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -3702,10 +3847,123 @@ "wb.save(filename)" ] }, + { + "cell_type": "markdown", + "id": "fc7701c1-0ce3-4fb9-a8eb-c9f8f2d44337", + "metadata": {}, + "source": [ + "## 导入问卷信息" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "4628f644-a571-4f2b-8d7b-e6b60b2ddcfd", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T12:25:33.111224Z", + "iopub.status.busy": "2025-11-17T12:25:33.110488Z", + "iopub.status.idle": "2025-11-17T12:25:33.267732Z", + "shell.execute_reply": "2025-11-17T12:25:33.267196Z", + "shell.execute_reply.started": "2025-11-17T12:25:33.111154Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "781\n" + ] + } + ], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "list1 = []\n", + "filename = 'data/sql_20251117.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", + "filename = 'data/北海炼化人员2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict3 = json.load(fl)\n", + "filename = 'data/result_北海2025.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "phone = {}\n", + "for k,v in dict3.items():\n", + " if 'phone' in v.keys():\n", + " phone[str(v['phone'])] = k\n", + "\n", + "\n", + "\n", + "nn = 0\n", + "for item in list1:\n", + " dict2 = {}\n", + " \n", + " phone_num = str(item[0])[2:]\n", + " if phone_num in phone:\n", + " content = json.loads(json.loads(item[1]))\n", + " tcm = []\n", + " spine = []\n", + " psy = []\n", + " for i in range(0,45):\n", + " psy.append(0)\n", + " psy[44] = []\n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " for i in range(0,26):\n", + " spine.append(0)\n", + " for k, v in content.items(): \n", + " if 'psy' in k:\n", + " i = int(k[3:])\n", + " psy[i-1] = int(v)\n", + " if 'tcm' in k:\n", + " i = int(k[3:])\n", + " tcm[i-1] = int(v)\n", + " if 'spine' in k:\n", + " i = int(k[5:])\n", + " if i<23:\n", + " spine[i-1] = int(v)\n", + " else:\n", + " spine[i] = int(v)\n", + " for i in range(26,40):\n", + " new_valve = 1+psy[i]\n", + " psy[i] = new_valve \n", + " code = phone[phone_num]\n", + " if code in dict3.keys() and code in dict1.keys(): \n", + " dict1[code]['tcm'] = tcm \n", + " dict1[code]['spine'] = spine\n", + " dict1[code]['psy'] = psy\n", + " elif code not in dict1.keys(): \n", + " dict1.setdefault(code,{})\n", + " dict1[code] = dict3[code]\n", + " birth = date.fromisoformat(dict3[code]['birth'])\n", + " rq = date.fromisoformat('2025-11-17')\n", + " days = (rq-birth).days \n", + " dict1[code]['age'] = int(days/365)\n", + " dict1[code]['month'] = int(days/365*12)\n", + " dict1[code]['rq'] = '2025-11-17'\n", + " dict1[code]['tcm'] = tcm \n", + " dict1[code]['spine'] = spine\n", + " dict1[code]['psy'] = psy\n", + "filename = 'data/result_北海2025-1.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print(len(dict1))" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "4b58eeae-089d-4007-ab5a-1e1e9e088dd7", + "id": "013474d1-e2e0-4562-bd72-80ec9425f0c9", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index a514900..cf82178 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -3513,6 +3513,108 @@ "print(len(list1),'ok')" ] }, + { + "cell_type": "markdown", + "id": "fd5cb794-6197-4204-a421-fd7a14aeab20", + "metadata": {}, + "source": [ + "## 获取人员测试成绩" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "52de3ba0-f430-444b-87e9-1f13c3e2dcc2", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T13:15:52.024202Z", + "iopub.status.busy": "2025-11-17T13:15:52.023733Z", + "iopub.status.idle": "2025-11-17T13:15:52.062303Z", + "shell.execute_reply": "2025-11-17T13:15:52.061818Z", + "shell.execute_reply.started": "2025-11-17T13:15:52.024158Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "253\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_20251117-2.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": "f58f041b-a3cb-475c-8ac2-a8a747c96386", + "metadata": {}, + "source": [ + "## 统计未体测人员明细表" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "04990b9f-a8f9-4442-935e-d223fde24e72", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T13:21:58.571623Z", + "iopub.status.busy": "2025-11-17T13:21:58.570712Z", + "iopub.status.idle": "2025-11-17T13:21:58.620055Z", + "shell.execute_reply": "2025-11-17T13:21:58.619536Z", + "shell.execute_reply.started": "2025-11-17T13:21:58.571556Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\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", + "\n", + "i = 1\n", + "for k, v in dict1.items(): \n", + " list2 = [i,k,v['name'],v['unit']]\n", + " i+=1\n", + " list1.append(list2)\n", + "#print(list1)\n", + "filename = f'data/天津石化体测人员名单(截至20251117).xlsx'\n", + "title = ['序号','员工编号','姓名','部门']\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(title)\n", + "for row in list1:\n", + " sheet.append(row) \n", + "wb.save(filename)" + ] + }, { "cell_type": "markdown", "id": "85a03b00-9624-4ae9-aa6d-386798d457df", diff --git a/体测单位/宁夏能化.ipynb b/体测单位/宁夏能化.ipynb index b7f007d..efa2e08 100644 --- a/体测单位/宁夏能化.ipynb +++ b/体测单位/宁夏能化.ipynb @@ -975,26 +975,10 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "396e64b8-c306-4613-9848-f0f183052b78", - "metadata": { - "execution": { - "iopub.execute_input": "2025-10-10T02:18:51.157197Z", - "iopub.status.busy": "2025-10-10T02:18:51.156880Z", - "iopub.status.idle": "2025-10-10T02:18:51.211412Z", - "shell.execute_reply": "2025-10-10T02:18:51.210755Z", - "shell.execute_reply.started": "2025-10-10T02:18:51.157161Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "210 ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -1033,26 +1017,10 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "f60e8194-7ef6-49d8-8538-9b79f35bb64d", - "metadata": { - "execution": { - "iopub.execute_input": "2025-10-10T02:09:50.365387Z", - "iopub.status.busy": "2025-10-10T02:09:50.364816Z", - "iopub.status.idle": "2025-10-10T02:09:50.391653Z", - "shell.execute_reply": "2025-10-10T02:09:50.391205Z", - "shell.execute_reply.started": "2025-10-10T02:09:50.365335Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "145 ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -1117,17 +1085,9 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "f0853629-e971-492b-88c8-4e9521b4b017", - "metadata": { - "execution": { - "iopub.execute_input": "2025-10-10T02:16:14.316496Z", - "iopub.status.busy": "2025-10-10T02:16:14.315869Z", - "iopub.status.idle": "2025-10-10T02:16:14.344471Z", - "shell.execute_reply": "2025-10-10T02:16:14.343924Z", - "shell.execute_reply.started": "2025-10-10T02:16:14.316435Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -1161,17 +1121,324 @@ "wb.save(filename)" ] }, + { + "cell_type": "markdown", + "id": "98de56de-95fe-4f21-be25-896fb1bda175", + "metadata": {}, + "source": [ + "## 问卷转换" + ] + }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "22be8f39-afbb-448a-8ae6-c825c7d38757", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "\n", + "title = []\n", + "\n", + "filename = 'data/surveys_records_宁夏能化.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "title = ['id', 'date_created']\n", + "data_title = ['name', 'gender', 'birth', 'code', 'unit', 'height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose-Comment', 'last_recipe-Comment', 'last_lose_weight', 'last_sport-Comment', 'sport_type-Comment']\n", + "for item in dict1:\n", + " list2 = []\n", + " for xm in title:\n", + " if xm in item.keys():\n", + " list2.append(item[xm])\n", + " else:\n", + " list2.append('')\n", + " for xm in data_title:\n", + " if xm in item['data'].keys():\n", + " if xm =='sport_type':\n", + " list2.append(','.join(item['data'][xm]))\n", + " else:\n", + " list2.append(item['data'][xm])\n", + " else:\n", + " list2.append('')\n", + " \n", + " list1.append(list2)\n", + "all_title = ['id', 'date_created','name', 'gender', 'birth', 'code', 'unit', 'height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose-Comment', 'last_recipe-Comment', 'last_lose_weight', 'last_sport-Comment', 'sport_type-Comment']\n", + "filename = 'data/宁夏能化干预人员问卷(20251114).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(all_title)\n", + "for row in list1:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename) " + ] + }, + { + "cell_type": "markdown", + "id": "ad2f24f2-f43c-4181-a5e4-16876b0d7443", "metadata": { "execution": { - "iopub.execute_input": "2025-10-10T02:18:10.620552Z", - "iopub.status.busy": "2025-10-10T02:18:10.619865Z", - "iopub.status.idle": "2025-10-10T02:18:10.652211Z", - "shell.execute_reply": "2025-10-10T02:18:10.651710Z", - "shell.execute_reply.started": "2025-10-10T02:18:10.620490Z" + "iopub.execute_input": "2025-11-14T09:41:32.283676Z", + "iopub.status.busy": "2025-11-14T09:41:32.283096Z", + "iopub.status.idle": "2025-11-14T09:41:32.303376Z", + "shell.execute_reply": "2025-11-14T09:41:32.302637Z", + "shell.execute_reply.started": "2025-11-14T09:41:32.283623Z" + } + }, + "source": [ + "## 问卷导入数据库" + ] + }, + { + "cell_type": "markdown", + "id": "88f6e148-bfd3-4394-8cfd-de7c84306431", + "metadata": {}, + "source": [ + "### 导入人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "747ff8ae-9e50-452f-9dcf-f5ba7c5b8f51", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "import psycopg2\n", + "\n", + "conn = psycopg2.connect(\n", + " host=\"localhost\",\n", + " database=\"tice\",\n", + " user=\"mydata\",\n", + " password=\"songyi\"\n", + ")\n", + "cur = conn.cursor()\n", + "wb = openpyxl.load_workbook('data/宁夏能化干预人员问卷(20251114).xlsx',data_only=True)\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "for n in range(2, sheet.max_row+1):\n", + " code = str(sheet.cell(n, 6).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['sex'] = sheet.cell(n, 4).value\n", + " birth = str(sheet.cell(n, 5).value).split()[0]\n", + " if len(birth)==7:\n", + " dict1['birth'] = birth+'-01'\n", + " else:\n", + " dict1['birth'] = birth\n", + " dict1['unit'] = sheet.cell(n, 7).value\n", + " person[code] = dict1\n", + "org_id = 1\n", + "data1 = []\n", + "for k,v in person.items():\n", + " tuple1 = (v['name'],v['sex'],v['unit'],v['birth'],k,org_id)\n", + " print(tuple1)\n", + " data1.append(tuple1)\n", + "sql = \"INSERT INTO fitness_person ( name, sex,unit,birth,code,org_id) VALUES (%s, %s, %s,%s, %s, %s)\" \n", + "#print(data1)\n", + "cur.executemany(sql, data1)\n", + "conn.commit()\n", + "\n", + "# 关闭连接\n", + "cur.close()\n", + "conn.close()" + ] + }, + { + "cell_type": "markdown", + "id": "5c2a37a0-18d3-4c89-8dd9-283a417b5c60", + "metadata": {}, + "source": [ + "### 导入问卷信息" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0b386dac-a335-41ba-8838-59b2866bb9a3", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "import psycopg2\n", + "\n", + "conn = psycopg2.connect(\n", + " host=\"localhost\",\n", + " database=\"tice\",\n", + " user=\"mydata\",\n", + " password=\"songyi\"\n", + ")\n", + "cur = conn.cursor()\n", + "\n", + "org_id = 1\n", + "event_id = 1\n", + "filename = 'data/surveys_records_宁夏能化.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "title = ['date_created', 'height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose_Comment', 'last_recipe_Comment', 'last_lose_weight', 'last_sport_Comment', 'sport_type_Comment']\n", + "data_title = ['height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose-Comment', 'last_recipe-Comment', 'last_lose_weight', 'last_sport-Comment', 'sport_type-Comment']\n", + "for item in dict1:\n", + " \n", + " code = item['data']['code']\n", + " sql = \"SELECT id from fitness_person where code = %s and org_id = %s\"\n", + " params = (code,org_id)\n", + " cur.execute(sql, params)\n", + " rows = cur.fetchone()\n", + " if rows:\n", + " list2 = []\n", + " id = rows[0]\n", + " list2.append(event_id)\n", + " list2.append(id)\n", + " date_created = item['date_created']\n", + " list2.append(date_created)\n", + " for xm in data_title:\n", + " if xm in item['data'].keys():\n", + " if xm =='sport_type':\n", + " list2.append(','.join(item['data'][xm]))\n", + " else:\n", + " list2.append(item['data'][xm])\n", + " else:\n", + " list2.append('')\n", + " list1.append(tuple(list2))\n", + "sql = \"INSERT INTO fitness_survey_data (event_id,user_id,date_created, height, weight, next_weight, waist, hip, level4, level3, level2, recipe, level1, last_level4, last_level3, last_level2, last_level1, last_recipe, last_lose, last_sport, sport_type, sport_duration, last_sport_time, last_lose_Comment, last_recipe_Comment, last_lose_weight, last_sport_Comment, sport_type_Comment)\" \n", + "sql = sql + \" VALUES (%s,%s, %s, %s,%s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s, %s, %s, %s)\"\n", + "cur.executemany(sql, list1)\n", + "conn.commit()\n", + "\n", + "# 关闭连接\n", + "cur.close()\n", + "conn.close()" + ] + }, + { + "cell_type": "markdown", + "id": "83a2518b-12d8-4ef8-8ee9-5b4289a94208", + "metadata": {}, + "source": [ + "## 问卷导入JSON" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7133988-213c-4b52-8d6b-17b56b8ea310", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "wb = openpyxl.load_workbook('data/宁夏能化干预人员问卷(20251114).xlsx',data_only=True)\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "for n in range(2, sheet.max_row+1):\n", + " code = str(sheet.cell(n, 6).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['sex'] = sheet.cell(n, 4).value\n", + " birth = str(sheet.cell(n, 5).value).split()[0]\n", + " if len(birth)==7:\n", + " dict1['birth'] = birth+'-01'\n", + " else:\n", + " dict1['birth'] = birth\n", + " dict1['unit'] = sheet.cell(n, 7).value\n", + " person[code] = dict1\n", + "#print(person)\n", + "\n", + "filename = 'data/surveys_records_宁夏能化.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "title = ['date_created', 'height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose_Comment', 'last_recipe_Comment', 'last_lose_weight', 'last_sport_Comment', 'sport_type_Comment']\n", + "data_title = ['height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose-Comment', 'last_recipe-Comment', 'last_lose_weight', 'last_sport-Comment', 'sport_type-Comment']\n", + "for item in dict1: \n", + " dict2 = {}\n", + " code = item['data']['code']\n", + " rq = item['date_created'].split()[0]\n", + " dict2['height'] = item['data']['height']\n", + " dict2['weight'] = item['data']['weight']\n", + " dict2['next_weight'] = item['data']['weight']-item['data']['next_weight']\n", + " dict2['bmi'] = (item['data']['weight']/item['data']['height'])/item['data']['height']*10000\n", + " bmi = (item['data']['weight']/item['data']['height'])/item['data']['height']*10000\n", + " if bmi<18.5:\n", + " bmi_zt = '体重偏轻'\n", + " elif bmi >=18.5 and bmi <24.0:\n", + " bmi_zt = '体重正常'\n", + " elif bmi >=24.0 and bmi <28.0:\n", + " bmi_zt = '体重超重'\n", + " else:\n", + " bmi_zt = '体重肥胖'\n", + " dict2['bmi_zt'] = bmi_zt\n", + " dict2['waist'] = item['data']['waist']\n", + " dict2['hip'] = item['data']['hip']\n", + " whr = dict2['waist']/dict2['hip']\n", + " if item['data']['gender'] =='male' and whr > 0.9:\n", + " whr_zt = '超标'\n", + " elif item['data']['gender'] =='female' and whr > 0.85:\n", + " whr_zt = '超标'\n", + " else:\n", + " whr_zt = '正常'\n", + " dict2['whr'] = whr\n", + " dict2['whr_zt'] = whr_zt\n", + " if 'sport_type' in item['data'].keys(): \n", + " dict2['sport_type'] = ','.join(item['data']['sport_type']).replace('other','其他')\n", + " dict2['sport_duration'] = item['data']['sport_duration']\n", + " dict2['recipe'] = item['data']['recipe']\n", + " if 'last_sport' in item['data'].keys(): \n", + " dict2['last_sport'] = item['data']['last_sport']\n", + " if 'last_sport_time' in item['data'].keys():\n", + " dict2['last_sport_time'] = item['data']['last_sport_time']\n", + " if 'last_sport-Comment' in item['data'].keys():\n", + " dict2['last_sport-Comment'] = item['data']['last_sport-Comment']\n", + " dict2['last_recipe'] = item['data']['last_recipe']\n", + " if 'last_recipe-Comment' in item['data'].keys(): \n", + " dict2['last_recipe-Comment'] = item['data']['last_recipe-Comment']\n", + " if 'last_lose' in item['data'].keys(): \n", + " dict2['last_lose'] = item['data']['last_lose']\n", + " if 'last_lose_weight' in item['data'].keys():\n", + " dict2['last_lose_weight'] = item['data']['last_lose_weight']\n", + " if 'last_lose-Comment' in item['data'].keys(): \n", + " dict2['last_lose-Comment'] = item['data']['last_lose-Comment']\n", + " if code in person.keys():\n", + " person[code][rq] = dict2\n", + "filename = 'data/宁夏能化干预人员问卷情况.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print(len(person),'ok')\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "7805ebad-fe9d-4bc2-a537-c665fc831332", + "metadata": {}, + "source": [ + "## 问卷信息汇总导出" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "633c35d3-61f0-4a9d-9982-441e4c1291b9", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T09:35:16.409939Z", + "iopub.status.busy": "2025-11-17T09:35:16.409246Z", + "iopub.status.idle": "2025-11-17T09:35:16.664860Z", + "shell.execute_reply": "2025-11-17T09:35:16.664302Z", + "shell.execute_reply.started": "2025-11-17T09:35:16.409918Z" } }, "outputs": [], @@ -1179,38 +1446,78 @@ "import json\n", "import openpyxl\n", "\n", - "\n", - "title = ['员工编号','姓名','性别','部门','手机号码']\n", - "\n", - "filename = 'data/survey_宁夏能化干预人员.json'\n", + "filename = 'data/宁夏能化干预人员问卷情况.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", - "\n", - "filename = 'data/宁夏能化干预人员.json'\n", - "with open(filename,'r') as fl:\n", - " dict2 = json.load(fl)\n", + "list1 = ['name','sex','birth','unit']\n", + "xm = ['height','weight','next_weight','bmi','bmi_zt','waist', 'hip','whr','whr_zt' ]\n", + "data2 = []\n", + "for k,v in dict1.items():\n", + " list2 = []\n", " \n", - "list1 = []\n", - "for k, v in dict2.items():\n", - " \n", - " if str(k) in dict1.keys():\n", - " list2 = []\n", - " list2 = [k,v['name'],v['sex'],v['unit'],dict1[k]['phone']] \n", - " list1.append(list2)\n", - "filename = 'data/宁夏能化干预人员参加问卷人员(20251010).xlsx'\n", + " for k1,v1 in v.items():\n", + " #list2 = []\n", + " if k1 not in list1:\n", + " list2.append(k1)\n", + " list2.sort()\n", + " \n", + " for rq in list2:\n", + " for k1, v1 in v[rq].items():\n", + " data1 = []\n", + " data1.append(rq)\n", + " data1.append(k)\n", + " data1.append(v['unit'])\n", + " data1.append(v['name'])\n", + " data1.append(v['sex'])\n", + " data1.append(v['sex'])\n", + " for item in xm:\n", + " data1.append(v[rq][item])\n", + " if 'sport_type' in v[rq].keys():\n", + " data1.append(v[rq]['sport_type'])\n", + " else:\n", + " data1.append('')\n", + " if 'sport_type' in v[rq].keys():\n", + " data1.append(v[rq]['sport_type'])\n", + " else:\n", + " data1.append('')\n", + " \n", + " if 'sport_duration' in v[rq].keys():\n", + " data1.append(v[rq]['sport_duration'])\n", + " else:\n", + " data1.append('')\n", + " if v[rq]['recipe']=='free':\n", + " data1.append('自行控制')\n", + " else:\n", + " data1.append('减脂餐')\n", + " if v[rq]['last_sport']=='是':\n", + " data1.append('运动时长:'+str(v[rq]['last_sport_time'])+'分钟')\n", + " else:\n", + " data1.append('未运动,'+v[rq]['last_sport-Comment'])\n", + " if v[rq]['last_recipe']=='是':\n", + " data1.append('是')\n", + " else:\n", + " data1.append('否。'+v[rq]['last_recipe-Comment'])\n", + " if v[rq]['last_lose']=='是':\n", + " data1.append('是,减重'+str(v[rq]['last_lose_weight'])+'公斤。')\n", + " elif 'last_lose-Comment' in v[rq].keys():\n", + " data1.append('否。'+v[rq]['last_lose-Comment'])\n", + " else:\n", + " data1.append('否。')\n", + " data2.append(data1)\n", + " \n", + "filename = 'data/宁夏能化干预人员问卷信息(20251114).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", - "sheet.append(title)\n", - "for row in list1:\n", + "for row in data2:\n", " sheet.append(row)\n", " \n", - "wb.save(filename)" + "wb.save(filename) " ] }, { "cell_type": "code", "execution_count": null, - "id": "f32288ee-167c-4e2a-9679-5d927db34950", + "id": "c19f04a8-64a4-4660-8359-7780de4a5227", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/新疆油田采油工艺研究院.ipynb b/体测单位/新疆油田采油工艺研究院.ipynb index 3d83369..1149c51 100644 --- a/体测单位/新疆油田采油工艺研究院.ipynb +++ b/体测单位/新疆油田采油工艺研究院.ipynb @@ -82,15 +82,15 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 1, "id": "cac3736a-56da-403b-9e62-5caaf989a6d4", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T05:28:56.646944Z", - "iopub.status.busy": "2025-11-14T05:28:56.646299Z", - "iopub.status.idle": "2025-11-14T05:28:58.033233Z", - "shell.execute_reply": "2025-11-14T05:28:58.032644Z", - "shell.execute_reply.started": "2025-11-14T05:28:56.646884Z" + "iopub.execute_input": "2025-11-17T14:38:09.521433Z", + "iopub.status.busy": "2025-11-17T14:38:09.520770Z", + "iopub.status.idle": "2025-11-17T14:38:11.569824Z", + "shell.execute_reply": "2025-11-17T14:38:11.569224Z", + "shell.execute_reply.started": "2025-11-17T14:38:09.521373Z" } }, "outputs": [ @@ -98,7 +98,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "72 ok\n" + "82 ok\n" ] } ], @@ -195,15 +195,15 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 2, "id": "925f7152-b365-4df8-8d98-73569aef68f8", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T05:30:21.558180Z", - "iopub.status.busy": "2025-11-14T05:30:21.557445Z", - "iopub.status.idle": "2025-11-14T05:30:21.572875Z", - "shell.execute_reply": "2025-11-14T05:30:21.571867Z", - "shell.execute_reply.started": "2025-11-14T05:30:21.558103Z" + "iopub.execute_input": "2025-11-17T14:38:34.526723Z", + "iopub.status.busy": "2025-11-17T14:38:34.525935Z", + "iopub.status.idle": "2025-11-17T14:38:34.542026Z", + "shell.execute_reply": "2025-11-17T14:38:34.541025Z", + "shell.execute_reply.started": "2025-11-17T14:38:34.526661Z" } }, "outputs": [ @@ -211,7 +211,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "35\n" + "40\n" ] } ], @@ -225,7 +225,7 @@ "filename = 'data/新疆油田采油工艺研究院-202511.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", - "filename = 'data/marks_20251114-1.csv'\n", + "filename = 'data/marks_20251117-3.csv'\n", "re_ta = My.get_result(filename,dict1)\n", "\n", "\n", @@ -287,15 +287,15 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 3, "id": "0e71f6b8-e17e-49f8-a577-7a2eb6f5e994", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T05:30:31.220354Z", - "iopub.status.busy": "2025-11-14T05:30:31.219652Z", - "iopub.status.idle": "2025-11-14T05:30:31.233956Z", - "shell.execute_reply": "2025-11-14T05:30:31.232979Z", - "shell.execute_reply.started": "2025-11-14T05:30:31.220290Z" + "iopub.execute_input": "2025-11-17T14:38:58.670424Z", + "iopub.status.busy": "2025-11-17T14:38:58.669763Z", + "iopub.status.idle": "2025-11-17T14:38:58.683725Z", + "shell.execute_reply": "2025-11-17T14:38:58.682758Z", + "shell.execute_reply.started": "2025-11-17T14:38:58.670352Z" } }, "outputs": [ @@ -664,15 +664,15 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 4, "id": "83872322-129c-410d-a9a3-ef6f4fe8dcde", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T05:31:42.228026Z", - "iopub.status.busy": "2025-11-14T05:31:42.227253Z", - "iopub.status.idle": "2025-11-14T05:31:42.243026Z", - "shell.execute_reply": "2025-11-14T05:31:42.242577Z", - "shell.execute_reply.started": "2025-11-14T05:31:42.227955Z" + "iopub.execute_input": "2025-11-17T14:41:08.300902Z", + "iopub.status.busy": "2025-11-17T14:41:08.300597Z", + "iopub.status.idle": "2025-11-17T14:41:08.314893Z", + "shell.execute_reply": "2025-11-17T14:41:08.314440Z", + "shell.execute_reply.started": "2025-11-17T14:41:08.300875Z" } }, "outputs": [ @@ -680,7 +680,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "35\n" + "40\n" ] } ], @@ -692,7 +692,7 @@ "from datetime import date\n", "\n", "list1 = []\n", - "filename = 'data/sql_20251114.csv'\n", + "filename = 'data/sql_20251117-1.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -823,15 +823,15 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 5, "id": "694ad38e-755e-4885-94a9-c157ddc96564", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T05:32:21.311002Z", - "iopub.status.busy": "2025-11-14T05:32:21.310252Z", - "iopub.status.idle": "2025-11-14T05:32:41.401453Z", - "shell.execute_reply": "2025-11-14T05:32:41.400670Z", - "shell.execute_reply.started": "2025-11-14T05:32:21.310932Z" + "iopub.execute_input": "2025-11-17T14:42:09.546636Z", + "iopub.status.busy": "2025-11-17T14:42:09.546054Z", + "iopub.status.idle": "2025-11-17T14:42:32.426068Z", + "shell.execute_reply": "2025-11-17T14:42:32.424869Z", + "shell.execute_reply.started": "2025-11-17T14:42:09.546580Z" } }, "outputs": [ @@ -839,7 +839,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "35\n" + "40\n" ] } ], diff --git a/体测单位/沧州炼化.ipynb b/体测单位/沧州炼化.ipynb index 45936c6..67ef1db 100644 --- a/体测单位/沧州炼化.ipynb +++ b/体测单位/沧州炼化.ipynb @@ -10,15 +10,15 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 8, "id": "270e8c57-36d3-476c-8c50-4d8bc38a918a", "metadata": { "execution": { - "iopub.execute_input": "2025-11-13T08:43:12.873509Z", - "iopub.status.busy": "2025-11-13T08:43:12.873249Z", - "iopub.status.idle": "2025-11-13T08:43:13.076138Z", - "shell.execute_reply": "2025-11-13T08:43:13.075593Z", - "shell.execute_reply.started": "2025-11-13T08:43:12.873486Z" + "iopub.execute_input": "2025-11-17T01:38:45.210547Z", + "iopub.status.busy": "2025-11-17T01:38:45.209877Z", + "iopub.status.idle": "2025-11-17T01:38:45.422897Z", + "shell.execute_reply": "2025-11-17T01:38:45.422462Z", + "shell.execute_reply.started": "2025-11-17T01:38:45.210491Z" } }, "outputs": [ @@ -26,7 +26,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1301 ok\n" + "1295 ok\n" ] } ], @@ -41,8 +41,8 @@ "person = {}\n", "\n", "for n in range(2, sheet.max_row+1):\n", - " code = sheet.cell(n, 2).value\n", - " person.setdefault(code, {})\n", + " code = int(sheet.cell(n, 2).value)\n", + " person.setdefault(str(code), {})\n", " dict1 = {}\n", " dict1['name'] = sheet.cell(n, 4).value\n", " dict1['sex'] = sheet.cell(n, 5).value\n", @@ -50,7 +50,7 @@ " dict1['unit'] = sheet.cell(n, 3).value\n", " if sheet.cell(n, 7).value is not None:\n", " dict1['phone'] = str(sheet.cell(n, 7).value)\n", - " person[code] = dict1\n", + " person[str(code)] = dict1\n", "filename = 'data/沧州炼化人员.json'\n", "with open(filename, 'w') as fl:\n", " json.dump(person, fl, ensure_ascii=False)\n", @@ -59,15 +59,48 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, + "id": "6c5f1858-e01e-4cf0-85b1-2019a37c3b37", + "metadata": {}, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "from datetime import date\n", + "\n", + "wb = openpyxl.load_workbook('data/沧州炼化人员.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = sheet.cell(n, 2).value\n", + " person.setdefault(str(code), {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 4).value\n", + " dict1['sex'] = sheet.cell(n, 5).value\n", + " dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0] \n", + " dict1['unit'] = sheet.cell(n, 3).value\n", + " if sheet.cell(n, 7).value is not None:\n", + " dict1['phone'] = str(sheet.cell(n, 7).value)\n", + " person[str(code)] = dict1\n", + "filename = 'data/沧州炼化人员.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print(len(person),'ok')" + ] + }, + { + "cell_type": "code", + "execution_count": 6, "id": "829d9460-a14e-4689-a7c4-d00bbd8c2e32", "metadata": { "execution": { - "iopub.execute_input": "2025-11-07T08:37:47.436725Z", - "iopub.status.busy": "2025-11-07T08:37:47.435955Z", - "iopub.status.idle": "2025-11-07T08:37:47.582958Z", - "shell.execute_reply": "2025-11-07T08:37:47.582377Z", - "shell.execute_reply.started": "2025-11-07T08:37:47.436655Z" + "iopub.execute_input": "2025-11-16T05:42:54.899442Z", + "iopub.status.busy": "2025-11-16T05:42:54.898753Z", + "iopub.status.idle": "2025-11-16T05:42:55.048242Z", + "shell.execute_reply": "2025-11-16T05:42:55.047690Z", + "shell.execute_reply.started": "2025-11-16T05:42:54.899375Z" } }, "outputs": [ @@ -123,26 +156,10 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "7b6c8cb8-50ab-4b59-ac9a-6afb3db61476", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-09T05:35:48.182110Z", - "iopub.status.busy": "2025-11-09T05:35:48.181365Z", - "iopub.status.idle": "2025-11-09T05:35:48.197106Z", - "shell.execute_reply": "2025-11-09T05:35:48.196434Z", - "shell.execute_reply.started": "2025-11-09T05:35:48.182041Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1297 ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "\n", @@ -175,15 +192,15 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 12, "id": "ccb2fe86-c588-4373-85df-37adda55c694", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T04:02:24.632013Z", - "iopub.status.busy": "2025-11-14T04:02:24.631372Z", - "iopub.status.idle": "2025-11-14T04:02:24.726424Z", - "shell.execute_reply": "2025-11-14T04:02:24.725880Z", - "shell.execute_reply.started": "2025-11-14T04:02:24.631959Z" + "iopub.execute_input": "2025-11-17T01:44:40.400061Z", + "iopub.status.busy": "2025-11-17T01:44:40.399563Z", + "iopub.status.idle": "2025-11-17T01:44:40.476607Z", + "shell.execute_reply": "2025-11-17T01:44:40.476073Z", + "shell.execute_reply.started": "2025-11-17T01:44:40.400012Z" } }, "outputs": [ @@ -191,7 +208,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1175\n" + "1225\n" ] } ], @@ -205,7 +222,7 @@ "filename = 'data/沧州炼化人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", - "filename = 'data/marks_20251114.csv'\n", + "filename = 'data/marks_20251117-1.csv'\n", "re_ta = My.get_result(filename,dict1)\n", "\n", "\n", @@ -215,6 +232,67 @@ "print(len(re_ta))" ] }, + { + "cell_type": "markdown", + "id": "0748c41c-bb8e-49e4-a88d-814928e9b956", + "metadata": {}, + "source": [ + "## 导入手工数据" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "9054c821-24a6-4ec3-82b4-1af2fbfd5090", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T01:45:32.893349Z", + "iopub.status.busy": "2025-11-17T01:45:32.892548Z", + "iopub.status.idle": "2025-11-17T01:45:32.978502Z", + "shell.execute_reply": "2025-11-17T01:45:32.977928Z", + "shell.execute_reply.started": "2025-11-17T01:45:32.893261Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "122\n", + "123\n", + "1225\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "from datetime import date\n", + "\n", + "wb = openpyxl.load_workbook('data/沧州俯卧撑手工成绩.xlsx')\n", + "sheet = wb.active\n", + "filename = 'data/result_沧州炼化.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl) \n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = str(sheet.cell(n, 1).value)\n", + " item = 'pushup'\n", + " mark = str(sheet.cell(n, 2).value)\n", + " rq = str(sheet.cell(n, 3).value)\n", + " if code in dict2.keys():\n", + " dict2[code]['rq'] = rq\n", + " dict2[code].setdefault(item,{})\n", + " dict2[code][item]['成绩'] = mark\n", + " else:\n", + " print(code)\n", + " \n", + "filename = 'data/result_沧州炼化-1.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict2, fl, ensure_ascii=False) \n", + "print(len(re_ta)) " + ] + }, { "cell_type": "markdown", "id": "a446935a-db14-41d5-9420-d1a5ddd0e548", @@ -225,17 +303,9 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "503c30bb-c537-43f6-b3c7-a1eeff4c313f", - "metadata": { - "execution": { - "iopub.execute_input": "2025-11-14T04:02:34.921004Z", - "iopub.status.busy": "2025-11-14T04:02:34.920268Z", - "iopub.status.idle": "2025-11-14T04:02:34.953734Z", - "shell.execute_reply": "2025-11-14T04:02:34.953246Z", - "shell.execute_reply.started": "2025-11-14T04:02:34.920949Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -291,15 +361,15 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 7, "id": "57de7845-76f2-4cdc-88a9-eb869acb28a5", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T04:02:42.621335Z", - "iopub.status.busy": "2025-11-14T04:02:42.620669Z", - "iopub.status.idle": "2025-11-14T04:02:42.655530Z", - "shell.execute_reply": "2025-11-14T04:02:42.654876Z", - "shell.execute_reply.started": "2025-11-14T04:02:42.621305Z" + "iopub.execute_input": "2025-11-17T01:05:50.422689Z", + "iopub.status.busy": "2025-11-17T01:05:50.421236Z", + "iopub.status.idle": "2025-11-17T01:05:50.450916Z", + "shell.execute_reply": "2025-11-17T01:05:50.450368Z", + "shell.execute_reply.started": "2025-11-17T01:05:50.422616Z" } }, "outputs": [], @@ -344,15 +414,15 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 14, "id": "c2ca861f-54ca-4312-bf24-20dbc2f3f2e6", "metadata": { "execution": { - "iopub.execute_input": "2025-11-14T04:11:04.381187Z", - "iopub.status.busy": "2025-11-14T04:11:04.380519Z", - "iopub.status.idle": "2025-11-14T04:11:04.413211Z", - "shell.execute_reply": "2025-11-14T04:11:04.412250Z", - "shell.execute_reply.started": "2025-11-14T04:11:04.381125Z" + "iopub.execute_input": "2025-11-17T01:46:18.717093Z", + "iopub.status.busy": "2025-11-17T01:46:18.716407Z", + "iopub.status.idle": "2025-11-17T01:46:18.735809Z", + "shell.execute_reply": "2025-11-17T01:46:18.735127Z", + "shell.execute_reply.started": "2025-11-17T01:46:18.717026Z" } }, "outputs": [ @@ -361,17 +431,16 @@ "output_type": "stream", "text": [ "1553238 齐金永 公用工程部 13231725301 2\n", - "1553763 王鑫 应急救援中心 15632778668 2\n", "1552999 赵崇胜 储运部 13722775060 2\n", - "01553836 王成柱 炼油一部 13111760190 1\n", - "01553839 徐振柱 炼油一部 17772650508 1\n" + "1553836 王成柱 炼油一部 13111760190 1\n", + "1553839 徐振柱 炼油一部 17772650508 1\n" ] } ], "source": [ "import json\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", "xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", @@ -384,10 +453,87 @@ " print(k,v['name'],v['unit'],v['phone'],len(list1))" ] }, + { + "cell_type": "markdown", + "id": "57a9f492-6971-4572-9e9e-8086a49dc6ce", + "metadata": {}, + "source": [ + "## 导出测试人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "e014e1f8-e13d-4bb1-a64a-606a3e44a876", + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-17T01:46:49.086947Z", + "iopub.status.busy": "2025-11-17T01:46:49.086254Z", + "iopub.status.idle": "2025-11-17T01:46:49.440499Z", + "shell.execute_reply": "2025-11-17T01:46:49.439939Z", + "shell.execute_reply.started": "2025-11-17T01:46:49.086882Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", + "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "\n", + "filename = 'data/result_沧州炼化-1.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/沧州炼化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + " \n", + "list1 = []\n", + "for k, v in dict1.items():\n", + " 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", + " list2.append(dict2[k]['birth'])\n", + " if 'phone' in v.keys():\n", + " list2.append(dict2[k]['phone'])\n", + " else:\n", + " list2.append('')\n", + " \n", + " if 'bmi' in v.keys():\n", + " height = v['bmi']['成绩'].split(',')[0]\n", + " weight = v['bmi']['成绩'].split(',')[1]\n", + " list2.append(height)\n", + " list2.append(weight)\n", + " else:\n", + " list2.append('')\n", + " list2.append('')\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", + " \n", + " list1.append(list2)\n", + "filename = 'data/沧州炼化体测情况表(2025年)-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": "code", "execution_count": null, - "id": "e6dea90d-2b60-4ff5-9598-a49f41b6ab24", + "id": "4042e92b-1d63-489a-9652-3f9f48453db8", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/镇海.ipynb b/体测单位/镇海.ipynb index 478c4b6..72d3181 100644 --- a/体测单位/镇海.ipynb +++ b/体测单位/镇海.ipynb @@ -2537,10 +2537,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 96, "id": "9663b933-57f4-486c-80e6-f9d513bbe6a8", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-11-14T07:35:38.747096Z", + "iopub.status.busy": "2025-11-14T07:35:38.746559Z", + "iopub.status.idle": "2025-11-14T07:35:38.947152Z", + "shell.execute_reply": "2025-11-14T07:35:38.945993Z", + "shell.execute_reply.started": "2025-11-14T07:35:38.747068Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+8613793180751 send success\n" + ] + } + ], "source": [ "from tencentcloud.common import credential\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", @@ -2553,7 +2569,7 @@ "\n", "\n", "\n", - "dw_jc = \"中国石化镇海炼化公司\"\n", + "dw_jc = \"镇海炼化体测用户\"\n", "filename = 'data/镇海短信码2025.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2575,7 +2591,7 @@ " client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n", " req = models.SendSmsRequest()\n", " req.SmsSdkAppId = \"1400140089\"\n", - " req.SignName = \"坤铭教育\"\n", + " req.SignName = \"北京坤铭教育\"\n", " req.TemplateId = \"1875765\" \n", " req.TemplateParamSet = [dw_jc,yzm]\n", " req.PhoneNumberSet = [phone]\n", diff --git a/高考数据导入.ipynb b/高考数据导入.ipynb index a35db2a..73f1cb5 100644 --- a/高考数据导入.ipynb +++ b/高考数据导入.ipynb @@ -2459,7 +2459,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -2473,7 +2473,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.12.3" }, "toc-autonumbering": true, "toc-showcode": false,