From 8242dc00aa62bd692695ea79e818e24101372d65 Mon Sep 17 00:00:00 2001 From: 512song Date: Thu, 25 May 2023 19:17:38 +0800 Subject: [PATCH] 20230525 --- 体测单位/体检报告分析.ipynb | 95 ++++-- 体测单位/北京农行.ipynb | 520 ++++++++++++++++++++++++++++++++ 体测单位/燕山石化.ipynb | 12 +- 体测单位/石家庄石化.ipynb | 580 +++++++++--------------------------- 文件操作.ipynb | 16 +- 5 files changed, 745 insertions(+), 478 deletions(-) create mode 100644 体测单位/北京农行.ipynb diff --git a/体测单位/体检报告分析.ipynb b/体测单位/体检报告分析.ipynb index 98c9bde..66b6262 100644 --- a/体测单位/体检报告分析.ipynb +++ b/体测单位/体检报告分析.ipynb @@ -33,8 +33,6 @@ ], "source": [ "import json\n", - "import time\n", - "import csv\n", "\n", "filename = 'data/淄博交警体质指标问卷.json'\n", "item = {}\n", @@ -63,6 +61,58 @@ "print('ok')" ] }, + { + "cell_type": "markdown", + "id": "5eed4886-a332-429f-9283-e109d48227fe", + "metadata": {}, + "source": [ + "## 体质指标问卷整理" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "857ca433-556a-4152-af7e-5f81434d11a7", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-22T13:35:16.464666Z", + "iopub.status.busy": "2023-05-22T13:35:16.463814Z", + "iopub.status.idle": "2023-05-22T13:35:16.476027Z", + "shell.execute_reply": "2023-05-22T13:35:16.474929Z", + "shell.execute_reply.started": "2023-05-22T13:35:16.464626Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/淄博交警体质问卷参数.json'\n", + "item = {}\n", + "unit = {}\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "for k, v in dict1.items():\n", + " if 'choices' in v.keys():\n", + " dict2 = {}\n", + " for item in v['choices']:\n", + " dict2[str(item['value'])] = item['text']\n", + " dict1[k]['choices'] = dict2\n", + "filename = 'data/淄博交警体质问卷参数.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, { "cell_type": "markdown", "id": "d7ab7cfd-3448-45a6-abb4-04e7f317b843", @@ -73,15 +123,15 @@ }, { "cell_type": "code", - "execution_count": 33, - "id": "e05bb84b-e649-4201-95d7-f9fee7b1a254", + "execution_count": 43, + "id": "f5c6a39a-3e3e-4844-8ff8-b9ebb7e8f8af", "metadata": { "execution": { - "iopub.execute_input": "2023-05-22T09:31:19.028959Z", - "iopub.status.busy": "2023-05-22T09:31:19.028116Z", - "iopub.status.idle": "2023-05-22T09:31:19.043637Z", - "shell.execute_reply": "2023-05-22T09:31:19.042568Z", - "shell.execute_reply.started": "2023-05-22T09:31:19.028917Z" + "iopub.execute_input": "2023-05-22T13:36:57.660765Z", + "iopub.status.busy": "2023-05-22T13:36:57.660192Z", + "iopub.status.idle": "2023-05-22T13:36:57.673702Z", + "shell.execute_reply": "2023-05-22T13:36:57.672666Z", + "shell.execute_reply.started": "2023-05-22T13:36:57.660720Z" }, "tags": [] }, @@ -156,9 +206,6 @@ ], "source": [ "import json\n", - "import time\n", - "import csv\n", - "\n", "filename = 'data/淄博交警体质问卷参数.json'\n", "item = {}\n", "unit = {}\n", @@ -166,8 +213,7 @@ " dict1 = json.load(fl) \n", "\n", "filename = 'data/Survey_20230522.json'\n", - "item = {}\n", - "unit = {}\n", + "\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl) \n", "for items in dict2['Survey']:\n", @@ -176,33 +222,22 @@ " print(phone)\n", " data = json.loads(items['data'])\n", " for k, v in data.items():\n", + " title = dict1[k]['title']\n", " if dict1[k]['type'] == 'radiogroup':\n", - " title = dict1[k]['title']\n", - " for item in dict1[k]['choices']:\n", - " if item['value'] == v:\n", - " value = item['text']\n", - " \n", + " value = dict1[k]['choices'][str(v)] \n", " if dict1[k]['type'] == 'text':\n", - " title = dict1[k]['title']\n", " value = v\n", " if dict1[k]['type'] == 'checkbox':\n", - " title = dict1[k]['title']\n", " value = []\n", " for choice in v:\n", - " for item in dict1[k]['choices']:\n", - " if item['value'] == choice:\n", - " value.append(item['text'])\n", - "\n", - " print(title,value) \n", - " \n", - " \n", - " " + " value.append(dict1[k]['choices'][str(choice)]) \n", + " print(title,value) " ] }, { "cell_type": "code", "execution_count": null, - "id": "f5c6a39a-3e3e-4844-8ff8-b9ebb7e8f8af", + "id": "2bb69139-b4be-4fd1-ae44-461f62b09503", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/北京农行.ipynb b/体测单位/北京农行.ipynb new file mode 100644 index 0000000..3e84181 --- /dev/null +++ b/体测单位/北京农行.ipynb @@ -0,0 +1,520 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ba2deee7-9c63-4115-bcee-ad341175fc02", + "metadata": {}, + "source": [ + "## 人员信息导入" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dea5e486-6927-469f-aa57-e5efac4670be", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/农业银行测试名单.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " if sheet.cell(n,1).value is not None:\n", + " code = int(sheet.cell(n, 2).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " if sheet.cell(n, 4).value ==1:\n", + " sex = '男'\n", + " else:\n", + " sex = '女'\n", + " dict1['sex'] = sex\n", + " birth = str(sheet.cell(n, 5).value).split()[0]\n", + " dict1['birth'] = birth\n", + " dict1['unit'] = sheet.cell(n, 1).value\n", + " if sheet.cell(n,10).value is not None:\n", + " dict1['phone'] = sheet.cell(n, 10).value \n", + " person[code] = dict1\n", + "\n", + "filename = 'data/北京农行人员名单.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "1c00e1e4-101a-4e9f-a7ed-9c65200d19df", + "metadata": {}, + "source": [ + "## 成绩导入" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import json\n", + "import time\n", + "import csv\n", + "\n", + "filename = '../item.json'\n", + "item = {}\n", + "unit = {}\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "for k,v in dict1.items():\n", + " item[k] = v\n", + "re_ta = {}\n", + "dict1 = {}\n", + "list1 = []\n", + "filename = 'data/北京农行人员名单.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/places_result_20230521.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", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " list1.append(line)\n", + "#print(list1)\n", + "for result in list1:\n", + " user = str(result[2])\n", + " if user in dict1.keys(): \n", + " m_item = str(result[3]) \n", + " re_ta.setdefault(user,{}) \n", + " re_ta[user]['name'] = dict1[user]['name']\n", + " re_ta[user]['sex'] = dict1[user]['sex'] \n", + " re_ta[user]['unit'] = dict1[user]['unit']\n", + " item_name = item[m_item]['name']\n", + " re_ta[user].setdefault(item_name,{}) \n", + " score = int(result[4])/item[m_item]['divisor'] \n", + " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", + "print(len(re_ta))\n", + "filename = 'data/result_北京农行.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(re_ta, fl, ensure_ascii=False) \n", + "print(len(re_ta))" + ] + }, + { + "cell_type": "markdown", + "id": "928790e6-d8a4-4b2b-852a-3c323380a80f", + "metadata": {}, + "source": [ + "## 成绩导出" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "\n", + "filename = 'data/result_北京农行.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\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(v['name']) \n", + " list2.append(dict2[k]['sex'])\n", + " list2.append(dict2[k]['unit'])\n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['成绩']) \n", + " elif item =='name':\n", + " list2.append(v[item])\n", + " else:\n", + " list2.append('') \n", + " list1.append(list2)\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)" + ] + }, + { + "cell_type": "markdown", + "id": "dd2034ca-fe8b-4322-b06d-8c5eaf96373d", + "metadata": {}, + "source": [ + "## 报告按部门分类更名" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "04967ec6-b9a0-4097-9e1f-8beaf8a9e75f", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import os,sys,shutil\n", + "import json\n", + "import math\n", + "import glob\n", + "from pathlib import Path\n", + "\n", + "fi_path = 'file/2023-05-23'\n", + "old = []\n", + "dict2 = {}\n", + "\n", + "filename = 'data/result_北京农行.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "for k, v in dict1.items():\n", + " m_name = v['name']\n", + " m_depart = v['unit'] \n", + " dict2[int(k)] = [m_name,m_depart]\n", + "\n", + "fls = glob.glob(f'{fi_path}/*.pdf')\n", + "\n", + "for fn in fls:\n", + " old.append(os.path.basename(fn).split('.')[0])\n", + "\n", + "for n in old: \n", + " o_name = f'{fi_path}/{n}.pdf'\n", + " new_path = Path(fi_path,'new',dict1[n]['unit'])\n", + " new_path.mkdir(parents = True, exist_ok = True)\n", + " n_name = Path(new_path,f'{str(n).rjust(5,\"0\")}-{dict2[int(n)][0]}.pdf')\n", + " if not os.path.exists(n_name):\n", + " shutil.copyfile(o_name,n_name)\n", + " print(n_name)\n", + " \n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "515bc854-5745-4c38-8633-f56a078ea9a8", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-25T09:28:28.615647Z", + "iopub.status.busy": "2023-05-25T09:28:28.614774Z", + "iopub.status.idle": "2023-05-25T09:28:28.619865Z", + "shell.execute_reply": "2023-05-25T09:28:28.618821Z", + "shell.execute_reply.started": "2023-05-25T09:28:28.615607Z" + } + }, + "source": [ + "## 生成人员电话信息表" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "c925d850-ff06-4be5-bf9f-31f4385c37c0", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-25T09:39:32.123643Z", + "iopub.status.busy": "2023-05-25T09:39:32.122802Z", + "iopub.status.idle": "2023-05-25T09:39:32.189169Z", + "shell.execute_reply": "2023-05-25T09:39:32.188132Z", + "shell.execute_reply.started": "2023-05-25T09:39:32.123602Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "162\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "wb = openpyxl.load_workbook('data/农业银行测试手机号码统计表.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "dict1 = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " if sheet.cell(n,5).value is not None:\n", + " phone = str(sheet.cell(n, 5).value)\n", + " dict1.setdefault(phone,{})\n", + " code = str(sheet.cell(n, 2).value)\n", + " unit = sheet.cell(n, 1).value\n", + " name = sheet.cell(n, 3).value\n", + " sex = sheet.cell(n, 4).value\n", + " dict1[phone]['code'] = code\n", + " dict1[phone]['name'] = name\n", + " #dict1[phone]['unit'] = unit\n", + " #dict1[phone]['sex'] = sex\n", + "filename = 'data/农业银行测试手机号码.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) \n", + "print(len(dict1))\n" + ] + }, + { + "cell_type": "markdown", + "id": "0f13e837-15d9-4dc6-b356-78b79bbb5b17", + "metadata": {}, + "source": [ + "## 生成验证码" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "a87384c6-dc46-4d09-b757-b42462ed818d", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-25T09:51:28.611776Z", + "iopub.status.busy": "2023-05-25T09:51:28.610914Z", + "iopub.status.idle": "2023-05-25T09:51:28.626319Z", + "shell.execute_reply": "2023-05-25T09:51:28.625266Z", + "shell.execute_reply.started": "2023-05-25T09:51:28.611734Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "162\n", + "['6085', '5304', '3071', '8954', '4051', '2348', '7629', '3607', '2095', '8107', '7905', '2791', '8460', '5096', '4062', '1978', '0976', '8492', '0197', '0287', '3764', '6589', '5439', '5607', '0541', '8629', '3275', '7620', '4795', '3025', '5862', '5410', '1438', '2408', '2167', '1094', '4026', '3184', '9104', '7694', '1862', '7286', '6170', '6578', '6587', '5179', '2043', '4813', '2597', '3207', '6859', '8920', '1268', '4860', '9627', '2918', '3841', '4193', '9281', '7961', '3510', '6912', '4921', '7520', '8930', '8271', '2163', '3457', '8713', '1962', '7480', '4138', '2504', '7490', '7285', '4029', '2496', '4920', '3572', '9305', '7512', '6324', '5731', '4719', '6895', '4591', '0679', '5287', '3817', '4063', '2108', '9153', '2401', '2897', '6782', '3875', '8014', '4753', '2146', '2483', '5012', '5803', '9425', '3578', '5628', '9245', '4835', '7052', '8654', '3586', '1693', '3086', '7609', '3021', '1794', '2865', '1739', '7435', '4135', '5240', '0374', '6583', '0856', '0812', '5837', '7106', '0268', '8376', '5346', '0753', '4158', '1756', '2473', '6139', '3178', '7824', '3201', '6304', '6109', '0735', '8573', '9857', '3240', '5340', '0438', '7415', '2783', '3127', '5497', '8542', '9764', '6107', '9016', '0248', '2195', '5149', '7982', '4750', '4023', '9684', '0823', '0692']\n" + ] + } + ], + "source": [ + "import random\n", + "import json\n", + "\n", + "code_list = []\n", + "for i in range(10): # 0~9\n", + " code_list.append(str(i))\n", + " \n", + "list1 = []\n", + "#print(code_num)\n", + "i = 1\n", + "while i < 163:\n", + " code = random.sample(code_list,4) #随机取6位数\n", + " code_num = ''.join(code)\n", + " if code_num not in list1:\n", + " list1.append(code_num)\n", + " i +=1\n", + "print(len(list1))\n", + "print(list1)\n", + "i = 0\n", + "filename = 'data/农业银行测试手机号码.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "for k, v in dict1.items():\n", + " dict1[k]['yzm'] = list1[i]\n", + " i +=1\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) " + ] + }, + { + "cell_type": "markdown", + "id": "fba0a0c4-edf2-45c2-9199-c6a86919f191", + "metadata": {}, + "source": [ + "## 发送短信" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "62733f52-62c1-43aa-964a-232eab8b5251", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-25T10:18:47.776482Z", + "iopub.status.busy": "2023-05-25T10:18:47.776048Z", + "iopub.status.idle": "2023-05-25T10:18:48.066702Z", + "shell.execute_reply": "2023-05-25T10:18:48.065832Z", + "shell.execute_reply.started": "2023-05-25T10:18:47.776444Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"SendStatusSet\": [\n", + " {\n", + " \"SerialNo\": \"2640:135690281916850099280618075\",\n", + " \"PhoneNumber\": \"+8613793180751\",\n", + " \"Fee\": 1,\n", + " \"SessionContext\": \"\",\n", + " \"Code\": \"Ok\",\n", + " \"Message\": \"send success\",\n", + " \"IsoCode\": \"CN\"\n", + " }\n", + " ],\n", + " \"RequestId\": \"7601194b-56e4-45a8-9543-6fcc76ce16a6\"\n", + "}\n" + ] + } + ], + "source": [ + "from tencentcloud.common import credential\n", + "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", + "from tencentcloud.sms.v20210111 import sms_client, models\n", + "\n", + "# 导入可选配置类\n", + "from tencentcloud.common.profile.client_profile import ClientProfile\n", + "from tencentcloud.common.profile.http_profile import HttpProfile\n", + "try: \n", + " secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n", + " secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n", + " cred = credential.Credential(secretId, secretKey)\n", + " \n", + "\n", + " # 实例化一个http选项,可选的,没有特殊需求可以跳过。\n", + " httpProfile = HttpProfile()\n", + " # 如果需要指定proxy访问接口,可以按照如下方式初始化hp(无需要直接忽略)\n", + " # httpProfile = HttpProfile(proxy=\"http://用户名:密码@代理IP:代理端口\")\n", + " httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n", + " httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)\n", + " httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n", + "\n", + " # 非必要步骤:\n", + " # 实例化一个客户端配置对象,可以指定超时时间等配置\n", + " clientProfile = ClientProfile()\n", + " clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n", + " clientProfile.language = \"en-US\"\n", + " clientProfile.httpProfile = httpProfile\n", + "\n", + " # 实例化要请求产品(以sms为例)的client对象\n", + " # 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,支持的地域列表参考 https://cloud.tencent.com/document/api/382/52071#.E5.9C.B0.E5.9F.9F.E5.88.97.E8.A1.A8\n", + " client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n", + " req = models.SendSmsRequest()\n", + "\n", + " \n", + " # 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666\n", + " # 应用 ID 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看\n", + " req.SmsSdkAppId = \"1400140089\"\n", + " # 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名\n", + " # 签名信息可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-sign) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-sign) 的签名管理查看\n", + " req.SignName = \"坤铭教育\"\n", + " # 模板 ID: 必须填写已审核通过的模板 ID\n", + " # 模板 ID 可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-template) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-template) 的正文模板管理查看\n", + " req.TemplateId = \"1808914\"\n", + " # 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,,若无模板参数,则设置为空\n", + " req.TemplateParamSet = [\"1234\"]\n", + " # 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]\n", + " # 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号\n", + " req.PhoneNumberSet = [\"+8613793180751\"]\n", + " # 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回\n", + " req.SessionContext = \"\"\n", + " # 短信码号扩展号(无需要可忽略): 默认未开通,如需开通请联系 [腾讯云短信小助手]\n", + " req.ExtendCode = \"\"\n", + " # 国内短信无需填写该项;国际/港澳台短信已申请独立 SenderId 需要填写该字段,默认使用公共 SenderId,无需填写该字段。注:月度使用量达到指定量级可申请独立 SenderId 使用,详情请联系 [腾讯云短信小助手](https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81)。\n", + " req.SenderId = \"\"\n", + "\n", + " resp = client.SendSms(req)\n", + "\n", + " # 输出json格式的字符串回包\n", + " print(resp.to_json_string(indent=2))\n", + "\n", + "except TencentCloudSDKException as err:\n", + " print(err)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "e924a0a9-65a5-49c4-bdf2-b9152d278ad5", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-25T11:05:39.390622Z", + "iopub.status.busy": "2023-05-25T11:05:39.389793Z", + "iopub.status.idle": "2023-05-25T11:05:39.396312Z", + "shell.execute_reply": "2023-05-25T11:05:39.395239Z", + "shell.execute_reply.started": "2023-05-25T11:05:39.390580Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "send success\n" + ] + } + ], + "source": [ + "dict1 = json.loads(resp.to_json_string(indent=2))\n", + "print(dict1['SendStatusSet'][0][\"Message\"])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "90242d3b-c719-4c23-a3e8-a718f86b14f3", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/体测单位/燕山石化.ipynb b/体测单位/燕山石化.ipynb index b2978f8..035fee2 100644 --- a/体测单位/燕山石化.ipynb +++ b/体测单位/燕山石化.ipynb @@ -10,15 +10,15 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16", "metadata": { "execution": { - "iopub.execute_input": "2023-05-18T12:36:59.824733Z", - "iopub.status.busy": "2023-05-18T12:36:59.824148Z", - "iopub.status.idle": "2023-05-18T12:37:02.051168Z", - "shell.execute_reply": "2023-05-18T12:37:02.050045Z", - "shell.execute_reply.started": "2023-05-18T12:36:59.824691Z" + "iopub.execute_input": "2023-05-25T05:10:51.673096Z", + "iopub.status.busy": "2023-05-25T05:10:51.672189Z", + "iopub.status.idle": "2023-05-25T05:10:53.934382Z", + "shell.execute_reply": "2023-05-25T05:10:53.933611Z", + "shell.execute_reply.started": "2023-05-25T05:10:51.673057Z" }, "tags": [] }, diff --git a/体测单位/石家庄石化.ipynb b/体测单位/石家庄石化.ipynb index 5467a40..feb7603 100644 --- a/体测单位/石家庄石化.ipynb +++ b/体测单位/石家庄石化.ipynb @@ -10,27 +10,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "9bd78072-29e5-4c98-8bbe-97f525cf9e4a", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T00:37:19.185801Z", - "iopub.status.busy": "2023-05-16T00:37:19.185377Z", - "iopub.status.idle": "2023-05-16T00:37:20.015287Z", - "shell.execute_reply": "2023-05-16T00:37:20.014538Z", - "shell.execute_reply.started": "2023-05-16T00:37:19.185772Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -71,28 +56,12 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "dd3c65ea-cc8a-4f1b-8698-d1799f99e101", "metadata": { - "execution": { - "iopub.execute_input": "2023-04-27T07:07:34.179338Z", - "iopub.status.busy": "2023-04-27T07:07:34.178517Z", - "iopub.status.idle": "2023-04-27T07:07:34.222956Z", - "shell.execute_reply": "2023-04-27T07:07:34.221926Z", - "shell.execute_reply.started": "2023-04-27T07:07:34.179297Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "118\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -150,16 +119,9 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "97d86ce2-6664-41a1-89d2-ddaa0611bac1", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-05T13:31:23.049611Z", - "iopub.status.busy": "2023-05-05T13:31:23.048757Z", - "iopub.status.idle": "2023-05-05T13:31:23.590103Z", - "shell.execute_reply": "2023-05-05T13:31:23.589419Z", - "shell.execute_reply.started": "2023-05-05T13:31:23.049566Z" - }, "tags": [] }, "outputs": [], @@ -213,28 +175,12 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "e2b68cb1-3a6f-4b51-afbd-d6c9634348b1", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-05T13:30:29.397704Z", - "iopub.status.busy": "2023-05-05T13:30:29.396865Z", - "iopub.status.idle": "2023-05-05T13:30:29.654357Z", - "shell.execute_reply": "2023-05-05T13:30:29.653607Z", - "shell.execute_reply.started": "2023-05-05T13:30:29.397657Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2254\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -292,16 +238,9 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "29ed0a03-72e1-4bee-8d00-95555f129d93", "metadata": { - "execution": { - "iopub.execute_input": "2023-04-27T07:11:19.132911Z", - "iopub.status.busy": "2023-04-27T07:11:19.132425Z", - "iopub.status.idle": "2023-04-27T07:11:19.660183Z", - "shell.execute_reply": "2023-04-27T07:11:19.659444Z", - "shell.execute_reply.started": "2023-04-27T07:11:19.132880Z" - }, "tags": [] }, "outputs": [], @@ -355,27 +294,12 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "57b22a08-554b-4b23-b98c-002b4608729f", "metadata": { - "execution": { - "iopub.execute_input": "2023-04-26T09:42:34.825177Z", - "iopub.status.busy": "2023-04-26T09:42:34.824747Z", - "iopub.status.idle": "2023-04-26T09:42:34.875587Z", - "shell.execute_reply": "2023-04-26T09:42:34.874720Z", - "shell.execute_reply.started": "2023-04-26T09:42:34.825140Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'综合办公室(党委办公室)': 19, '销运管理部': 41, '企业管理部(法律事务部)': 12, '合资运行部': 27, '消防支队': 39, '设备工程部': 44, '党群文化部(宣传工团)': 9, '检验计量中心': 180, '发展计划部计划组': 11, '物资采购中心': 52, '炼油运行一部': 112, '审计管理部': 6, '发展计划部发展规划组': 12, '财务管理部': 18, '生产技术部': 35, '党委组织部(资源管理部)': 16, '安全环保部': 26, '储运运行部': 151, '化工运行部': 267, '信息中心': 18, '热电运行部': 92, '炼油运行三部': 127, '行政事务中心': 45, '电气仪表中心': 196, '炼油运行五部': 120, '水务运行部': 133, '编组站': 49, '炼油运行二部': 113, '炼油运行四部': 168, '纪委(监督部)': 2}\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import openpyxl\n", @@ -414,16 +338,9 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "0001a577-3d89-4e3d-be07-51cc74e3640f", "metadata": { - "execution": { - "iopub.execute_input": "2023-04-26T09:39:12.083561Z", - "iopub.status.busy": "2023-04-26T09:39:12.083234Z", - "iopub.status.idle": "2023-04-26T09:39:12.148788Z", - "shell.execute_reply": "2023-04-26T09:39:12.147956Z", - "shell.execute_reply.started": "2023-04-26T09:39:12.083534Z" - }, "tags": [] }, "outputs": [], @@ -461,27 +378,12 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": null, "id": "e85c1be2-7859-4b7d-8f67-a9ad12d167d4", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T14:44:53.635480Z", - "iopub.status.busy": "2023-05-16T14:44:53.634628Z", - "iopub.status.idle": "2023-05-16T14:44:53.695874Z", - "shell.execute_reply": "2023-05-16T14:44:53.694856Z", - "shell.execute_reply.started": "2023-05-16T14:44:53.635438Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "filename = 'data/result_石家庄.json'\n", @@ -497,6 +399,112 @@ " " ] }, + { + "cell_type": "markdown", + "id": "762b7b9d-e4ee-4722-909f-aa8331168b0b", + "metadata": {}, + "source": [ + "## 报告按部门分类更名" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ce2f56f9-bd85-436f-af14-844c94fa7e86", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import os,sys,shutil\n", + "import json\n", + "import math\n", + "import glob\n", + "from pathlib import Path\n", + "\n", + "fi_path = 'file/2023-04-30'\n", + "old = []\n", + "dict2 = {}\n", + "\n", + "filename = 'data/result_石家庄.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "for k, v in dict1.items():\n", + " m_name = v['name']\n", + " m_depart = v['unit'] \n", + " dict2[int(k)] = [m_name,m_depart]\n", + "\n", + "fls = glob.glob(f'{fi_path}/*.pdf')\n", + "\n", + "for fn in fls:\n", + " old.append(os.path.basename(fn).split('.')[0])\n", + "\n", + "for n in old: \n", + " o_name = f'{fi_path}/{n}.pdf'\n", + " new_path = Path(fi_path,'new',dict1[n]['unit'])\n", + " new_path.mkdir(parents = True, exist_ok = True)\n", + " n_name = Path(new_path,f'{str(n).rjust(5,\"0\")}-{dict2[int(n)][0]}.pdf')\n", + " if not os.path.exists(n_name):\n", + " shutil.copyfile(o_name,n_name)\n", + " print(n_name)\n", + " \n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "aa655c35-1765-4a62-aa07-a6b0e7d41c6d", + "metadata": {}, + "source": [ + "## 生成电子文件明细表" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "0f049372-de7c-42fd-8ee3-618a894fbabc", + "metadata": { + "execution": { + "iopub.execute_input": "2023-05-23T07:20:54.552740Z", + "iopub.status.busy": "2023-05-23T07:20:54.551892Z", + "iopub.status.idle": "2023-05-23T07:20:54.727460Z", + "shell.execute_reply": "2023-05-23T07:20:54.726743Z", + "shell.execute_reply.started": "2023-05-23T07:20:54.552699Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import os,sys,shutil\n", + "import json\n", + "import openpyxl\n", + "import glob\n", + "from pathlib import Path\n", + "\n", + "fi_path = 'file/2023-04-30'\n", + "old = []\n", + "dict2 = {}\n", + "list1 = []\n", + "\n", + "filename = 'data/result_石家庄.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "for k, v in dict1.items(): \n", + " m_name = v['name']\n", + " m_depart = v['unit'] \n", + " dict2[int(k)] = [m_name,m_depart]\n", + " list1.append([k.rjust(5,\"0\"),m_depart,m_name])\n", + "filename = 'data/石家庄测试报告明细表.xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "\n", + "for row in list1:\n", + " sheet.append(row)\n", + "wb.save(filename)" + ] + }, { "cell_type": "markdown", "id": "3a3ae88b-a59b-4403-9c98-685afe1f5268", @@ -515,30 +523,12 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "c9e4f67a-a34d-4c81-9ed7-9099d3f283f4", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T06:42:46.952331Z", - "iopub.status.busy": "2023-05-16T06:42:46.951922Z", - "iopub.status.idle": "2023-05-16T06:42:47.188427Z", - "shell.execute_reply": "2023-05-16T06:42:47.187703Z", - "shell.execute_reply.started": "2023-05-16T06:42:46.952303Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2253\n", - "['988', '2088', '2199', '1112', '2192', '523', '584', '170', '89', '1974', '1181', '1926', '846', '850', '2324', '2098', '2024', '2083', '1329', '1237']\n", - "2233\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -607,38 +597,12 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "3a8f7e29-aff1-4a5b-b31d-1c47aaf1e2fa", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T01:34:43.883914Z", - "iopub.status.busy": "2023-05-16T01:34:43.883060Z", - "iopub.status.idle": "2023-05-16T01:34:43.990826Z", - "shell.execute_reply": "2023-05-16T01:34:43.989773Z", - "shell.execute_reply.started": "2023-05-16T01:34:43.883871Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2388 {'name': '任宁', 'unit': '化工运行部', 'sex': '男', 'birth': '1982-01-16 00:00:00', '肺活量': {'成绩': '3292.0 毫升', '得分': '3'}, '选择反应时': {'成绩': '0.56 秒', '得分': '3'}, '握力': {'成绩': '41.6 千克', '得分': '2'}} \n", - "\n", - "986 {'name': '左少卿', 'unit': '炼油运行一部', 'sex': '男', 'birth': '1990-1-1', '肺活量': {'成绩': '2106.0 毫升', '得分': '0'}, '选择反应时': {'成绩': '0.665 秒', '得分': '1'}, '握力': {'成绩': '45.2 千克', '得分': '3'}} \n", - "\n", - "2053 {'name': '韩海涛', 'unit': '水务运行部', 'sex': '男', 'birth': '1971-2-1', '肺活量': {'成绩': '2414.0 毫升', '得分': '2'}, '握力': {'成绩': '38.8 千克', '得分': '2'}, '选择反应时': {'成绩': '0.591 秒', '得分': '3'}} \n", - "\n", - "2356 {'name': '张义生', 'unit': '编组站', 'sex': '男', 'birth': '1981-7-1', '肺活量': {'成绩': '1904.0 毫升', '得分': '0'}, '握力': {'成绩': '39.8 千克', '得分': '2'}, '选择反应时': {'成绩': '0.553 秒', '得分': '3'}} \n", - "\n", - "1974 {'name': '鲍英杰', 'unit': '热电运行部', 'sex': '男', 'birth': '1979-8-1', '肺活量': {'成绩': '4006.0 毫升', '得分': '4'}} \n", - "\n", - "1987 {'name': '贾宁', 'unit': '热电运行部', 'sex': '男', 'birth': '1979-1-1', '握力': {'成绩': '46.3 千克', '得分': '3'}, '单脚站立': {'成绩': '4.2 秒', '得分': '2'}, '选择反应时': {'成绩': '0.592 秒', '得分': '2'}} \n", - "\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -671,27 +635,12 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "70a69705-908f-4c77-948c-c5c781707af5", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T07:18:56.549625Z", - "iopub.status.busy": "2023-05-16T07:18:56.548729Z", - "iopub.status.idle": "2023-05-16T07:18:56.718501Z", - "shell.execute_reply": "2023-05-16T07:18:56.717607Z", - "shell.execute_reply.started": "2023-05-16T07:18:56.549584Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import datetime\n", @@ -763,31 +712,12 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, "id": "69b5f5e5-04e4-4509-8518-b7fc54cd4e45", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T07:57:17.722569Z", - "iopub.status.busy": "2023-05-16T07:57:17.722163Z", - "iopub.status.idle": "2023-05-16T07:57:17.883835Z", - "shell.execute_reply": "2023-05-16T07:57:17.883079Z", - "shell.execute_reply.started": "2023-05-16T07:57:17.722541Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:779人,男性:678人,女性:101人\n", - "256~332分人数:1009人,男性:786人,女性:223人\n", - "333~367分人数:316人,男性:189人,女性:127人\n", - "368~500分人数:129人,男性:57人,女性:72人\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -831,35 +761,12 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": null, "id": "cd27296f-2412-4a77-8b74-676c7d0efb30", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T10:12:11.824773Z", - "iopub.status.busy": "2023-05-16T10:12:11.823933Z", - "iopub.status.idle": "2023-05-16T10:12:11.901112Z", - "shell.execute_reply": "2023-05-16T10:12:11.900078Z", - "shell.execute_reply.started": "2023-05-16T10:12:11.824732Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.48分,人数:107人,男性:94人\n", - "25~29岁平均成绩:2.54分,人数:84人,男性:54人\n", - "30~34岁平均成绩:2.69分,人数:204人,男性:159人\n", - "35~39岁平均成绩:2.78分,人数:213人,男性:166人\n", - "40~44岁平均成绩:2.79分,人数:330人,男性:254人\n", - "45~49岁平均成绩:2.84分,人数:449人,男性:278人\n", - "50~54岁平均成绩:2.81分,人数:532人,男性:402人\n", - "55~59岁平均成绩:2.6分,人数:293人,男性:282人\n", - "60~69岁平均成绩:2.5分,人数:21人,男性:21人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -886,35 +793,12 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": null, "id": "5dbdf7cf-9014-448a-ba9e-0aea8afbdd6f", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T12:45:45.673845Z", - "iopub.status.busy": "2023-05-16T12:45:45.673313Z", - "iopub.status.idle": "2023-05-16T12:45:45.751891Z", - "shell.execute_reply": "2023-05-16T12:45:45.750835Z", - "shell.execute_reply.started": "2023-05-16T12:45:45.673803Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.46分,人数:94人\n", - "25~29岁平均成绩:2.36分,人数:54人\n", - "30~34岁平均成绩:2.58分,人数:159人\n", - "35~39岁平均成绩:2.7分,人数:166人\n", - "40~44岁平均成绩:2.71分,人数:254人\n", - "45~49岁平均成绩:2.71分,人数:278人\n", - "50~54岁平均成绩:2.69分,人数:402人\n", - "55~59岁平均成绩:2.59分,人数:282人\n", - "60~69岁平均成绩:2.5分,人数:21人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -940,35 +824,12 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": null, "id": "cfbb33c5-6740-4226-a792-9ef32e32479e", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T12:47:14.940870Z", - "iopub.status.busy": "2023-05-16T12:47:14.940032Z", - "iopub.status.idle": "2023-05-16T12:47:15.016945Z", - "shell.execute_reply": "2023-05-16T12:47:15.015912Z", - "shell.execute_reply.started": "2023-05-16T12:47:14.940827Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.41分,人数:13人\n", - "25~29岁平均成绩:2.77分,人数:30人\n", - "30~34岁平均成绩:3.02分,人数:45人\n", - "35~39岁平均成绩:2.99分,人数:47人\n", - "40~44岁平均成绩:3.03分,人数:76人\n", - "45~49岁平均成绩:3.02分,人数:171人\n", - "50~54岁平均成绩:3.18分,人数:130人\n", - "55~59岁平均成绩:2.61分,人数:11人\n", - "60~69岁平均成绩:0.0分,人数:0人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,59],[60,69]]\n", @@ -1001,16 +862,9 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": null, "id": "fb5ccc15-b5bb-4379-88fb-acd8abbe48b6", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T11:00:12.386346Z", - "iopub.status.busy": "2023-05-16T11:00:12.385863Z", - "iopub.status.idle": "2023-05-16T11:00:12.736993Z", - "shell.execute_reply": "2023-05-16T11:00:12.736288Z", - "shell.execute_reply.started": "2023-05-16T11:00:12.386313Z" - }, "tags": [] }, "outputs": [], @@ -1043,29 +897,12 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": null, "id": "41714148-5130-4c83-805f-bb98dbb96dd6", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T11:14:05.569248Z", - "iopub.status.busy": "2023-05-16T11:14:05.568377Z", - "iopub.status.idle": "2023-05-16T11:14:05.634577Z", - "shell.execute_reply": "2023-05-16T11:14:05.633521Z", - "shell.execute_reply.started": "2023-05-16T11:14:05.569202Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:2.6583分,男性:1710人\n", - "平均成绩:3.064分,女性:523人\n", - "平均成绩:2.7533分,女性:2233人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1104,31 +941,12 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": null, "id": "de6fbd5b-2361-4207-8bf0-08652148b729", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T11:29:57.182599Z", - "iopub.status.busy": "2023-05-16T11:29:57.182200Z", - "iopub.status.idle": "2023-05-16T11:29:57.360092Z", - "shell.execute_reply": "2023-05-16T11:29:57.359361Z", - "shell.execute_reply.started": "2023-05-16T11:29:57.182571Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:779人,男性:678人,女性:101人\n", - "256~332分人数:1009人,男性:786人,女性:223人\n", - "333~367分人数:316人,男性:189人,女性:127人\n", - "368~500分人数:129人,男性:57人,女性:72人\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1172,35 +990,12 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": null, "id": "eae7e34f-df88-4d46-bdb2-9f6bf4cfd357", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T11:52:33.551057Z", - "iopub.status.busy": "2023-05-16T11:52:33.550217Z", - "iopub.status.idle": "2023-05-16T11:52:33.628918Z", - "shell.execute_reply": "2023-05-16T11:52:33.627848Z", - "shell.execute_reply.started": "2023-05-16T11:52:33.551014Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'不合格': 4, '合格': 9, '良好': 0}\n", - "25-29 {'合格': 13, '优秀': 2, '不合格': 9, '良好': 6}\n", - "30-34 {'不合格': 8, '良好': 13, '合格': 20, '优秀': 4}\n", - "35-39 {'合格': 20, '良好': 13, '不合格': 9, '优秀': 5}\n", - "40-44 {'合格': 31, '不合格': 16, '良好': 17, '优秀': 12}\n", - "45-49 {'优秀': 20, '合格': 67, '良好': 46, '不合格': 38}\n", - "50-54 {'合格': 57, '不合格': 14, '良好': 30, '优秀': 29}\n", - "55-59 {'合格': 6, '不合格': 3, '优秀': 0, '良好': 2}\n", - "60-69 {'合格': 0, '优秀': 0, '不合格': 0, '良好': 0}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,59],[60,69]]\n", "filename = 'data/result_石家庄.json'\n", @@ -1240,56 +1035,12 @@ }, { "cell_type": "code", - "execution_count": 84, + "execution_count": null, "id": "33bfec2f-3f0c-40b3-81f6-cbbc4a0ce4b4", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T11:57:36.714514Z", - "iopub.status.busy": "2023-05-16T11:57:36.713654Z", - "iopub.status.idle": "2023-05-16T11:57:36.798934Z", - "shell.execute_reply": "2023-05-16T11:57:36.797944Z", - "shell.execute_reply.started": "2023-05-16T11:57:36.714470Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "综合办公室(党委办公室) 3.06 22\n", - "销运管理部 2.99 45\n", - "企业管理部(法律事务部) 2.84 12\n", - "合资运行部 2.9 27\n", - "消防支队 2.98 43\n", - "设备工程部 3.0 44\n", - "党群文化部(宣传工团) 2.98 10\n", - "检验计量中心 2.86 185\n", - "发展计划部计划组 3.03 12\n", - "物资采购中心 2.93 55\n", - "炼油运行一部 2.6 112\n", - "审计管理部 2.93 6\n", - "发展计划部发展规划组 2.99 13\n", - "财务管理部 3.03 17\n", - "生产技术部 2.85 37\n", - "党委组织部(资源管理部) 3.24 16\n", - "安全环保部 3.15 26\n", - "储运运行部 2.64 160\n", - "化工运行部 2.74 269\n", - "信息中心 2.95 17\n", - "电气仪表中心 2.86 226\n", - "热电运行部 2.5 91\n", - "炼油运行三部 2.58 140\n", - "行政事务中心 2.49 47\n", - "炼油运行五部 2.78 124\n", - "水务运行部 2.75 135\n", - "编组站 2.44 50\n", - "炼油运行二部 2.68 113\n", - "炼油运行四部 2.67 176\n", - "纪委(监督部) 3.0 3\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -1319,36 +1070,12 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": null, "id": "1626c578-b38d-435b-8c08-45588cd44096", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T12:15:49.551456Z", - "iopub.status.busy": "2023-05-16T12:15:49.550669Z", - "iopub.status.idle": "2023-05-16T12:15:49.633599Z", - "shell.execute_reply": "2023-05-16T12:15:49.632661Z", - "shell.execute_reply.started": "2023-05-16T12:15:49.551420Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "体重 3.49\n", - "肺活量 3.26\n", - "握力 2.54\n", - "坐位体前屈 3.06\n", - "纵跳 1.9\n", - "俯卧撑 2.39\n", - "一分钟仰卧起坐 3.9\n", - "单脚站立 2.23\n", - "选择反应时 2.9\n", - "台阶指数 3.01\n" - ] - } - ], + "outputs": [], "source": [ "filename = 'data/result_石家庄.json'\n", "with open(filename,'r') as fl:\n", @@ -1366,27 +1093,12 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": null, "id": "25b5f474-1f2e-4d6b-a6d7-2c0427a9bcbf", "metadata": { - "execution": { - "iopub.execute_input": "2023-05-16T14:14:45.541203Z", - "iopub.status.busy": "2023-05-16T14:14:45.540306Z", - "iopub.status.idle": "2023-05-16T14:14:45.551035Z", - "shell.execute_reply": "2023-05-16T14:14:45.549704Z", - "shell.execute_reply.started": "2023-05-16T14:14:45.541147Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'1': {'name': '齐新', 'phone': '13810412119'}, '2': {'name': '代盼盼', 'phone': '18811016592'}, '7': {'name': '陈建侨', 'phone': '18518668138'}, '8': {'name': '孟琳', 'phone': '13810582314'}, '15': {'name': '赵文静', 'phone': '18612218066'}, '16': {'name': '高艳丽', 'phone': '17746578620'}, '17': {'name': '魏腾飞', 'phone': '18519094064'}, '19': {'name': '杨爽', 'phone': '13911804937'}, '20': {'name': '杨静', 'phone': '15201222908'}, '21': {'name': '王京亚', 'phone': '15210034201'}, '22': {'name': '张笑寒', 'phone': '13811282007'}, '23': {'name': '周海苗', 'phone': '15811323860'}, '24': {'name': '胡颖', 'phone': '15901552680'}, '25': {'name': '孙鑫', 'phone': '15810028607'}, '26': {'name': '徐栋刚', 'phone': '13611378746'}, '27': {'name': '屈俊英', 'phone': '15321996557'}, '28': {'name': '侯然', 'phone': '15811321170'}, '29': {'name': '高梦珊', 'phone': '18310115505'}, '30': {'name': '王璐', 'phone': '18210908699'}, '31': {'name': '赵晨阳', 'phone': '13811750045'}, '32': {'name': '张子娣', 'phone': '13811679953'}, '33': {'name': '张昊翔', 'phone': '13699269376'}, '34': {'name': '霍东林', 'phone': '13701385970'}, '37': {'name': '刘鑫', 'phone': '13120475746'}, '39': {'name': '吴家硕', 'phone': '17600977328'}, '40': {'name': '田征', 'phone': '13552876727'}, '41': {'name': '张静瑶', 'phone': '13681188042'}, '42': {'name': '周维', 'phone': '13683093209'}, '43': {'name': '王芳', 'phone': '13439355291'}, '44': {'name': '刘静', 'phone': '13671067523'}, '45': {'name': '张翠萍', 'phone': '13426307538'}, '46': {'name': '郭晏辰', 'phone': '13522701405'}, '49': {'name': '王亚峰', 'phone': '13691445507'}, '50': {'name': '杨静', 'phone': '13436666818'}, '51': {'name': '刘海云', 'phone': '15011151011'}, '53': {'name': '李丽', 'phone': '13521299700'}, '54': {'name': '余华国', 'phone': '13611383112'}, '58': {'name': '叶红', 'phone': '13699107409'}, '59': {'name': '杨雪', 'phone': '13581675022'}, '60': {'name': '胡宇翔', 'phone': '18612251290'}, '61': {'name': '耿利群', 'phone': '13717616853'}, '62': {'name': '张丽侠', 'phone': '13716114708'}, '63': {'name': '郭萌萌', 'phone': '15811322896'}, '64': {'name': '刘然', 'phone': '13810646725'}, '65': {'name': '王芳', 'phone': '13811152058'}, '66': {'name': '李雪', 'phone': '18201450903'}, '67': {'name': '刘秋红', 'phone': '13581670255'}, '68': {'name': '罗琪', 'phone': '13693021978'}, '69': {'name': '刘影翠', 'phone': '13716611017'}, '70': {'name': '李芳', 'phone': '13720086106'}, '71': {'name': '王红晶', 'phone': '13911385423'}, '72': {'name': '翁田田', 'phone': '15210580711'}, '73': {'name': '宋丹', 'phone': '18610698277'}, '74': {'name': '焦阳', 'phone': '13691376452'}, '76': {'name': '孙科', 'phone': '13381073047'}, '78': {'name': '齐占先', 'phone': '13718162901'}, '79': {'name': '刘成', 'phone': '13901322542'}, '80': {'name': '尹玉岐', 'phone': '13911810030'}, '81': {'name': '祁俊', 'phone': '13911778826'}, '82': {'name': '王超', 'phone': '13691485486'}, '83': {'name': '肖国颖', 'phone': '13552568891'}, '84': {'name': '马欣欢', 'phone': '15901057009'}, '86': {'name': '宋新华', 'phone': '13683673008'}, '87': {'name': '李建坤', 'phone': '15010250252'}, '88': {'name': '李雪萌', 'phone': '13811680197'}, '90': {'name': '莱阳', 'phone': '18210672698'}, '92': {'name': '霍少博', 'phone': '15910351351'}, '93': {'name': '杜劲', 'phone': '13681129230'}, '94': {'name': '殷爽', 'phone': '13501210584'}, '95': {'name': '毛佳', 'phone': '15210691317'}, '96': {'name': '徐韬韫', 'phone': '15901441970'}, '97': {'name': '杨跃超', 'phone': '15910281728'}, '98': {'name': '张举', 'phone': '18610224503'}, '99': {'name': '蔺少华', 'phone': '18600655580'}, '100': {'name': '宁培', 'phone': '13810303077'}, '101': {'name': '朱影', 'phone': '15811174828'}, '102': {'name': '孙然', 'phone': '15810802850'}, '103': {'name': '叶文君', 'phone': '13716840153'}, '104': {'name': '刘旭', 'phone': '13651000624'}, '105': {'name': '闫超阔', 'phone': '18210273718'}, '108': {'name': '王君', 'phone': '13691332722'}, '109': {'name': '张秋瑾', 'phone': '13269560927'}, '110': {'name': '史维维', 'phone': '15010368255'}, '111': {'name': '张泽', 'phone': '15010234727'}, '112': {'name': '孙林', 'phone': '13520752811'}, '113': {'name': '王润生', 'phone': '13261988826'}, '114': {'name': '崔亚菲', 'phone': '13810979122'}, '115': {'name': '李雪娇', 'phone': '15910619124'}, '116': {'name': '柳建军', 'phone': '13011030093'}, '117': {'name': '孙学勇', 'phone': '13520765718'}, '118': {'name': '董兰兰', 'phone': '13910303323'}, '119': {'name': '陈娜', 'phone': '18510337879'}, '120': {'name': '杨帆', 'phone': '18610229696'}, '122': {'name': '张春贤', 'phone': '17310179107'}, '123': {'name': '张立伟', 'phone': '13911285239'}, '124': {'name': '李岩', 'phone': '15810525991'}, '126': {'name': '肖杰', 'phone': '13466726203'}, '127': {'name': '张振宇', 'phone': '15910659316'}, '128': {'name': '汪伟', 'phone': '13911416349'}, '129': {'name': '张晓银', 'phone': '13501239434'}, '130': {'name': '马玉桥', 'phone': '13683207236'}, '131': {'name': '吕灿', 'phone': '13269115851'}, '132': {'name': '于双双', 'phone': '18001370626'}, '133': {'name': '贾鹏', 'phone': '13581577666'}, '134': {'name': '张雪', 'phone': '13910212354'}, '135': {'name': '王迪', 'phone': '19800383262'}, '136': {'name': '兰法坡', 'phone': '13683298902'}, '137': {'name': '陆志刚', 'phone': '13716622494'}, '138': {'name': '张国虎', 'phone': '13651376603'}, '139': {'name': '张学超', 'phone': '13520253719'}, '140': {'name': '康玉林', 'phone': '13552112130'}, '141': {'name': '李满存', 'phone': '13552872968'}, '142': {'name': '赵金义', 'phone': '13366615285'}, '143': {'name': '刘劲松', 'phone': '15010832956'}, '144': {'name': '韩旭', 'phone': '17600988129'}, '147': {'name': '高洪影', 'phone': '13552119586'}, '148': {'name': '刘万凯', 'phone': '13683339037'}, '149': {'name': '王超', 'phone': '13911939930'}, '150': {'name': '张建杰', 'phone': '18511186138'}, '151': {'name': '薛贺', 'phone': '13691358158'}, '152': {'name': '张秀荣', 'phone': '13716648282'}, '153': {'name': '马小英', 'phone': '15910231342'}, '154': {'name': '任任', 'phone': '13910519224'}, '155': {'name': '王燕含', 'phone': '18601126504'}, '156': {'name': '王志博', 'phone': '17610603732'}, '157': {'name': '韦杰友', 'phone': '13521551136'}, '158': {'name': '李文业', 'phone': '13831351283'}, '159': {'name': '李炳忠', 'phone': '15245887158'}, '160': {'name': '李景文', 'phone': '13644589589'}, '161': {'name': '张慧锋', 'phone': '18790630680'}, '162': {'name': '张玉英', 'phone': '18201187087'}, '163': {'name': '魏铁', 'phone': '18500399231'}, '164': {'name': '李龙', 'phone': '18545428957'}, '165': {'name': '鲁丹', 'phone': '15910286571'}, '166': {'name': '王成才', 'phone': '13683325919'}, '167': {'name': '李亮', 'phone': '13021026178'}, '168': {'name': '刘素芳', 'phone': '13718625812'}, '169': {'name': '吕云霞', 'phone': '18901325393'}, '170': {'name': '段苏菲', 'phone': '13041038841'}, '171': {'name': '张泽强', 'phone': '13897829556'}, '172': {'name': '刘会强', 'phone': '13791542068'}, '173': {'name': '张建峰', 'phone': '13897829556'}, '174': {'name': '马东明', 'phone': '13716383150'}, '175': {'name': '李东峰', 'phone': '18811266311'}, '176': {'name': '田佳强', 'phone': '15650768161'}}\n" - ] - } - ], + "outputs": [], "source": [ "filename = 'data/tiangongyuan.json'\n", "with open(filename,'r') as fl:\n", diff --git a/文件操作.ipynb b/文件操作.ipynb index b4f0bc7..c2186c7 100644 --- a/文件操作.ipynb +++ b/文件操作.ipynb @@ -364,14 +364,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "metadata": { "execution": { - "iopub.execute_input": "2023-05-05T22:31:49.960396Z", - "iopub.status.busy": "2023-05-05T22:31:49.959563Z", - "iopub.status.idle": "2023-05-05T22:31:50.078269Z", - "shell.execute_reply": "2023-05-05T22:31:50.077529Z", - "shell.execute_reply.started": "2023-05-05T22:31:49.960354Z" + "iopub.execute_input": "2023-05-25T04:57:08.561094Z", + "iopub.status.busy": "2023-05-25T04:57:08.560220Z", + "iopub.status.idle": "2023-05-25T04:57:08.638199Z", + "shell.execute_reply": "2023-05-25T04:57:08.637153Z", + "shell.execute_reply.started": "2023-05-25T04:57:08.561054Z" }, "tags": [] }, @@ -388,12 +388,12 @@ "import yaml\n", "import json\n", "\n", - "filename = 'data/体质指标问卷.yaml'\n", + "filename = 'data/全维健康职工心理测评量表.yml'\n", "with open(filename, 'r', encoding='utf-8') as f:\n", " result = yaml.load(f.read(), Loader=yaml.FullLoader)\n", "i = 1\n", "#print(result)\n", - "filename = 'data/体质指标问卷.json'\n", + "filename = 'data/全维健康职工心理测评量表.json'\n", "with open(filename, 'w') as fl:\n", " json.dump(result, fl, ensure_ascii=False)\n", "print('ok')"