This commit is contained in:
512song committed 2024-12-05 10:54:06 +08:00
1 parent f763498a42
commit 9c40a2b9f7
3 files changed
+678 -435

No files matched your search

File diff suppressed because it is too large. Load diff
+136 -7
View File
@@ -636,6 +636,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e", "id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
"metadata": { "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": [] "tags": []
}, },
"source": [ "source": [
@@ -2182,10 +2183,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 31,
"id": "e1a1b329-acf1-4be9-bcf0-736dbe7f8e0b", "id": "e1a1b329-acf1-4be9-bcf0-736dbe7f8e0b",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2024-12-04T14:53:01.181252Z",
"iopub.status.busy": "2024-12-04T14:53:01.180490Z",
"iopub.status.idle": "2024-12-04T14:53:01.243823Z",
"shell.execute_reply": "2024-12-04T14:53:01.243252Z",
"shell.execute_reply.started": "2024-12-04T14:53:01.181166Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"739\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import datetime\n", "import datetime\n",
@@ -2313,10 +2330,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 32,
"id": "dd89efe8-13b9-4db8-8c39-2a48888dd635", "id": "dd89efe8-13b9-4db8-8c39-2a48888dd635",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2024-12-04T14:53:17.474923Z",
"iopub.status.busy": "2024-12-04T14:53:17.474146Z",
"iopub.status.idle": "2024-12-04T14:53:18.915899Z",
"shell.execute_reply": "2024-12-04T14:53:18.915258Z",
"shell.execute_reply.started": "2024-12-04T14:53:17.474853Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import time\n", "import time\n",
@@ -2524,10 +2557,106 @@
"wb.save(filename)" "wb.save(filename)"
] ]
}, },
{
"cell_type": "markdown",
"id": "16bf831a-e725-47d4-87bb-0103ae55f8a6",
"metadata": {},
"source": [
"## 清理报告数据"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "6d8a345d-39e0-40cd-9bed-ac4e144b426c",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-04T15:01:40.945578Z",
"iopub.status.busy": "2024-12-04T15:01:40.944820Z",
"iopub.status.idle": "2024-12-04T15:01:40.998222Z",
"shell.execute_reply": "2024-12-04T15:01:40.997687Z",
"shell.execute_reply.started": "2024-12-04T15:01:40.945506Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"738\n",
"ok!\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_北海炼化2024.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
" \n",
"#items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"items = {}\n",
"items['lung'] = '肺活量'\n",
"items['grip'] ='握力'\n",
"items['flexion'] ='坐位体前屈'\n",
"items['jump'] ='纵跳'\n",
"items['pushup'] ='俯卧撑'\n",
"items['balance'] ='单脚站立'\n",
"items['reaction'] ='选择反应时'\n",
"items['step'] ='台阶指数'\n",
"items['situp'] ='一分钟仰卧起坐'\n",
"items['bmi'] ='BMI'\n",
"\n",
"\n",
"list1 = []\n",
"\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=1\n",
"list2 = []\n",
"dict2 = {}\n",
"for k, v in dict1.items():\n",
" list1 = []\n",
" mydata = {}\n",
" \n",
" id = str(k).rjust(5,\"0\")\n",
" mydata['unit'] = v['unit']\n",
" mydata['name'] = v['name']\n",
" mydata['sex'] = v['sex']\n",
" mydata['month'] = v['month']\n",
" age = int(v['month']/12)\n",
" if age <20:\n",
" mydata['age'] = 20\n",
" else:\n",
" mydata['age'] = int(v['month']/12)\n",
" \n",
" mydata['fits'] = {}\n",
" score = 0\n",
" for item in list_item:\n",
" if item in v.keys():\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'][items[item]] = {'mark':mark,'score':v[item]['score']}\n",
" score = score + v[item]['score']\n",
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
" if len(mydata['fits']) >2:\n",
" dict2[str(k)] = mydata\n",
"filename = f'data/data_北海炼化2024.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print(len(dict2))\n",
"print('ok!')"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "a2cce583-323d-4631-a9bd-39052d3cccbf", "id": "6cba8d5e-92fd-4afd-94d2-0dcf42e2e22e",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
+66 -18
View File
@@ -2356,6 +2356,54 @@
"print('ok')" "print('ok')"
] ]
}, },
{
"cell_type": "markdown",
"id": "4451ac02-b5c4-4e6c-88cf-9dd6f2067763",
"metadata": {},
"source": [
"## 汇总2023、2024人员"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "a6dc8ae7-5a51-4eb1-954e-19c17b6062cd",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-05T01:26:00.236419Z",
"iopub.status.busy": "2024-12-05T01:26:00.235845Z",
"iopub.status.idle": "2024-12-05T01:26:00.282366Z",
"shell.execute_reply": "2024-12-05T01:26:00.281825Z",
"shell.execute_reply.started": "2024-12-05T01:26:00.236362Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/长炼医院人员2024.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",
" dict2 = json.load(fl) \n",
"\n",
"for k, v in dict2.items():\n",
" dict1[k] = v\n",
"filename = 'data/长炼医院人员2024(汇总).json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "b056832e-049c-40f4-b7e7-adac6976bf77", "id": "b056832e-049c-40f4-b7e7-adac6976bf77",
@@ -2366,15 +2414,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 4,
"id": "1e2d586e-6ff5-4fd1-a909-278d23e54561", "id": "1e2d586e-6ff5-4fd1-a909-278d23e54561",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2024-09-29T05:14:10.446230Z", "iopub.execute_input": "2024-12-05T01:38:43.355077Z",
"iopub.status.busy": "2024-09-29T05:14:10.445350Z", "iopub.status.busy": "2024-12-05T01:38:43.354336Z",
"iopub.status.idle": "2024-09-29T05:14:10.477950Z", "iopub.status.idle": "2024-12-05T01:38:43.429440Z",
"shell.execute_reply": "2024-09-29T05:14:10.477374Z", "shell.execute_reply": "2024-12-05T01:38:43.428824Z",
"shell.execute_reply.started": "2024-09-29T05:14:10.446151Z" "shell.execute_reply.started": "2024-12-05T01:38:43.355007Z"
} }
}, },
"outputs": [ "outputs": [
@@ -2382,8 +2430,8 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"212\n", "377\n",
"212\n" "377\n"
] ]
} }
], ],
@@ -2392,7 +2440,7 @@
"import time\n", "import time\n",
"import csv\n", "import csv\n",
"\n", "\n",
"filename = '../item.json'\n", "filename = '../item1.json'\n",
"item = {}\n", "item = {}\n",
"unit = {}\n", "unit = {}\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
@@ -2402,7 +2450,7 @@
"re_ta = {}\n", "re_ta = {}\n",
"dict1 = {}\n", "dict1 = {}\n",
"list1 = []\n", "list1 = []\n",
"filename = 'data/长炼医院人员2024.json'\n", "filename = 'data/长炼医院人员2024(汇总).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",
@@ -2444,15 +2492,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 5,
"id": "64c6e1e3-801c-4573-b78f-5a9e842597a9", "id": "64c6e1e3-801c-4573-b78f-5a9e842597a9",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2024-09-29T05:14:43.182012Z", "iopub.execute_input": "2024-12-05T01:39:11.222107Z",
"iopub.status.busy": "2024-09-29T05:14:43.181450Z", "iopub.status.busy": "2024-12-05T01:39:11.221349Z",
"iopub.status.idle": "2024-09-29T05:14:43.242249Z", "iopub.status.idle": "2024-12-05T01:39:11.314666Z",
"shell.execute_reply": "2024-09-29T05:14:43.241683Z", "shell.execute_reply": "2024-12-05T01:39:11.314133Z",
"shell.execute_reply.started": "2024-09-29T05:14:43.181959Z" "shell.execute_reply.started": "2024-12-05T01:39:11.222034Z"
} }
}, },
"outputs": [], "outputs": [],
@@ -2467,7 +2515,7 @@
"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/长炼医院人员2024.json'\n", "filename = 'data/长炼医院人员2024(汇总).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",
@@ -2487,7 +2535,7 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/长炼医院人员检测情况表(20240720).xlsx'\n", "filename = 'data/长炼医院人员检测情况表(20240930).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",