This commit is contained in:
512song committed 2023-10-25 07:45:59 +00:00
1 parent 9b8fac651e
commit ceda991559
2 files changed
+917 -4

No files matched your search

+418 -3
View File
@@ -1,5 +1,17 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "1c72f0cf-165b-4025-af9d-6771e4a0a5d1",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": [],
"toc-hr-collapsed": true
},
"source": [
"## 2022年体质检测"
]
},
{
"cell_type": "markdown",
"id": "61f4a6eb-797e-4fe2-95df-e27b316c95f1",
@@ -626,10 +638,413 @@
"wb.save(filename) "
]
},
{
"cell_type": "markdown",
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
"metadata": {},
"source": [
"## 2023年体质检测"
]
},
{
"cell_type": "markdown",
"id": "1e3f67e9-e332-41c5-89f8-b64ec0bace4c",
"metadata": {},
"source": [
"### 人员信息汇总(批量人员)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"id": "648d597d-2ac4-470c-9562-271e3e2863d6",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:27:22.517401Z",
"iopub.status.busy": "2023-10-25T07:27:22.517103Z",
"iopub.status.idle": "2023-10-25T07:27:22.818722Z",
"shell.execute_reply": "2023-10-25T07:27:22.818086Z",
"shell.execute_reply.started": "2023-10-25T07:27:22.517373Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"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 = 'data/北海炼化/'\n",
"\n",
"fls = glob.glob(f'{fi_path}/*.xlsx')\n",
"i = 1\n",
"person = {}\n",
"for fl in fls:\n",
" wb = openpyxl.load_workbook(fl)\n",
" sheet = wb.active\n",
" # sheets = wb.sheetnames\n",
" \n",
"\n",
" for n in range(3,sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = str(i)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n,3 ).value\n",
" dict1['婚姻'] = sheet.cell(n, 5).value\n",
" dict1['phone'] = str(sheet.cell(n,6).value)\n",
" dict1['id'] = sheet.cell(n,7 ).value\n",
" dict1['总工龄'] = sheet.cell(n, 8).value\n",
" dict1['损害工龄'] = sheet.cell(n, 9).value\n",
" dict1['既往病史'] = sheet.cell(n,10 ).value\n",
" dict1['有毒因素'] = sheet.cell(n, 11).value\n",
" dict1['unit'] = sheet.cell(n, 12).value\n",
" dict1['工种'] = sheet.cell(n, 13).value\n",
" dict1['防护措施'] = sheet.cell(n,15 ).value \n",
" person[code] = dict1\n",
" i+=1\n",
" \n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "b1f47560-4183-4699-8d63-3d81a3ec002b",
"metadata": {},
"source": [
"### 检查身份证及手机号码唯一性"
]
},
{
"cell_type": "code",
"execution_count": 75,
"id": "a2c1c315-c522-433a-9611-e08dca2445a9",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:39:03.122723Z",
"iopub.status.busy": "2023-10-25T07:39:03.122416Z",
"iopub.status.idle": "2023-10-25T07:39:03.163768Z",
"shell.execute_reply": "2023-10-25T07:39:03.163068Z",
"shell.execute_reply.started": "2023-10-25T07:39:03.122696Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"董红军 18877976757\n",
"苗光浩 13927509537\n",
"440906199104060046 440906199104060046\n",
"黄仁进 13807799565\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"id= []\n",
"phone = [] \n",
"\n",
"for k, v in dict1.items():\n",
" if v['phone'] not in phone:\n",
" phone.append(v['phone'] )\n",
" else:\n",
" print(v['name'] ,v['phone'])\n",
" if v['id'] not in id:\n",
" id.append(v['id'] )\n",
" else:\n",
" print(v['id'] ,v['id'] )\n"
]
},
{
"cell_type": "markdown",
"id": "c1842f66-c81f-423d-bcda-0d49be82b32a",
"metadata": {},
"source": [
"### 查找身份证号码"
]
},
{
"cell_type": "code",
"execution_count": 48,
"id": "7ba235d2-4638-4479-babb-2f9867c177c2",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T06:41:49.969813Z",
"iopub.status.busy": "2023-10-25T06:41:49.969303Z",
"iopub.status.idle": "2023-10-25T06:41:49.984085Z",
"shell.execute_reply": "2023-10-25T06:41:49.982976Z",
"shell.execute_reply.started": "2023-10-25T06:41:49.969767Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"440906199104060046 凌倩\n",
"440906199104060046 陈继杨\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"id= '440906199104060046'\n",
"for k, v in dict1.items():\n",
" if v['id'] == id:\n",
" print(id,v['name'])"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "f9d8aafa-9a00-484a-a3c2-b3e9252b505d",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:22:33.048929Z",
"iopub.status.busy": "2023-10-25T07:22:33.048318Z",
"iopub.status.idle": "2023-10-25T07:22:33.073020Z",
"shell.execute_reply": "2023-10-25T07:22:33.070785Z",
"shell.execute_reply.started": "2023-10-25T07:22:33.048870Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18877976757 刘前程\n",
"13927509537 黄洁强\n",
"18877976757 董红军\n",
"13927509537 苗光浩\n",
"13807799565 谢昌俊\n",
"13807799565 黄仁进\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"phone= ['13807799565','18877976757','13927509537']\n",
"for k, v in dict1.items():\n",
" if v['phone'] in phone:\n",
" print(v['phone'],v['name'])"
]
},
{
"cell_type": "markdown",
"id": "1ea37f21-f03a-4450-8867-71fb8c3eeee7",
"metadata": {},
"source": [
"### 生成出生日期"
]
},
{
"cell_type": "code",
"execution_count": 76,
"id": "dff13fe9-d5cd-45e3-a3e7-f47d12560699",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:39:16.409162Z",
"iopub.status.busy": "2023-10-25T07:39:16.408552Z",
"iopub.status.idle": "2023-10-25T07:39:16.466833Z",
"shell.execute_reply": "2023-10-25T07:39:16.465723Z",
"shell.execute_reply.started": "2023-10-25T07:39:16.409106Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"for k, v in dict1.items():\n",
" id = str(v['id']) \n",
" #print(id)\n",
" birth = id[6:10] + '-' +id[10:12] + '-' +id[12:14]\n",
" dict1[k]['birth'] = birth\n",
" \n",
" \n",
"filename = 'data/北海炼化2023.json' \n",
"with open(filename, 'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "de060103-776c-40d8-9704-ece6cc574308",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T06:22:41.417620Z",
"iopub.status.busy": "2023-10-25T06:22:41.417111Z",
"iopub.status.idle": "2023-10-25T06:22:41.439732Z",
"shell.execute_reply": "2023-10-25T06:22:41.437319Z",
"shell.execute_reply.started": "2023-10-25T06:22:41.417575Z"
},
"tags": []
},
"source": [
"### 人员信息汇总(单个文件)"
]
},
{
"cell_type": "code",
"execution_count": 72,
"id": "61f8d7c3-b7f2-44b7-86f1-5b29d22193cb",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:33:25.703931Z",
"iopub.status.busy": "2023-10-25T07:33:25.703619Z",
"iopub.status.idle": "2023-10-25T07:33:25.762953Z",
"shell.execute_reply": "2023-10-25T07:33:25.762254Z",
"shell.execute_reply.started": "2023-10-25T07:33:25.703903Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" person = json.load(fl)\n",
"i = len(person)+1\n",
"fl = 'data/北海炼化机关名单表(2023年汇总156人).xlsx'\n",
"wb = openpyxl.load_workbook(fl)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"\n",
"\n",
"for n in range(3,sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = str(i)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n,3 ).value \n",
" dict1['phone'] = sheet.cell(n,6).value\n",
" dict1['id'] = sheet.cell(n,5 ).value \n",
" dict1['婚姻'] = sheet.cell(n, 11).value\n",
" dict1['unit'] = sheet.cell(n, 8).value \n",
" person[code] = dict1\n",
" i+=1\n",
"filename = 'data/北海炼化2023.json' \n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')\n"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "8da8e47d-b62b-4719-82d5-fcfc61473e08",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T07:38:29.475177Z",
"iopub.status.busy": "2023-10-25T07:38:29.474849Z",
"iopub.status.idle": "2023-10-25T07:38:29.554478Z",
"shell.execute_reply": "2023-10-25T07:38:29.553811Z",
"shell.execute_reply.started": "2023-10-25T07:38:29.475149Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" person = json.load(fl)\n",
"i = len(person)+1\n",
"fl = 'data/北海炼化上岗体检人员名单 (2023年).xlsx'\n",
"wb = openpyxl.load_workbook(fl)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"\n",
"\n",
"for n in range(3,sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = str(i)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n,3 ).value \n",
" dict1['phone'] = str(sheet.cell(n,7).value)\n",
" dict1['id'] = sheet.cell(n,6 ).value\n",
" \n",
" dict1['有毒因素'] = sheet.cell(n, 11).value\n",
" dict1['unit'] = '新上岗'\n",
" dict1['工种'] = sheet.cell(n, 8).value\n",
" dict1['防护措施'] = sheet.cell(n,13 ).value \n",
" person[code] = dict1\n",
" i+=1\n",
"filename = 'data/北海炼化2023.json' \n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2dc319f7-ccca-469a-8db3-2ca82097ab8f",
"id": "fca6186b-9b4d-4bcd-b5ac-1aecfeb2e149",
"metadata": {},
"outputs": [],
"source": []
@@ -637,7 +1052,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -651,7 +1066,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.12"
}
},
"nbformat": 4,