This commit is contained in:
512song committed 2025-06-23 18:07:05 +08:00
1 parent 926edeed0a
commit 678a2c983d
4 files changed
+733 -198

No files matched your search

+229 -25
View File
@@ -3,7 +3,9 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "b6ce4321-f82a-4d9d-a110-44a23b95970b", "id": "b6ce4321-f82a-4d9d-a110-44a23b95970b",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [ "source": [
"# 2023年体质检测" "# 2023年体质检测"
] ]
@@ -1295,15 +1297,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 1,
"id": "3e6da1e5-4b4e-448a-9663-815372da636b", "id": "3e6da1e5-4b4e-448a-9663-815372da636b",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-13T03:27:04.981862Z", "iopub.execute_input": "2025-06-20T07:00:42.285453Z",
"iopub.status.busy": "2025-06-13T03:27:04.981235Z", "iopub.status.busy": "2025-06-20T07:00:42.285034Z",
"iopub.status.idle": "2025-06-13T03:27:05.072701Z", "iopub.status.idle": "2025-06-20T07:00:42.566814Z",
"shell.execute_reply": "2025-06-13T03:27:05.072214Z", "shell.execute_reply": "2025-06-20T07:00:42.566337Z",
"shell.execute_reply.started": "2025-06-13T03:27:04.981836Z" "shell.execute_reply.started": "2025-06-20T07:00:42.285425Z"
} }
}, },
"outputs": [ "outputs": [
@@ -1405,15 +1407,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 2,
"id": "d07d132b-dd74-458d-af0c-6a6ae005ad3a", "id": "d07d132b-dd74-458d-af0c-6a6ae005ad3a",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-13T03:27:18.479485Z", "iopub.execute_input": "2025-06-20T07:01:09.689108Z",
"iopub.status.busy": "2025-06-13T03:27:18.478877Z", "iopub.status.busy": "2025-06-20T07:01:09.688292Z",
"iopub.status.idle": "2025-06-13T03:27:18.509731Z", "iopub.status.idle": "2025-06-20T07:01:09.724466Z",
"shell.execute_reply": "2025-06-13T03:27:18.509101Z", "shell.execute_reply": "2025-06-20T07:01:09.724012Z",
"shell.execute_reply.started": "2025-06-13T03:27:18.479432Z" "shell.execute_reply.started": "2025-06-20T07:01:09.689036Z"
} }
}, },
"outputs": [ "outputs": [
@@ -1455,15 +1457,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 3,
"id": "971d592d-9ff5-4758-af68-2f60a986c2a2", "id": "971d592d-9ff5-4758-af68-2f60a986c2a2",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-13T03:27:29.624787Z", "iopub.execute_input": "2025-06-20T07:01:12.924286Z",
"iopub.status.busy": "2025-06-13T03:27:29.623200Z", "iopub.status.busy": "2025-06-20T07:01:12.923570Z",
"iopub.status.idle": "2025-06-13T03:27:29.651956Z", "iopub.status.idle": "2025-06-20T07:01:12.944059Z",
"shell.execute_reply": "2025-06-13T03:27:29.651402Z", "shell.execute_reply": "2025-06-20T07:01:12.943647Z",
"shell.execute_reply.started": "2025-06-13T03:27:29.624721Z" "shell.execute_reply.started": "2025-06-20T07:01:12.924217Z"
} }
}, },
"outputs": [ "outputs": [
@@ -1582,6 +1584,123 @@
"wb.save(filename)" "wb.save(filename)"
] ]
}, },
{
"cell_type": "markdown",
"id": "1fb920d9-2a09-45cf-80e8-0e2dfe7da4c2",
"metadata": {},
"source": [
"## 导入问卷信息"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "9108c394-577f-451a-975c-e1e1cf8b4daf",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-23T03:24:33.496466Z",
"iopub.status.busy": "2025-06-23T03:24:33.495720Z",
"iopub.status.idle": "2025-06-23T03:24:33.522545Z",
"shell.execute_reply": "2025-06-23T03:24:33.522082Z",
"shell.execute_reply.started": "2025-06-23T03:24:33.496392Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"#import my_module as My\n",
"\n",
"dict1 = {}\n",
"filename = 'data/result_东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"filename = 'data/东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict3 = json.load(fl)\n",
"\n",
"phone = {}\n",
"for k,v in dict3.items():\n",
" if 'phone' in v.keys():\n",
" phone[str(v['phone'])] = k\n",
"\n",
"list1 = []\n",
"filename = 'data/survey_records_20250623.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",
"#print(list1)\n",
"dict2 = {}\n",
"psy =[]\n",
"tcm = []\n",
"spine = []\n",
"for i in range(0,44):\n",
" psy.append(0)\n",
"\n",
"for i in range(0,60):\n",
" tcm.append(0)\n",
"for i in range(0,26):\n",
" spine.append(0)\n",
"i= 1\n",
"for item in list1:\n",
" if item[3] in phone.keys():\n",
" psy =[]\n",
" tcm = []\n",
" spine = []\n",
" for i in range(0,44):\n",
" psy.append(0)\n",
" psy.append([])\n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" for i in range(0,26):\n",
" spine.append(0)\n",
" \n",
" content = json.loads(item[4])\n",
" if phone[item[3]] not in dict1.keys():\n",
" dict1[phone[item[3]]] = dict3[phone[item[3]]]\n",
" rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n",
" #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
" else:\n",
" rq = date.fromisoformat('2025-06-23')\n",
" for k, v in content.items():\n",
" if 'psy' in k:\n",
" i = int(k[3:])\n",
" psy[i-1] = int(v)\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",
" if 'psy' in item[4]:\n",
" #for i in range(5,26):\n",
" # new_valve = 5-psy[i]\n",
" # psy[i] = new_valve\n",
" \n",
" \n",
" dict1[phone[item[3]]]['psy'] = psy\n",
" if 'tcm' in item[4]:\n",
" dict1[phone[item[3]]]['tcm'] = tcm\n",
" if 'spine' in item[4]:\n",
" dict1[phone[item[3]]]['spine'] = spine\n",
" birth = date.fromisoformat(dict3[phone[item[3]]]['birth'].replace('/','-'))\n",
" \n",
" days = (rq-birth).days \n",
" dict1[phone[item[3]]]['age'] = int(days/365)\n",
" dict1[phone[item[3]]]['month'] = int(days/365*12)\n",
" \n",
"\n",
"filename = 'data/result_东营石油工程设计院2025-1.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"#print(data1[1])"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "1f2c3e94-e14b-4c68-b5c7-a71b95fc2f86", "id": "1f2c3e94-e14b-4c68-b5c7-a71b95fc2f86",
@@ -1596,11 +1715,11 @@
"id": "cf15813a-02de-4dc9-95fe-912d9a5d9025", "id": "cf15813a-02de-4dc9-95fe-912d9a5d9025",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-09T08:14:41.869403Z", "iopub.execute_input": "2025-06-20T07:01:28.279760Z",
"iopub.status.busy": "2025-06-09T08:14:41.868754Z", "iopub.status.busy": "2025-06-20T07:01:28.279048Z",
"iopub.status.idle": "2025-06-09T08:16:55.156384Z", "iopub.status.idle": "2025-06-20T07:03:42.883383Z",
"shell.execute_reply": "2025-06-09T08:16:55.155379Z", "shell.execute_reply": "2025-06-20T07:03:42.882115Z",
"shell.execute_reply.started": "2025-06-09T08:14:41.869343Z" "shell.execute_reply.started": "2025-06-20T07:01:28.279692Z"
} }
}, },
"outputs": [ "outputs": [
@@ -1676,8 +1795,93 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 13,
"id": "a7eb6a67-a31d-43cf-a44b-8c36c4686de4", "id": "a7eb6a67-a31d-43cf-a44b-8c36c4686de4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-23T03:24:39.379408Z",
"iopub.status.busy": "2025-06-23T03:24:39.378752Z",
"iopub.status.idle": "2025-06-23T03:24:40.314206Z",
"shell.execute_reply": "2025-06-23T03:24:40.313653Z",
"shell.execute_reply.started": "2025-06-23T03:24:39.379350Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'path': './东营石油设计院2025-1/0263-周翠娟.pdf', 'title': '东营石油设计院', 'subtitle': '档案管理中心', 'id': '0263', 'name': '周翠娟', 'gender': 'female', 'month': 468, 'fits': {'lung': {'mark': '2737', 'score': 4}, 'grip': {'mark': '26.4', 'score': 2}, 'flexion': {'mark': '18.6', 'score': 4}, 'jump': {'mark': '22.8', 'score': 4}, 'balance': {'mark': '66.8', 'score': 5}, 'reaction': {'mark': '0.423', 'score': 5}, 'situp': {'mark': '25', 'score': 5}, 'bmi': {'mark': '166.3,57.1', 'score': 5}}, 'surveys': {'tcm': [4, 4, 1, 3, 1, 5, 2, 2, 2, 1, 3, 1, 3, 3, 3, 3, 1, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 2, 2, 1, 4, 1, 3, 2, 2, 3, 1, 1, 1, 1, 4, 4, 1, 3], 'psy': [6, 7, 7, 7, 7, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 3, 2, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, []], 'spine': [2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 0, 2, 1, 2, 2]}}\n",
"1\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_东营石油工程设计院2025-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./东营石油设计院2025-1/'\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'] = 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 'surveys' in mydata.keys():\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": "be1fbc81-363c-41cc-8ede-63100002ef1c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
+37 -37
View File
@@ -10,15 +10,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 13,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731", "id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-18T03:26:12.021116Z", "iopub.execute_input": "2025-06-20T10:47:35.704078Z",
"iopub.status.busy": "2025-06-18T03:26:12.020644Z", "iopub.status.busy": "2025-06-20T10:47:35.703306Z",
"iopub.status.idle": "2025-06-18T03:26:12.049270Z", "iopub.status.idle": "2025-06-20T10:47:35.731176Z",
"shell.execute_reply": "2025-06-18T03:26:12.048820Z", "shell.execute_reply": "2025-06-20T10:47:35.730652Z",
"shell.execute_reply.started": "2025-06-18T03:26:12.021068Z" "shell.execute_reply.started": "2025-06-20T10:47:35.704005Z"
}, },
"tags": [] "tags": []
}, },
@@ -27,7 +27,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"73 ok\n" "79 ok\n"
] ]
} }
], ],
@@ -50,7 +50,8 @@
" dict1['unit'] = sheet.cell(n, 2).value\n", " dict1['unit'] = sheet.cell(n, 2).value\n",
" #dict1['sub_unit'] = sheet.cell(n, 6).value\n", " #dict1['sub_unit'] = sheet.cell(n, 6).value\n",
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0]\n", " dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0]\n",
" dict1['phone'] = sheet.cell(n,6).value\n", " if sheet.cell(n,6).value is not None:\n",
" dict1['phone'] = sheet.cell(n,6).value\n",
" person[code] = dict1\n", " person[code] = dict1\n",
"filename = 'data/东营胜利宾馆人员.json'\n", "filename = 'data/东营胜利宾馆人员.json'\n",
"with open(filename, 'w') as fl:\n", "with open(filename, 'w') as fl:\n",
@@ -121,15 +122,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 17,
"id": "970e171e-1360-448f-a28c-520ccb8f314a", "id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-18T01:40:54.605859Z", "iopub.execute_input": "2025-06-20T10:51:01.494775Z",
"iopub.status.busy": "2025-06-18T01:40:54.605169Z", "iopub.status.busy": "2025-06-20T10:51:01.494058Z",
"iopub.status.idle": "2025-06-18T01:40:54.711625Z", "iopub.status.idle": "2025-06-20T10:51:01.506744Z",
"shell.execute_reply": "2025-06-18T01:40:54.711049Z", "shell.execute_reply": "2025-06-20T10:51:01.505991Z",
"shell.execute_reply.started": "2025-06-18T01:40:54.605797Z" "shell.execute_reply.started": "2025-06-20T10:51:01.494710Z"
}, },
"tags": [] "tags": []
}, },
@@ -138,7 +139,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"1690\n" "70\n"
] ]
} }
], ],
@@ -149,14 +150,14 @@
"from datetime import date\n", "from datetime import date\n",
"import my_module as My\n", "import my_module as My\n",
"\n", "\n",
"filename = 'data/宁夏能化人员.json'\n", "filename = 'data/东营胜利宾馆人员.json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
"filename = 'data/marks_20250618.csv'\n", "filename = 'data/marks_20250620.csv'\n",
"re_ta = My.get_result(filename,dict1)\n", "re_ta = My.get_result(filename,dict1)\n",
"\n", "\n",
"\n", "\n",
"filename = 'data/result_宁夏能化人员.json'\n", "filename = 'data/result_东营胜利宾馆.json'\n",
"with open(filename,'w') as fl:\n", "with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n", " json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))" "print(len(re_ta))"
@@ -172,15 +173,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 18,
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-18T01:41:01.815005Z", "iopub.execute_input": "2025-06-20T10:51:03.742479Z",
"iopub.status.busy": "2025-06-18T01:41:01.814285Z", "iopub.status.busy": "2025-06-20T10:51:03.741782Z",
"iopub.status.idle": "2025-06-18T01:41:01.908319Z", "iopub.status.idle": "2025-06-20T10:51:03.759950Z",
"shell.execute_reply": "2025-06-18T01:41:01.907777Z", "shell.execute_reply": "2025-06-20T10:51:03.759128Z",
"shell.execute_reply.started": "2025-06-18T01:41:01.814939Z" "shell.execute_reply.started": "2025-06-20T10:51:03.742415Z"
} }
}, },
"outputs": [ "outputs": [
@@ -199,7 +200,7 @@
"\n", "\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','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_宁夏能化人员.json'\n", "filename = 'data/result_东营胜利宾馆.json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n", " dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n", "for k, v in dict2.items():\n",
@@ -222,7 +223,7 @@
" dict2[k][item_en]['score'] = My.cal_score(data1)\n", " dict2[k][item_en]['score'] = My.cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n", " #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n", "\n",
"filename = f'data/result_宁夏能化人员.json'\n", "filename = f'data/result_东营胜利宾馆.json'\n",
"with open(filename,'w') as fl:\n", "with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n", " json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') " "print('ok!') "
@@ -238,15 +239,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 19,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2025-06-18T01:41:10.410077Z", "iopub.execute_input": "2025-06-20T10:51:06.440772Z",
"iopub.status.busy": "2025-06-18T01:41:10.409472Z", "iopub.status.busy": "2025-06-20T10:51:06.440201Z",
"iopub.status.idle": "2025-06-18T01:41:10.837219Z", "iopub.status.idle": "2025-06-20T10:51:06.470414Z",
"shell.execute_reply": "2025-06-18T01:41:10.836678Z", "shell.execute_reply": "2025-06-20T10:51:06.469898Z",
"shell.execute_reply.started": "2025-06-18T01:41:10.410021Z" "shell.execute_reply.started": "2025-06-20T10:51:06.440747Z"
}, },
"tags": [] "tags": []
}, },
@@ -258,22 +259,21 @@
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n", "\n",
"filename = 'data/result_宁夏能化人员.json'\n", "filename = 'data/result_东营胜利宾馆.json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n", " dict1 = json.load(fl)\n",
"\n", "\n",
"filename = 'data/宁夏能化人员.json'\n", "filename = 'data/东营胜利宾馆人员.json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n", " dict2 = json.load(fl)\n",
" \n", " \n",
"list1 = []\n", "list1 = []\n",
"for k, v in dict1.items():\n", "for k, v in dict1.items():\n",
" list2 = []\n", " list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n", " list2.append(str(k).rjust(6,'0'))\n",
" list2.append(v['name']) \n", " list2.append(v['name']) \n",
" list2.append(dict2[k]['sex'])\n", " list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['unit'])\n", " list2.append(dict2[k]['unit'])\n",
" list2.append(dict2[k]['sub_unit'])\n",
" if 'bmi' in v.keys():\n", " if 'bmi' in v.keys():\n",
" height = v['bmi']['成绩'].split(',')[0]\n", " height = v['bmi']['成绩'].split(',')[0]\n",
" weight = v['bmi']['成绩'].split(',')[1]\n", " weight = v['bmi']['成绩'].split(',')[1]\n",
@@ -291,7 +291,7 @@
" list2.append('')\n", " list2.append('')\n",
" \n", " \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/宁夏能化测试情况明细表.xlsx'\n", "filename = 'data/东营胜利宾馆测试情况明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
+272 -25
View File
@@ -391,16 +391,32 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 13,
"id": "d6498431-2103-4d27-bba9-f1669b710361", "id": "d6498431-2103-4d27-bba9-f1669b710361",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2025-06-20T10:23:26.493123Z",
"iopub.status.busy": "2025-06-20T10:23:26.492405Z",
"iopub.status.idle": "2025-06-20T10:23:26.517341Z",
"shell.execute_reply": "2025-06-20T10:23:26.516599Z",
"shell.execute_reply.started": "2025-06-20T10:23:26.493058Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('141002','648960','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','570566','pushup','23','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491887','pushup','6','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','574298','pushup','17','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491960','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491662','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','575445','pushup','43','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','560212','pushup','40','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491851','pushup','11','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491871','pushup','17','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491724','pushup','13','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','573863','pushup','16','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','701505','pushup','15','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491852','pushup','44','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491792','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491628','pushup','5','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491730','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491857','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491909','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491644','pushup','1','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491659','pushup','21','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491991','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','567279','pushup','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491979','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491815','pushup','5','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','570113','pushup','51','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','697697','pushup','28','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491842','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491638','situp','24','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491797','situp','18','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491837','situp','18','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491964','situp','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491701','situp','23','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491634','situp','16','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491929','situp','7','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491873','situp','11','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491947','situp','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491816','situp','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491664','situp','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491715','situp','22','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491896','situp','11','2025-06-20','2025-06-20 19:00:00.000 +0800')\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
"\n", "\n",
"\n", "\n",
"wb = openpyxl.load_workbook('data/手工数据2.xlsx',data_only=True)\n", "wb = openpyxl.load_workbook('data/手工数据3.xlsx',data_only=True)\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"s = ''\n", "s = ''\n",
"list1 = []\n", "list1 = []\n",
@@ -1552,10 +1568,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842", "id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2025-06-20T07:02:57.467110Z",
"iopub.status.busy": "2025-06-20T07:02:57.466845Z",
"iopub.status.idle": "2025-06-20T07:02:57.734080Z",
"shell.execute_reply": "2025-06-20T07:02:57.733499Z",
"shell.execute_reply.started": "2025-06-20T07:02:57.467082Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"245\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import openpyxl\n", "import openpyxl\n",
@@ -1630,12 +1662,29 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb", "id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:03:02.456319Z",
"iopub.status.busy": "2025-06-20T07:03:02.455985Z",
"iopub.status.idle": "2025-06-20T07:03:02.466008Z",
"shell.execute_reply": "2025-06-20T07:03:02.465278Z",
"shell.execute_reply.started": "2025-06-20T07:03:02.456291Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"平均成绩:2.8648分,男性:149人\n",
"平均成绩:3.347分,女性:96人\n",
"平均成绩:3.0537分,总体:245人\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"\n", "\n",
@@ -1674,12 +1723,32 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 4,
"id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1", "id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:18:09.278839Z",
"iopub.status.busy": "2025-06-20T07:18:09.278136Z",
"iopub.status.idle": "2025-06-20T07:18:09.306423Z",
"shell.execute_reply": "2025-06-20T07:18:09.305900Z",
"shell.execute_reply.started": "2025-06-20T07:18:09.278775Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0~255分人数:45人,男性:38人,女性:7人\n",
"256~332分人数:117人,男性:81人,女性:36人\n",
"333~367分人数:52人,男性:24人,女性:28人\n",
"368~500分人数:31人,男性:6人,女性:25人\n",
"245\n",
"ok\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"\n", "\n",
@@ -1725,12 +1794,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"id": "2d661ca6-6129-4da1-ac25-51d0156babb2", "id": "2d661ca6-6129-4da1-ac25-51d0156babb2",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:21:51.234293Z",
"iopub.status.busy": "2025-06-20T07:21:51.233818Z",
"iopub.status.idle": "2025-06-20T07:21:51.247599Z",
"shell.execute_reply": "2025-06-20T07:21:51.246811Z",
"shell.execute_reply.started": "2025-06-20T07:21:51.234246Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 1, '不合格': 0, '优秀': 0, '良好': 1}\n",
"25-29 {'不合格': 3, '合格': 9, '良好': 5}\n",
"30-34 {'合格': 7, '不合格': 3, '良好': 3, '优秀': 3}\n",
"35-39 {'合格': 8, '不合格': 0, '良好': 5, '优秀': 7}\n",
"40-44 {'优秀': 5, '合格': 8, '良好': 2, '不合格': 1}\n",
"45-49 {'合格': 3, '良好': 5, '优秀': 7, '不合格': 0}\n",
"50-54 {'合格': 0, '良好': 7, '优秀': 1, '不合格': 0}\n",
"55-80 {'合格': 0, '优秀': 2, '不合格': 0}\n"
]
}
],
"source": [ "source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n", "\n",
@@ -1770,12 +1861,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 6,
"id": "fc97df37-34ff-4a02-9d26-b5d81b706e46", "id": "fc97df37-34ff-4a02-9d26-b5d81b706e46",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:22:47.684882Z",
"iopub.status.busy": "2025-06-20T07:22:47.684089Z",
"iopub.status.idle": "2025-06-20T07:22:47.694069Z",
"shell.execute_reply": "2025-06-20T07:22:47.693102Z",
"shell.execute_reply.started": "2025-06-20T07:22:47.684812Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 5, '不合格': 2, '优秀': 1, '良好': 0}\n",
"25-29 {'不合格': 18, '合格': 18, '良好': 4}\n",
"30-34 {'合格': 7, '不合格': 5, '良好': 3, '优秀': 0}\n",
"35-39 {'合格': 18, '不合格': 5, '良好': 4, '优秀': 2}\n",
"40-44 {'优秀': 0, '合格': 11, '良好': 5, '不合格': 3}\n",
"45-49 {'合格': 5, '良好': 3, '优秀': 2, '不合格': 2}\n",
"50-54 {'合格': 10, '良好': 5, '优秀': 1, '不合格': 2}\n",
"55-80 {'合格': 7, '优秀': 0, '不合格': 1}\n"
]
}
],
"source": [ "source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n", "\n",
@@ -1815,12 +1928,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 7,
"id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5", "id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:23:11.398803Z",
"iopub.status.busy": "2025-06-20T07:23:11.398178Z",
"iopub.status.idle": "2025-06-20T07:23:11.412257Z",
"shell.execute_reply": "2025-06-20T07:23:11.411707Z",
"shell.execute_reply.started": "2025-06-20T07:23:11.398743Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16~24岁平均成绩:2.83分,人数:10人,男性:8人\n",
"25~29岁平均成绩:2.74分,人数:57人,男性:40人\n",
"30~34岁平均成绩:2.99分,人数:31人,男性:15人\n",
"35~39岁平均成绩:3.17分,人数:49人,男性:29人\n",
"40~44岁平均成绩:3.18分,人数:35人,男性:19人\n",
"45~49岁平均成绩:3.33分,人数:27人,男性:12人\n",
"50~54岁平均成绩:3.19分,人数:26人,男性:18人\n",
"55~69岁平均成绩:3.1分,人数:10人,男性:8人\n"
]
}
],
"source": [ "source": [
"nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
"\n", "\n",
@@ -1855,12 +1990,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 8,
"id": "347703a1-501b-4800-bd29-16e94f4a6793", "id": "347703a1-501b-4800-bd29-16e94f4a6793",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:24:33.635096Z",
"iopub.status.busy": "2025-06-20T07:24:33.634402Z",
"iopub.status.idle": "2025-06-20T07:24:33.651087Z",
"shell.execute_reply": "2025-06-20T07:24:33.649880Z",
"shell.execute_reply.started": "2025-06-20T07:24:33.635035Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:2.76分,人数:8人\n",
"25~29岁平均成绩:2.65分,人数:40人\n",
"30~34岁平均成绩:2.79分,人数:15人\n",
"35~39岁平均成绩:2.94分,人数:29人\n",
"40~44岁平均成绩:2.99分,人数:19人\n",
"45~49岁平均成绩:3.06分,人数:12人\n",
"50~54岁平均成绩:3.06分,人数:18人\n",
"55~80岁平均成绩:2.86分,人数:8人\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"\n", "\n",
@@ -1895,12 +2052,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 9,
"id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d", "id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:25:13.064370Z",
"iopub.status.busy": "2025-06-20T07:25:13.063575Z",
"iopub.status.idle": "2025-06-20T07:25:13.078290Z",
"shell.execute_reply": "2025-06-20T07:25:13.077372Z",
"shell.execute_reply.started": "2025-06-20T07:25:13.064296Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:3.1分,人数:2人\n",
"25~29岁平均成绩:2.96分,人数:17人\n",
"30~34岁平均成绩:3.18分,人数:16人\n",
"35~39岁平均成绩:3.51分,人数:20人\n",
"40~44岁平均成绩:3.41分,人数:16人\n",
"45~49岁平均成绩:3.54分,人数:15人\n",
"50~54岁平均成绩:3.5分,人数:8人\n",
"55~80岁平均成绩:4.05分,人数:2人\n"
]
}
],
"source": [ "source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n", "\n",
@@ -1933,12 +2112,36 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 11,
"id": "ad69c45d-3f62-42df-894d-47424e759029", "id": "ad69c45d-3f62-42df-894d-47424e759029",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:27:00.500978Z",
"iopub.status.busy": "2025-06-20T07:27:00.500308Z",
"iopub.status.idle": "2025-06-20T07:27:00.512882Z",
"shell.execute_reply": "2025-06-20T07:27:00.511833Z",
"shell.execute_reply.started": "2025-06-20T07:27:00.500920Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BMI 3.52 245\n",
"肺活量 3.84 245\n",
"握力 2.16 245\n",
"坐位体前屈 2.64 240\n",
"纵跳 2.95 243\n",
"俯卧撑 3.56 143\n",
"一分钟仰卧起坐 4.18 89\n",
"单脚站立 2.77 245\n",
"选择反应时 3.46 245\n",
"台阶指数 2.36 231\n"
]
}
],
"source": [ "source": [
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
@@ -1963,12 +2166,56 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 12,
"id": "dcf152e7-bbcc-47d1-9c5f-83854db35412", "id": "dcf152e7-bbcc-47d1-9c5f-83854db35412",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-20T07:27:51.081316Z",
"iopub.status.busy": "2025-06-20T07:27:51.080661Z",
"iopub.status.idle": "2025-06-20T07:27:51.092225Z",
"shell.execute_reply": "2025-06-20T07:27:51.091127Z",
"shell.execute_reply.started": "2025-06-20T07:27:51.081252Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"管道工程设计所 2.96 30\n",
"勘察与地下工程事业部 2.87 21\n",
"电力设计所 3.03 13\n",
"注水及水处理工艺设计所 2.98 11\n",
"油气工艺设计所 2.81 20\n",
"机械设备设计所 3.08 8\n",
"集成设计中心 2.78 12\n",
"经营管理部 2.44 1\n",
"技术发展中心 2.98 6\n",
"党群工作部 3.67 1\n",
"财务资产部 3.64 5\n",
"智能化研究中心 3.29 21\n",
"建筑设计所 3.33 14\n",
"档案管理中心 3.37 8\n",
"综合服务中心 3.04 8\n",
"绿色低碳技术研究中心 3.03 8\n",
"控制部 3.12 6\n",
"党委组织部(人力资源部) 3.11 1\n",
"工程监理公司 3.2 6\n",
"施工管理部 3.04 5\n",
"物资装备管理中心 3.47 4\n",
"海洋工程设计所 2.78 9\n",
"国际工程管理部 2.89 1\n",
"自控通信设计所 3.05 12\n",
"法律合规部 3.59 3\n",
"工程造价中心 3.04 7\n",
"运行管理部 3.0 1\n",
"纪检监督部 3.33 1\n",
"项目执行部 3.33 1\n",
"HSE管理部 3.11 1\n"
]
}
],
"source": [ "source": [
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
+195 -111
View File
@@ -10,33 +10,18 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731", "id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-19T04:09:25.167271Z",
"iopub.status.busy": "2025-06-19T04:09:25.166662Z",
"iopub.status.idle": "2025-06-19T04:09:25.402923Z",
"shell.execute_reply": "2025-06-19T04:09:25.402331Z",
"shell.execute_reply.started": "2025-06-19T04:09:25.167211Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"1697 ok\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
"\n", "\n",
"\n", "\n",
"wb = openpyxl.load_workbook('data/宁夏能化人员.xlsx')\n", "wb = openpyxl.load_workbook('data/宁夏能化人员.xlsx',data_only=True)\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"# sheets = wb.sheetnames\n", "# sheets = wb.sheetnames\n",
"person = {}\n", "person = {}\n",
@@ -55,7 +40,7 @@
" else:\n", " else:\n",
" dict1['unit'] = sheet.cell(n, 9).value\n", " dict1['unit'] = sheet.cell(n, 9).value\n",
" \n", " \n",
" dict1['birth'] = sheet.cell(n,5).value\n", " dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n",
" person[code] = dict1\n", " person[code] = dict1\n",
"filename = 'data/宁夏能化人员.json'\n", "filename = 'data/宁夏能化人员.json'\n",
"with open(filename, 'w') as fl:\n", "with open(filename, 'w') as fl:\n",
@@ -111,27 +96,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"id": "970e171e-1360-448f-a28c-520ccb8f314a", "id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-19T04:10:33.526593Z",
"iopub.status.busy": "2025-06-19T04:10:33.525876Z",
"iopub.status.idle": "2025-06-19T04:10:33.640312Z",
"shell.execute_reply": "2025-06-19T04:10:33.639700Z",
"shell.execute_reply.started": "2025-06-19T04:10:33.526529Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"1690\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import datetime\n", "import datetime\n",
@@ -162,26 +132,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
"metadata": { "metadata": {},
"execution": { "outputs": [],
"iopub.execute_input": "2025-06-19T04:10:36.891162Z",
"iopub.status.busy": "2025-06-19T04:10:36.890453Z",
"iopub.status.idle": "2025-06-19T04:10:36.986179Z",
"shell.execute_reply": "2025-06-19T04:10:36.985655Z",
"shell.execute_reply.started": "2025-06-19T04:10:36.891096Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import time\n", "import time\n",
@@ -228,16 +182,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-18T01:41:10.410077Z",
"iopub.status.busy": "2025-06-18T01:41:10.409472Z",
"iopub.status.idle": "2025-06-18T01:41:10.837219Z",
"shell.execute_reply": "2025-06-18T01:41:10.836678Z",
"shell.execute_reply.started": "2025-06-18T01:41:10.410021Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -301,17 +248,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 64, "execution_count": null,
"id": "c4b71b0f-0f0c-4962-a540-611cbab51bfa", "id": "c4b71b0f-0f0c-4962-a540-611cbab51bfa",
"metadata": { "metadata": {},
"execution": {
"iopub.execute_input": "2025-06-17T10:59:19.218357Z",
"iopub.status.busy": "2025-06-17T10:59:19.217982Z",
"iopub.status.idle": "2025-06-17T10:59:19.259352Z",
"shell.execute_reply": "2025-06-17T10:59:19.258768Z",
"shell.execute_reply.started": "2025-06-17T10:59:19.218320Z"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"import json\n", "import json\n",
@@ -359,16 +298,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 66, "execution_count": null,
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15", "id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2025-06-17T11:02:38.842412Z",
"iopub.status.busy": "2025-06-17T11:02:38.841860Z",
"iopub.status.idle": "2025-06-17T11:02:38.879864Z",
"shell.execute_reply": "2025-06-17T11:02:38.879320Z",
"shell.execute_reply.started": "2025-06-17T11:02:38.842360Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -417,17 +349,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 65, "execution_count": null,
"id": "61dde8c3-844a-4016-8952-cb726ab5f61d", "id": "61dde8c3-844a-4016-8952-cb726ab5f61d",
"metadata": { "metadata": {},
"execution": {
"iopub.execute_input": "2025-06-17T11:01:30.219475Z",
"iopub.status.busy": "2025-06-17T11:01:30.218747Z",
"iopub.status.idle": "2025-06-17T11:01:30.259871Z",
"shell.execute_reply": "2025-06-17T11:01:30.259320Z",
"shell.execute_reply.started": "2025-06-17T11:01:30.219409Z"
}
},
"outputs": [], "outputs": [],
"source": [ "source": [
"import json\n", "import json\n",
@@ -482,26 +406,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": null,
"id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4", "id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4",
"metadata": { "metadata": {},
"execution": { "outputs": [],
"iopub.execute_input": "2025-06-19T04:34:04.657964Z",
"iopub.status.busy": "2025-06-19T04:34:04.657683Z",
"iopub.status.idle": "2025-06-19T04:48:50.472054Z",
"shell.execute_reply": "2025-06-19T04:48:50.471179Z",
"shell.execute_reply.started": "2025-06-19T04:34:04.657939Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1690\n"
]
}
],
"source": [ "source": [
"import requests\n", "import requests\n",
"import json\n", "import json\n",
@@ -567,7 +475,183 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "87556725-f68a-484b-827c-f6735155e940", "id": "9ffec868-3851-42f6-8431-c5c5d3d15424",
"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_宁夏能化人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./宁夏能化人员/'\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",
" if str(k) =='2019945':\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'] = v['month']\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": "markdown",
"id": "a056e973-b5d2-4130-85bf-1b1f21f53e48",
"metadata": {},
"source": [
"## 体测报告按部门分类"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "59f69be9-ab27-4308-8641-927dbcfda87e",
"metadata": {},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import glob\n",
"from pathlib import Path\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript-old2/宁夏能化人员'\n",
"new_path = 'file/宁夏能化'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/result_宁夏能化人员.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",
" 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",
" #if not os.path.exists(n_name):\n",
" shutil.copyfile(fn,n_name)\n",
" #print(fn)"
]
},
{
"cell_type": "markdown",
"id": "e4d3abe9-707d-4edd-92df-95a5b0fea941",
"metadata": {},
"source": [
"## 生成体测报告打印明细表"
]
},
{
"cell_type": "code",
"execution_count": 11,
"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"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import os,sys,shutil\n",
"import json\n",
"import glob\n",
"from pathlib import Path\n",
"import openpyxl\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript-old2/宁夏能化人员'\n",
"\n",
"filename = 'data/result_宁夏能化人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
"list1 = []\n",
"title = ['测试编号','姓名','性别','部门']\n",
"for fn in fls:\n",
" list2 = []\n",
" fi_name =Path(fn).stem.split('-')[0] \n",
" code = 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/宁夏能化体测报告明细表.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": "code",
"execution_count": null,
"id": "a1907b6f-3ba7-4773-8f6e-6559af18131e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []