From 0da5d5e2cdf589376bb88ebe717d381243c87ab1 Mon Sep 17 00:00:00 2001 From: 512song Date: Sun, 15 Oct 2023 14:18:29 +0800 Subject: [PATCH] 20231015 --- 体测单位/北京党校.ipynb | 194 ++++++++++++++++++++++++++++++++++++++++ 体测单位/天津石化.ipynb | 153 ++++++++++++------------------- 2 files changed, 251 insertions(+), 96 deletions(-) create mode 100644 体测单位/北京党校.ipynb diff --git a/体测单位/北京党校.ipynb b/体测单位/北京党校.ipynb new file mode 100644 index 0000000..04da2bc --- /dev/null +++ b/体测单位/北京党校.ipynb @@ -0,0 +1,194 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04524c85-988e-4dbf-86eb-939a9db7aa28", + "metadata": {}, + "source": [ + "## 体测人员导入" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "bbba6efc-73cd-4db6-bae7-014724fee731", + "metadata": { + "execution": { + "iopub.execute_input": "2023-10-14T10:59:21.792059Z", + "iopub.status.busy": "2023-10-14T10:59:21.791573Z", + "iopub.status.idle": "2023-10-14T10:59:21.924403Z", + "shell.execute_reply": "2023-10-14T10:59:21.923914Z", + "shell.execute_reply.started": "2023-10-14T10:59:21.792012Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/报名登记表142人.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = int(sheet.cell(n, 1).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['sex'] = sheet.cell(n, 4).value\n", + " dict1['unit'] = sheet.cell(n, 2).value\n", + " dict1['birth'] = sheet.cell(n,5).value\n", + " person[code] = dict1\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": "048a95aa-1691-45f6-b933-6eaf95ae1d30", + "metadata": {}, + "source": [ + "## 生成读卡系统文件" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f", + "metadata": { + "execution": { + "iopub.execute_input": "2023-10-14T11:00:39.153235Z", + "iopub.status.busy": "2023-10-14T11:00:39.152837Z", + "iopub.status.idle": "2023-10-14T11:00:39.160327Z", + "shell.execute_reply": "2023-10-14T11:00:39.159338Z", + "shell.execute_reply.started": "2023-10-14T11:00:39.153204Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/北京党校.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "for k, v in dict1.items():\n", + " dict2 = {}\n", + " #if dict1['sex'] =='男':\n", + " # sex = 1\n", + " \n", + " dict2 = {'id':k,'name':v['name'],'gender':v['sex'],'birth':v['birth'],'unit':v['unit']}\n", + " list1.append(dict2)\n", + "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", + "\n", + "# 将 json 数据写入文件\n", + "with open(\"data/data_北京党校.json\", \"w\",encoding = 'utf-8') as file:\n", + " file.write(json_data) \n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "699c6a40-a6ae-4300-9646-708cb85aa5e8", + "metadata": {}, + "source": [ + "## 手工数据导入数据库" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "def3f47a-24ef-4815-b63b-2a16b79b4c15", + "metadata": { + "execution": { + "iopub.execute_input": "2023-10-15T06:15:31.143651Z", + "iopub.status.busy": "2023-10-15T06:15:31.143188Z", + "iopub.status.idle": "2023-10-15T06:15:31.160440Z", + "shell.execute_reply": "2023-10-15T06:15:31.159756Z", + "shell.execute_reply.started": "2023-10-15T06:15:31.143614Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(496534, 6, 5, 32, '2023-10-15', '2023-10-15 14:00:00'), (496534, 39, 5, 12, '2023-10-15', '2023-10-15 14:00:00'), (496534, 105, 5, 22, '2023-10-15', '2023-10-15 14:00:00'), (496534, 136, 5, 20, '2023-10-15', '2023-10-15 14:00:00'), (496534, 110, 5, 53, '2023-10-15', '2023-10-15 14:00:00'), (496534, 144, 5, 11, '2023-10-15', '2023-10-15 14:00:00'), (496534, 87, 5, 45, '2023-10-15', '2023-10-15 14:00:00'), (496534, 71, 5, 22, '2023-10-15', '2023-10-15 14:00:00'), (496534, 153, 5, 16, '2023-10-15', '2023-10-15 14:00:00'), (496534, 158, 5, 23, '2023-10-15', '2023-10-15 14:00:00'), (496534, 150, 5, 28, '2023-10-15', '2023-10-15 14:00:00'), (496534, 140, 5, 16, '2023-10-15', '2023-10-15 14:00:00'), (496534, 138, 5, 35, '2023-10-15', '2023-10-15 14:00:00'), (496534, 137, 5, 30, '2023-10-15', '2023-10-15 14:00:00'), (496534, 377, 5, 59, '2023-10-15', '2023-10-15 14:00:00'), (496534, 131, 5, 55, '2023-10-15', '2023-10-15 14:00:00'), (496534, 76, 5, 52, '2023-10-15', '2023-10-15 14:00:00'), (496534, 14, 5, 25, '2023-10-15', '2023-10-15 14:00:00'), (496534, 88, 5, 29, '2023-10-15', '2023-10-15 14:00:00'), (496534, 115, 5, 30, '2023-10-15', '2023-10-15 14:00:00'), (496534, 78, 5, 57, '2023-10-15', '2023-10-15 14:00:00'), (496534, 103, 5, 67, '2023-10-15', '2023-10-15 14:00:00'), (496534, 148, 5, 10, '2023-10-15', '2023-10-15 14:00:00'), (496534, 54, 5, 57, '2023-10-15', '2023-10-15 14:00:00'), (496534, 35, 5, 21, '2023-10-15', '2023-10-15 14:00:00'), (496534, 42, 5, 39, '2023-10-15', '2023-10-15 14:00:00'), (496534, 45, 5, 50, '2023-10-15', '2023-10-15 14:00:00'), (496534, 95, 5, 36, '2023-10-15', '2023-10-15 14:00:00'), (496534, 122, 5, 51, '2023-10-15', '2023-10-15 14:00:00'), (496534, 74, 5, 27, '2023-10-15', '2023-10-15 14:00:00'), (496534, 63, 5, 62, '2023-10-15', '2023-10-15 14:00:00'), (496534, 100, 5, 20, '2023-10-15', '2023-10-15 14:00:00'), (496534, 162, 5, 30, '2023-10-15', '2023-10-15 14:00:00'), (496534, 43, 5, 50, '2023-10-15', '2023-10-15 14:00:00'), (496534, 149, 5, 49, '2023-10-15', '2023-10-15 14:00:00'), (496534, 127, 5, 16, '2023-10-15', '2023-10-15 14:00:00'), (496534, 62, 5, 21, '2023-10-15', '2023-10-15 14:00:00'), (496534, 40, 5, 10, '2023-10-15', '2023-10-15 14:00:00'), (496534, 53, 5, 24, '2023-10-15', '2023-10-15 14:00:00')]\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "filename = 'data/北京党校.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "wb = openpyxl.load_workbook('data/北京党校手工数据.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "dict1 = {}\n", + "dict3 = {1:10,2:11,3:7,4:2,5:6,6:3,7:1}\n", + "sheet = wb.active\n", + "data1 =list(sheet.values)\n", + "del data1[0]\n", + "list1 = []\n", + "for item in data1:\n", + " code = int(item[0])\n", + " list1.append((496534,code,item[2],item[1],'2023-10-15','2023-10-15 14:00:00'))\n", + "print(list1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b", + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index 5b1a453..a0b7d29 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -1507,27 +1507,12 @@ }, { "cell_type": "code", - "execution_count": 158, + "execution_count": null, "id": "25283932-c03a-4a34-a59d-314fc64d8fbd", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-13T10:46:27.564722Z", - "iopub.status.busy": "2023-10-13T10:46:27.564257Z", - "iopub.status.idle": "2023-10-13T10:46:28.420646Z", - "shell.execute_reply": "2023-10-13T10:46:28.420116Z", - "shell.execute_reply.started": "2023-10-13T10:46:27.564686Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -1602,28 +1587,12 @@ }, { "cell_type": "code", - "execution_count": 160, + "execution_count": null, "id": "e26b88fc-c75b-4c1e-82ea-5017370afa9b", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-13T10:46:43.012204Z", - "iopub.status.busy": "2023-10-13T10:46:43.011994Z", - "iopub.status.idle": "2023-10-13T10:46:43.424110Z", - "shell.execute_reply": "2023-10-13T10:46:43.423577Z", - "shell.execute_reply.started": "2023-10-13T10:46:43.012190Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "5395\n", - "5395\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -1682,16 +1651,9 @@ }, { "cell_type": "code", - "execution_count": 161, + "execution_count": null, "id": "0a6ea33d-c112-4ed8-9366-3376e55a5731", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-13T10:46:56.465928Z", - "iopub.status.busy": "2023-10-13T10:46:56.465473Z", - "iopub.status.idle": "2023-10-13T10:46:58.050547Z", - "shell.execute_reply": "2023-10-13T10:46:58.050043Z", - "shell.execute_reply.started": "2023-10-13T10:46:56.465892Z" - }, "tags": [] }, "outputs": [], @@ -1746,16 +1708,9 @@ }, { "cell_type": "code", - "execution_count": 162, + "execution_count": null, "id": "589a5d44-605d-41a1-a981-7ec7258305ed", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-13T10:47:08.088774Z", - "iopub.status.busy": "2023-10-13T10:47:08.088563Z", - "iopub.status.idle": "2023-10-13T10:47:08.185316Z", - "shell.execute_reply": "2023-10-13T10:47:08.184845Z", - "shell.execute_reply.started": "2023-10-13T10:47:08.088760Z" - }, "tags": [] }, "outputs": [], @@ -1811,16 +1766,9 @@ }, { "cell_type": "code", - "execution_count": 111, + "execution_count": null, "id": "2f7c9847-f283-4a09-b385-2c7559be7c7e", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-08T07:33:01.133632Z", - "iopub.status.busy": "2023-10-08T07:33:01.133414Z", - "iopub.status.idle": "2023-10-08T07:33:01.179672Z", - "shell.execute_reply": "2023-10-08T07:33:01.179189Z", - "shell.execute_reply.started": "2023-10-08T07:33:01.133617Z" - }, "tags": [] }, "outputs": [], @@ -1866,46 +1814,12 @@ }, { "cell_type": "code", - "execution_count": 163, + "execution_count": null, "id": "e47c361d-a047-4932-b24e-fdcf65cb8a73", "metadata": { - "execution": { - "iopub.execute_input": "2023-10-13T10:47:27.530948Z", - "iopub.status.busy": "2023-10-13T10:47:27.530491Z", - "iopub.status.idle": "2023-10-13T10:47:27.735957Z", - "shell.execute_reply": "2023-10-13T10:47:27.735471Z", - "shell.execute_reply.started": "2023-10-13T10:47:27.530913Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "党委党校(培训中心)未测试人员名单(截至20231013)生产成功!\n", - "研究院未测试人员名单(截至20231013)生产成功!\n", - "原油储运部未测试人员名单(截至20231013)生产成功!\n", - "烯烃部未测试人员名单(截至20231013)生产成功!\n", - "化验计量部未测试人员名单(截至20231013)生产成功!\n", - "水务部未测试人员名单(截至20231013)生产成功!\n", - "消防支队未测试人员名单(截至20231013)生产成功!\n", - "公司机关未测试人员名单(截至20231013)生产成功!\n", - "装备研究院未测试人员名单(截至20231013)生产成功!\n", - "聚醚部未测试人员名单(截至20231013)生产成功!\n", - "电仪部未测试人员名单(截至20231013)生产成功!\n", - "运输销售部未测试人员名单(截至20231013)生产成功!\n", - "行政事务中心未测试人员名单(截至20231013)生产成功!\n", - "南港乙烯项目管理部未测试人员名单(截至20231013)生产成功!\n", - "热电部未测试人员名单(截至20231013)生产成功!\n", - "化工部未测试人员名单(截至20231013)生产成功!\n", - "南港烯烃部未测试人员名单(截至20231013)生产成功!\n", - "信息档案管理中心未测试人员名单(截至20231013)生产成功!\n", - "物资采购中心未测试人员名单(截至20231013)生产成功!\n", - "炼油部未测试人员名单(截至20231013)生产成功!\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import openpyxl\n", @@ -1944,10 +1858,57 @@ " " ] }, + { + "cell_type": "markdown", + "id": "6246f8b0-d9fc-4c9a-8ffa-07bd8dcdc3ed", + "metadata": {}, + "source": [ + "## 统计未体测人员明细表" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "756df8f2-70ab-4f7f-9cc7-66c57fd47548", + "id": "b7f62515-c45d-4d10-8e94-b5f9a9a98e3f", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "filename = 'data/result_天津2023.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/天津石化人员名单2023.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "\n", + "list1 = []\n", + "\n", + "i = 1\n", + "for k, v in dict2.items():\n", + " \n", + " if k not in dict1.keys():\n", + " list2 = [i,k,v['name'],unit,v['sub_unit']]\n", + " i+=1\n", + " list1.append(list2)\n", + "filename = f'data/天津石化未测试人员名单.xlsx'\n", + "title = ['序号','员工编号','姓名','部门','车间(科室)']\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "sheet.append(title)\n", + "for row in list1:\n", + " sheet.append(row) \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0f3c5384-04b0-432a-8800-c7af57ee1131", "metadata": {}, "outputs": [], "source": []