This commit is contained in:
512song committed 2023-12-03 15:04:51 +08:00
1 parent b33bbbd408
commit de6a5be703
3 files changed
+1026 -71

No files matched your search

+351 -62
View File
@@ -506,47 +506,6 @@
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "cf8f168e-4161-4fbb-bf5f-f9d1cb9bbb6f",
"metadata": {},
"source": [
"### 生成报告清单"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f20224aa-2131-473d-a0ec-0743482ed58e",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"\n",
"filename = 'data/result_天津231017.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"dict2 = {}\n",
"list2 = []\n",
"i= 1\n",
"p= 1\n",
"for k, v in dict1.items():\n",
" list2.append(k)\n",
" i+=1\n",
" if i>200:\n",
" dict2[p] = list2\n",
" p+=1\n",
" i = 1\n",
" list2 = []\n",
"dict2[p] = list2\n",
"filename = f'data/报告清单.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "ceef0742-f62a-4a7d-b0d5-be7ae7abb741",
@@ -640,6 +599,130 @@
"print(i)"
]
},
{
"cell_type": "markdown",
"id": "4642faf7-52bf-40e9-9af3-7555d4eef10b",
"metadata": {},
"source": [
"## 体测报告按部门分类"
]
},
{
"cell_type": "code",
"execution_count": 91,
"id": "d913a531-51b3-4795-adc3-f4fc858d7401",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-03T05:44:37.781259Z",
"iopub.status.busy": "2023-12-03T05:44:37.780816Z",
"iopub.status.idle": "2023-12-03T05:44:37.997978Z",
"shell.execute_reply": "2023-12-03T05:44:37.997477Z",
"shell.execute_reply.started": "2023-12-03T05:44:37.781224Z"
},
"tags": []
},
"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/北海炼化2023'\n",
"new_path = 'file/北海炼化2023'\n",
"old = []\n",
"dict2 = {}\n",
"\n",
"filename = 'data/北海炼化2023年.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\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)"
]
},
{
"cell_type": "markdown",
"id": "1e6ece92-7845-49df-a84c-88a2befee570",
"metadata": {},
"source": [
"## 生成体测报告打印明细表"
]
},
{
"cell_type": "code",
"execution_count": 93,
"id": "02319955-7fb6-4791-ae45-55b03bdadd54",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-03T05:54:39.061703Z",
"iopub.status.busy": "2023-12-03T05:54:39.061244Z",
"iopub.status.idle": "2023-12-03T05:54:39.128729Z",
"shell.execute_reply": "2023-12-03T05:54:39.128308Z",
"shell.execute_reply.started": "2023-12-03T05:54:39.061649Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[['0325', '邱建明', '男', '炼油一部'], ['0175', '季彩平', '女', '检验计量中心'], ['0818', '刘潮辉', '男', '新上岗'], ['0396', '邓桂雄', '男', '炼油一部'], ['0780', '邓施艳', '女', '财务资产部'], ['0372', '李哲宇', '男', '炼油一部'], ['0340', '张宏智', '男', '炼油一部'], ['0403', '卫恒', '男', '炼油一部'], ['0090', '黄鑫', '女', '炼油三部'], ['0082', '董澄林', '男', '炼油三部'], ['0817', '封帆', '女', '新上岗'], ['0807', '张惜光', '男', '行政事务中心'], ['0433', '李晋渊', '男', '储运部'], ['0717', '杨梦春', '男', '生产技术部'], ['0386', '盛国娟', '女', '炼油一部'], ['0313', '李志永', '男', '炼油一部'], ['0561', '杨微', '女', '炼油二部'], ['0473', '王晓甫', '男', '储运部'], ['0643', '王梓润', '男', '炼油二部'], ['0453', '李志雄', '男', '储运部'], ['0010', '蓝志君', '男', '炼油三部'], ['0747', '吴文强', '男', '设备工程部'], ['0256', '马祥光', '男', '电气仪表中心'], ['0625', '郭卫富', '男', '炼油二部'], ['0475', '刘利', '男', '储运部'], ['0283', '魏建民', '男', '炼油一部'], ['0134', '赵小丽', '女', '公用工程部'], ['0057', '苗光浩', '男', '炼油三部'], ['0162', '李林', '男', '检验计量中心'], ['0092', '刘鸿亮', '男', '炼油三部'], ['0614', '张金斗', '男', '炼油二部'], ['0452', '江荣明', '男', '储运部'], ['0437', '张琪静', '女', '储运部'], ['0239', '陈孔兰', '女', '检验计量中心'], ['0622', '陆锡健', '男', '炼油二部'], ['0595', '李孩峄', '男', '炼油二部'], ['0246', '苏晓东', '男', '电气仪表中心'], ['0532', '王威', '男', '炼油二部'], ['0266', '刘建功', '男', '电气仪表中心'], ['0320', '涂莉', '女', '炼油一部'], ['0091', '冼冠宇', '男', '炼油三部'], ['0062', '刘天宇', '男', '炼油三部'], ['0432', '梁波', '男', '储运部'], ['0339', '王继政', '男', '炼油一部'], ['0683', '于洋', '女', '党群工作部'], ['0581', '王建鑫', '男', '炼油二部'], ['0011', '刘前程', '男', '炼油三部'], ['0610', '李忠', '男', '炼油二部'], ['0375', '聂珊珊', '女', '炼油一部'], ['0118', '苏远雄', '男', '公用工程部'], ['0801', '杨敏', '女', '物资采购中心'], ['0042', '赵欣野', '男', '炼油三部'], ['0496', '李晗', '男', '储运部'], ['0308', '田铮铮', '男', '炼油一部'], ['0772', '杨坤妮', '女', '安全环保部'], ['0400', '王海林', '男', '炼油一部'], ['0441', '郑志强', '男', '储运部'], ['0594', '陈达', '男', '炼油二部'], ['0563', '朱鑫', '男', '炼油二部'], ['0334', '黎镇杰', '男', '炼油一部'], ['0781', '文星', '男', '财务资产部'], ['0307', '黄春湖', '女', '炼油一部'], ['0686', '黄洁', '女', '党委组织部'], ['0564', '符龙', '男', '炼油二部'], ['0401', '陈福培', '男', '炼油一部'], ['0371', '张中升', '男', '炼油一部'], ['0109', '李红武', '男', '公用工程部'], ['0569', '张健尧', '男', '炼油二部'], ['0820', '苏铭', '男', '新上岗'], ['0815', '杨尊', '男', '新上岗'], ['0124', '曹炳锋', '男', '公用工程部'], ['0526', '吴德立', '男', '炼油二部'], ['0707', '徐业卫', '女', '发展计划部'], ['0143', '崔路巧', '男', '公用工程部'], ['0247', '许俊雄', '男', '电气仪表中心'], ['0830', '张原', '男', '新上岗'], ['0618', '王增利', '男', '炼油二部'], ['0600', '刘业宇', '男', '炼油二部'], ['0766', '翟璟峰', '男', '安全环保部'], ['0637', '阎千兵', '男', '炼油二部'], ['0730', '莫有先', '男', '生产技术部'], ['0026', '刘志', '男', '炼油三部'], ['0423', '罗海', '男', '储运部'], ['0348', '黎福营', '男', '炼油一部'], ['0177', '张健', '女', '检验计量中心'], ['0218', '杨植文', '男', '检验计量中心'], ['0560', '张健', '男', '炼油二部'], ['0367', '冯福', '男', '炼油一部'], ['0306', '杨水珍', '女', '炼油一部'], ['0787', '李建英', '女', '财务资产部'], ['0330', '王鹏', '男', '炼油一部'], ['0612', '默鑫晔', '男', '炼油二部'], ['0557', '梁本康', '男', '炼油二部'], ['0052', '张鹏', '男', '炼油三部'], ['0087', '张仕尧', '男', '炼油三部'], ['0216', '宁碧玉', '女', '检验计量中心'], ['0617', '张升坚', '男', '炼油二部'], ['0501', '谭力允', '男', '储运部'], ['0756', '文鹏', '男', '设备工程部'], ['0504', '李扩生', '男', '储运部'], ['0718', '谭德', '男', '生产技术部'], ['0466', '黄钰智', '男', '储运部'], ['0567', '王勇', '男', '炼油二部'], ['0763', '王健', '男', '安全环保部'], ['0095', '韦增铝', '男', '炼油三部'], ['0611', '韦汉团', '男', '炼油二部'], ['0314', '柏可军', '男', '炼油一部'], ['0506', '陆进生', '男', '储运部'], ['0085', '叶广兵', '男', '炼油三部'], [Line truncated
"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/北海炼化2023'\n",
"\n",
"filename = 'data/北海炼化2023年.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": "849ccf0c-374c-4915-98ae-78156203ed59",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "732161bb-98f2-4861-ab66-7a374678bcd8",
@@ -1325,15 +1408,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 80,
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:38:38.431850Z",
"iopub.status.busy": "2023-12-02T09:38:38.431525Z",
"iopub.status.idle": "2023-12-02T09:38:38.446189Z",
"shell.execute_reply": "2023-12-02T09:38:38.445802Z",
"shell.execute_reply.started": "2023-12-02T09:38:38.431810Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"平均成绩:2.8593分,男性:327人\n",
"平均成绩:3.1506分,女性:77人\n",
"平均成绩:2.9148分,总体:404人\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
"filename = 'data/data_长炼医院.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -1367,18 +1467,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 81,
"id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:38:42.982840Z",
"iopub.status.busy": "2023-12-02T09:38:42.982381Z",
"iopub.status.idle": "2023-12-02T09:38:43.037289Z",
"shell.execute_reply": "2023-12-02T09:38:43.036187Z",
"shell.execute_reply.started": "2023-12-02T09:38:42.982802Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0~255分人数:92人,男性:84人,女性:8人\n",
"256~332分人数:217人,男性:178人,女性:39人\n",
"333~367分人数:72人,男性:50人,女性:22人\n",
"368~500分人数:23人,男性:15人,女性:8人\n",
"404\n",
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n",
"filename = 'data/data_北海炼化2023.json'\n",
"filename = 'data/data_长炼医院.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
@@ -1418,12 +1538,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 82,
"id": "2d661ca6-6129-4da1-ac25-51d0156babb2",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:38:46.862847Z",
"iopub.status.busy": "2023-12-02T09:38:46.862403Z",
"iopub.status.idle": "2023-12-02T09:38:46.885423Z",
"shell.execute_reply": "2023-12-02T09:38:46.884184Z",
"shell.execute_reply.started": "2023-12-02T09:38:46.862811Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 11, '不合格': 4, '良好': 2, '优秀': 1}\n",
"25-29 {'不合格': 0, '合格': 2, '良好': 3, '优秀': 1}\n",
"30-34 {'合格': 3, '不合格': 0, '良好': 1, '优秀': 0}\n",
"35-39 {'合格': 1, '不合格': 0, '良好': 1, '优秀': 1}\n",
"40-44 {'合格': 4, '不合格': 0, '良好': 0, '优秀': 0}\n",
"45-49 {'不合格': 3, '良好': 13, '合格': 17, '优秀': 5}\n",
"50-54 {'不合格': 1, '合格': 1, '良好': 2, '优秀': 0}\n",
"55-80 {'合格': 0, '不合格': 0}\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1463,12 +1605,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 83,
"id": "fc97df37-34ff-4a02-9d26-b5d81b706e46",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:38:49.264932Z",
"iopub.status.busy": "2023-12-02T09:38:49.264452Z",
"iopub.status.idle": "2023-12-02T09:38:49.286566Z",
"shell.execute_reply": "2023-12-02T09:38:49.285493Z",
"shell.execute_reply.started": "2023-12-02T09:38:49.264866Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 34, '不合格': 19, '良好': 10, '优秀': 1}\n",
"25-29 {'不合格': 9, '合格': 17, '良好': 3, '优秀': 0}\n",
"30-34 {'合格': 24, '不合格': 12, '良好': 6, '优秀': 3}\n",
"35-39 {'合格': 20, '不合格': 6, '良好': 4, '优秀': 3}\n",
"40-44 {'合格': 14, '不合格': 5, '良好': 8, '优秀': 1}\n",
"45-49 {'不合格': 15, '良好': 13, '合格': 27, '优秀': 2}\n",
"50-54 {'不合格': 12, '合格': 31, '良好': 6, '优秀': 5}\n",
"55-80 {'合格': 11, '不合格': 6}\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1508,12 +1672,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 84,
"id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:38:53.375671Z",
"iopub.status.busy": "2023-12-02T09:38:53.375130Z",
"iopub.status.idle": "2023-12-02T09:38:53.396164Z",
"shell.execute_reply": "2023-12-02T09:38:53.394885Z",
"shell.execute_reply.started": "2023-12-02T09:38:53.375634Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16~24岁平均成绩:2.82分,人数:82人,男性:64人\n",
"25~29岁平均成绩:2.84分,人数:35人,男性:29人\n",
"30~34岁平均成绩:2.84分,人数:49人,男性:45人\n",
"35~39岁平均成绩:3.03分,人数:36人,男性:33人\n",
"40~44岁平均成绩:2.95分,人数:32人,男性:28人\n",
"45~49岁平均成绩:3.03分,人数:95人,男性:57人\n",
"50~54岁平均成绩:2.95分,人数:58人,男性:54人\n",
"55~69岁平均成绩:2.72分,人数:17人,男性:17人\n"
]
}
],
"source": [
"nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
"\n",
@@ -1548,12 +1734,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 89,
"id": "347703a1-501b-4800-bd29-16e94f4a6793",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T15:15:48.243512Z",
"iopub.status.busy": "2023-12-02T15:15:48.243065Z",
"iopub.status.idle": "2023-12-02T15:15:48.263263Z",
"shell.execute_reply": "2023-12-02T15:15:48.262071Z",
"shell.execute_reply.started": "2023-12-02T15:15:48.243476Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:2.8分,人数:64人\n",
"25~29岁平均成绩:2.74分,人数:29人\n",
"30~34岁平均成绩:2.82分,人数:45人\n",
"35~39岁平均成绩:2.96分,人数:33人\n",
"40~44岁平均成绩:2.96分,人数:28人\n",
"45~49岁平均成绩:2.89分,人数:57人\n",
"50~54岁平均成绩:2.94分,人数:54人\n",
"55~80岁平均成绩:2.72分,人数:17人\n"
]
}
],
"source": [
"import json\n",
"\n",
@@ -1588,10 +1796,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 90,
"id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T15:15:53.325620Z",
"iopub.status.busy": "2023-12-02T15:15:53.325175Z",
"iopub.status.idle": "2023-12-02T15:15:53.345673Z",
"shell.execute_reply": "2023-12-02T15:15:53.344765Z",
"shell.execute_reply.started": "2023-12-02T15:15:53.325577Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:2.9分,人数:18人\n",
"25~29岁平均成绩:3.32分,人数:6人\n",
"30~34岁平均成绩:3.08分,人数:4人\n",
"35~39岁平均成绩:3.74分,人数:3人\n",
"40~44岁平均成绩:2.91分,人数:4人\n",
"45~49岁平均成绩:3.23分,人数:38人\n",
"50~54岁平均成绩:3.11分,人数:4人\n",
"55~80岁平均成绩:0分,人数:0人\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1624,12 +1856,36 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 87,
"id": "ad69c45d-3f62-42df-894d-47424e759029",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:39:03.145078Z",
"iopub.status.busy": "2023-12-02T09:39:03.144630Z",
"iopub.status.idle": "2023-12-02T09:39:03.164888Z",
"shell.execute_reply": "2023-12-02T09:39:03.163659Z",
"shell.execute_reply.started": "2023-12-02T09:39:03.145041Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BMI 3.73 397\n",
"肺活量 3.44 394\n",
"握力 1.95 365\n",
"坐位体前屈 3.19 249\n",
"纵跳 2.73 377\n",
"俯卧撑 2.24 248\n",
"一分钟仰卧起坐 3.34 67\n",
"单脚站立 2.75 378\n",
"选择反应时 3.22 386\n",
"台阶指数 2.78 331\n"
]
}
],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -1654,12 +1910,45 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 88,
"id": "dcf152e7-bbcc-47d1-9c5f-83854db35412",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-02T09:39:08.338346Z",
"iopub.status.busy": "2023-12-02T09:39:08.337893Z",
"iopub.status.idle": "2023-12-02T09:39:08.356987Z",
"shell.execute_reply": "2023-12-02T09:39:08.355926Z",
"shell.execute_reply.started": "2023-12-02T09:39:08.338309Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"行政事务中心 2.46 12\n",
"储运部 2.79 58\n",
"长炼医院外二科 2.5 1\n",
"设备工程部 3.22 2\n",
"群众工作部 3.71 4\n",
"纪委(监督部) 3.33 2\n",
"IT服务中心 3.67 1\n",
"计量站 2.87 3\n",
"热电部 2.88 84\n",
"生产部 3.38 1\n",
"炼油一部 2.96 39\n",
"安全环保部 2.35 2\n",
"化工部 2.95 143\n",
"财务资产部 2.67 1\n",
"计划经营部 3.22 1\n",
"炼油二部 3.02 44\n",
"消防中心 3.0 1\n",
"港口部 2.77 4\n",
"水务部 3.11 1\n"
]
}
],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",