This commit is contained in:
512song committed 2023-09-05 16:28:09 +08:00
1 parent 24a9839483
commit 23ce121293
11 files changed
+1506 -561

No files matched your search

+326 -141
View File
@@ -1,5 +1,13 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "4626da6c-d228-4270-8d8d-c98784a106ad",
"metadata": {},
"source": [
"# 第一次体测"
]
},
{
"cell_type": "markdown",
"id": "ba2deee7-9c63-4115-bcee-ad341175fc02",
@@ -10,27 +18,12 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": null,
"id": "dea5e486-6927-469f-aa57-e5efac4670be",
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-31T05:19:09.972334Z",
"iopub.status.busy": "2023-05-31T05:19:09.971473Z",
"iopub.status.idle": "2023-05-31T05:19:10.054344Z",
"shell.execute_reply": "2023-05-31T05:19:10.053621Z",
"shell.execute_reply.started": "2023-05-31T05:19:09.972292Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -255,27 +248,12 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": null,
"id": "c925d850-ff06-4be5-bf9f-31f4385c37c0",
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-31T05:19:14.796522Z",
"iopub.status.busy": "2023-05-31T05:19:14.795763Z",
"iopub.status.idle": "2023-05-31T05:19:14.859923Z",
"shell.execute_reply": "2023-05-31T05:19:14.858869Z",
"shell.execute_reply.started": "2023-05-31T05:19:14.796492Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"163\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
@@ -313,28 +291,12 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": null,
"id": "a87384c6-dc46-4d09-b757-b42462ed818d",
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-31T05:19:18.950211Z",
"iopub.status.busy": "2023-05-31T05:19:18.949352Z",
"iopub.status.idle": "2023-05-31T05:19:18.965945Z",
"shell.execute_reply": "2023-05-31T05:19:18.964916Z",
"shell.execute_reply.started": "2023-05-31T05:19:18.950168Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"164\n",
"['659821', '079384', '876923', '387406', '694158', '563974', '628540', '281407', '798056', '274185', '705316', '571698', '693240', '650329', '481397', '610492', '250746', '619873', '675018', '619204', '984351', '279548', '027154', '856432', '296138', '290486', '218396', '973605', '269043', '653487', '528397', '031947', '370415', '872591', '018592', '251794', '718203', '869254', '408517', '071948', '536729', '259430', '867310', '285413', '805216', '405192', '630721', '386219', '504216', '418752', '402398', '231947', '850743', '901378', '394175', '431092', '157489', '961378', '305921', '620417', '352906', '629380', '417086', '086149', '804693', '342580', '310827', '637102', '128635', '346780', '325076', '643917', '710548', '046732', '762390', '350712', '368419', '342701', '245107', '087136', '023185', '759846', '346758', '514976', '570482', '781935', '210987', '340615', '075891', '810596', '430689', '920785', '815347', '917562', '295817', '765238', '058479', '674159', '567894', '109842', '851943', '703918', '073489', '403958', '578492', '798046', '502876', '943180', '498306', '835760', '726305', '490867', '709413', '275683', '256934', '721830', '973841', '729685', '021349', '265413', '321597', '064187', '136794', '708352', '710928', '657129', '962105', '905436', '513749', '257361', '420691', '941567', '839574', '906358', '218095', '364152', '562149', '109823', '560942', '293561', '194053', '509246', '026951', '243561', '093154', '654083', '519048', '459136', '914362', '605834', '508693', '823906', '349725', '572390', '541236', '419570', '513467', '724063', '164823', '890712', '529840', '641958', '678590', '648951']\n"
]
}
],
"outputs": [],
"source": [
"import random\n",
"import json\n",
@@ -375,27 +337,12 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"id": "10845b90-48b4-4418-9dac-dd4a6f0147c0",
"metadata": {
"execution": {
"iopub.execute_input": "2023-05-31T05:19:22.535432Z",
"iopub.status.busy": "2023-05-31T05:19:22.534590Z",
"iopub.status.idle": "2023-05-31T05:19:22.546728Z",
"shell.execute_reply": "2023-05-31T05:19:22.545447Z",
"shell.execute_reply.started": "2023-05-31T05:19:22.535392Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"163\n"
]
}
],
"outputs": [],
"source": [
"filename = 'data/农业银行测试手机号码.json'\n",
"with open(filename,'r') as fl:\n",
@@ -421,41 +368,14 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": null,
"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"
]
}
],
"outputs": [],
"source": [
"import json\n",
"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",
@@ -477,8 +397,8 @@
" req = models.SendSmsRequest()\n",
" req.SmsSdkAppId = \"1400140089\"\n",
" req.SignName = \"坤铭教育\"\n",
" req.TemplateId = \"1808914\" \n",
" req.TemplateParamSet = [\"1234\"]\n",
" req.TemplateId = \"1875765\" \n",
" req.TemplateParamSet = [\"北京石油分公司体测者\",\"01740518\"]\n",
" req.PhoneNumberSet = [\"+8613793180751\"]\n",
" req.SessionContext = \"\"\n",
" req.ExtendCode = \"\"\n",
@@ -491,27 +411,12 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": null,
"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"
]
}
],
"outputs": [],
"source": [
"dict1 = json.loads(resp.to_json_string(indent=2))\n",
"print(dict1['SendStatusSet'][0][\"Message\"])"
@@ -527,30 +432,12 @@
},
{
"cell_type": "code",
"execution_count": 57,
"execution_count": null,
"id": "910d1881-d090-48dc-ac87-685ccaaf9553",
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-07T02:57:09.482569Z",
"iopub.status.busy": "2023-06-07T02:57:09.481698Z",
"iopub.status.idle": "2023-06-07T02:57:10.568979Z",
"shell.execute_reply": "2023-06-07T02:57:10.567913Z",
"shell.execute_reply.started": "2023-06-07T02:57:09.482528Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"亓宇航 send success\n",
"李伟丽 send success\n",
"高松 send success\n",
"张树伟 send success\n"
]
}
],
"outputs": [],
"source": [
"\n",
"from tencentcloud.common import credential\n",
@@ -588,7 +475,7 @@
" req.SessionContext = \"\"\n",
" req.ExtendCode = \"\"\n",
" req.SenderId = \"\"\n",
" resp = client.SendSms(req)\n",
" #resp = client.SendSms(req)\n",
" dict2 = json.loads(resp.to_json_string(indent=2))\n",
"\n",
" print(v['name'],dict2['SendStatusSet'][0][\"Message\"])\n",
@@ -596,10 +483,308 @@
" print(v['name'],err)"
]
},
{
"cell_type": "markdown",
"id": "59d38404-e097-4f08-a3fd-565e351f09bb",
"metadata": {},
"source": [
"# 第二次体测"
]
},
{
"cell_type": "markdown",
"id": "deeb7606-5752-4337-9117-4ba9edc762e9",
"metadata": {},
"source": [
"## 人员信息导入"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "759cad53-8745-4862-8874-cf35f13ab0b3",
"id": "d803a2b2-4a61-42ba-84a3-e9846e3e9f5c",
"metadata": {},
"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, 1).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, 2).value\n",
" if sheet.cell(n,6).value is not None:\n",
" dict1['phone'] = sheet.cell(n, 6).value \n",
" person[code] = dict1\n",
"\n",
"filename = 'data/北京农行人员名单2308.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "ff97823f-fd67-45ae-bd78-f209317be6b9",
"metadata": {},
"source": [
"## 成绩导入"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4adf86dd-addf-490a-9954-5dcac4693868",
"metadata": {},
"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/北京农行人员名单2308.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20230825.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_北京农行0825.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": "code",
"execution_count": null,
"id": "bb01b9a9-418d-4a1b-8ea9-1215af0b8285",
"metadata": {},
"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/北京农行人员名单2308.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20230825.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_北京农行0825.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": "4d2a0d63-4124-4063-96a7-a02478b9eabe",
"metadata": {},
"source": [
"## 查看项目不足人员"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b26857af-5fa3-42d0-bf79-bc33d9f5e4a8",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"filename = 'data/result_北京农行0825.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i= 0\n",
"for k, v in dict1.items():\n",
" if len(v.keys())< 8:\n",
" print(k,v['name'])"
]
},
{
"cell_type": "markdown",
"id": "1966307c-4161-4c5b-b19a-b8a143972223",
"metadata": {},
"source": [
"## 导出测试人员信息"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "288e39fb-b7e3-4566-ac13-ba98d7e72edb",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_北京农行0825.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 =[]\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2 = [k,v['name'],v['sex'],v['unit']]\n",
" list1.append(list2)\n",
"filename = 'data/北京农行测试人员202308.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "a42cb587-8673-4655-8943-3cbd63f22b73",
"metadata": {},
"source": [
"## 检查性别"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6352b95c-0e19-4943-9e99-218138213060",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"\n",
"filename = 'data/result_北京农行0825.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"for k, v in dict1.items():\n",
" if v['sex'] == '男' and '一分钟仰卧起坐' in v.keys():\n",
" print(k,'应为女性!')\n",
" if v['sex'] == '女' and '俯卧撑' in v.keys():\n",
" print(k,'应为男性!')"
]
},
{
"cell_type": "markdown",
"id": "fddd68cd-b20c-4cf9-b503-5d59f52e3c1b",
"metadata": {},
"source": [
"## 手工数据生成SQL"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "372294de-5370-41c0-9883-b18de9d8ef7e",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/北京农行测试人员202308.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"\n",
"data1 =list(sheet.values)\n",
"del data1[0]\n",
"list1 = []\n",
"for item in data1:\n",
" code = int(item[0])\n",
" list1.append((309118,code,5,item[4],'2023-08-23','2023-08-23 22:00:00'))\n",
"print(list1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "93d4d513-17ee-4f20-bd86-be52398b5852",
"metadata": {},
"outputs": [],
"source": []
@@ -621,7 +806,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.12"
}
},
"nbformat": 4,