This commit is contained in:
512song committed 2025-11-17 22:46:37 +08:00
1 parent 48f119d087
commit 31ddcb887f
9 files changed
+1089 -276

No files matched your search

+29 -45
View File
@@ -690,11 +690,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_镇海2025-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 ='./镇海石化2025/'\n",
"file_path ='./北海炼化2025-1/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -703,9 +703,9 @@
" mydata = {}\n",
" \n",
" #id = str(k).rjust(8,\"0\")\n",
" id = str(k)\n",
" id = str(k).rjust(4,\"0\")\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",
@@ -732,8 +732,8 @@
" 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",
" 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",
@@ -915,19 +915,19 @@
"import glob\n",
"from pathlib import Path\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
"new_path = 'file/镇海石化2025'\n",
"fi_path = '/home/songyi/pdf-typescript-old2/北海炼化2025'\n",
"new_path = 'file/北海炼化2025'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/result_镇海2025-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 = fi_name \n",
" code = str(int(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",
@@ -946,15 +946,15 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 18,
"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"
"iopub.execute_input": "2025-11-17T14:25:08.413467Z",
"iopub.status.busy": "2025-11-17T14:25:08.412602Z",
"iopub.status.idle": "2025-11-17T14:25:08.498336Z",
"shell.execute_reply": "2025-11-17T14:25:08.497785Z",
"shell.execute_reply.started": "2025-11-17T14:25:08.413400Z"
},
"tags": []
},
@@ -974,9 +974,9 @@
"from pathlib import Path\n",
"import openpyxl\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript-old2/镇海石化2025'\n",
"fi_path = '/home/songyi/pdf-typescript-old2/北海炼化2025'\n",
"\n",
"filename = 'data/result_镇海2025-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",
@@ -985,14 +985,14 @@
"for fn in fls:\n",
" list2 = []\n",
" fi_name =Path(fn).stem.split('-')[0] \n",
" code = fi_name\n",
" code = str(int(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/2025年镇海石化体测报告明细表.xlsx'\n",
"filename = 'data/2025年北海炼化体测报告明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -1656,7 +1656,7 @@
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"filename = 'data/result_镇海2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
@@ -1709,7 +1709,7 @@
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
" if len(mydata['fits']) >2:\n",
" dict2[str(k)] = mydata\n",
"filename = f'data/data_胜利采油厂.json'\n",
"filename = f'data/data_镇海2025.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print(len(dict2)) "
@@ -1735,7 +1735,7 @@
"import json\n",
"\n",
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"filename = 'data/data_胜利采油厂.json'\n",
"filename = 'data/data_镇海2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -2108,7 +2108,7 @@
" score = 0\n",
" n = 0\n",
" for k, v in dict1.items():\n",
" if item == v['unit'] and v['sex'] == '男':\n",
" if item == v['unit'] and v['sex'] == '女':\n",
" score = score + v['score']\n",
" n = n +1 \n",
" if n>0:\n",
@@ -2175,7 +2175,7 @@
"import json\n",
"\n",
"items = ['BMI','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数'] \n",
"filename = 'data/data_宁夏能化人员.json'\n",
"filename = 'data/data_镇海2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
@@ -2222,17 +2222,9 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-14T05:36:30.068876Z",
"iopub.status.busy": "2025-11-14T05:36:30.068084Z",
"iopub.status.idle": "2025-11-14T05:36:30.079053Z",
"shell.execute_reply": "2025-11-14T05:36:30.078052Z",
"shell.execute_reply.started": "2025-11-14T05:36:30.068800Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -2584,17 +2576,9 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-14T05:36:39.675837Z",
"iopub.status.busy": "2025-11-14T05:36:39.675165Z",
"iopub.status.idle": "2025-11-14T05:36:39.706916Z",
"shell.execute_reply": "2025-11-14T05:36:39.706427Z",
"shell.execute_reply.started": "2025-11-14T05:36:39.675772Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",