20240410
This commit is contained in:
1 parent
daf054d886
commit
55437a8820
3 files changed
+1808
-123
No files matched your search
+227
-89
@@ -4,9 +4,7 @@
|
||||
"cell_type": "markdown",
|
||||
"id": "1c72f0cf-165b-4025-af9d-6771e4a0a5d1",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": [],
|
||||
"toc-hr-collapsed": true
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"# 2022年体质检测"
|
||||
@@ -636,7 +634,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"# 2023年体质检测"
|
||||
]
|
||||
@@ -1183,16 +1183,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 136,
|
||||
"execution_count": null,
|
||||
"id": "c0128f52-8697-4258-aba0-89a522fb9cc0",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-30T06:20:41.159682Z",
|
||||
"iopub.status.busy": "2023-11-30T06:20:41.159227Z",
|
||||
"iopub.status.idle": "2023-11-30T06:20:41.330886Z",
|
||||
"shell.execute_reply": "2023-11-30T06:20:41.330393Z",
|
||||
"shell.execute_reply.started": "2023-11-30T06:20:41.159643Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -1871,27 +1864,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 135,
|
||||
"execution_count": null,
|
||||
"id": "2e5ae18e-c153-4cdf-825e-f969080eea16",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-29T10:35:01.457310Z",
|
||||
"iopub.status.busy": "2023-11-29T10:35:01.456843Z",
|
||||
"iopub.status.idle": "2023-11-29T10:35:01.509548Z",
|
||||
"shell.execute_reply": "2023-11-29T10:35:01.508047Z",
|
||||
"shell.execute_reply.started": "2023-11-29T10:35:01.457255Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"719\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
@@ -1965,69 +1943,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 140,
|
||||
"execution_count": null,
|
||||
"id": "a3f1476d-5f70-45c4-aa04-ebc6558033b8",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-12-02T09:58:33.152532Z",
|
||||
"iopub.status.busy": "2023-12-02T09:58:33.152132Z",
|
||||
"iopub.status.idle": "2023-12-02T09:58:33.270132Z",
|
||||
"shell.execute_reply": "2023-12-02T09:58:33.269673Z",
|
||||
"shell.execute_reply.started": "2023-12-02T09:58:33.152500Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"787\n",
|
||||
"1 吴强\n",
|
||||
"2 李丹\n",
|
||||
"3 王勃\n",
|
||||
"4 史海燕\n",
|
||||
"5 周美琴\n",
|
||||
"6 钟丽\n",
|
||||
"7 徐玉清\n",
|
||||
"8 苏洪梅\n",
|
||||
"9 张杰\n",
|
||||
"10 杨植文\n",
|
||||
"11 张梦瑶\n",
|
||||
"12 韩晓舒\n",
|
||||
"13 栗晓娜\n",
|
||||
"14 陈继杨\n",
|
||||
"15 陈雪梅\n",
|
||||
"16 林宏锟\n",
|
||||
"17 汝晴\n",
|
||||
"18 庞珺珊\n",
|
||||
"19 姚子翔\n",
|
||||
"20 罗泽伟\n",
|
||||
"21 吴子巍\n",
|
||||
"22 史策\n",
|
||||
"23 赵婷婷\n",
|
||||
"24 韦州全\n",
|
||||
"25 代迪\n",
|
||||
"26 傅志成\n",
|
||||
"27 刘国旭\n",
|
||||
"28 宋燕\n",
|
||||
"29 侯海霞\n",
|
||||
"30 刘慧\n",
|
||||
"31 古富兰\n",
|
||||
"32 范和文\n",
|
||||
"33 冯鸥\n",
|
||||
"34 王依然\n",
|
||||
"35 田长利\n",
|
||||
"36 杜苹苹\n",
|
||||
"37 姜涛\n",
|
||||
"38 王晓松\n",
|
||||
"39 雷文秀\n",
|
||||
"40 徐月\n",
|
||||
"41 李凤燕\n",
|
||||
"42 尹莎\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
@@ -2057,10 +1978,227 @@
|
||||
" i+=1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "76c5c17a-462d-4a7b-95a5-6b895f5a25dc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2024年体质检测"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a51dadfb-30e7-40f3-a437-321aa986a10f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 北海体检情况汇总"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 149,
|
||||
"id": "7410324c-92c2-4a20-9715-f003d4915c8a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-04-10T11:51:24.039781Z",
|
||||
"iopub.status.busy": "2024-04-10T11:51:24.039544Z",
|
||||
"iopub.status.idle": "2024-04-10T11:51:24.665413Z",
|
||||
"shell.execute_reply": "2024-04-10T11:51:24.664830Z",
|
||||
"shell.execute_reply.started": "2024-04-10T11:51:24.039764Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/北海体检报告数据整理2024.xlsx')\n",
|
||||
"#sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"sheet = wb['Sheet3']\n",
|
||||
"dict1 = {}\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n,2).value is None:\n",
|
||||
" break\n",
|
||||
" else: \n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" dict1.setdefault(code, {}) \n",
|
||||
" dict1[code]['name'] = sheet.cell(n, 3).value \n",
|
||||
" \n",
|
||||
" dict1[code]['sex'] = sheet.cell(n, 4).value \n",
|
||||
" dict1[code]['age'] = sheet.cell(n, 5).value \n",
|
||||
" dict1[code].setdefault('bz',[]) \n",
|
||||
" dict1[code]['bz'].append(sheet.cell(n, 7).value) \n",
|
||||
" \n",
|
||||
"filename = 'data/北海炼化2023年健康体检团体报告.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok')\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" mbz = set(v['bz'])\n",
|
||||
" list2.append(k)\n",
|
||||
" list2.append(v['name'])\n",
|
||||
" list2.append(v['sex'])\n",
|
||||
" list2.append(v['age'])\n",
|
||||
" list2.append(','.join(mbz))\n",
|
||||
" list1.append(list2)\n",
|
||||
"title = ['体检编号','姓名','性别','年龄','体检症状']\n",
|
||||
"filename = 'data/中国石化北海炼化有限责任公司2023年职业体检团体报告汇总统计表.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) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "3cb5a5c9-e3d5-4959-a085-b3a34d778334",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计体检项目"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 148,
|
||||
"id": "28825d80-9123-4ec5-b107-9ad133f11a82",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-04-10T11:47:45.024742Z",
|
||||
"iopub.status.busy": "2024-04-10T11:47:45.024528Z",
|
||||
"iopub.status.idle": "2024-04-10T11:47:45.386052Z",
|
||||
"shell.execute_reply": "2024-04-10T11:47:45.385453Z",
|
||||
"shell.execute_reply.started": "2024-04-10T11:47:45.024726Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"畸胎瘤\n",
|
||||
"细胞角蛋白19片段增高\n",
|
||||
"癌胚抗原(定量)(CEA)增高\n",
|
||||
"尿糖阳性\n",
|
||||
"脊柱侧弯\n",
|
||||
"甲状腺结节\n",
|
||||
"游离三碘甲状腺原氨酸(FT3)增高\n",
|
||||
"2级高血压(中度)\n",
|
||||
"肾错构瘤\n",
|
||||
"胆囊结石\n",
|
||||
"天门冬氨酸氨基转移酶(AST)增高\n",
|
||||
"颈椎退行性变\n",
|
||||
"血脂异常\n",
|
||||
"听力下降\n",
|
||||
"肺少许慢性炎症\n",
|
||||
"卵巢囊肿\n",
|
||||
"色弱\n",
|
||||
"肥胖\n",
|
||||
"窦性心动过缓\n",
|
||||
"预激综合征\n",
|
||||
"甲胎蛋白(AFP)增高\n",
|
||||
"体重偏低\n",
|
||||
"糖链抗原(CA-125)偏高\n",
|
||||
"前列腺特异抗原(PSA)增高\n",
|
||||
"肾钙乳症\n",
|
||||
"血压高\n",
|
||||
"轻度ST段改变\n",
|
||||
"肺大疱\n",
|
||||
"心影增大\n",
|
||||
"肝囊肿\n",
|
||||
"乳腺囊肿\n",
|
||||
"胆管扩张\n",
|
||||
"C-14呼气试验阳性\n",
|
||||
"肾结石\n",
|
||||
"胆囊壁稍毛糙\n",
|
||||
"尿蛋白阳性\n",
|
||||
"血清γ-谷氨酰基转移酶(GGT)增高\n",
|
||||
"咽部充血\n",
|
||||
"糖链抗原(CA-242)偏高\n",
|
||||
"脂肪肝\n",
|
||||
"前列腺囊肿\n",
|
||||
"动脉血管弹性下降\n",
|
||||
"肝脂肪度为中度\n",
|
||||
"胆囊息肉\n",
|
||||
"白内障\n",
|
||||
"前列腺稍大并钙化灶\n",
|
||||
"肝纤维化为轻度\n",
|
||||
"肝血管瘤\n",
|
||||
"血压低\n",
|
||||
"空腹血糖增高\n",
|
||||
"肝脂肪度为轻度\n",
|
||||
"前列腺增大\n",
|
||||
"肝纤维化为中度\n",
|
||||
"人乳头瘤病毒基因分型(HPV)高危型阳\n",
|
||||
"前列腺钙化灶\n",
|
||||
"EB病毒抗体(EB-Ab)阳性\n",
|
||||
"颈椎骨质增生\n",
|
||||
"肝脂肪度为重度\n",
|
||||
"胆囊息肉样病变\n",
|
||||
"轻度ST-T改变\n",
|
||||
"胆囊泥沙样结石\n",
|
||||
"肝实质光点密集\n",
|
||||
"肾囊肿\n",
|
||||
"血尿酸增高\n",
|
||||
"尿潜血阳性\n",
|
||||
"心电图提示:V1呈QS型\n",
|
||||
"血肌酐增高\n",
|
||||
"室性早搏\n",
|
||||
"宫颈息肉\n",
|
||||
"肺结节\n",
|
||||
"胆固醇结晶\n",
|
||||
"神经元特异性烯醇化酶(NSE)偏高\n",
|
||||
"心房纤颤\n",
|
||||
"肝纤维化为重度\n",
|
||||
"糖化血红蛋白(HbA1c)增高\n",
|
||||
"甲状腺囊肿\n",
|
||||
"肺少许炎症\n",
|
||||
"脾囊肿\n",
|
||||
"肝低回声区\n",
|
||||
"屈光不正\n",
|
||||
"血清丙氨酸氨基转移酶(ALT)增高\n",
|
||||
"肝实质光点稍密集\n",
|
||||
"动脉血管弹性稍下降\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/北海体检报告数据整理2024.xlsx')\n",
|
||||
"#sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"sheet = wb['Sheet3']\n",
|
||||
"xm = set()\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n,2).value is None:\n",
|
||||
" break\n",
|
||||
" else: \n",
|
||||
" xm.add(sheet.cell(n, 7).value) \n",
|
||||
"for item in xm:\n",
|
||||
" print(item)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e30031dc-3597-4594-8c32-693a958ae171",
|
||||
"id": "d3e0075b-7a93-4454-860b-ba523e63ea08",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
+1497
-16
File diff suppressed because it is too large.
Load diff
+84
-18
@@ -615,6 +615,87 @@
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "75aa9852-64aa-4ede-b9a0-00cd4f672527",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## word文档读取表格"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2d01d0ae-ab9a-4798-9723-51e4fd2bb112",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import docx\n",
|
||||
"import json\n",
|
||||
"doc = docx.Document(r\"data/中国石化北海炼化有限责任公司2023年健康体检团体报告.docx\")\n",
|
||||
"for i, table in enumerate(doc.tables):\n",
|
||||
" print(f\"Table {i}:\")\n",
|
||||
" for row in table.rows:\n",
|
||||
" print(type(row))\n",
|
||||
" for cell in row.cells:\n",
|
||||
" if cell.text =='序号':\n",
|
||||
" print(cell.text, end=\" | \")\n",
|
||||
" print() # 每一行结束后换行\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "c3ccfa25-f31c-46d4-bfd0-903832cc620d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-04-10T11:08:13.063231Z",
|
||||
"iopub.status.busy": "2024-04-10T11:08:13.063012Z",
|
||||
"iopub.status.idle": "2024-04-10T11:08:25.173599Z",
|
||||
"shell.execute_reply": "2024-04-10T11:08:25.173048Z",
|
||||
"shell.execute_reply.started": "2024-04-10T11:08:13.063213Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import docx\n",
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"doc = docx.Document(r\"data/中国石化北海炼化有限责任公司2023年职业体检团体报告.docx\")\n",
|
||||
"list2 = []\n",
|
||||
"for i, table in enumerate(doc.tables):\n",
|
||||
" \n",
|
||||
" if table.cell(0, 0).text == '序号':\n",
|
||||
" #print(f\"Table {i}:\")\n",
|
||||
" \n",
|
||||
" for row in table.rows:\n",
|
||||
" list1= []\n",
|
||||
" for cell in row.cells:\n",
|
||||
" list1.append(cell.text)\n",
|
||||
" if list1[0] !='序号':\n",
|
||||
" list2.append(list1)\n",
|
||||
"filename = '北海体测报告情况表2024.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": "code",
|
||||
"execution_count": null,
|
||||
@@ -735,27 +816,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 40,
|
||||
"execution_count": null,
|
||||
"id": "d05d85d2-5229-446e-bfff-1f0feb8b7f09",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-10T10:04:32.991821Z",
|
||||
"iopub.status.busy": "2023-04-10T10:04:32.991387Z",
|
||||
"iopub.status.idle": "2023-04-10T10:04:34.154437Z",
|
||||
"shell.execute_reply": "2023-04-10T10:04:34.153707Z",
|
||||
"shell.execute_reply.started": "2023-04-10T10:04:32.991783Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"13\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"from docxtpl import DocxTemplate,InlineImage\n",
|
||||
@@ -1175,7 +1241,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user