20251107
This commit is contained in:
1 parent
2e77e939dd
commit
b2ba8722fa
5 files changed
+855
-182
No files matched your search
+109
-14
@@ -690,11 +690,11 @@
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_胜利采油厂1.json'\n",
|
||||
"filename = 'data/result_镇海2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./胜利采油厂/'\n",
|
||||
"file_path ='./镇海石化2025/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
@@ -702,9 +702,89 @@
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" \n",
|
||||
" id = str(k).rjust(8,\"0\")\n",
|
||||
" #id = str(k).rjust(8,\"0\")\n",
|
||||
" id = str(k)\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
" mydata['title'] = '东营胜利采油厂'\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','psy','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",
|
||||
" list2.append([k,v['name']])\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",
|
||||
"id": "e81d3d4e-561e-4b43-bceb-b6d9afb38100",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 生成报告(按照编号)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2e34cf3a-3488-49c2-b18f-48c35b62e6ee",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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_镇海2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./镇海石化2025/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
"person =['X00309','012947','013304','007231','007243','013612']\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" \n",
|
||||
" #id = str(k).rjust(8,\"0\")\n",
|
||||
" id = str(k)\n",
|
||||
" if id in person:\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",
|
||||
@@ -835,19 +915,19 @@
|
||||
"import glob\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/胜利采油厂'\n",
|
||||
"new_path = 'file/胜利采油厂'\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
|
||||
"new_path = 'file/镇海石化2025'\n",
|
||||
"old = []\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_胜利采油厂1.json'\n",
|
||||
"filename = 'data/result_镇海2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"print(len(fls))\n",
|
||||
"for fn in fls:\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" code = int(fi_name) \n",
|
||||
" code = fi_name \n",
|
||||
" unit_path = Path(new_path,dict1[str(code)]['unit'])\n",
|
||||
" unit_path.mkdir(parents = True, exist_ok = True)\n",
|
||||
" n_name = Path(unit_path,Path(fn).stem+'.pdf')\n",
|
||||
@@ -866,12 +946,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"id": "02319955-7fb6-4791-ae45-55b03bdadd54",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T06:31:33.947472Z",
|
||||
"iopub.status.busy": "2025-11-07T06:31:33.946853Z",
|
||||
"iopub.status.idle": "2025-11-07T06:31:34.095980Z",
|
||||
"shell.execute_reply": "2025-11-07T06:31:34.095388Z",
|
||||
"shell.execute_reply.started": "2025-11-07T06:31:33.947411Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
@@ -879,9 +974,9 @@
|
||||
"from pathlib import Path\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/胜利采油厂'\n",
|
||||
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
|
||||
"\n",
|
||||
"filename = 'data/result_胜利采油厂1.json'\n",
|
||||
"filename = 'data/result_镇海2025-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
@@ -890,14 +985,14 @@
|
||||
"for fn in fls:\n",
|
||||
" list2 = []\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0] \n",
|
||||
" code = int(fi_name)\n",
|
||||
" code = fi_name\n",
|
||||
" sex = dict1[str(code)]['sex']\n",
|
||||
" unit = dict1[str(code)]['unit']\n",
|
||||
" list2 = [fi_name,Path(fn).stem.split('-')[1],sex,unit]\n",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"\n",
|
||||
"filename = 'data/胜利采油厂体测报告明细表.xlsx'\n",
|
||||
"filename = 'data/2025年镇海石化体测报告明细表.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
|
||||
+178
-1
@@ -3205,10 +3205,187 @@
|
||||
"print(len(list1),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6139bf27-5367-451f-9f1a-f252625eab1d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 合并读卡系统文件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"id": "2d7f5a24-f247-4199-a84d-dcf611dbeef6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:49:25.694191Z",
|
||||
"iopub.status.busy": "2025-11-06T09:49:25.693476Z",
|
||||
"iopub.status.idle": "2025-11-06T09:49:25.720613Z",
|
||||
"shell.execute_reply": "2025-11-06T09:49:25.719806Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:49:25.694101Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"864 杨小波 \n",
|
||||
"865 宋舒波 炼油一部\n",
|
||||
"866 黄耀 公用工程部\n",
|
||||
"867 陈永佳 炼油一部\n",
|
||||
"868 欧阳惠婕 检验计量中心\n",
|
||||
"868 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",
|
||||
" dict1.setdefault(code,{})\n",
|
||||
" dict1[code]['name'] = item['name']\n",
|
||||
" dict1[code]['sex'] = item['gender']\n",
|
||||
" dict1[code]['unit'] = item['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",
|
||||
"id": "cccfebad-8fc5-4aa9-b15d-05eff2fa421f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 获取人员测试成绩"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "7b79c7bb-ce87-44b2-95b1-01e9cb66d5f0",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:50:07.068317Z",
|
||||
"iopub.status.busy": "2025-11-06T09:50:07.067538Z",
|
||||
"iopub.status.idle": "2025-11-06T09:50:07.100869Z",
|
||||
"shell.execute_reply": "2025-11-06T09:50:07.100391Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:50:07.068246Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"333\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/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20251106.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "12b33ee8-2b4e-4b85-9301-4fbcadf4129c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计各部门测试情况"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "ca079428-2df9-4f15-b141-2c83cd0efaf5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:50:13.734766Z",
|
||||
"iopub.status.busy": "2025-11-06T09:50:13.734508Z",
|
||||
"iopub.status.idle": "2025-11-06T09:50:13.753135Z",
|
||||
"shell.execute_reply": "2025-11-06T09:50:13.752583Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:50:13.734739Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"dict3 = {}\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" unit = v['unit']\n",
|
||||
" #sub_unit = v['sub_unit']\n",
|
||||
" dict3.setdefault(unit,{})\n",
|
||||
" dict3[unit].setdefault('人数',0)\n",
|
||||
" dict3[unit].setdefault('体测人数',0)\n",
|
||||
" #dict3[unit].setdefault(sub_unit,0)\n",
|
||||
" #dict3[unit][sub_unit] = dict3[unit][sub_unit] + 1\n",
|
||||
" dict3[unit]['人数'] = dict3[unit]['人数'] + 1\n",
|
||||
"\n",
|
||||
"title =['单位','报名人数','体测人数']\n",
|
||||
"list1 = []\n",
|
||||
"for k,v in dict1.items(): \n",
|
||||
" unit = v['unit']\n",
|
||||
" #sub_unit = v['sub_unit']\n",
|
||||
" #dict3[unit][sub_unit] = dict3[unit][sub_unit] - 1\n",
|
||||
" dict3[unit].setdefault('体测人数',0)\n",
|
||||
" dict3[unit]['体测人数'] = dict3[unit]['体测人数'] + 1\n",
|
||||
"for k, v in dict3.items():\n",
|
||||
" list2 = [k,v['人数'],v['体测人数']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化部门测试情况(截至20251105).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": "code",
|
||||
"execution_count": null,
|
||||
"id": "8ac3a30f-002f-49b4-bbb0-c63ac37037f9",
|
||||
"id": "78f2737d-97e7-4ded-994a-86818119597a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
+256
-83
@@ -47,26 +47,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"id": "de3144e7-544a-4430-bf69-3d20479d50c9",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-25T07:09:50.818045Z",
|
||||
"iopub.status.busy": "2025-08-25T07:09:50.817355Z",
|
||||
"iopub.status.idle": "2025-08-25T07:09:51.017532Z",
|
||||
"shell.execute_reply": "2025-08-25T07:09:51.017045Z",
|
||||
"shell.execute_reply.started": "2025-08-25T07:09:50.817980Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"30 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -106,27 +90,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-25T07:10:06.792695Z",
|
||||
"iopub.status.busy": "2025-08-25T07:10:06.791764Z",
|
||||
"iopub.status.idle": "2025-08-25T07:10:06.809711Z",
|
||||
"shell.execute_reply": "2025-08-25T07:10:06.808745Z",
|
||||
"shell.execute_reply.started": "2025-08-25T07:10:06.792617Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"25\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -183,26 +152,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-25T07:13:08.181827Z",
|
||||
"iopub.status.busy": "2025-08-25T07:13:08.181087Z",
|
||||
"iopub.status.idle": "2025-08-25T07:13:08.195674Z",
|
||||
"shell.execute_reply": "2025-08-25T07:13:08.194568Z",
|
||||
"shell.execute_reply.started": "2025-08-25T07:13:08.181758Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -249,16 +202,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"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": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -567,26 +513,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-08-25T07:13:29.388206Z",
|
||||
"iopub.status.busy": "2025-08-25T07:13:29.387452Z",
|
||||
"iopub.status.idle": "2025-08-25T07:13:42.980504Z",
|
||||
"shell.execute_reply": "2025-08-25T07:13:42.979631Z",
|
||||
"shell.execute_reply.started": "2025-08-25T07:13:29.388132Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"25\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import json\n",
|
||||
@@ -649,10 +579,253 @@
|
||||
"print(i)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ffb6c02a-8ae1-4332-96ca-ce541bfbf0be",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 问卷信息统计"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "87556725-f68a-484b-827c-f6735155e940",
|
||||
"id": "d22061b2-0109-4d6c-90d7-c31d9e318add",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/sql_20251106.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",
|
||||
"nn = 0\n",
|
||||
"for item in list1:\n",
|
||||
" dict2 = {}\n",
|
||||
" \n",
|
||||
" phone = str(item[0])[2:]\n",
|
||||
" content = json.loads(json.loads(item[1]))\n",
|
||||
" tcm = []\n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" for k, v in content.items(): \n",
|
||||
" if 'tcm' not in k:\n",
|
||||
" dict2[k] = v\n",
|
||||
" else:\n",
|
||||
" i = int(k[3:])\n",
|
||||
" tcm[i-1] = int(v)\n",
|
||||
" \n",
|
||||
" code = phone\n",
|
||||
" dict1.setdefault(code,{})\n",
|
||||
" dict1[code]['name'] = content['name']\n",
|
||||
" if content['gender'] == 'male':\n",
|
||||
" dict1[code]['sex'] = '男'\n",
|
||||
" else:\n",
|
||||
" dict1[code]['sex'] = '女'\n",
|
||||
" dict1[code]['birth'] = str(content['birth'])\n",
|
||||
" dict1[code]['unit'] = '采油工艺研究院'\n",
|
||||
" #dict1[code]['phone'] = phone\n",
|
||||
" #dict1[code]['weight'] = dict2['weight']\n",
|
||||
" #dict1[code]['waist'] = dict2['waist']\n",
|
||||
" #dict1[code]['hip'] = dict2['hip']\n",
|
||||
" dict1[code]['tcm'] = tcm\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = [k,v['name'],v['sex'],v['birth']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"title =['手机号码','姓名','性别','出生年月']\n",
|
||||
"filename = 'data/采油工艺研究院问卷人员(截至20251105).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": "code",
|
||||
"execution_count": 21,
|
||||
"id": "5c4df7b1-ced9-49c1-a9e4-dc2a54f201bc",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T02:15:58.258398Z",
|
||||
"iopub.status.busy": "2025-11-06T02:15:58.257685Z",
|
||||
"iopub.status.idle": "2025-11-06T02:15:58.274276Z",
|
||||
"shell.execute_reply": "2025-11-06T02:15:58.273471Z",
|
||||
"shell.execute_reply.started": "2025-11-06T02:15:58.258334Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"27\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/sql_20251106.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",
|
||||
"nn = 0\n",
|
||||
"for item in list1:\n",
|
||||
" dict2 = {}\n",
|
||||
" \n",
|
||||
" phone = str(item[0])[2:]\n",
|
||||
" content = json.loads(json.loads(item[1]))\n",
|
||||
" tcm = []\n",
|
||||
" spine = []\n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" for i in range(0,25):\n",
|
||||
" spine.append(0)\n",
|
||||
" for k, v in content.items(): \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",
|
||||
" code = phone\n",
|
||||
" dict1.setdefault(code,{})\n",
|
||||
" dict1[code]['name'] = content['name']\n",
|
||||
" if content['gender'] == 'male':\n",
|
||||
" dict1[code]['sex'] = '男'\n",
|
||||
" else:\n",
|
||||
" dict1[code]['sex'] = '女'\n",
|
||||
" dict1[code]['birth'] = str(content['birth'])+'-01'\n",
|
||||
" dict1[code]['unit'] = '采油工艺研究院'\n",
|
||||
" dict1[code]['tcm'] = tcm \n",
|
||||
" dict1[code]['spine'] = spine\n",
|
||||
" \n",
|
||||
"filename = 'data/result_新疆油田-2511.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print(len(dict1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3a7bc501-6739-4b74-90f6-21066de637e2",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成问卷报告"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "cdbeb2f8-2784-4688-806a-6506799941cb",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T02:20:43.542803Z",
|
||||
"iopub.status.busy": "2025-11-06T02:20:43.542192Z",
|
||||
"iopub.status.idle": "2025-11-06T02:20:50.673104Z",
|
||||
"shell.execute_reply": "2025-11-06T02:20:50.671961Z",
|
||||
"shell.execute_reply.started": "2025-11-06T02:20:43.542746Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"27\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",
|
||||
"list1 = []\n",
|
||||
"file_path ='./新疆油田-2511/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
"for k, v in dict1.items():\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'] = 60\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",
|
||||
" list2.append([k,v['name']])\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": "code",
|
||||
"execution_count": null,
|
||||
"id": "8564de3a-1511-4a79-9ec3-32aea03595c7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ce7a7798-b8b7-4564-9e17-3e9c2d4565d8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 体测人员导入"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "270e8c57-36d3-476c-8c50-4d8bc38a918a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T02:09:01.530591Z",
|
||||
"iopub.status.busy": "2025-11-07T02:09:01.529883Z",
|
||||
"iopub.status.idle": "2025-11-07T02:09:01.667299Z",
|
||||
"shell.execute_reply": "2025-11-07T02:09:01.666813Z",
|
||||
"shell.execute_reply.started": "2025-11-07T02:09:01.530529Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1287 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",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0] \n",
|
||||
" dict1['unit'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['phone'] = str(sheet.cell(n, 7).value)\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/沧州炼化人员.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print(len(person),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "829d9460-a14e-4689-a7c4-d00bbd8c2e32",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T02:21:14.683211Z",
|
||||
"iopub.status.busy": "2025-11-07T02:21:14.682609Z",
|
||||
"iopub.status.idle": "2025-11-07T02:21:14.839810Z",
|
||||
"shell.execute_reply": "2025-11-07T02:21:14.839319Z",
|
||||
"shell.execute_reply.started": "2025-11-07T02:21:14.683158Z"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
"list1 = []\n",
|
||||
"list2 = []\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" if code not in list1:\n",
|
||||
" list1.append(code)\n",
|
||||
" else:\n",
|
||||
" list2.append(code)\n",
|
||||
"list3 = []\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" if code in list2:\n",
|
||||
" list4 = [code,sheet.cell(n, 4).value,sheet.cell(n, 3).value]\n",
|
||||
" list3.append(list4)\n",
|
||||
"filename = 'data/沧州炼化编号重复人员.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"\n",
|
||||
"for row in list3:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6c1cfb7b-7252-49ff-97f9-399b658ddf38",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
+176
-84
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user