20250629
This commit is contained in:
1 parent
678a2c983d
commit
b58fc4376a
4 files changed
+1023
-365
No files matched your search
+315
-27
@@ -10,12 +10,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 13,
|
||||
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T06:47:52.647999Z",
|
||||
"iopub.status.busy": "2025-06-24T06:47:52.647468Z",
|
||||
"iopub.status.idle": "2025-06-24T06:47:52.837761Z",
|
||||
"shell.execute_reply": "2025-06-24T06:47:52.837173Z",
|
||||
"shell.execute_reply.started": "2025-06-24T06:47:52.647952Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1698 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -48,6 +63,60 @@
|
||||
"print(len(person),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"id": "ddddbac1-ab71-436a-ab64-2a15600f5b1b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:47:30.639088Z",
|
||||
"iopub.status.busy": "2025-06-24T07:47:30.638546Z",
|
||||
"iopub.status.idle": "2025-06-24T07:47:30.944089Z",
|
||||
"shell.execute_reply": "2025-06-24T07:47:30.943556Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:47:30.639038Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1953 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/宁夏能化-全部名单.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, 2).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 4).value\n",
|
||||
" unit = sheet.cell(n, 8).value\n",
|
||||
" \n",
|
||||
" dict1['sub_unit'] = sheet.cell(n, 6).value\n",
|
||||
" if unit == '管理部门':\n",
|
||||
" dict1['unit'] = sheet.cell(n, 9).value\n",
|
||||
" else:\n",
|
||||
" dict1['unit'] = sheet.cell(n, 8).value\n",
|
||||
" \n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/宁夏能化人员all.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": "048a95aa-1691-45f6-b933-6eaf95ae1d30",
|
||||
@@ -96,11 +165,52 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 37,
|
||||
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:47:35.746440Z",
|
||||
"iopub.status.busy": "2025-06-24T07:47:35.746188Z",
|
||||
"iopub.status.idle": "2025-06-24T07:47:35.874766Z",
|
||||
"shell.execute_reply": "2025-06-24T07:47:35.874285Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:47:35.746417Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1699\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
"import csv\n",
|
||||
"from datetime import date\n",
|
||||
"import my_module as My\n",
|
||||
"\n",
|
||||
"filename = 'data/宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20250619.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员all.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": "24189bf6-d2b2-4855-a6b2-7a6e36cd79f3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -122,6 +232,45 @@
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"id": "2082c096-9f36-430c-9823-f09d8b6f9b42",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:24:22.507391Z",
|
||||
"iopub.status.busy": "2025-06-24T07:24:22.506635Z",
|
||||
"iopub.status.idle": "2025-06-24T07:24:22.548344Z",
|
||||
"shell.execute_reply": "2025-06-24T07:24:22.547831Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:24:22.507322Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"['2018652', '2019665', '2019160', '2019512', '3427477', '2019423', '2019494', '2019901']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"filename = 'data/result_宁夏能化人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"list1 = []\n",
|
||||
"for k,v in dict2.items():\n",
|
||||
" if k not in dict1.keys():\n",
|
||||
" #print(k,v['name'],v['sex'],v['unit'])\n",
|
||||
" #print(k,v)\n",
|
||||
" list1.append(str(k))\n",
|
||||
"print(list1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6d381859-6d21-45d2-8313-55ebbabf8bd4",
|
||||
@@ -132,10 +281,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 38,
|
||||
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:47:41.560238Z",
|
||||
"iopub.status.busy": "2025-06-24T07:47:41.559637Z",
|
||||
"iopub.status.idle": "2025-06-24T07:47:41.657989Z",
|
||||
"shell.execute_reply": "2025-06-24T07:47:41.657434Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:47:41.560182Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -143,7 +308,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_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for k, v in dict2.items():\n",
|
||||
@@ -166,7 +331,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_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
||||
"print('ok!') "
|
||||
@@ -182,9 +347,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 42,
|
||||
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-26T01:35:41.139581Z",
|
||||
"iopub.status.busy": "2025-06-26T01:35:41.139145Z",
|
||||
"iopub.status.idle": "2025-06-26T01:35:41.663585Z",
|
||||
"shell.execute_reply": "2025-06-26T01:35:41.663054Z",
|
||||
"shell.execute_reply.started": "2025-06-26T01:35:41.139557Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -195,11 +367,11 @@
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员.json'\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/宁夏能化人员.json'\n",
|
||||
"filename = 'data/宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
@@ -396,6 +568,90 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "970a1cc8-4fdf-478a-9f5b-b82d7d4bf762",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成体测成绩明细表"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 44,
|
||||
"id": "d31020be-c9c0-404f-8e0b-f8f507385f48",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-27T04:14:46.467739Z",
|
||||
"iopub.status.busy": "2025-06-27T04:14:46.466974Z",
|
||||
"iopub.status.idle": "2025-06-27T04:14:47.053693Z",
|
||||
"shell.execute_reply": "2025-06-27T04:14:47.053104Z",
|
||||
"shell.execute_reply.started": "2025-06-27T04:14:46.467668Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"bmi = ['height','weight']\n",
|
||||
"title = ['编号','姓名','性别','单位/部门','身高','体重','bmi','肺活量','得分','握力','得分','坐位体前屈','得分','纵跳','得分','俯卧撑','得分','一分钟仰卧起坐','得分','单脚站立','得分','选择反应时','得分','台阶指数','得分']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(dict1[k]['name']) \n",
|
||||
" list2.append(dict1[k]['sex'])\n",
|
||||
" list2.append(dict1[k]['unit'])\n",
|
||||
" i = 0\n",
|
||||
" if 'bmi' in dict1[k].keys():\n",
|
||||
" list2.append(dict1[k]['bmi']['成绩'].split(',')[0])\n",
|
||||
" list2.append(dict1[k]['bmi']['成绩'].split(',')[1])\n",
|
||||
" list2.append(dict1[k]['bmi']['score'])\n",
|
||||
" i+=1\n",
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" for item in items:\n",
|
||||
" if item in dict1[k].keys():\n",
|
||||
" list2.append(dict1[k][item]['成绩'])\n",
|
||||
" list2.append(dict1[k][item]['score']) \n",
|
||||
" i+=1\n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(dict1[k][item])\n",
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list2.append('') \n",
|
||||
" if i>2:\n",
|
||||
" list1.append(list2)\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)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8d5f4103-0d1e-4711-b324-ece360f8dcd3",
|
||||
@@ -474,10 +730,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 39,
|
||||
"id": "9ffec868-3851-42f6-8431-c5c5d3d15424",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:47:57.736323Z",
|
||||
"iopub.status.busy": "2025-06-24T07:47:57.736061Z",
|
||||
"iopub.status.idle": "2025-06-24T07:48:02.653903Z",
|
||||
"shell.execute_reply": "2025-06-24T07:48:02.653030Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:47:57.736300Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"8\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import json\n",
|
||||
@@ -487,7 +759,7 @@
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_宁夏能化人员.json'\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
@@ -498,7 +770,7 @@
|
||||
"for k, v in dict1.items():\n",
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" if str(k) =='2019945':\n",
|
||||
" if str(k) in ['2018652', '2019665', '2019160', '2019512', '3427477', '2019423', '2019494', '2019901']:\n",
|
||||
" \n",
|
||||
" id = str(k).rjust(4,\"0\")\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
@@ -551,10 +823,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 40,
|
||||
"id": "59f69be9-ab27-4308-8641-927dbcfda87e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-24T07:48:39.717546Z",
|
||||
"iopub.status.busy": "2025-06-24T07:48:39.716729Z",
|
||||
"iopub.status.idle": "2025-06-24T07:48:40.238267Z",
|
||||
"shell.execute_reply": "2025-06-24T07:48:40.237638Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:48:39.717462Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1699\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
@@ -566,7 +854,7 @@
|
||||
"old = []\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员.json'\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
@@ -592,15 +880,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 41,
|
||||
"id": "896955ac-351a-4914-94a6-56e6d1ae9e6e",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-23T09:48:19.322071Z",
|
||||
"iopub.status.busy": "2025-06-23T09:48:19.321505Z",
|
||||
"iopub.status.idle": "2025-06-23T09:48:19.482488Z",
|
||||
"shell.execute_reply": "2025-06-23T09:48:19.482024Z",
|
||||
"shell.execute_reply.started": "2025-06-23T09:48:19.322019Z"
|
||||
"iopub.execute_input": "2025-06-24T07:48:42.641359Z",
|
||||
"iopub.status.busy": "2025-06-24T07:48:42.641096Z",
|
||||
"iopub.status.idle": "2025-06-24T07:48:42.812702Z",
|
||||
"shell.execute_reply": "2025-06-24T07:48:42.812095Z",
|
||||
"shell.execute_reply.started": "2025-06-24T07:48:42.641334Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -621,7 +909,7 @@
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/宁夏能化人员'\n",
|
||||
"\n",
|
||||
"filename = 'data/result_宁夏能化人员.json'\n",
|
||||
"filename = 'data/result_宁夏能化人员all.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
|
||||
Reference in new issue
Block a user