This commit is contained in:
512song committed 2025-08-13 20:36:47 +08:00
1 parent c0db3d691e
commit dcbfb8f1eb
5 files changed
+592 -384

No files matched your search

@@ -10,27 +10,12 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"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": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"71 ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -60,6 +45,41 @@
"print(len(person),'ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "de3144e7-544a-4430-bf69-3d20479d50c9",
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/新疆油田采油工艺研究院-1.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, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n, 3).value\n",
" if sheet.cell(n,4).value is not None:\n",
" dict1['unit'] = sheet.cell(n, 4).value\n",
" else:\n",
" dict1['unit'] = ''\n",
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0]\n",
" dict1['phone'] = sheet.cell(n, 6).value \n",
" person[code] = dict1\n",
"filename = 'data/新疆油田采油工艺研究院-1.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": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f",
@@ -70,27 +90,38 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": null,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"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": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"71\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
"import csv\n",
"from datetime import date\n",
"import my_module as My\n",
"\n",
"filename = 'data/新疆油田采油工艺研究院-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20250813.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"\n",
"filename = 'data/result_新疆油田采油工艺研究院1.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d1270459-e27a-46cc-b436-ec7e82b47be2",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
@@ -101,7 +132,7 @@
"filename = 'data/新疆油田采油工艺研究院.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20250726.csv'\n",
"filename = 'data/marks_20250727.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"\n",
@@ -121,26 +152,10 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": null,
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
"metadata": {
"execution": {
"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": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -148,7 +163,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",
@@ -171,7 +186,7 @@
" 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!') "
@@ -187,15 +202,15 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 7,
"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"
"iopub.execute_input": "2025-08-13T02:46:29.876079Z",
"iopub.status.busy": "2025-08-13T02:46:29.875587Z",
"iopub.status.idle": "2025-08-13T02:46:29.904595Z",
"shell.execute_reply": "2025-08-13T02:46:29.904071Z",
"shell.execute_reply.started": "2025-08-13T02:46:29.876014Z"
},
"tags": []
},
@@ -207,11 +222,11 @@
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\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",
"filename = 'data/新疆油田采油工艺研究院.json'\n",
"filename = 'data/新疆油田采油工艺研究院-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
@@ -239,7 +254,59 @@
" list2.append('')\n",
" \n",
" list1.append(list2)\n",
"filename = 'data/新疆油田采油工艺研究院测试情况明细表(截至20250725).xlsx'\n",
"filename = 'data/新疆油田采油工艺研究院测试情况明细表(第二批).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": "f44edca7-a1bd-4937-a290-bf80ea91dd5b",
"metadata": {},
"source": [
"## 导出未体测人员"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf6b900f-1fcc-49c8-9b03-7723f9ca2429",
"metadata": {},
"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_新疆油田采油工艺研究院.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",
"print(dict1.keys()) \n",
"list1 = []\n",
"for k, v in dict2.items():\n",
" \n",
" if k not in dict1.keys():\n",
" \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",
" \n",
" list1.append(list2)\n",
"print(list1)\n",
"filename = 'data/新疆油田采油工艺研究院未体测人员(截至20250725).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -259,16 +326,9 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"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": [],
@@ -321,40 +381,10 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": null,
"id": "9cb0172e-5f6c-4b47-8431-83dc5cc4601c",
"metadata": {
"execution": {
"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": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"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"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -397,26 +427,10 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"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"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -426,10 +440,10 @@
"\n",
"dict1 = {}\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",
"filename = 'data/新疆油田采油工艺研究院.json'\n",
"filename = 'data/新疆油田采油工艺研究院-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict3 = json.load(fl)\n",
"\n",
@@ -439,7 +453,7 @@
" phone[v['phone']] = k\n",
"\n",
"list1 = []\n",
"filename = 'data/survey_records_20250725.csv'\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",
@@ -489,7 +503,7 @@
" dict1[code]['month'] = int(days/365*12)\n",
" #print(phone[item[2]])\n",
" nn+=1\n",
"filename = 'data/result_新疆油田采油工艺研究院-1.json'\n",
"filename = 'data/result_新疆油田采油工艺研究院1-1.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
@@ -506,15 +520,15 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 6,
"id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4",
"metadata": {
"execution": {
"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"
"iopub.execute_input": "2025-08-13T02:43:03.163356Z",
"iopub.status.busy": "2025-08-13T02:43:03.162804Z",
"iopub.status.idle": "2025-08-13T02:43:17.799933Z",
"shell.execute_reply": "2025-08-13T02:43:17.799273Z",
"shell.execute_reply.started": "2025-08-13T02:43:03.163305Z"
}
},
"outputs": [
@@ -522,7 +536,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"71\n"
"24\n"
]
}
],
@@ -535,11 +549,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_新疆油田采油工艺研究院-1.json'\n",
"filename = 'data/result_新疆油田采油工艺研究院1-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./新疆油田采油工艺研究院/'\n",
"file_path ='./新疆油田采油工艺研究院1/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",