From c0db3d691eca687045452cf24bcb0b70b3a558d6 Mon Sep 17 00:00:00 2001 From: 512song Date: Sat, 26 Jul 2025 08:12:26 +0800 Subject: [PATCH] 20250726 --- 体测单位/新疆油田采油工艺研究院.ipynb | 241 ++++++++++++++++++++------ 1 file changed, 188 insertions(+), 53 deletions(-) diff --git a/体测单位/新疆油田采油工艺研究院.ipynb b/体测单位/新疆油田采油工艺研究院.ipynb index 25432c8..2cc8466 100644 --- a/体测单位/新疆油田采油工艺研究院.ipynb +++ b/体测单位/新疆油田采油工艺研究院.ipynb @@ -10,15 +10,15 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 30, "id": "bbba6efc-73cd-4db6-bae7-014724fee731", "metadata": { "execution": { - "iopub.execute_input": "2025-07-15T04:17:52.450721Z", - "iopub.status.busy": "2025-07-15T04:17:52.449970Z", - "iopub.status.idle": "2025-07-15T04:17:52.467224Z", - "shell.execute_reply": "2025-07-15T04:17:52.466044Z", - "shell.execute_reply.started": "2025-07-15T04:17:52.450647Z" + "iopub.execute_input": "2025-07-26T00:04:43.702270Z", + "iopub.status.busy": "2025-07-26T00:04:43.701709Z", + "iopub.status.idle": "2025-07-26T00:04:43.722751Z", + "shell.execute_reply": "2025-07-26T00:04:43.722227Z", + "shell.execute_reply.started": "2025-07-26T00:04:43.702216Z" }, "tags": [] }, @@ -27,7 +27,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "3 ok\n" + "71 ok\n" ] } ], @@ -52,7 +52,7 @@ " else:\n", " dict1['unit'] = ''\n", " dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0]\n", - " #dict1['phone'] = sheet.cell(n, 12).value \n", + " dict1['phone'] = sheet.cell(n, 6).value \n", " person[code] = dict1\n", "filename = 'data/新疆油田采油工艺研究院.json'\n", "with open(filename, 'w') as fl:\n", @@ -70,15 +70,15 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 31, "id": "970e171e-1360-448f-a28c-520ccb8f314a", "metadata": { "execution": { - "iopub.execute_input": "2025-07-15T04:17:54.693914Z", - "iopub.status.busy": "2025-07-15T04:17:54.692725Z", - "iopub.status.idle": "2025-07-15T04:17:54.703956Z", - "shell.execute_reply": "2025-07-15T04:17:54.702901Z", - "shell.execute_reply.started": "2025-07-15T04:17:54.693844Z" + "iopub.execute_input": "2025-07-26T00:04:50.800932Z", + "iopub.status.busy": "2025-07-26T00:04:50.800184Z", + "iopub.status.idle": "2025-07-26T00:04:50.821256Z", + "shell.execute_reply": "2025-07-26T00:04:50.820361Z", + "shell.execute_reply.started": "2025-07-26T00:04:50.800866Z" }, "tags": [] }, @@ -87,7 +87,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1\n" + "71\n" ] } ], @@ -101,7 +101,7 @@ "filename = 'data/新疆油田采油工艺研究院.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", - "filename = 'data/marks_20250715.csv'\n", + "filename = 'data/marks_20250726.csv'\n", "re_ta = My.get_result(filename,dict1)\n", "\n", "\n", @@ -121,15 +121,15 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 32, "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", "metadata": { "execution": { - "iopub.execute_input": "2025-07-15T04:17:57.064201Z", - "iopub.status.busy": "2025-07-15T04:17:57.063428Z", - "iopub.status.idle": "2025-07-15T04:17:57.077018Z", - "shell.execute_reply": "2025-07-15T04:17:57.075783Z", - "shell.execute_reply.started": "2025-07-15T04:17:57.064131Z" + "iopub.execute_input": "2025-07-26T00:04:58.023332Z", + "iopub.status.busy": "2025-07-26T00:04:58.022777Z", + "iopub.status.idle": "2025-07-26T00:04:58.041468Z", + "shell.execute_reply": "2025-07-26T00:04:58.040883Z", + "shell.execute_reply.started": "2025-07-26T00:04:58.023283Z" } }, "outputs": [ @@ -187,9 +187,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", "metadata": { + "execution": { + "iopub.execute_input": "2025-07-26T00:05:04.440594Z", + "iopub.status.busy": "2025-07-26T00:05:04.439940Z", + "iopub.status.idle": "2025-07-26T00:05:04.474727Z", + "shell.execute_reply": "2025-07-26T00:05:04.474128Z", + "shell.execute_reply.started": "2025-07-26T00:05:04.440537Z" + }, "tags": [] }, "outputs": [], @@ -200,11 +207,11 @@ "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", @@ -232,7 +239,7 @@ " list2.append('')\n", " \n", " list1.append(list2)\n", - "filename = 'data/南京化工测试情况明细表(截至20250630).xlsx'\n", + "filename = 'data/新疆油田采油工艺研究院测试情况明细表(截至20250725).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -252,9 +259,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "def3f47a-24ef-4815-b63b-2a16b79b4c15", "metadata": { + "execution": { + "iopub.execute_input": "2025-07-25T13:18:57.344342Z", + "iopub.status.busy": "2025-07-25T13:18:57.344014Z", + "iopub.status.idle": "2025-07-25T13:18:57.363693Z", + "shell.execute_reply": "2025-07-25T13:18:57.363137Z", + "shell.execute_reply.started": "2025-07-25T13:18:57.344308Z" + }, "tags": [] }, "outputs": [], @@ -266,7 +280,7 @@ "from datetime import date\n", "\n", "\n", - "filename = 'data/南京化工人员.json'\n", + "filename = 'data/新疆油田采油工艺研究院.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -275,7 +289,7 @@ "for k,v in dict1.items():\n", " phone1.add(v['phone'])\n", "list1 = []\n", - "filename = 'data/survey_records_20250701.csv'\n", + "filename = 'data/survey_records_20250725.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -295,7 +309,7 @@ " list3.append(v['unit'])\n", " list3.append(code)\n", " list2.append(list3)\n", - "filename = 'data/南化问卷情况表.xlsx'\n", + "filename = 'data/新疆油田采油工艺研究院问卷情况表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "#sheet.append(title)\n", @@ -307,15 +321,15 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 29, "id": "9cb0172e-5f6c-4b47-8431-83dc5cc4601c", "metadata": { "execution": { - "iopub.execute_input": "2025-07-01T06:26:28.751949Z", - "iopub.status.busy": "2025-07-01T06:26:28.751236Z", - "iopub.status.idle": "2025-07-01T06:26:28.761510Z", - "shell.execute_reply": "2025-07-01T06:26:28.760394Z", - "shell.execute_reply.started": "2025-07-01T06:26:28.751881Z" + "iopub.execute_input": "2025-07-25T13:55:37.064250Z", + "iopub.status.busy": "2025-07-25T13:55:37.063559Z", + "iopub.status.idle": "2025-07-25T13:55:37.077165Z", + "shell.execute_reply": "2025-07-25T13:55:37.076333Z", + "shell.execute_reply.started": "2025-07-25T13:55:37.064186Z" } }, "outputs": [ @@ -323,11 +337,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "13718042132\n", - "17625911723\n", - "13851588009\n", - "15077893706\n", - "13705162311\n" + "18610346996 杨霖坤\n", + "13121563838 高洁\n", + "15349912576 韩晓强\n", + "13899592125 粟刘\n", + "15509909309 关子越\n", + "13579524663 王金龙\n", + "13121073480 罗腾\n", + "13899586957 袁鹏\n", + "13999311222 闫鹏\n", + "15609905966 李阳\n", + "18909908078 吕长智\n", + "18040802080 王立坤\n", + "17709901414 侯丽娜\n", + "17399375199 史瑶\n", + "18699008113 荣玉健\n" ] } ], @@ -339,7 +363,7 @@ "from datetime import date\n", "\n", "\n", - "filename = 'data/南京化工人员.json'\n", + "filename = 'data/新疆油田采油工艺研究院.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -348,7 +372,7 @@ "for k,v in dict1.items():\n", " phone1.add(v['phone'])\n", "list1 = []\n", - "filename = 'data/survey_records_20250701.csv'\n", + "filename = 'data/survey_records_20250725.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -356,9 +380,120 @@ " list1.append(line)\n", "\n", "for item in list1:\n", - " code = int(item[3]) \n", + " code = int(item[3]) \n", + " content = json.loads(item[4])\n", + " name = item[4]\n", " if code not in phone1: \n", - " print(code)" + " print(code,content['name'])" + ] + }, + { + "cell_type": "markdown", + "id": "2528bc3c-bf40-4459-9c33-b795600a6cb1", + "metadata": {}, + "source": [ + "## 导入问卷信息" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "2fa85089-8dc7-42f7-9ff3-c37cbe0899ed", + "metadata": { + "execution": { + "iopub.execute_input": "2025-07-26T00:06:01.368354Z", + "iopub.status.busy": "2025-07-26T00:06:01.367653Z", + "iopub.status.idle": "2025-07-26T00:06:01.401313Z", + "shell.execute_reply": "2025-07-26T00:06:01.400714Z", + "shell.execute_reply.started": "2025-07-26T00:06:01.368289Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "54\n" + ] + } + ], + "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_20250725.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", + " \n", + " if int(item[3]) in phone.keys():\n", + " code = phone[int(item[3])]\n", + " tcm = []\n", + " spine = []\n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " for i in range(0,26):\n", + " spine.append(0)\n", + " \n", + " content = json.loads(item[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'] = item[5].replace('/','-').split(' ')[0]\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", + " if 'spine' in k:\n", + " i = int(k[5:])\n", + " spine[i-1] = int(v)\n", + " \n", + " if 'tcm' in item[4]:\n", + " \n", + " dict1[code]['tcm'] = tcm\n", + " if 'spine' in item[4]:\n", + " for ii in range(25,23,-1):\n", + " spine[ii] = spine[ii-1]\n", + " spine[22] = 0 \n", + " dict1[code]['spine'] = spine\n", + " birth = date.fromisoformat(dict3[code]['birth'].replace('/','-'))\n", + " rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\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_新疆油田采油工艺研究院-1.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print(nn)" ] }, { @@ -371,15 +506,15 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 35, "id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4", "metadata": { "execution": { - "iopub.execute_input": "2025-07-15T04:18:02.549898Z", - "iopub.status.busy": "2025-07-15T04:18:02.549192Z", - "iopub.status.idle": "2025-07-15T04:18:03.406607Z", - "shell.execute_reply": "2025-07-15T04:18:03.405390Z", - "shell.execute_reply.started": "2025-07-15T04:18:02.549834Z" + "iopub.execute_input": "2025-07-26T00:06:07.337672Z", + "iopub.status.busy": "2025-07-26T00:06:07.336904Z", + "iopub.status.idle": "2025-07-26T00:06:50.437010Z", + "shell.execute_reply": "2025-07-26T00:06:50.436483Z", + "shell.execute_reply.started": "2025-07-26T00:06:07.337571Z" } }, "outputs": [ @@ -387,7 +522,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "1\n" + "71\n" ] } ], @@ -400,7 +535,7 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\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", "list1 = []\n",