20251126
This commit is contained in:
1 parent
aff0303bc9
commit
d41474d9f1
6 files changed
+662
-1607
No files matched your search
+108
-1404
File diff suppressed because it is too large.
Load diff
+87
-23
@@ -2793,7 +2793,9 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "08bcbf58-4356-4f30-850f-0d0ff0e2528b",
|
"id": "08bcbf58-4356-4f30-850f-0d0ff0e2528b",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"# 第三次体测(2024年10月)"
|
"# 第三次体测(2024年10月)"
|
||||||
]
|
]
|
||||||
@@ -3511,6 +3513,67 @@
|
|||||||
"print(len(list1),'ok')"
|
"print(len(list1),'ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "4b7730ae-e5ca-4d4f-8abf-fd23e9138002",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 合并读卡系统文件"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "0bebc944-ffa0-4bc9-8ae5-5643fe1015dd",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-25T09:08:42.753636Z",
|
||||||
|
"iopub.status.busy": "2025-11-25T09:08:42.752981Z",
|
||||||
|
"iopub.status.idle": "2025-11-25T09:08:42.813419Z",
|
||||||
|
"shell.execute_reply": "2025-11-25T09:08:42.812811Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-25T09:08:42.753578Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"03603055 赵文远 电仪部-电气作业一区\n",
|
||||||
|
"03603051 李英豪 电仪部-电气作业一区\n",
|
||||||
|
"5060 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",
|
||||||
|
" unit = item['unit'].split('-')[0]\n",
|
||||||
|
" sub_unit = item['unit'].split('-')[1]\n",
|
||||||
|
" dict1.setdefault(code,{})\n",
|
||||||
|
" dict1[code]['name'] = item['name']\n",
|
||||||
|
" dict1[code]['sex'] = item['gender']\n",
|
||||||
|
" dict1[code]['unit'] = unit\n",
|
||||||
|
" dict1[code]['sub_unit'] = sub_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",
|
"cell_type": "markdown",
|
||||||
"id": "fd5cb794-6197-4204-a421-fd7a14aeab20",
|
"id": "fd5cb794-6197-4204-a421-fd7a14aeab20",
|
||||||
@@ -3521,15 +3584,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 25,
|
"execution_count": 2,
|
||||||
"id": "52de3ba0-f430-444b-87e9-1f13c3e2dcc2",
|
"id": "52de3ba0-f430-444b-87e9-1f13c3e2dcc2",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T13:09:49.032705Z",
|
"iopub.execute_input": "2025-11-25T09:12:56.872603Z",
|
||||||
"iopub.status.busy": "2025-11-21T13:09:49.032208Z",
|
"iopub.status.busy": "2025-11-25T09:12:56.871910Z",
|
||||||
"iopub.status.idle": "2025-11-21T13:09:49.211933Z",
|
"iopub.status.idle": "2025-11-25T09:12:57.023721Z",
|
||||||
"shell.execute_reply": "2025-11-21T13:09:49.211382Z",
|
"shell.execute_reply": "2025-11-25T09:12:57.023114Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T13:09:49.032662Z"
|
"shell.execute_reply.started": "2025-11-25T09:12:56.872536Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -3537,7 +3600,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"1898\n"
|
"2646\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -3551,7 +3614,7 @@
|
|||||||
"filename = 'data/天津石化人员2025.json'\n",
|
"filename = 'data/天津石化人员2025.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"filename = 'data/marks_20251121.csv'\n",
|
"filename = 'data/marks_20251125.csv'\n",
|
||||||
"re_ta = My.get_result(filename,dict1)\n",
|
"re_ta = My.get_result(filename,dict1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -3623,20 +3686,21 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 26,
|
"execution_count": 4,
|
||||||
"id": "fcb3c816-5260-4807-9536-b8203680ed1c",
|
"id": "fcb3c816-5260-4807-9536-b8203680ed1c",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T13:10:04.169431Z",
|
"iopub.execute_input": "2025-11-25T09:13:27.357951Z",
|
||||||
"iopub.status.busy": "2025-11-21T13:10:04.168764Z",
|
"iopub.status.busy": "2025-11-25T09:13:27.357275Z",
|
||||||
"iopub.status.idle": "2025-11-21T13:10:04.215983Z",
|
"iopub.status.idle": "2025-11-25T09:13:27.620960Z",
|
||||||
"shell.execute_reply": "2025-11-21T13:10:04.215442Z",
|
"shell.execute_reply": "2025-11-25T09:13:27.620410Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T13:10:04.169372Z"
|
"shell.execute_reply.started": "2025-11-25T09:13:27.357888Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
|
"import openpyxl\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/result_天津石化2025.json'\n",
|
"filename = 'data/result_天津石化2025.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
@@ -3669,7 +3733,7 @@
|
|||||||
" list2 = [k,v['人数'],v['体测人数']]\n",
|
" list2 = [k,v['人数'],v['体测人数']]\n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/天津石化部门测试情况(截至20241121).xlsx'\n",
|
"filename = 'data/天津石化部门测试情况(截至20241125).xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"sheet.append(title)\n",
|
"sheet.append(title)\n",
|
||||||
@@ -3689,15 +3753,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 27,
|
"execution_count": 5,
|
||||||
"id": "df8b9405-a2d9-413d-bcf4-205704b0243a",
|
"id": "df8b9405-a2d9-413d-bcf4-205704b0243a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T13:10:36.807855Z",
|
"iopub.execute_input": "2025-11-25T09:13:35.113929Z",
|
||||||
"iopub.status.busy": "2025-11-21T13:10:36.807222Z",
|
"iopub.status.busy": "2025-11-25T09:13:35.113224Z",
|
||||||
"iopub.status.idle": "2025-11-21T13:10:37.013652Z",
|
"iopub.status.idle": "2025-11-25T09:13:35.286136Z",
|
||||||
"shell.execute_reply": "2025-11-21T13:10:37.013094Z",
|
"shell.execute_reply": "2025-11-25T09:13:35.285593Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T13:10:36.807795Z"
|
"shell.execute_reply.started": "2025-11-25T09:13:35.113867Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -3722,7 +3786,7 @@
|
|||||||
" i+=1\n",
|
" i+=1\n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"#print(list1)\n",
|
"#print(list1)\n",
|
||||||
"filename = f'data/天津石化未测试人员名单(截至20251121).xlsx'\n",
|
"filename = f'data/天津石化未测试人员名单(截至20251125).xlsx'\n",
|
||||||
"title = ['序号','员工编号','姓名','部门']\n",
|
"title = ['序号','员工编号','姓名','部门']\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
|
|||||||
+128
-36
@@ -90,15 +90,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": 1,
|
||||||
"id": "cac3736a-56da-403b-9e62-5caaf989a6d4",
|
"id": "cac3736a-56da-403b-9e62-5caaf989a6d4",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T02:48:24.228686Z",
|
"iopub.execute_input": "2025-11-26T02:10:09.280736Z",
|
||||||
"iopub.status.busy": "2025-11-21T02:48:24.228035Z",
|
"iopub.status.busy": "2025-11-26T02:10:09.280206Z",
|
||||||
"iopub.status.idle": "2025-11-21T02:48:26.022844Z",
|
"iopub.status.idle": "2025-11-26T02:10:11.865840Z",
|
||||||
"shell.execute_reply": "2025-11-21T02:48:26.022393Z",
|
"shell.execute_reply": "2025-11-26T02:10:11.865214Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T02:48:24.228627Z"
|
"shell.execute_reply.started": "2025-11-26T02:10:09.280687Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"96 ok\n"
|
"118 ok\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -201,17 +201,25 @@
|
|||||||
"print(len(re_ta))"
|
"print(len(re_ta))"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "e75065f5-127e-49c9-bc1f-c0843ab1996b",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 获取人员测试成绩(202511)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 2,
|
||||||
"id": "925f7152-b365-4df8-8d98-73569aef68f8",
|
"id": "925f7152-b365-4df8-8d98-73569aef68f8",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T02:51:03.993610Z",
|
"iopub.execute_input": "2025-11-26T02:14:20.866292Z",
|
||||||
"iopub.status.busy": "2025-11-21T02:51:03.993034Z",
|
"iopub.status.busy": "2025-11-26T02:14:20.865663Z",
|
||||||
"iopub.status.idle": "2025-11-21T02:51:04.009834Z",
|
"iopub.status.idle": "2025-11-26T02:14:20.885592Z",
|
||||||
"shell.execute_reply": "2025-11-21T02:51:04.008842Z",
|
"shell.execute_reply": "2025-11-26T02:14:20.884489Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T02:51:03.993560Z"
|
"shell.execute_reply.started": "2025-11-26T02:14:20.866240Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -219,7 +227,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"48\n"
|
"59\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -233,7 +241,7 @@
|
|||||||
"filename = 'data/新疆油田采油工艺研究院-202511.json'\n",
|
"filename = 'data/新疆油田采油工艺研究院-202511.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"filename = 'data/marks_20251121-1.csv'\n",
|
"filename = 'data/marks_20251126.csv'\n",
|
||||||
"re_ta = My.get_result(filename,dict1)\n",
|
"re_ta = My.get_result(filename,dict1)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -311,15 +319,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 3,
|
||||||
"id": "0e71f6b8-e17e-49f8-a577-7a2eb6f5e994",
|
"id": "0e71f6b8-e17e-49f8-a577-7a2eb6f5e994",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T02:54:29.164196Z",
|
"iopub.execute_input": "2025-11-26T02:14:31.777686Z",
|
||||||
"iopub.status.busy": "2025-11-21T02:54:29.163638Z",
|
"iopub.status.busy": "2025-11-26T02:14:31.776942Z",
|
||||||
"iopub.status.idle": "2025-11-21T02:54:29.182035Z",
|
"iopub.status.idle": "2025-11-26T02:14:31.796905Z",
|
||||||
"shell.execute_reply": "2025-11-21T02:54:29.181011Z",
|
"shell.execute_reply": "2025-11-26T02:14:31.796178Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T02:54:29.164147Z"
|
"shell.execute_reply.started": "2025-11-26T02:14:31.777614Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -688,15 +696,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 4,
|
||||||
"id": "83872322-129c-410d-a9a3-ef6f4fe8dcde",
|
"id": "83872322-129c-410d-a9a3-ef6f4fe8dcde",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T02:53:17.422865Z",
|
"iopub.execute_input": "2025-11-26T02:15:53.506585Z",
|
||||||
"iopub.status.busy": "2025-11-21T02:53:17.422300Z",
|
"iopub.status.busy": "2025-11-26T02:15:53.506045Z",
|
||||||
"iopub.status.idle": "2025-11-21T02:53:17.441843Z",
|
"iopub.status.idle": "2025-11-26T02:15:53.538569Z",
|
||||||
"shell.execute_reply": "2025-11-21T02:53:17.441201Z",
|
"shell.execute_reply": "2025-11-26T02:15:53.537485Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T02:53:17.422814Z"
|
"shell.execute_reply.started": "2025-11-26T02:15:53.506536Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -704,7 +712,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"48\n"
|
"59\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -716,7 +724,7 @@
|
|||||||
"from datetime import date\n",
|
"from datetime import date\n",
|
||||||
"\n",
|
"\n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"filename = 'data/sql_20251121.csv'\n",
|
"filename = 'data/sql_20251126.csv'\n",
|
||||||
"with open(filename,'r',newline='') as csv_file:\n",
|
"with open(filename,'r',newline='') as csv_file:\n",
|
||||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||||
" header = next(fl) \n",
|
" header = next(fl) \n",
|
||||||
@@ -847,15 +855,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 18,
|
||||||
"id": "694ad38e-755e-4885-94a9-c157ddc96564",
|
"id": "694ad38e-755e-4885-94a9-c157ddc96564",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-11-21T02:55:17.019680Z",
|
"iopub.execute_input": "2025-11-24T11:08:24.326077Z",
|
||||||
"iopub.status.busy": "2025-11-21T02:55:17.019091Z",
|
"iopub.status.busy": "2025-11-24T11:08:24.325551Z",
|
||||||
"iopub.status.idle": "2025-11-21T02:55:45.001413Z",
|
"iopub.status.idle": "2025-11-24T11:08:55.094267Z",
|
||||||
"shell.execute_reply": "2025-11-21T02:55:45.000749Z",
|
"shell.execute_reply": "2025-11-24T11:08:55.093154Z",
|
||||||
"shell.execute_reply.started": "2025-11-21T02:55:17.019625Z"
|
"shell.execute_reply.started": "2025-11-24T11:08:24.326028Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -863,7 +871,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"48\n"
|
"53\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -929,6 +937,90 @@
|
|||||||
"print(i)"
|
"print(i)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "28790176-7666-4b2d-83a5-9207cb8ad757",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-26T02:19:09.568448Z",
|
||||||
|
"iopub.status.busy": "2025-11-26T02:19:09.567632Z",
|
||||||
|
"iopub.status.idle": "2025-11-26T02:19:13.217423Z",
|
||||||
|
"shell.execute_reply": "2025-11-26T02:19:13.216897Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-26T02:19:09.568384Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"6\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import requests\n",
|
||||||
|
"import json\n",
|
||||||
|
"import openpyxl\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"headers = {\n",
|
||||||
|
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||||
|
" }\n",
|
||||||
|
"filename = 'data/result_新疆油田采油工艺研究院2511.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"file_path ='./新疆油田采油工艺研究院2511/'\n",
|
||||||
|
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||||
|
"i=0\n",
|
||||||
|
"list2 = ['148','149','150','151','152','153']\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if k in list2:\n",
|
||||||
|
" list1 = []\n",
|
||||||
|
" mydata = {}\n",
|
||||||
|
" \n",
|
||||||
|
" id = str(k).rjust(4,\"0\")\n",
|
||||||
|
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||||
|
" mydata['title'] = '新疆油田采油工艺研究院'\n",
|
||||||
|
" mydata['subtitle'] = v['unit']\n",
|
||||||
|
" mydata['id'] = id\n",
|
||||||
|
" mydata['name'] = v['name']\n",
|
||||||
|
" if v['sex'] == '男':\n",
|
||||||
|
" mydata['gender'] = 'male'\n",
|
||||||
|
" else:\n",
|
||||||
|
" mydata['gender'] = 'female'\n",
|
||||||
|
" \n",
|
||||||
|
" mydata['month'] = v['month']\n",
|
||||||
|
" mydata['fits'] = {}\n",
|
||||||
|
" survey_list = ['tcm','psy57','spine']\n",
|
||||||
|
" for item in survey_list:\n",
|
||||||
|
" if item in v.keys():\n",
|
||||||
|
" mydata.setdefault('surveys',{})\n",
|
||||||
|
" mydata['surveys'][item] = v[item]\n",
|
||||||
|
" \n",
|
||||||
|
" \n",
|
||||||
|
" #mydata['fits'] = {}\n",
|
||||||
|
" for item in list_item:\n",
|
||||||
|
" if item in v.keys():\n",
|
||||||
|
" mydata.setdefault('fits',{})\n",
|
||||||
|
" if item in ['lung','pushup','step','situp']:\n",
|
||||||
|
" mark = v[item]['成绩'].split()[0].split('.')[0]\n",
|
||||||
|
" 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",
|
||||||
|
" list1.append(mydata)\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\n",
|
||||||
|
" #print(id,v['name'],x.text)\n",
|
||||||
|
" #print(mydata)\n",
|
||||||
|
" #x.close()\n",
|
||||||
|
"print(i)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "ffb6c02a-8ae1-4332-96ca-ce541bfbf0be",
|
"id": "ffb6c02a-8ae1-4332-96ca-ce541bfbf0be",
|
||||||
|
|||||||
+104
-3
@@ -150,6 +150,88 @@
|
|||||||
"print(len(list1),'ok')"
|
"print(len(list1),'ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 43,
|
||||||
|
"id": "d76d7645-c337-4257-8be7-4b6664ce8428",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T14:42:06.097431Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T14:42:06.096911Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T14:42:06.102150Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T14:42:06.101126Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T14:42:06.097383Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"## 修正部门信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 45,
|
||||||
|
"id": "2033b245-1892-4668-a6e6-fe4e6ce3a659",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T14:42:40.124175Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T14:42:40.123533Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T14:42:40.189066Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T14:42:40.188604Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T14:42:40.124115Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1225 ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if v['unit'] =='行政事物中心':\n",
|
||||||
|
" v['unit'] = '行政事务中心'\n",
|
||||||
|
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||||
|
"print(len(dict1),'ok')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 46,
|
||||||
|
"id": "6c01cc41-71d9-433d-910f-462345d9c5b8",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T14:42:44.057583Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T14:42:44.056985Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T14:42:44.075338Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T14:42:44.074893Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T14:42:44.057530Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if v['unit'] =='行政事物中心':\n",
|
||||||
|
" print(v['name'])"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "f9ef800a-b760-4933-b7a4-c69edef593d0",
|
"id": "f9ef800a-b760-4933-b7a4-c69edef593d0",
|
||||||
@@ -340,10 +422,29 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 33,
|
||||||
"id": "c2ca861f-54ca-4312-bf24-20dbc2f3f2e6",
|
"id": "c2ca861f-54ca-4312-bf24-20dbc2f3f2e6",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
"outputs": [],
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T06:36:37.829125Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T06:36:37.828609Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T06:36:37.858470Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T06:36:37.857858Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T06:36:37.829078Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1553238 齐金永 公用工程部 13231725301 2\n",
|
||||||
|
"1552999 赵崇胜 储运部 13722775060 2\n",
|
||||||
|
"1553836 王成柱 炼油一部 13111760190 1\n",
|
||||||
|
"1553839 徐振柱 炼油一部 17772650508 1\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|||||||
+51
-22
@@ -1763,10 +1763,26 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 13,
|
||||||
"id": "505fce63-ed92-4f63-82da-7207b015dab4",
|
"id": "505fce63-ed92-4f63-82da-7207b015dab4",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
"outputs": [],
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T10:09:42.882767Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T10:09:42.882236Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T10:09:42.907880Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T10:09:42.907306Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T10:09:42.882717Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1595 ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -1821,6 +1837,35 @@
|
|||||||
"print(len(dict1),'ok')"
|
"print(len(dict1),'ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 14,
|
||||||
|
"id": "4fb7dc45-b509-4be7-a173-cce2cad4c67c",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-24T10:10:58.479565Z",
|
||||||
|
"iopub.status.busy": "2025-11-24T10:10:58.479001Z",
|
||||||
|
"iopub.status.idle": "2025-11-24T10:10:58.489706Z",
|
||||||
|
"shell.execute_reply": "2025-11-24T10:10:58.488704Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-24T10:10:58.479512Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1606\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"filename = 'data/data_镇海2025.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" list1 = json.load(fl)\n",
|
||||||
|
"print(len(list1))"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "a5965545-1f5b-4ba2-b1b2-81a56572af74",
|
"id": "a5965545-1f5b-4ba2-b1b2-81a56572af74",
|
||||||
@@ -2158,26 +2203,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": null,
|
||||||
"id": "557508ff-842c-4e15-93fa-457b571223a8",
|
"id": "557508ff-842c-4e15-93fa-457b571223a8",
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"execution": {
|
"outputs": [],
|
||||||
"iopub.execute_input": "2025-11-19T06:12:59.269561Z",
|
|
||||||
"iopub.status.busy": "2025-11-19T06:12:59.269005Z",
|
|
||||||
"iopub.status.idle": "2025-11-19T06:12:59.475923Z",
|
|
||||||
"shell.execute_reply": "2025-11-19T06:12:59.475387Z",
|
|
||||||
"shell.execute_reply.started": "2025-11-19T06:12:59.269511Z"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok!\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
|
|||||||
+184
-119
@@ -1,143 +1,208 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "markdown",
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import pymysql\n",
|
"# Django数据处理"
|
||||||
"db = pymysql.connect(\"localhost\",\"songyi\",\"yylzs\",\"mydata\" )\n",
|
]
|
||||||
"cursor = db.cursor()\n",
|
},
|
||||||
"cursor.execute(\"SELECT VERSION()\")\n",
|
{
|
||||||
"data = cursor.fetchone()\n",
|
"cell_type": "markdown",
|
||||||
"print (\"Database version : %s \" % data)\n",
|
"metadata": {},
|
||||||
"db.close()"
|
"source": [
|
||||||
|
"## 初始化数据库"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 44,
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import pymysql\n",
|
|
||||||
"db = pymysql.connect(\"localhost\",\"songyi\",\"yylzs\",\"mydata\" )\n",
|
|
||||||
"cursor = db.cursor()\n",
|
|
||||||
"sql = \"select id,name from sports_person where name= %s\"\n",
|
|
||||||
"cursor.execute(sql, ('张联红',))\n",
|
|
||||||
"result = cursor.fetchone()\n",
|
|
||||||
"print(result)\n",
|
|
||||||
"db.close()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import pymysql\n",
|
|
||||||
"db = pymysql.connect(\"localhost\",\"songyi\",\"yylzs\",\"mydata\" )\n",
|
|
||||||
"cursor = db.cursor()\n",
|
|
||||||
"sql = \"select id,name from sports_person\"\n",
|
|
||||||
"cursor.execute(sql)\n",
|
|
||||||
"result = cursor.fetchone()\n",
|
|
||||||
"print(\"人员信息:\")\n",
|
|
||||||
"print(result)\n",
|
|
||||||
"sql = \"select id,name from sports_item\"\n",
|
|
||||||
"cursor.execute(sql)\n",
|
|
||||||
"result = cursor.fetchone()\n",
|
|
||||||
"print(\"\\n运动项目信息:\")\n",
|
|
||||||
"print(result)\n",
|
|
||||||
"db.close()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import pymysql\n",
|
|
||||||
"db = pymysql.connect(\"localhost\",\"songyi\",\"yylzs\",\"mydata\" )\n",
|
|
||||||
"cursor = db.cursor()\n",
|
|
||||||
"sql = \"select a.target_id,b.name from sports_item_target as a,sports_target as b where a.target_id=b.id\"\n",
|
|
||||||
"cursor.execute(sql)\n",
|
|
||||||
"re_ta = {}\n",
|
|
||||||
"print(\"\\n运动项目信息:\")\n",
|
|
||||||
"results = cursor.fetchall()\n",
|
|
||||||
"for result in results:\n",
|
|
||||||
"# print (\"%d--%s\" %(result[0],result[1]))\n",
|
|
||||||
" re_ta[result[0]] = result[1]\n",
|
|
||||||
" print(\"re_ta[%d]= #%s\" %(result[0],result[1]))\n",
|
|
||||||
"print(re_ta)\n",
|
|
||||||
"db.close()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import pymysql\n",
|
|
||||||
"db = pymysql.connect(\"localhost\",\"songyi\",\"yylzs\",\"mydata\" )\n",
|
|
||||||
"cursor = db.cursor()\n",
|
|
||||||
"person_id = \n",
|
|
||||||
"record_date = ''\n",
|
|
||||||
"item_id =\n",
|
|
||||||
"re_ta = {}\n",
|
|
||||||
"re_ta[1]= #运动距离\n",
|
|
||||||
"re_ta[2]= #运动时间\n",
|
|
||||||
"re_ta[3]= #平均配速\n",
|
|
||||||
"re_ta[4]= #平均速度\n",
|
|
||||||
"re_ta[5]= #平均步频\n",
|
|
||||||
"re_ta[6]= #平均步幅\n",
|
|
||||||
"re_ta[7]= #步数\n",
|
|
||||||
"re_ta[8]= #平均心率\n",
|
|
||||||
"re_ta[9]= #最大心率\n",
|
|
||||||
"re_ta[10]= #无氧耐力\n",
|
|
||||||
"re_ta[11]= #有氧耐力\n",
|
|
||||||
"re_ta[12]= #最大步频\n",
|
|
||||||
"re_ta[13]= #最快配速\n",
|
|
||||||
"sql = \"select * from sports_person\"\n",
|
|
||||||
"db.close()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 6,
|
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-03-27T06:10:30.861854Z",
|
"iopub.execute_input": "2025-11-26T04:58:22.889919Z",
|
||||||
"iopub.status.busy": "2023-03-27T06:10:30.861008Z",
|
"iopub.status.busy": "2025-11-26T04:58:22.889099Z",
|
||||||
"iopub.status.idle": "2023-03-27T06:10:30.877436Z",
|
"iopub.status.idle": "2025-11-26T04:58:22.916971Z",
|
||||||
"shell.execute_reply": "2023-03-27T06:10:30.876689Z",
|
"shell.execute_reply": "2025-11-26T04:58:22.916139Z",
|
||||||
"shell.execute_reply.started": "2023-03-27T06:10:30.861813Z"
|
"shell.execute_reply.started": "2025-11-26T04:58:22.889849Z"
|
||||||
},
|
}
|
||||||
"tags": []
|
},
|
||||||
|
"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()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 列示单位及事件"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 29,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-26T03:18:44.997174Z",
|
||||||
|
"iopub.status.busy": "2025-11-26T03:18:44.996492Z",
|
||||||
|
"iopub.status.idle": "2025-11-26T03:18:45.006209Z",
|
||||||
|
"shell.execute_reply": "2025-11-26T03:18:45.005343Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-26T03:18:44.997112Z"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"100\n"
|
"(1, '宁夏能化员工干预', 1, '中石化宁夏能化公司')\n",
|
||||||
|
"(2, '天津石化2025年体质检测', 2, '中石化(天津)石油化工有限公司')\n",
|
||||||
|
"(3, '新疆采油工艺研究院2025年11月体质检测', 3, '新疆油田采油工艺研究院')\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"sql = \"SELECT e.id,e.name,e.org_id,o.name from fitness_event as e,fitness_org as o where e.org_id = o.id\"\n",
|
||||||
"import pymongo\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
"cur.execute(sql)\n",
|
||||||
"mydb = myclient[\"tice\"]\n",
|
"rows = cur.fetchall()\n",
|
||||||
"mycol = mydb[\"test\"]\n",
|
"for row in rows:\n",
|
||||||
"renyuan = set()\n",
|
" print(row)"
|
||||||
"for x in mycol.find():\n",
|
]
|
||||||
" renyuan.add(x['name'])\n",
|
},
|
||||||
"print(len(renyuan))\n"
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导入事件人员信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 17,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-26T02:26:51.443764Z",
|
||||||
|
"iopub.status.busy": "2025-11-26T02:26:51.443185Z",
|
||||||
|
"iopub.status.idle": "2025-11-26T02:26:51.471921Z",
|
||||||
|
"shell.execute_reply": "2025-11-26T02:26:51.470918Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-26T02:26:51.443710Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"event_id = 3\n",
|
||||||
|
"sql = \"SELECT code from fitness_person where org_id = %s\"\n",
|
||||||
|
"params = (event_id,)\n",
|
||||||
|
"cur.execute(sql, params)\n",
|
||||||
|
"rows = cur.fetchall()\n",
|
||||||
|
"codes = []\n",
|
||||||
|
"for row in rows:\n",
|
||||||
|
" codes.append(row[0])\n",
|
||||||
|
"filename = '体测单位/data/新疆油田采油工艺研究院-202511.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"data1 = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if k not in codes:\n",
|
||||||
|
" if 'sub_unit' in v.keys():\n",
|
||||||
|
" sub_unit = v['sub_unit']\n",
|
||||||
|
" else:\n",
|
||||||
|
" sub_unit = ''\n",
|
||||||
|
" if 'phone' in v.keys():\n",
|
||||||
|
" phone = v['phone']\n",
|
||||||
|
" else:\n",
|
||||||
|
" phone = ''\n",
|
||||||
|
" tuple1 = (k,v['name'],v['sex'],v['unit'],sub_unit,v['birth'],phone,event_id)\n",
|
||||||
|
" data1.append(tuple1)\n",
|
||||||
|
" \n",
|
||||||
|
"sql = \"INSERT INTO exam_person ( code,name, sex,unit,sub_unit,birth,phone,event_id) VALUES (%s, %s, %s,%s, %s, %s, %s, %s)\" \n",
|
||||||
|
"#print(data1)\n",
|
||||||
|
"cur.executemany(sql, data1)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
" "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导入测试成绩"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 46,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-11-26T05:16:17.188547Z",
|
||||||
|
"iopub.status.busy": "2025-11-26T05:16:17.187969Z",
|
||||||
|
"iopub.status.idle": "2025-11-26T05:16:17.273706Z",
|
||||||
|
"shell.execute_reply": "2025-11-26T05:16:17.272752Z",
|
||||||
|
"shell.execute_reply.started": "2025-11-26T05:16:17.188494Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import csv\n",
|
||||||
|
"\n",
|
||||||
|
"event_id = 3\n",
|
||||||
|
"sql = \"SELECT code,sex,id from exam_person where event_id = %s\"\n",
|
||||||
|
"params = (event_id,)\n",
|
||||||
|
"cur.execute(sql, params)\n",
|
||||||
|
"rows = cur.fetchall()\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"for row in rows:\n",
|
||||||
|
" dict1.setdefault(row[0],{})\n",
|
||||||
|
" dict1[row[0]]['id']= row[2]\n",
|
||||||
|
" dict1[row[0]]['sex']= row[1]\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = '体测单位/data/marks_20251126.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",
|
||||||
|
" #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n",
|
||||||
|
" list1.append(line)\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"for result in list1:\n",
|
||||||
|
" user = str(result[2]).lower() \n",
|
||||||
|
" if user in dict1.keys(): \n",
|
||||||
|
" #rq = date.fromisoformat(result[5].replace('/','-'))\n",
|
||||||
|
" m_item = str(result[3])\n",
|
||||||
|
" if dict1[user]['sex'] == '男':\n",
|
||||||
|
" l_xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step']\n",
|
||||||
|
" else:\n",
|
||||||
|
" l_xm = ['bmi','lung','grip','flexion','jump','balance','reaction','step','situp']\n",
|
||||||
|
" item_name = result[3] \n",
|
||||||
|
" if item_name in l_xm:\n",
|
||||||
|
" rq = result[5].replace('/','-').split(' ')[0]\n",
|
||||||
|
" if item_name =='bmi':\n",
|
||||||
|
" height = result[4].split(',')[0]\n",
|
||||||
|
" weight = result[4].split(',')[1]\n",
|
||||||
|
" tuple1 = (event_id,dict1[user]['id'],user,rq,'height',height,result[6])\n",
|
||||||
|
" list2.append(tuple1)\n",
|
||||||
|
" tuple1 = (event_id,dict1[user]['id'],user,rq,'weight',weight,result[6])\n",
|
||||||
|
" list2.append(tuple1) \n",
|
||||||
|
" else:\n",
|
||||||
|
" tuple1 = (event_id,dict1[user]['id'],user,rq,result[3],result[4],result[6])\n",
|
||||||
|
" list2.append(tuple1)\n",
|
||||||
|
"sql = \"INSERT INTO exam_record_data (event_id,user_id,code,date_exam,item,mark,date_created) VALUES (%s,%s, %s, %s,%s, %s, %s)\" \n",
|
||||||
|
"#print(data1)\n",
|
||||||
|
"cur.executemany(sql, list2)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
" "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -164,7 +229,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.6"
|
"version": "3.12.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Reference in new issue
Block a user