This commit is contained in:
512song committed 2024-12-11 18:57:54 +08:00
1 parent 1da757e355
commit 82372feb99
3 files changed
+512 -51

No files matched your search

+106 -26
View File
@@ -497,17 +497,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-11T07:12:20.657211Z",
"iopub.status.busy": "2024-12-11T07:12:20.656910Z",
"iopub.status.idle": "2024-12-11T07:12:20.675619Z",
"shell.execute_reply": "2024-12-11T07:12:20.675056Z",
"shell.execute_reply.started": "2024-12-11T07:12:20.657186Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"\n",
"filename = '../item.json'\n",
"filename = '../item1.json'\n",
"item = {}\n",
"unit = {}\n",
"with open(filename,'r') as fl:\n",
@@ -600,7 +615,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_天津石化2024.json'\n",
"filename = 'data/result_长炼医院人员2024(湖南青年).json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -621,7 +636,7 @@
" dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_天津石化2024.json'\n",
"filename = f'data/result_长炼医院人员2024(湖南青年).json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -637,15 +652,15 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": 8,
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-06T14:42:19.023726Z",
"iopub.status.busy": "2024-12-06T14:42:19.023180Z",
"iopub.status.idle": "2024-12-06T14:49:16.425361Z",
"shell.execute_reply": "2024-12-06T14:49:16.424225Z",
"shell.execute_reply.started": "2024-12-06T14:42:19.023678Z"
"iopub.execute_input": "2024-12-11T07:12:25.035537Z",
"iopub.status.busy": "2024-12-11T07:12:25.034817Z",
"iopub.status.idle": "2024-12-11T07:13:06.145312Z",
"shell.execute_reply": "2024-12-11T07:13:06.144192Z",
"shell.execute_reply.started": "2024-12-11T07:12:25.035471Z"
},
"tags": []
},
@@ -654,7 +669,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"757\n"
"78\n"
]
}
],
@@ -667,11 +682,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_北海炼化2024.json'\n",
"filename = 'data/result_长炼医院人员2024(湖南青年).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./北海炼化2024/'\n",
"file_path ='./长炼医院2024(湖南青年)/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -681,7 +696,7 @@
" \n",
" id = str(k).rjust(4,\"0\")\n",
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
" mydata['title'] = '中国石化北海炼化\\n有限责任公司'\n",
" mydata['title'] = '中石化长岭分公司'\n",
" mydata['subtitle'] = v['unit']\n",
" mydata['id'] = id\n",
" mydata['name'] = v['name']\n",
@@ -708,8 +723,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",
@@ -2367,7 +2382,7 @@
" for i in range(0,6):\n",
" score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n",
" list5.append(score)\n",
" list4.append(list5)\n",
" list4.append(list5)\n",
"filename = 'data/北海炼化心理情况明细表2024.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
@@ -2389,15 +2404,15 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 63,
"id": "122f19fb-3531-4074-94e4-e2afdb8af51a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-06T14:23:42.730508Z",
"iopub.status.busy": "2024-12-06T14:23:42.729973Z",
"iopub.status.idle": "2024-12-06T14:23:42.794427Z",
"shell.execute_reply": "2024-12-06T14:23:42.793835Z",
"shell.execute_reply.started": "2024-12-06T14:23:42.730459Z"
"iopub.execute_input": "2024-12-08T04:21:58.990344Z",
"iopub.status.busy": "2024-12-08T04:21:58.989588Z",
"iopub.status.idle": "2024-12-08T04:21:59.054676Z",
"shell.execute_reply": "2024-12-08T04:21:59.054144Z",
"shell.execute_reply.started": "2024-12-08T04:21:58.990273Z"
}
},
"outputs": [
@@ -2427,7 +2442,7 @@
" score+= spine[ii]\n",
" #print(k,list4[i],int(score/list5[i][2]*100)-100)\n",
" list7.append(int(score/list5[i][2]*100)-100)\n",
" list6.append(list7)\n",
" list6.append(list7)\n",
"filename = 'data/北海炼化脊柱情况明细表2024.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
@@ -2439,10 +2454,75 @@
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "b9d5bad6-4d72-43d7-b86b-55c9b9d33af2",
"metadata": {},
"source": [
"## 导出脊柱明细表"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "1a5a10cb-f6bc-4e3a-83cc-78b9c0cbe994",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-08T04:24:23.871310Z",
"iopub.status.busy": "2024-12-08T04:24:23.870782Z",
"iopub.status.idle": "2024-12-08T04:24:24.037452Z",
"shell.execute_reply": "2024-12-08T04:24:24.036877Z",
"shell.execute_reply.started": "2024-12-08T04:24:23.871259Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]\n",
"filename = 'data/result_北海炼化2024.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list6 = []\n",
"for k, v in dict1.items():\n",
" if 'spine' in v.keys():\n",
" list7 = []\n",
" spine = v['spine']\n",
" list7.append(k)\n",
" list7.append(v['name'])\n",
" list7.append(v['sex'])\n",
" list7.append(v['age'])\n",
" for i in range(0,4):\n",
" score = 0\n",
" for ii in range(list5[i][0],list5[i][1]):\n",
" score+= spine[ii]\n",
" #print(k,list4[i],int(score/list5[i][2]*100)-100)\n",
" list7.append(int(score/list5[i][2]*100)-100)\n",
" for item in v['spine']:\n",
" list7.append(item)\n",
" list6.append(list7)\n",
"filename = 'data/北海炼化脊柱情况明细表2024.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
"for row in list6:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)\n",
"print('ok') "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5912a87a-7b93-4b79-b708-dd23032e97ae",
"id": "1fcca066-04a7-41c1-8c5e-aea251b87250",
"metadata": {},
"outputs": [],
"source": []