This commit is contained in:
512song committed 2025-10-30 08:24:56 +08:00
1 parent a10492f0ad
commit 9ec7907bde
4 files changed
+1062 -1793

No files matched your search

+56 -335
View File
@@ -391,32 +391,16 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": null,
"id": "d6498431-2103-4d27-bba9-f1669b710361",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-02T07:57:16.226394Z",
"iopub.status.busy": "2025-07-02T07:57:16.225723Z",
"iopub.status.idle": "2025-07-02T07:57:16.244956Z",
"shell.execute_reply": "2025-07-02T07:57:16.244165Z",
"shell.execute_reply.started": "2025-07-02T07:57:16.226327Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('345321','1787376','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787128','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789517','pushup','2','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786135','pushup','3','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789748','pushup','3','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3530344','pushup','4','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786084','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788859','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783509','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782462','pushup','5','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788929','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789072','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782596','pushup','6','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780972','pushup','7','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786095','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788116','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783917','pushup','8','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786562','pushup','9','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787804','pushup','9','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782395','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1782049','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783534','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783827','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783263','pushup','10','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540299','pushup','11','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789560','pushup','11','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786102','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788660','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780017','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789307','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788676','pushup','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788744','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786234','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3530368','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1789685','pushup','14','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1785410','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783124','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788788','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788120','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1795937','pushup','15','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786639','pushup','16','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540355','pushup','18','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788685','pushup','19','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3470775','pushup','20','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786153','pushup','21','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566780','pushup','22','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3438972','pushup','28','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566790','pushup','29','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3566668','pushup','29','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786252','pushup','30','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1783259','pushup','31','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3219236','pushup','34','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788226','pushup','40','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788113','pushup','40','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3540363','pushup','47','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786183','pushup','52','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','3502448','pushup','62','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1786259','pushup','101','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787741','situp','12','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1784476','situp','17','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1788718','situp','19','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1785742','situp','24','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1787496','bmi','155.0,65.0','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1780280','bmi','173.0,85.0','2025-07-02','2025-07-02 16:00:00.000 +0800'),('None','1Line truncated
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/手工数据4.xlsx',data_only=True)\n",
"wb = openpyxl.load_workbook('data/镇海手工数据.xlsx',data_only=True)\n",
"sheet = wb.active\n",
"s = ''\n",
"list1 = []\n",
@@ -428,7 +412,7 @@
" list2.append(\"'\"+str(sheet.cell(n, 3).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 4).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 5).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 6).value)+\"'\")\n",
" #list2.append(\"'\"+str(sheet.cell(n, 6).value)+\"'\")\n",
" ss = ','.join(list2)\n",
" list1.append(\"(\"+ss+\")\")\n",
"s = ','.join(list1)\n",
@@ -706,11 +690,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_长炼医院人员2024(湖南青年).json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./长炼医院2024(湖南青年)/'\n",
"file_path ='./胜利采油厂/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -718,9 +702,9 @@
" list1 = []\n",
" mydata = {}\n",
" \n",
" id = str(k).rjust(4,\"0\")\n",
" id = str(k).rjust(8,\"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",
@@ -776,11 +760,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_东营工程设计院2024_all.json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./中石化石油工程设计有限公司/'\n",
"file_path ='./胜利采油厂/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -790,7 +774,7 @@
" \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",
@@ -851,12 +835,12 @@
"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/胜利采油厂'\n",
"new_path = 'file/胜利采油厂'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/result_东营胜利宾馆.json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
@@ -882,27 +866,12 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "02319955-7fb6-4791-ae45-55b03bdadd54",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T02:26:40.883312Z",
"iopub.status.busy": "2025-06-30T02:26:40.882740Z",
"iopub.status.idle": "2025-06-30T02:26:40.906024Z",
"shell.execute_reply": "2025-06-30T02:26:40.905551Z",
"shell.execute_reply.started": "2025-06-30T02:26:40.883256Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
@@ -910,9 +879,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/胜利采油厂'\n",
"\n",
"filename = 'data/result_东营胜利宾馆.json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
@@ -928,7 +897,7 @@
" \n",
" list1.append(list2)\n",
"\n",
"filename = 'data/东营胜利宾馆体测报告明细表.xlsx'\n",
"filename = 'data/胜利采油厂体测报告明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -1583,32 +1552,16 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:25:50.554226Z",
"iopub.status.busy": "2025-06-30T03:25:50.553608Z",
"iopub.status.idle": "2025-06-30T03:25:50.575194Z",
"shell.execute_reply": "2025-06-30T03:25:50.574507Z",
"shell.execute_reply.started": "2025-06-30T03:25:50.554173Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"70\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_东营胜利宾馆.json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
@@ -1661,7 +1614,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_胜利采油厂.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print(len(dict2)) "
@@ -1677,34 +1630,17 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:25:56.345990Z",
"iopub.status.busy": "2025-06-30T03:25:56.345178Z",
"iopub.status.idle": "2025-06-30T03:25:56.355811Z",
"shell.execute_reply": "2025-06-30T03:25:56.354676Z",
"shell.execute_reply.started": "2025-06-30T03:25:56.345906Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"平均成绩:2.8165分,男性:34人\n",
"平均成绩:3.0694分,女性:36人\n",
"平均成绩:2.9466分,总体:70人\n"
]
}
],
"outputs": [],
"source": [
"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_胜利采油厂.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -1738,32 +1674,12 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:26:28.871704Z",
"iopub.status.busy": "2025-06-30T03:26:28.871155Z",
"iopub.status.idle": "2025-06-30T03:26:28.887396Z",
"shell.execute_reply": "2025-06-30T03:26:28.886702Z",
"shell.execute_reply.started": "2025-06-30T03:26:28.871647Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0~255分人数:12人,男性:9人,女性:3人\n",
"256~332分人数:38人,男性:19人,女性:19人\n",
"333~367分人数:16人,男性:5人,女性:11人\n",
"368~500分人数:4人,男性:1人,女性:3人\n",
"70\n",
"ok\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1809,34 +1725,12 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"id": "2d661ca6-6129-4da1-ac25-51d0156babb2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:27:10.453095Z",
"iopub.status.busy": "2025-06-30T03:27:10.452579Z",
"iopub.status.idle": "2025-06-30T03:27:10.463588Z",
"shell.execute_reply": "2025-06-30T03:27:10.462674Z",
"shell.execute_reply.started": "2025-06-30T03:27:10.453043Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {}\n",
"25-29 {}\n",
"30-34 {'合格': 1}\n",
"35-39 {'合格': 5, '良好': 1, '不合格': 1}\n",
"40-44 {'良好': 4, '不合格': 2, '优秀': 1, '合格': 3}\n",
"45-49 {'合格': 9, '优秀': 2, '良好': 5, '不合格': 0}\n",
"50-54 {'合格': 1, '不合格': 0, '优秀': 0, '良好': 1}\n",
"55-80 {'良好': 0, '不合格': 0, '合格': 0}\n"
]
}
],
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1876,34 +1770,12 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": null,
"id": "fc97df37-34ff-4a02-9d26-b5d81b706e46",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:28:43.794940Z",
"iopub.status.busy": "2025-06-30T03:28:43.794179Z",
"iopub.status.idle": "2025-06-30T03:28:43.804569Z",
"shell.execute_reply": "2025-06-30T03:28:43.803453Z",
"shell.execute_reply.started": "2025-06-30T03:28:43.794866Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {}\n",
"25-29 {}\n",
"30-34 {'合格': 1}\n",
"35-39 {'合格': 2, '良好': 0, '不合格': 0}\n",
"40-44 {'良好': 1, '不合格': 0, '优秀': 0, '合格': 2}\n",
"45-49 {'合格': 6, '优秀': 0, '良好': 1, '不合格': 5}\n",
"50-54 {'合格': 6, '不合格': 2, '优秀': 1, '良好': 2}\n",
"55-80 {'良好': 1, '不合格': 2, '合格': 2}\n"
]
}
],
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1943,34 +1815,12 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": null,
"id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:31:08.238140Z",
"iopub.status.busy": "2025-06-30T03:31:08.237468Z",
"iopub.status.idle": "2025-06-30T03:31:08.249928Z",
"shell.execute_reply": "2025-06-30T03:31:08.248854Z",
"shell.execute_reply.started": "2025-06-30T03:31:08.238077Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16~24岁平均成绩:0分,人数:0人,男性:0人\n",
"25~29岁平均成绩:0分,人数:0人,男性:0人\n",
"30~34岁平均成绩:2.73分,人数:2人,男性:1人\n",
"35~39岁平均成绩:2.94分,人数:9人,男性:2人\n",
"40~44岁平均成绩:3.04分,人数:13人,男性:3人\n",
"45~49岁平均成绩:2.95分,人数:28人,男性:12人\n",
"50~54岁平均成绩:3.01分,人数:13人,男性:11人\n",
"55~69岁平均成绩:2.64分,人数:5人,男性:5人\n"
]
}
],
"outputs": [],
"source": [
"nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
"\n",
@@ -2005,34 +1855,12 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": null,
"id": "347703a1-501b-4800-bd29-16e94f4a6793",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:33:02.816587Z",
"iopub.status.busy": "2025-06-30T03:33:02.815993Z",
"iopub.status.idle": "2025-06-30T03:33:02.824768Z",
"shell.execute_reply": "2025-06-30T03:33:02.823787Z",
"shell.execute_reply.started": "2025-06-30T03:33:02.816525Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:0分,人数:0人\n",
"25~29岁平均成绩:0分,人数:0人\n",
"30~34岁平均成绩:2.56分,人数:1人\n",
"35~39岁平均成绩:3.24分,人数:2人\n",
"40~44岁平均成绩:3.18分,人数:3人\n",
"45~49岁平均成绩:2.62分,人数:12人\n",
"50~54岁平均成绩:2.96分,人数:11人\n",
"55~80岁平均成绩:2.64分,人数:5人\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -2067,34 +1895,12 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": null,
"id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:34:15.938497Z",
"iopub.status.busy": "2025-06-30T03:34:15.937943Z",
"iopub.status.idle": "2025-06-30T03:34:15.949638Z",
"shell.execute_reply": "2025-06-30T03:34:15.948577Z",
"shell.execute_reply.started": "2025-06-30T03:34:15.938442Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:0分,人数:0人\n",
"25~29岁平均成绩:0分,人数:0人\n",
"30~34岁平均成绩:2.89分,人数:1人\n",
"35~39岁平均成绩:2.86分,人数:7人\n",
"40~44岁平均成绩:3.0分,人数:10人\n",
"45~49岁平均成绩:3.19分,人数:16人\n",
"50~54岁平均成绩:3.28分,人数:2人\n",
"55~80岁平均成绩:0分,人数:0人\n"
]
}
],
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -2127,36 +1933,12 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": null,
"id": "ad69c45d-3f62-42df-894d-47424e759029",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:38:18.058882Z",
"iopub.status.busy": "2025-06-30T03:38:18.058174Z",
"iopub.status.idle": "2025-06-30T03:38:18.070777Z",
"shell.execute_reply": "2025-06-30T03:38:18.069764Z",
"shell.execute_reply.started": "2025-06-30T03:38:18.058815Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BMI 3.66 70\n",
"肺活量 3.67 70\n",
"握力 2.64 69\n",
"坐位体前屈 2.69 68\n",
"纵跳 2.6 67\n",
"俯卧撑 2.93 28\n",
"一分钟仰卧起坐 3.65 34\n",
"单脚站立 2.19 70\n",
"选择反应时 3.41 70\n",
"台阶指数 2.48 63\n"
]
}
],
"outputs": [],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -2181,43 +1963,12 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"id": "dcf152e7-bbcc-47d1-9c5f-83854db35412",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-30T03:39:23.962598Z",
"iopub.status.busy": "2025-06-30T03:39:23.961860Z",
"iopub.status.idle": "2025-06-30T03:39:23.970708Z",
"shell.execute_reply": "2025-06-30T03:39:23.969751Z",
"shell.execute_reply.started": "2025-06-30T03:39:23.962527Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"安全(QHSE)管理督查部 3.06 2\n",
"综合保障服务部 3.04 6\n",
"餐饮部 2.86 21\n",
"市场营销部 3.18 5\n",
"后勤服务技能鉴定站 3.17 2\n",
"综合管理部 2.81 5\n",
"展厅服务部 3.0 1\n",
"经理、党委副书记 3.33 1\n",
"安全总监 3.78 1\n",
"信息化服务部 3.11 5\n",
"人力资源总监 3.0 1\n",
"人力资源(组织)部 2.56 1\n",
"副经理 2.56 2\n",
"协理员 1.71 1\n",
"经营管理部 2.82 3\n",
"客房部 2.89 10\n",
"会务部 3.4 3\n"
]
}
],
"outputs": [],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -2376,17 +2127,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-22T12:52:59.350814Z",
"iopub.status.busy": "2025-09-22T12:52:59.350137Z",
"iopub.status.idle": "2025-09-22T12:52:59.367870Z",
"shell.execute_reply": "2025-09-22T12:52:59.366720Z",
"shell.execute_reply.started": "2025-09-22T12:52:59.350750Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -2525,32 +2268,16 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "1acaf159-637e-4101-9881-f6bb79400136",
"metadata": {
"execution": {
"iopub.execute_input": "2025-07-27T15:45:48.440829Z",
"iopub.status.busy": "2025-07-27T15:45:48.440078Z",
"iopub.status.idle": "2025-07-27T15:45:48.629122Z",
"shell.execute_reply": "2025-07-27T15:45:48.628652Z",
"shell.execute_reply.started": "2025-07-27T15:45:48.440759Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[['48', '气虚', False, 65, 53, 28, 15, 0, 0, 10, 3, 0], ['24', '痰湿', False, 59, 43, 25, 37, 53, 50, 17, 32, 25], ['30', '平和', False, 78, 15, 7, 6, 6, 0, 7, 3, 7], ['49', '气虚', False, 62, 43, 21, 31, 31, 25, 3, 10, 0], ['61', '平和', False, 84, 9, 28, 21, 25, 29, 28, 21, 3], ['17', '阳虚', False, 62, 31, 50, 40, 25, 25, 21, 7, 14], ['50', '气虚', False, 62, 40, 25, 25, 34, 29, 32, 39, 25], ['51', '平和', False, 96, 9, 0, 0, 12, 8, 3, 0, 3], ['59', '气虚', False, 43, 43, 32, 31, 31, 16, 17, 39, 35], ['52', '阳虚', False, 37, 50, 64, 28, 31, 50, 35, 28, 10], ['60', '湿热', False, 43, 65, 53, 43, 68, 70, 53, 46, 53], ['19', '阴虚', True, 93, 18, 28, 37, 21, 37, 28, 10, 17], ['29', '平和', False, 68, 12, 7, 0, 12, 12, 10, 14, 3], ['18', '气虚', False, 65, 50, 32, 28, 21, 12, 32, 7, 46], ['16', '气虚', True, 75, 34, 21, 25, 25, 25, 25, 25, 21], ['14', '平和', False, 93, 3, 0, 0, 0, 0, 0, 0, 0], ['71', '阳虚', False, 59, 40, 75, 50, 56, 62, 39, 32, 21], ['70', '平和', False, 78, 18, 0, 0, 0, 8, 0, 0, 21], ['73', '平和', False, 68, 28, 0, 6, 15, 16, 14, 17, 17], ['36', '痰湿', False, 62, 37, 35, 31, 43, 37, 25, 35, 21], ['13', '血瘀', False, 40, 65, 64, 62, 68, 75, 82, 60, 57], ['53', '痰湿', True, 84, 18, 3, 28, 31, 16, 14, 3, 0], ['57', '气虚', False, 53, 43, 25, 9, 34, 25, 10, 21, 21], ['56', '气虚', False, 43, 59, 57, 28, 43, 37, 35, 32, 32], ['58', '阳虚', False, 43, 53, 57, 53, 46, 45, 42, 46, 42], ['10', '平和', False, 100, 9, 0, 0, 0, 4, 0, 0, 7], ['26', '阴虚', False, 62, 34, 21, 46, 34, 33, 35, 42, 46], ['8', '湿热', False, 62, 43, 25, 31, 37, 54, 28, 35, 32], ['55', '阳虚', False, 56, 37, 50, 50, 50, 45, 42, 42, 46], ['54', '平和', False, 71, 9, 14, 18, 28, 29, 14, 25, 10], ['3', '特禀', False, 68, 37, 28, 28, 43, 41, 14, 39, 46], ['4', '湿热', False, 56, 40, 53, 37, 34, 54, 14, 7, 14], ['38', '湿热', False, 84, 15, 0, 0, 18, 41, 7, 14, 0], ['39', '痰湿', False, 75, 34, 39, 43, 56, 45, 17, 28, 7], ['40', '湿热', False, 50, 21, 0, 12, 18, 29, 7, 21, 17], ['35', '平和', False, 90, 15, 0, 6, 15, 12, 3, 0, 3], ['33', '湿热', True, 71, 28, 28, 28, 34, 37, 32, 25, 14], ['41', '痰湿', False, 78, 21, 14, 31, 53, 33, 17, 32, 50], ['34', '平和', False, 93, 18, 21, 15, 12, 4, 0, 0, 0], ['22', '气虚', False, 71, 43, 25, 18, 9, 33, 25, 28, 17], ['23', '气虚', False, 50, 46, 32, 31, 34, 16, 32, 21, 3], ['32', '平和', False, 75, 12, 7, 25, 15, 8, 7, 10, 0], ['72', '气虚', False, 50, 46, 46, 31, 40, 41, 35, 39, 28], ['21', '气虚', True, 68, 31, 17, 21, 18, 16, 17, 0, 0], ['20', '特禀', False, 71, 31, 14, 40, 37, 41, 28, 21, 42], ['74', '平和', False, 78, 25, 7, 28, 28, 25, 10, 21, 0], ['31', '湿热', False, 71, 46, 7, 31, 46, 50, 46, 7, 17], ['43', '气郁', False, 37, 43, 35, 21, 53, 45, 21, 71, 32], ['44', '阳虚', False, 75, 37, 60, 34, 50, 50, 10, 14, 46], ['45', '阴虚', False, 84, 25, 14, 56, 43, 50, 3, 17, 3], ['64', '特禀', False, 65, 40, 32, 34, 34, 41, 32, 25, 42], ['47', '湿热', False, 59, 37, 35, 28, 40, 54, 28, 14, 14], ['28', '湿热', False, 62, 50, 35, 46, 50, 54, 42, 28, 42], ['12', '阳虚', False, 53, 46, 50, 50, 43, 50, 35, 42, 32]]\n",
"ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
"filename = 'data/result_新疆油田采油工艺研究院-1.json'\n",
"filename = 'data/result_南京化工-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -2570,13 +2297,15 @@
" #i+=1\n",
" list3 = []\n",
" list3.append(k)\n",
" list3.append(v['name'])\n",
" list3.append(v['sex'])\n",
" list3.append(kinds[kind])\n",
" list3.append(near)\n",
" for item in score:\n",
" list3.append(item)\n",
" list2.append(list3)\n",
"print(list2)\n",
"filename = 'data/新疆油田采油工艺研究院中医情况明细表.xlsx'\n",
"filename = 'data/南京化工中医情况明细表(202510).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
@@ -2752,23 +2481,15 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-22T12:54:30.458387Z",
"iopub.status.busy": "2025-09-22T12:54:30.457853Z",
"iopub.status.idle": "2025-09-22T12:54:30.653511Z",
"shell.execute_reply": "2025-09-22T12:54:30.653048Z",
"shell.execute_reply.started": "2025-09-22T12:54:30.458336Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_通用技术中国医药-1.json'\n",
"filename = 'data/result_南京化工-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"data_list = []\n",
@@ -2850,7 +2571,7 @@
" list6.append('')\n",
" i+=1\n",
" data_list.append(list6)\n",
"filename = 'data/通用技术中国医药.xlsx'\n",
"filename = 'data/南京化工中医情况明细表(202510).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
+187 -82
View File
@@ -10,48 +10,33 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-21T02:05:09.966940Z",
"iopub.status.busy": "2025-10-21T02:05:09.966195Z",
"iopub.status.idle": "2025-10-21T02:05:10.249499Z",
"shell.execute_reply": "2025-10-21T02:05:10.248277Z",
"shell.execute_reply.started": "2025-10-21T02:05:09.966870Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"270 ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/胜利采油厂人员名单.xlsx',data_only=True)\n",
"wb = openpyxl.load_workbook('data/南化人员信息表.xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" code = int(sheet.cell(n, 2).value)\n",
" code = int(sheet.cell(n, 4).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 4).value\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
" dict1['sex'] = sheet.cell(n, 5).value\n",
" dict1['unit'] = sheet.cell(n, 3).value \n",
" dict1['unit'] = sheet.cell(n, 2).value \n",
" dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0]\n",
" #dict1['phone'] = sheet.cell(n, 12).value \n",
" dict1['phone'] = sheet.cell(n, 12).value \n",
" person[code] = dict1\n",
"filename = 'data/胜利采油厂人员.json'\n",
"filename = 'data/南京化工人员.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person),'ok')"
@@ -67,31 +52,16 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-21T02:05:49.362922Z",
"iopub.status.busy": "2025-10-21T02:05:49.362143Z",
"iopub.status.idle": "2025-10-21T02:05:49.376741Z",
"shell.execute_reply": "2025-10-21T02:05:49.375761Z",
"shell.execute_reply.started": "2025-10-21T02:05:49.362862Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
"filename = 'data/胜利采油厂人员.json'\n",
"filename = 'data/南京化工人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
@@ -105,7 +75,7 @@
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
"\n",
"# 将 json 数据写入文件\n",
"with open(\"data/data_胜利采油厂人员.json\", \"w\",encoding = 'utf-8') as file:\n",
"with open(\"data/data_南京化工人员.json\", \"w\",encoding = 'utf-8') as file:\n",
" file.write(json_data) \n",
"print('ok')"
]
@@ -465,26 +435,10 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"id": "9b801085-ca98-4958-8dcc-bcd9985fcd4b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-01T07:20:37.177771Z",
"iopub.status.busy": "2025-09-01T07:20:37.177055Z",
"iopub.status.idle": "2025-09-01T07:20:37.198841Z",
"shell.execute_reply": "2025-09-01T07:20:37.198253Z",
"shell.execute_reply.started": "2025-09-01T07:20:37.177707Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"83\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -550,6 +504,120 @@
"print(len(dict1))"
]
},
{
"cell_type": "markdown",
"id": "acfc1736-9185-4217-bd05-a83b7e292725",
"metadata": {},
"source": [
"## 导入问卷信息(20251027)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "4b6cf9bc-fe84-4cf6-b762-8c30f8dd7953",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-28T02:58:31.746734Z",
"iopub.status.busy": "2025-10-28T02:58:31.746060Z",
"iopub.status.idle": "2025-10-28T02:58:31.786856Z",
"shell.execute_reply": "2025-10-28T02:58:31.786112Z",
"shell.execute_reply.started": "2025-10-28T02:58:31.746685Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"81\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_20251028.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 = dict2['code']\n",
" dict1.setdefault(code,{})\n",
" dict1[code]['name'] = dict2['name']\n",
" if dict2['gender'] == 'male':\n",
" dict1[code]['sex'] = '男'\n",
" else:\n",
" dict1[code]['sex'] = '女'\n",
" dict1[code]['birth'] = str(dict2['birth'])+'-01'\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",
"filename = 'data/result_南京化工-3.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"print(len(dict1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7392d5bf-c6a8-4cdf-8653-0fb4961f1405",
"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_20251027.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(item[1])\n",
" print(type(json.loads(content)))"
]
},
{
"cell_type": "markdown",
"id": "89689b86-3fae-402e-a456-a646f0c7201f",
@@ -603,10 +671,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"id": "e233e6c3-9c3f-42c7-8057-012bbcfe8b26",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-28T02:58:52.451889Z",
"iopub.status.busy": "2025-10-28T02:58:52.451452Z",
"iopub.status.idle": "2025-10-28T02:58:52.546239Z",
"shell.execute_reply": "2025-10-28T02:58:52.545487Z",
"shell.execute_reply.started": "2025-10-28T02:58:52.451850Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
@@ -721,7 +805,7 @@
" }\n",
"\n",
"\n",
"filename = 'data/result_南京化工-2.json'\n",
"filename = 'data/result_南京化工-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -743,16 +827,17 @@
" list3.append(k)\n",
" list3.append(v['name'])\n",
" list3.append(v['sex'])\n",
" list3.append(v['phone'])\n",
" list3.append(v['weight'])\n",
" list3.append(v['yao'])\n",
" list3.append(v['tun'])\n",
" list3.append(v['waist'])\n",
" list3.append(v['hip'])\n",
" list3.append(kinds[kind])\n",
" list3.append(near)\n",
" for item in score:\n",
" list3.append(item)\n",
" list2.append(list3)\n",
"\n",
"filename = 'data/南化第二次问卷明细表(截至20250831).xlsx'\n",
"filename = 'data/南化第三次问卷明细表(截至20251028).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
@@ -863,10 +948,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-27T06:11:24.661422Z",
"iopub.status.busy": "2025-10-27T06:11:24.660908Z",
"iopub.status.idle": "2025-10-27T06:11:24.977141Z",
"shell.execute_reply": "2025-10-27T06:11:24.975637Z",
"shell.execute_reply.started": "2025-10-27T06:11:24.661386Z"
}
},
"outputs": [
{
"ename": "KeyError",
"evalue": "'month'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[18], line 32\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 30\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mgender\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfemale\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m---> 32\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmonth\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mv\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmonth\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 33\u001b[0m mydata[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfits\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m {}\n\u001b[1;32m 34\u001b[0m survey_list \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtcm\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpsy57\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mspine\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
"\u001b[0;31mKeyError\u001b[0m: 'month'"
]
}
],
"source": [
"import requests\n",
"import json\n",
@@ -876,11 +981,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_南京化工-2.json'\n",
"filename = 'data/result_南京化工-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./南京化工第二批问卷/'\n",
"file_path ='./南京化工第三批问卷(251021)/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -939,15 +1044,15 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 19,
"id": "fc2bfab2-7f56-4abf-b2c4-0fb49a0da563",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-01T07:20:49.606201Z",
"iopub.status.busy": "2025-09-01T07:20:49.605939Z",
"iopub.status.idle": "2025-09-01T07:21:08.746449Z",
"shell.execute_reply": "2025-09-01T07:21:08.745281Z",
"shell.execute_reply.started": "2025-09-01T07:20:49.606179Z"
"iopub.execute_input": "2025-10-27T06:12:04.742517Z",
"iopub.status.busy": "2025-10-27T06:12:04.738837Z",
"iopub.status.idle": "2025-10-27T06:12:30.134155Z",
"shell.execute_reply": "2025-10-27T06:12:30.133408Z",
"shell.execute_reply.started": "2025-10-27T06:12:04.742463Z"
}
},
"outputs": [
@@ -955,7 +1060,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"83\n"
"72\n"
]
}
],
@@ -968,11 +1073,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_南京化工-2.json'\n",
"filename = 'data/result_南京化工-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./南京化工第二批问卷/'\n",
"file_path ='./南京化工第三批问卷/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
+219 -618
View File
@@ -10,33 +10,48 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-23T04:40:11.186792Z",
"iopub.status.busy": "2025-10-23T04:40:11.186527Z",
"iopub.status.idle": "2025-10-23T04:40:11.243321Z",
"shell.execute_reply": "2025-10-23T04:40:11.242693Z",
"shell.execute_reply.started": "2025-10-23T04:40:11.186767Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"412 ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/南化人员信息表.xlsx',data_only=True)\n",
"wb = openpyxl.load_workbook('data/胜利采油厂人员名单.xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" code = int(sheet.cell(n, 4).value)\n",
" code = int(sheet.cell(n, 2).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
" dict1['name'] = sheet.cell(n, 4).value\n",
" dict1['sex'] = sheet.cell(n, 5).value\n",
" dict1['unit'] = sheet.cell(n, 2).value \n",
" dict1['unit'] = sheet.cell(n, 3).value \n",
" dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0]\n",
" dict1['phone'] = sheet.cell(n, 12).value \n",
" #dict1['phone'] = sheet.cell(n, 12).value \n",
" person[code] = dict1\n",
"filename = 'data/南京化工人员.json'\n",
"filename = 'data/胜利采油厂人员.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person),'ok')"
@@ -52,16 +67,31 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-22T05:36:04.807935Z",
"iopub.status.busy": "2025-10-22T05:36:04.807038Z",
"iopub.status.idle": "2025-10-22T05:36:04.823769Z",
"shell.execute_reply": "2025-10-22T05:36:04.822605Z",
"shell.execute_reply.started": "2025-10-22T05:36:04.807861Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/南京化工人员.json'\n",
"filename = 'data/胜利采油厂人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
@@ -75,11 +105,78 @@
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
"\n",
"# 将 json 数据写入文件\n",
"with open(\"data/data_南京化工人员.json\", \"w\",encoding = 'utf-8') as file:\n",
"with open(\"data/data_胜利采油厂人员.json\", \"w\",encoding = 'utf-8') as file:\n",
" file.write(json_data) \n",
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "a627e5b1-15c7-405b-9c81-2022e1173ed3",
"metadata": {},
"source": [
"## 合并读卡系统文件"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "82526579-8902-458d-a097-c2446983fa3f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-23T04:40:17.340605Z",
"iopub.status.busy": "2025-10-23T04:40:17.339457Z",
"iopub.status.idle": "2025-10-23T04:40:17.357806Z",
"shell.execute_reply": "2025-10-23T04:40:17.356944Z",
"shell.execute_reply.started": "2025-10-23T04:40:17.340544Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"496834 李继升 QHSE监督中心\n",
"3532664 谭嘉辰 人力资源(组织)部\n",
"496657 张秀成 企业管理部(三基工作办公室)\n",
"495136 闫福霞 公共事业服务中心\n",
"494062 赵霞 公共事业服务中心\n",
"495293 赵振华 \n",
"689404 马科 胜利采油厂\n",
"498782 封莹 胜利采油厂\n",
"999999 孙振峰 \n",
"445607 王大明 \n",
"490000 陆岩玮 信息化服务中心\n",
"000000 焦瀛 胜利采油厂\n",
"424 ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/胜利采油厂人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/data_胜利采油厂人员(1).json'\n",
"with open(filename,'r') as fl:\n",
" list1 = json.load(fl)\n",
"for item in list1:\n",
" code = item['id']\n",
" if code not in dict1.keys():\n",
" print(code,item['name'],item['unit'])\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/胜利采油厂人员.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": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f",
@@ -90,12 +187,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-23T04:40:34.626526Z",
"iopub.status.busy": "2025-10-23T04:40:34.625771Z",
"iopub.status.idle": "2025-10-23T04:40:34.653754Z",
"shell.execute_reply": "2025-10-23T04:40:34.653195Z",
"shell.execute_reply.started": "2025-10-23T04:40:34.626453Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"216\n"
]
}
],
"source": [
"import json\n",
"import datetime\n",
@@ -103,14 +215,14 @@
"from datetime import date\n",
"import my_module as My\n",
"\n",
"filename = 'data/南京化工人员.json'\n",
"filename = 'data/胜利采油厂人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20250703.csv'\n",
"filename = 'data/marks_20251023.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"\n",
"filename = 'data/result_南京化工.json'\n",
"filename = 'data/result_胜利采油厂.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
@@ -128,8 +240,21 @@
"cell_type": "code",
"execution_count": null,
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-27T01:50:10.738997Z",
"iopub.status.busy": "2025-10-27T01:50:10.738633Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import time\n",
@@ -137,7 +262,7 @@
"\n",
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_南京化工.json'\n",
"filename = 'data/result_胜利采油厂1.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -160,12 +285,73 @@
" dict2[k][item_en]['score'] = My.cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_南京化工.json'\n",
"filename = f'data/result_胜利采油厂1.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "3f7a810e-2a5f-4856-8119-bfe299b71f92",
"metadata": {},
"source": [
"## 补充人员信息"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "9c3b7195-b7f3-4355-90bc-9f1ae322641d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-27T01:22:18.116597Z",
"iopub.status.busy": "2025-10-27T01:22:18.116000Z",
"iopub.status.idle": "2025-10-27T01:22:18.187150Z",
"shell.execute_reply": "2025-10-27T01:22:18.186557Z",
"shell.execute_reply.started": "2025-10-27T01:22:18.116559Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/胜利采油厂测试情况明细表(补充人员信息).xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"\n",
"filename = 'data/result_胜利采油厂.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"list1 = []\n",
"for n in range(2, sheet.max_row+1):\n",
" code = int(sheet.cell(n, 1).value)\n",
" unit = sheet.cell(n, 4).value\n",
" dict1[code] = unit\n",
"for k, v in dict2.items():\n",
" if int(k) not in dict1.keys():\n",
" list1.append(k)\n",
" else:\n",
" dict2[k]['unit'] = dict1[int(k)]\n",
"for item in list1:\n",
" del dict2[item]\n",
"filename = f'data/result_胜利采油厂1.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') \n"
]
},
{
"cell_type": "markdown",
"id": "d034a61d-1fbd-417b-99bd-277e43ebb678",
@@ -176,9 +362,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-23T04:41:25.970953Z",
"iopub.status.busy": "2025-10-23T04:41:25.969895Z",
"iopub.status.idle": "2025-10-23T04:41:26.058240Z",
"shell.execute_reply": "2025-10-23T04:41:26.057610Z",
"shell.execute_reply.started": "2025-10-23T04:41:25.970875Z"
},
"tags": []
},
"outputs": [],
@@ -189,18 +382,18 @@
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n",
"filename = 'data/result_南京化工.json'\n",
"filename = 'data/result_胜利采油厂.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/南京化工人员.json'\n",
"filename = 'data/胜利采油厂人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(str(k).rjust(8,'0'))\n",
" list2.append(v['name']) \n",
" list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['unit'])\n",
@@ -221,7 +414,7 @@
" list2.append('')\n",
" \n",
" list1.append(list2)\n",
"filename = 'data/南京化工测试情况明细表(截至20250630).xlsx'\n",
"filename = 'data/胜利采油厂测试情况明细表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -231,598 +424,6 @@
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "699c6a40-a6ae-4300-9646-708cb85aa5e8",
"metadata": {},
"source": [
"## 统计问卷人员情况"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"\n",
"filename = 'data/南京化工人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"phone1 = set()\n",
"phone2 = set()\n",
"for k,v in dict1.items():\n",
" phone1.add(v['phone'])\n",
"list1 = []\n",
"filename = 'data/survey_records_20250813.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",
"\n",
"i =1\n",
"list2 = []\n",
"for item in list1:\n",
" content = json.loads(item[4])\n",
" code = int(content['phone'])\n",
" for k, v in dict1.items():\n",
" list3 = []\n",
" if v['phone'] == code: \n",
" list3.append(k)\n",
" list3.append(v['name'])\n",
" list3.append(v['sex'])\n",
" list3.append(v['unit'])\n",
" list3.append(code)\n",
" list2.append(list3)\n",
"filename = 'data/南化问卷情况表(第二批).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
"for row in list2:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8b7c0528-17b6-4469-b15f-3c4b794e286e",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"\n",
"\n",
"filename = 'data/survey_records_20250813.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",
"\n",
"i =1\n",
"list2 = []\n",
"for item in list1:\n",
" list3 = []\n",
" content = json.loads(item[4])\n",
" phone = int(content['phone'])\n",
" name = content['name']\n",
" sex = content['gender']\n",
" list3.append(name)\n",
" list3.append(sex)\n",
" list3.append(phone)\n",
" list2.append(list3)\n",
"filename = 'data/南化问卷情况表(第二批).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
"for row in list2:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) "
]
},
{
"cell_type": "markdown",
"id": "797717d5-47b9-4d47-be6c-8d54bede67d4",
"metadata": {},
"source": [
"## 导入问卷信息"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9d9dd574-9fbf-4d0a-96fd-9b55d98021d2",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"dict1 = {}\n",
"\n",
"filename = 'data/result_南京化工.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"filename = 'data/南京化工人员.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[v['phone']] = k\n",
"\n",
"list1 = []\n",
"filename = 'data/survey_records_20250812.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",
"\n",
"\n",
"\n",
"nn = 0\n",
"for item in list1:\n",
" if int(item[3]) in phone.keys(): \n",
" tcm = []\n",
" code = phone[int(item[3])]\n",
" \n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" \n",
" \n",
" content = json.loads(item[4])\n",
" if code not in dict1.keys():\n",
" dict1[code] = dict3[code]\n",
" rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n",
" dict1[code]['rq'] = str(date.fromisoformat(item[5].replace('/','-').split(' ')[0]))\n",
" #dict1[code]['rq'] = item[5].replace('/','-').split(' ')[0]\n",
" else:\n",
" rq=date.fromisoformat('2025-07-01')\n",
" dict1[code]['rq'] = '2025-07-01'\n",
" for k, v in content.items():\n",
" \n",
" if 'tcm' in k:\n",
" i = int(k[3:])\n",
" tcm[i-1] = int(v) \n",
" \n",
" if 'tcm' in item[4]: \n",
" dict1[code]['tcm'] = tcm\n",
" \n",
" birth = date.fromisoformat(dict3[code]['birth'].replace('/','-'))\n",
" \n",
" days = (rq-birth).days \n",
" dict1[code]['age'] = int(days/365)\n",
" dict1[code]['month'] = int(days/365*12)\n",
" #print(phone[item[2]])\n",
" nn+=1\n",
"filename = 'data/result_南京化工-2.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n"
]
},
{
"cell_type": "markdown",
"id": "4930b4cb-2114-4432-a8ae-e6d2cde69b5c",
"metadata": {},
"source": [
"## 导入问卷信息(新)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "9b801085-ca98-4958-8dcc-bcd9985fcd4b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-01T07:20:37.177771Z",
"iopub.status.busy": "2025-09-01T07:20:37.177055Z",
"iopub.status.idle": "2025-09-01T07:20:37.198841Z",
"shell.execute_reply": "2025-09-01T07:20:37.198253Z",
"shell.execute_reply.started": "2025-09-01T07:20:37.177707Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"83\n"
]
}
],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"\n",
"filename = 'data/南京化工人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict3 = json.load(fl)\n",
"\n",
"\n",
"list1 = []\n",
"filename = 'data/survey_records_20250901.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",
"\n",
"\n",
"dict1 = {}\n",
"nn = 0\n",
"for item in list1: \n",
" tcm = [] \n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" \n",
" content = json.loads(item[4]) \n",
" phone = content['phone']\n",
" name = content['name']\n",
" for k,v in dict3.items():\n",
" if name == v['name']:\n",
" code = k\n",
" unit = v['unit']\n",
" sex = v['sex']\n",
" dict1.setdefault(code,{})\n",
" \n",
" #rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n",
" #dict1[phone]['rq'] = str(date.fromisoformat(item[5].replace('/','-').split(' ')[0]))\n",
" \n",
" for k, v in content.items(): \n",
" if 'tcm' in k:\n",
" i = int(k[3:])\n",
" tcm[i-1] = int(v) \n",
" \n",
" if 'tcm' in item[4]: \n",
" dict1[code]['tcm'] = tcm\n",
" \n",
" dict1[code]['name'] = content['name']\n",
" dict1[code]['unit'] = unit\n",
" dict1[code]['sex'] = sex\n",
" dict1[code]['weight'] = content['weight']\n",
" dict1[code]['tun'] = content['hip']\n",
" dict1[code]['yao'] = content['waist']\n",
" #print(phone[item[2]])\n",
" nn+=1\n",
"filename = 'data/result_南京化工-2.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": "89689b86-3fae-402e-a456-a646f0c7201f",
"metadata": {},
"source": [
"## 导入腰臀数据"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a0678c6-0c64-4314-bb03-24b10a3d695a",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"dict1 = {}\n",
"\n",
"filename = 'data/result_南京化工-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"wb = openpyxl.load_workbook('data/南化腰臀数据.xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" code = str(sheet.cell(n, 1).value)\n",
" if code in dict1.keys():\n",
" yao = str(sheet.cell(n, 2).value)\n",
" tun = str(sheet.cell(n, 3).value)\n",
" dict1[code]['腰臀比'] = yao+','+tun\n",
"filename = 'data/result_南京化工-1.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n"
]
},
{
"cell_type": "markdown",
"id": "19c6e8b6-2663-447d-884b-a22af3944c71",
"metadata": {},
"source": [
"## 计算中医体质并导出"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e233e6c3-9c3f-42c7-8057-012bbcfe8b26",
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"questions = [\n",
" [1],\n",
" [-1, 2],\n",
" [-1, 2],\n",
" [-1, 8],\n",
" [-1, 3],\n",
" [1],\n",
" [-1],\n",
" [-1, 7],\n",
" [2],\n",
" [2],\n",
" [2],\n",
" [2, 3],\n",
" [2],\n",
" [2],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9]\n",
"]\n",
"\n",
"kinds = [\n",
" '平和',\n",
" '气虚',\n",
" '阳虚',\n",
" '阴虚',\n",
" '痰湿',\n",
" '湿热',\n",
" '血瘀',\n",
" '气郁',\n",
" '特禀'\n",
"]\n",
"\n",
"def tcm_calc(arr):\n",
" qa = [8, 8, 7, 8, 8, 6, 7, 7, 7]\n",
" # 成绩数组\n",
" s = [0] * 9\n",
" # 遍历五进制\n",
" for i in range(len(questions)):\n",
" m = arr[i] - 1\n",
" for v in questions[i]:\n",
" if v < 0:\n",
" s[-v - 1] += 4 - m\n",
" else:\n",
" s[v - 1] += m\n",
" return [int((v / qa[i]) * 25) for i, v in enumerate(s)]\n",
"\n",
"def tcm_kind(score):\n",
" kind = 0\n",
" near = False\n",
" max_kind = 0\n",
" max_score = 0\n",
" for i in range(1, 9):\n",
" if score[i] > max_score:\n",
" max_kind = i\n",
" max_score = score[i]\n",
" if score[0] >= 60 and max_score < 40:\n",
" if max_score >= 30:\n",
" near = True\n",
" kind = max_kind\n",
" else:\n",
" kind = max_kind\n",
" return {\n",
" \"kind\": kind,\n",
" \"near\": near\n",
" }\n",
"\n",
"\n",
"filename = 'data/result_南京化工-2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
"list2 = []\n",
"for k, v in dict1.items():\n",
" if 'tcm' in v.keys():\n",
" list1 = []\n",
" tcm =v['tcm']\n",
" for item in tcm:\n",
" list1.append(item)\n",
" score = tcm_calc(list1)\n",
"\n",
" result = tcm_kind(score)\n",
" kind = result['kind']\n",
" near = result['near']\n",
" #print(i,k,kinds[kind], near, score)\n",
" #i+=1\n",
" list3 = []\n",
" list3.append(k)\n",
" list3.append(v['name'])\n",
" list3.append(v['sex'])\n",
" list3.append(v['weight'])\n",
" list3.append(v['yao'])\n",
" list3.append(v['tun'])\n",
" list3.append(kinds[kind])\n",
" list3.append(near)\n",
" for item in score:\n",
" list3.append(item)\n",
" list2.append(list3)\n",
"\n",
"filename = 'data/南化第二次问卷明细表(截至20250831).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
"for row in list2:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)\n",
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "caf77c95-3090-4fa1-bcec-c9e8a38d4ca9",
"metadata": {},
"source": [
"## 体检报告汇总"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b815a478-d178-4b87-9080-a779d397d945",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import json\n",
"import shutil\n",
"\n",
"\n",
"target_directory = Path('./file/南化体重')\n",
"new_path = './file/南化体重/new'\n",
"filename = 'data/南京化工人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"# 遍历目标目录及其子目录获取所有文件\n",
"\n",
"for fl in target_directory.rglob('*.pdf'):\n",
" if fl.is_file():\n",
" fl_name = fl.stem\n",
" name = fl_name[12:] \n",
" for k, v in dict1.items(): \n",
" if name == v['name']:\n",
" n_name = Path(new_path,str(k)+'-'+name+'.pdf')\n",
" shutil.copyfile(fl,n_name)\n",
" print(n_name)\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f192b79-5dc7-4517-b7f3-409e30d60dad",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import json\n",
"import shutil\n",
"import pymupdf4llm\n",
"#md_text = pymupdf4llm.to_markdown(\"data/1782596-唐荣.pdf\")\n",
"llama_reader = pymupdf4llm.LlamaMarkdownReader()\n",
"#llama_docs = llama_reader.load_data(\"data/1782596-唐荣.pdf\")\n",
"\n",
"\n",
"target_directory = Path('./file/北海体检报告')\n",
"new_path = './file/北海体检报告/md'\n",
"\n",
"\n",
"for fl in target_directory.rglob('*.pdf'):\n",
" if fl.is_file():\n",
" fl_name = fl.stem\n",
" llama_lists = pymupdf4llm.to_markdown(fl,page_chunks=True)\n",
" list1 = []\n",
" for item in llama_lists:\n",
" list1.append(item['text'])\n",
" llama_docs = '\\n'.join(list1)\n",
" Path(new_path,fl_name+'.md').write_bytes(llama_docs.encode())\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e5863760-0d11-45b0-acb3-1a38c78d4fc7",
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"import json\n",
"import shutil\n",
"import pymupdf4llm\n",
"#md_text = pymupdf4llm.to_markdown(\"data/1782596-唐荣.pdf\")\n",
"llama_reader = pymupdf4llm.LlamaMarkdownReader()\n",
"llama_docs = llama_reader.load_data(\"data/1782596-唐荣.pdf\",page_chunks=True)\n",
"print(llama_docs)\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "8d5f4103-0d1e-4711-b324-ece360f8dcd3",
+600 -758
View File
File diff suppressed because it is too large. Load diff