20230426
This commit is contained in:
1 parent
60cd4d2643
commit
d5af3bcb91
6 files changed
+896
-218
No files matched your search
+243
-75
@@ -10,27 +10,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "6ab7bf77-5451-4773-9b13-10e04a48ddfb",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-21T06:44:50.778622Z",
|
||||
"iopub.status.busy": "2023-04-21T06:44:50.777794Z",
|
||||
"iopub.status.idle": "2023-04-21T06:44:51.048732Z",
|
||||
"shell.execute_reply": "2023-04-21T06:44:51.047657Z",
|
||||
"shell.execute_reply.started": "2023-04-21T06:44:50.778580Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -59,6 +44,45 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "176b8fca-a7aa-4949-88df-b99158bfd46b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 补充人员信息(部门)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c4baf116-9e8b-4820-98a7-9a468f4abb7f",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"filename = 'data/高新区.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"wb = openpyxl.load_workbook('data/高新区.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n,2).value is None:\n",
|
||||
" break\n",
|
||||
" else: \n",
|
||||
" code = int(sheet.cell(n, 4).value)\n",
|
||||
" if str(code) in dict1.keys():\n",
|
||||
" dict1[str(code)]['unit'] = sheet.cell(n, 3).value\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "502638d8-79d0-4392-953e-047c8428c9a5",
|
||||
@@ -77,27 +101,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"id": "7609f3c3-5c52-4b92-a2d5-359bf4a45a10",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-21T07:01:46.516495Z",
|
||||
"iopub.status.busy": "2023-04-21T07:01:46.515666Z",
|
||||
"iopub.status.idle": "2023-04-21T07:01:46.605645Z",
|
||||
"shell.execute_reply": "2023-04-21T07:01:46.604904Z",
|
||||
"shell.execute_reply.started": "2023-04-21T07:01:46.516452Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"213\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -106,7 +115,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"cjry = set()\n",
|
||||
"filename = 'data/Survey_20230421-psy.csv'\n",
|
||||
"filename = 'data/Survey_20230424-psy.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -120,7 +129,7 @@
|
||||
" if 'phone' in v.keys() and v['phone'] not in cjry:\n",
|
||||
" list2.append([k,dict1[str(k)]['name'],dict1[str(k)]['phone']])\n",
|
||||
" \n",
|
||||
"filename = 'data/高新未参加心理评估人员(20230421).xlsx'\n",
|
||||
"filename = 'data/高新未参加心理评估人员(20230424).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"#sheet.append(title)\n",
|
||||
@@ -140,27 +149,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "fd2391c1-8d73-4714-8c20-42161b3eb493",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-21T07:03:35.174975Z",
|
||||
"iopub.status.busy": "2023-04-21T07:03:35.174533Z",
|
||||
"iopub.status.idle": "2023-04-21T07:03:35.240353Z",
|
||||
"shell.execute_reply": "2023-04-21T07:03:35.239435Z",
|
||||
"shell.execute_reply.started": "2023-04-21T07:03:35.174944Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"217\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -169,7 +163,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"cjry = set()\n",
|
||||
"filename = 'data/Survey_20230421-tcm1.csv'\n",
|
||||
"filename = 'data/Survey_20230424-tcm1.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -183,7 +177,7 @@
|
||||
" if 'phone' in v.keys() and v['phone'] not in cjry:\n",
|
||||
" list2.append([k,dict1[str(k)]['name'],dict1[str(k)]['phone']])\n",
|
||||
" \n",
|
||||
"filename = 'data/高新未参加中医评估人员(20230421).xlsx'\n",
|
||||
"filename = 'data/高新未参加中医评估人员(20230424).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"#sheet.append(title)\n",
|
||||
@@ -203,27 +197,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"id": "fd5af221-9369-4eab-884c-06885c940d88",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-21T07:16:05.935096Z",
|
||||
"iopub.status.busy": "2023-04-21T07:16:05.934235Z",
|
||||
"iopub.status.idle": "2023-04-21T07:16:05.967884Z",
|
||||
"shell.execute_reply": "2023-04-21T07:16:05.966719Z",
|
||||
"shell.execute_reply.started": "2023-04-21T07:16:05.935054Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"235\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -232,7 +211,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"cjry = set()\n",
|
||||
"filename = 'data/Survey_20230421.csv'\n",
|
||||
"filename = 'data/Survey_20230424-gx.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -249,7 +228,7 @@
|
||||
"for item in cjry: \n",
|
||||
" if item not in phones:\n",
|
||||
" list2.append(['','',item])\n",
|
||||
"filename = 'data/高新缺失信息人员(20230421).xlsx'\n",
|
||||
"filename = 'data/高新缺失信息人员(20230424).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"#sheet.append(title)\n",
|
||||
@@ -259,10 +238,199 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9e9dc89c-5ca1-4c2d-997a-6330df544ea0",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 统计生成报告人员情况表"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "01933c1f-b7e8-46ff-8a52-f415fca82e27",
|
||||
"id": "4c1b32b8-5cbd-430b-81fd-957e3def5155",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import glob\n",
|
||||
"from pathlib2 import Path\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/高新区.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"list1 = []\n",
|
||||
"fi_path = 'file/130/20230424'\n",
|
||||
"fl=glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"print(len(fl))\n",
|
||||
"for fn in fl:\n",
|
||||
" name = Path(fn).stem\n",
|
||||
" if name in dict1.keys():\n",
|
||||
" list1.append([name,dict1[name]['name']])\n",
|
||||
"filename = 'data/高新报告明细表(20230424).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"title = ['测试编号','姓名']\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2731b99f-8138-4e9e-baf0-c9c0c375f0eb",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 报告分组重命名"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a9f5a1d4-4c01-4656-85f3-bdbf2776b69d",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import math\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/高新区.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"list1 = []\n",
|
||||
"list_bh = []\n",
|
||||
"depart = []\n",
|
||||
"dict2 = {}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" dict2.setdefault(k,{}) \n",
|
||||
" \n",
|
||||
" if 'unit' in v.keys():\n",
|
||||
" m_depart = v['unit']\n",
|
||||
" else:\n",
|
||||
" m_depart = '未明确部门'\n",
|
||||
" dict2[k]['unit'] = m_depart\n",
|
||||
" if m_depart not in depart:\n",
|
||||
" depart.append(m_depart)\n",
|
||||
" dict2[k]['name'] = v['name']\n",
|
||||
" \n",
|
||||
"old = []\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"fi_path = 'file/130/20230424'\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# 创建部门办公室 \n",
|
||||
"m_path = 'file/130/new'\n",
|
||||
"for pn in depart:\n",
|
||||
" if not os.path.exists(m_path + '/' + pn):\n",
|
||||
" os.mkdir(m_path + '/' + pn)\n",
|
||||
"fl=os.listdir(fi_path)\n",
|
||||
"for fn in fl:\n",
|
||||
" if os.path.isfile(fi_path + '/' + fn):\n",
|
||||
" ofn = int(fn.split('.')[0])\n",
|
||||
" old.append(ofn) \n",
|
||||
"old.sort()\n",
|
||||
"for n in old: \n",
|
||||
" o_name = f'{fi_path}/{n}.pdf'\n",
|
||||
" unit = dict2[str(n)]['unit']\n",
|
||||
" name = dict2[str(n)]['name']\n",
|
||||
" n_name = f'{m_path}/{unit}/{str(n).rjust(5,\"0\")}-{name}.pdf'\n",
|
||||
" #print(o_name,n_name)\n",
|
||||
" if not os.path.exists(n_name):\n",
|
||||
" shutil.copyfile(o_name,n_name)\n",
|
||||
" print(n_name)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"id": "3d0268bb-8bce-4887-a745-077a62069675",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-25T07:52:40.990776Z",
|
||||
"iopub.status.busy": "2023-04-25T07:52:40.989921Z",
|
||||
"iopub.status.idle": "2023-04-25T07:52:41.056793Z",
|
||||
"shell.execute_reply": "2023-04-25T07:52:41.055627Z",
|
||||
"shell.execute_reply.started": "2023-04-25T07:52:40.990734Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import math\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/高新区.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"list1 = []\n",
|
||||
"list_bh = []\n",
|
||||
"depart = []\n",
|
||||
"dict2 = {}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" dict2.setdefault(k,{}) \n",
|
||||
" \n",
|
||||
" if 'unit' in v.keys():\n",
|
||||
" m_depart = v['unit']\n",
|
||||
" else:\n",
|
||||
" m_depart = '未明确部门'\n",
|
||||
" dict2[k]['unit'] = m_depart\n",
|
||||
" if m_depart not in depart:\n",
|
||||
" depart.append(m_depart)\n",
|
||||
" dict2[k]['name'] = v['name']\n",
|
||||
" \n",
|
||||
"old = []\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"fi_path = 'file/130/20230424'\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# 创建部门办公室 \n",
|
||||
"m_path = 'file/130/new'\n",
|
||||
"for pn in depart:\n",
|
||||
" if not os.path.exists(m_path + '/' + pn):\n",
|
||||
" os.mkdir(m_path + '/' + pn)\n",
|
||||
"fl=os.listdir(fi_path)\n",
|
||||
"for fn in fl:\n",
|
||||
" if os.path.isfile(fi_path + '/' + fn):\n",
|
||||
" ofn = int(fn.split('.')[0])\n",
|
||||
" old.append(ofn) \n",
|
||||
"old.sort()\n",
|
||||
"\n",
|
||||
"for n in old: \n",
|
||||
" o_name = f'{fi_path}/{n}.pdf'\n",
|
||||
" unit = dict2[str(n)]['unit']\n",
|
||||
" name = dict2[str(n)]['name']\n",
|
||||
" code = str(n).rjust(5,\"0\")\n",
|
||||
" list1.append([unit,code,name])\n",
|
||||
"filename = 'data/高新报告打印明细表.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"title = ['部门','测试编号','姓名']\n",
|
||||
"sheet.append(title)\n",
|
||||
"for row in list1:\n",
|
||||
" sheet.append(row)\n",
|
||||
" \n",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f5910a5a-05a5-404f-b3e9-eca86226e244",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user