This commit is contained in:
512song committed 2025-08-13 20:36:47 +08:00
1 parent c0db3d691e
commit dcbfb8f1eb
5 files changed
+592 -384

No files matched your search

+164 -176
View File
@@ -10,27 +10,12 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T06:47:52.647999Z",
"iopub.status.busy": "2025-06-24T06:47:52.647468Z",
"iopub.status.idle": "2025-06-24T06:47:52.837761Z",
"shell.execute_reply": "2025-06-24T06:47:52.837173Z",
"shell.execute_reply.started": "2025-06-24T06:47:52.647952Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1698 ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -65,26 +50,10 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": null,
"id": "ddddbac1-ab71-436a-ab64-2a15600f5b1b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:47:30.639088Z",
"iopub.status.busy": "2025-06-24T07:47:30.638546Z",
"iopub.status.idle": "2025-06-24T07:47:30.944089Z",
"shell.execute_reply": "2025-06-24T07:47:30.943556Z",
"shell.execute_reply.started": "2025-06-24T07:47:30.639038Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1953 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -165,27 +134,12 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": null,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:47:35.746440Z",
"iopub.status.busy": "2025-06-24T07:47:35.746188Z",
"iopub.status.idle": "2025-06-24T07:47:35.874766Z",
"shell.execute_reply": "2025-06-24T07:47:35.874285Z",
"shell.execute_reply.started": "2025-06-24T07:47:35.746417Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1699\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
@@ -234,26 +188,10 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"id": "2082c096-9f36-430c-9823-f09d8b6f9b42",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:24:22.507391Z",
"iopub.status.busy": "2025-06-24T07:24:22.506635Z",
"iopub.status.idle": "2025-06-24T07:24:22.548344Z",
"shell.execute_reply": "2025-06-24T07:24:22.547831Z",
"shell.execute_reply.started": "2025-06-24T07:24:22.507322Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['2018652', '2019665', '2019160', '2019512', '3427477', '2019423', '2019494', '2019901']\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"filename = 'data/result_宁夏能化人员.json'\n",
"with open(filename,'r') as fl:\n",
@@ -281,26 +219,10 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": null,
"id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:47:41.560238Z",
"iopub.status.busy": "2025-06-24T07:47:41.559637Z",
"iopub.status.idle": "2025-06-24T07:47:41.657989Z",
"shell.execute_reply": "2025-06-24T07:47:41.657434Z",
"shell.execute_reply.started": "2025-06-24T07:47:41.560182Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -347,16 +269,9 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": null,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-26T01:35:41.139581Z",
"iopub.status.busy": "2025-06-26T01:35:41.139145Z",
"iopub.status.idle": "2025-06-26T01:35:41.663585Z",
"shell.execute_reply": "2025-06-26T01:35:41.663054Z",
"shell.execute_reply.started": "2025-06-26T01:35:41.139557Z"
},
"tags": []
},
"outputs": [],
@@ -578,26 +493,10 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": null,
"id": "d31020be-c9c0-404f-8e0b-f8f507385f48",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-27T04:14:46.467739Z",
"iopub.status.busy": "2025-06-27T04:14:46.466974Z",
"iopub.status.idle": "2025-06-27T04:14:47.053693Z",
"shell.execute_reply": "2025-06-27T04:14:47.053104Z",
"shell.execute_reply.started": "2025-06-27T04:14:46.467668Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
@@ -730,26 +629,10 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": null,
"id": "9ffec868-3851-42f6-8431-c5c5d3d15424",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:47:57.736323Z",
"iopub.status.busy": "2025-06-24T07:47:57.736061Z",
"iopub.status.idle": "2025-06-24T07:48:02.653903Z",
"shell.execute_reply": "2025-06-24T07:48:02.653030Z",
"shell.execute_reply.started": "2025-06-24T07:47:57.736300Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"8\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -823,26 +706,10 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": null,
"id": "59f69be9-ab27-4308-8641-927dbcfda87e",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:48:39.717546Z",
"iopub.status.busy": "2025-06-24T07:48:39.716729Z",
"iopub.status.idle": "2025-06-24T07:48:40.238267Z",
"shell.execute_reply": "2025-06-24T07:48:40.237638Z",
"shell.execute_reply.started": "2025-06-24T07:48:39.717462Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1699\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
@@ -880,26 +747,10 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": null,
"id": "896955ac-351a-4914-94a6-56e6d1ae9e6e",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-24T07:48:42.641359Z",
"iopub.status.busy": "2025-06-24T07:48:42.641096Z",
"iopub.status.idle": "2025-06-24T07:48:42.812702Z",
"shell.execute_reply": "2025-06-24T07:48:42.812095Z",
"shell.execute_reply.started": "2025-06-24T07:48:42.641334Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
@@ -936,10 +787,147 @@
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "3e5363cb-233c-4050-9c3a-18207d7f597a",
"metadata": {},
"source": [
"## 统计体质检测等级明细表"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "360831b7-e204-4801-9f72-879e338ed962",
"metadata": {
"execution": {
"iopub.execute_input": "2025-08-13T11:53:04.589116Z",
"iopub.status.busy": "2025-08-13T11:53:04.588495Z",
"iopub.status.idle": "2025-08-13T11:53:04.762457Z",
"shell.execute_reply": "2025-08-13T11:53:04.761877Z",
"shell.execute_reply.started": "2025-08-13T11:53:04.589057Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/data_宁夏能化人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list1.append([k,v['name'],v['unit'],v['sex'],v['age'],v['level'],v['score']])\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",
" "
]
},
{
"cell_type": "markdown",
"id": "d9705453-5c8c-40d2-83c5-7c2ddfc5f094",
"metadata": {},
"source": [
"## 导出体检报告阳性数据"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a1907b6f-3ba7-4773-8f6e-6559af18131e",
"id": "e9f6d0ce-7be5-4bb9-8a64-9281a99eb897",
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/2025年中国石化长城能源化工(宁夏)有限公司体检数据.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, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
" dict1['sex'] = sheet.cell(n, 4).value\n",
" dict1['unit'] = sheet.cell(n, 2).value\n",
" dict1['age'] = sheet.cell(n, 5).value\n",
" content = sheet.cell(n, 6).value\n",
" dict1['signs'] = content.split(',')\n",
" person[code] = dict1\n",
"filename = 'data/宁夏能化体检数据2025.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person),'ok')"
]
},
{
"cell_type": "markdown",
"id": "f315bd79-122f-4dd6-9666-d4945fe216cb",
"metadata": {},
"source": [
"## 筛选体重相关异常数据人员"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "e3117237-b921-41fe-9b65-4918c5b2a165",
"metadata": {
"execution": {
"iopub.execute_input": "2025-08-13T08:52:05.672800Z",
"iopub.status.busy": "2025-08-13T08:52:05.672283Z",
"iopub.status.idle": "2025-08-13T08:52:05.820901Z",
"shell.execute_reply": "2025-08-13T08:52:05.820357Z",
"shell.execute_reply.started": "2025-08-13T08:52:05.672751Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/宁夏能化体检数据2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"list2 = ['肥胖','超重','脂肪肝','血脂','高脂血症','动脉粥样硬化']\n",
"for k, v in dict1.items():\n",
" zz = set()\n",
" for item in v['signs']:\n",
" for xm in list2:\n",
" if xm in item:\n",
" zz.add(item)\n",
" if len(zz) > 0:\n",
" list1.append([k,v['name'],v['unit'],v['sex'],v['age'],','.join(zz)])\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",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6133f0d5-75aa-41c0-a624-b354d89b5ba3",
"metadata": {},
"outputs": [],
"source": []