This commit is contained in:
512song committed 2025-11-07 14:43:16 +08:00
1 parent 2e77e939dd
commit b2ba8722fa
5 files changed
+855 -182

No files matched your search

+176 -84
View File
@@ -1684,6 +1684,39 @@
"print(len(person),'ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2af3b485-743e-40ca-8caa-5eecd572c2a5",
"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, 1).value.lower()\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n, 3).value\n",
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n",
" dict1['unit'] = sheet.cell(n, 4).value\n",
" if sheet.cell(n,6).value is not None:\n",
" dict1['phone'] = sheet.cell(n, 6).value\n",
" person[code] = dict1\n",
"filename = 'data/镇海人员2025.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person),'ok')"
]
},
{
"cell_type": "markdown",
"id": "c938346f-711c-4cd7-b2f1-3776df5a00b8",
@@ -1730,26 +1763,10 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"id": "505fce63-ed92-4f63-82da-7207b015dab4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-01T07:31:37.856873Z",
"iopub.status.busy": "2025-11-01T07:31:37.856270Z",
"iopub.status.idle": "2025-11-01T07:31:37.883335Z",
"shell.execute_reply": "2025-11-01T07:31:37.882723Z",
"shell.execute_reply.started": "2025-11-01T07:31:37.856814Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1596 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1778,26 +1795,10 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"id": "f1aefe1c-150d-4a55-98b5-3a72e9510e5d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-01T07:33:40.360278Z",
"iopub.status.busy": "2025-11-01T07:33:40.359732Z",
"iopub.status.idle": "2025-11-01T07:33:40.384531Z",
"shell.execute_reply": "2025-11-01T07:33:40.383953Z",
"shell.execute_reply.started": "2025-11-01T07:33:40.360223Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1596 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1820,6 +1821,100 @@
"print(len(dict1),'ok')"
]
},
{
"cell_type": "markdown",
"id": "a5965545-1f5b-4ba2-b1b2-81a56572af74",
"metadata": {},
"source": [
"## 核对人员信息"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "a8438d1b-ec3d-41e3-9c28-d44e88378c75",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-07T05:30:46.511261Z",
"iopub.status.busy": "2025-11-07T05:30:46.510560Z",
"iopub.status.idle": "2025-11-07T05:30:46.695916Z",
"shell.execute_reply": "2025-11-07T05:30:46.695456Z",
"shell.execute_reply.started": "2025-11-07T05:30:46.511196Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1564 ok\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",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" code = 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",
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n",
" dict1['unit'] = sheet.cell(n, 4).value\n",
" if sheet.cell(n, 6).value is not None:\n",
" dict1['phone'] = sheet.cell(n, 6).value\n",
" person[code] = dict1\n",
"filename = 'data/镇海人员2025.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person),'ok')"
]
},
{
"cell_type": "markdown",
"id": "74f568d1-0bd9-4028-8e6a-e0c25ead7958",
"metadata": {},
"source": [
"## 导入手工数据"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "772330af-6224-43ad-9727-79854c33231c",
"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",
"filename = 'data/result_镇海2025.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 = str(sheet.cell(n, 2).value)\n",
" mark = str(sheet.cell(n, 3).value)\n",
" dict2[code].setdefault(item,{})\n",
" dict2[code][item]['成绩'] = mark\n",
" \n",
"filename = 'data/result_镇海2025-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": "065cb133-3c61-46bd-bf81-7afa2c9be9e0",
@@ -1856,34 +1951,56 @@
},
{
"cell_type": "markdown",
"id": "09c60f09-e35b-424a-85a8-804dd3644a0f",
"id": "f9df8146-0430-42b5-b6d0-992c71ee645b",
"metadata": {},
"source": [
"## 获取人员测试成绩(上午)"
"## 修正测试成绩"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9a6a8ce6-5c8b-47c4-a597-cd0c9eb8a9fb",
"metadata": {},
"outputs": [],
"execution_count": 60,
"id": "9caa8291-7d48-483b-992a-45f244567600",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-07T06:15:57.737800Z",
"iopub.status.busy": "2025-11-07T06:15:57.737061Z",
"iopub.status.idle": "2025-11-07T06:15:57.818225Z",
"shell.execute_reply": "2025-11-07T06:15:57.817635Z",
"shell.execute_reply.started": "2025-11-07T06:15:57.737730Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1564\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import datetime\n",
"import csv\n",
"from datetime import date\n",
"import my_module1 as My\n",
"\n",
"\n",
"filename = 'data/result_镇海2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"filename = 'data/镇海人员2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20251030-1.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"\n",
"\n",
"print(len(re_ta))"
" dict3 = json.load(fl) \n",
"dict1 = {}\n",
"for k, v in dict2.items():\n",
" code = k.upper()\n",
" dict1[code] = v\n",
" dict1[code]['unit'] = dict3[code]['unit']\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(re_ta))\n",
" "
]
},
{
@@ -1907,7 +2024,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_镇海2025.json'\n",
"filename = 'data/result_镇海2025-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -1946,17 +2063,9 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": null,
"id": "8ed6705e-b4f6-419e-b94b-4c391fed4551",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-01T07:33:54.641236Z",
"iopub.status.busy": "2025-11-01T07:33:54.640521Z",
"iopub.status.idle": "2025-11-01T07:33:55.013934Z",
"shell.execute_reply": "2025-11-01T07:33:55.013388Z",
"shell.execute_reply.started": "2025-11-01T07:33:54.641173Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -1969,7 +2078,7 @@
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/镇海人员2025-1.json'\n",
"filename = 'data/镇海人员2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
@@ -2003,7 +2112,7 @@
" list2.append('')\n",
" \n",
" list1.append(list2)\n",
"filename = 'data/镇海体测情况表(截至20251031).xlsx'\n",
"filename = 'data/镇海体测情况表(2025年).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -2071,23 +2180,6 @@
"wb.save(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bea9e53e-96e7-4006-9674-48c91e8ab0c7",
"metadata": {},
"outputs": [],
"source": [
"filename = 'data/result_镇海2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"i = 1\n",
"for k, v in dict2.items():\n",
" if 'bmi' in v.keys():\n",
" print(i,k,v['name'])\n",
" i+=1"
]
},
{
"cell_type": "markdown",
"id": "0d7d8dd1-45f7-455d-8db3-38febc2a2395",