20230430
This commit is contained in:
1 parent
f03e964585
commit
5ac233adcc
4 files changed
+574
-141
No files matched your search
+397
-62
@@ -26,27 +26,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 33,
|
"execution_count": null,
|
||||||
"id": "8cd73044-56a8-409b-a873-085feb63af17",
|
"id": "8cd73044-56a8-409b-a873-085feb63af17",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2022-12-11T04:12:38.717398Z",
|
|
||||||
"iopub.status.busy": "2022-12-11T04:12:38.716743Z",
|
|
||||||
"iopub.status.idle": "2022-12-11T04:12:38.819382Z",
|
|
||||||
"shell.execute_reply": "2022-12-11T04:12:38.818678Z",
|
|
||||||
"shell.execute_reply.started": "2022-12-11T04:12:38.717334Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -111,27 +96,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 73,
|
"execution_count": null,
|
||||||
"id": "2ca52d7b-d77e-452f-98f6-95072a5a1934",
|
"id": "2ca52d7b-d77e-452f-98f6-95072a5a1934",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2022-12-11T08:20:52.050056Z",
|
|
||||||
"iopub.status.busy": "2022-12-11T08:20:52.049496Z",
|
|
||||||
"iopub.status.idle": "2022-12-11T08:20:52.311023Z",
|
|
||||||
"shell.execute_reply": "2022-12-11T08:20:52.310420Z",
|
|
||||||
"shell.execute_reply.started": "2022-12-11T08:20:52.049977Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -198,28 +168,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 98,
|
"execution_count": null,
|
||||||
"id": "f32b266a-7e46-4703-ab61-7cbbc81b5ab1",
|
"id": "f32b266a-7e46-4703-ab61-7cbbc81b5ab1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2022-12-15T01:23:46.345354Z",
|
|
||||||
"iopub.status.busy": "2022-12-15T01:23:46.344556Z",
|
|
||||||
"iopub.status.idle": "2022-12-15T01:23:46.364220Z",
|
|
||||||
"shell.execute_reply": "2022-12-15T01:23:46.363538Z",
|
|
||||||
"shell.execute_reply.started": "2022-12-15T01:23:46.345276Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"[25.9, 31.5, 38.6, 44.0, 50.8]\n",
|
|
||||||
"5\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import time\n",
|
"import time\n",
|
||||||
@@ -261,15 +215,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 93,
|
"execution_count": 53,
|
||||||
"id": "b32fbbdd-eb0a-4f0d-8901-e39a727c3ff8",
|
"id": "b32fbbdd-eb0a-4f0d-8901-e39a727c3ff8",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2022-12-11T08:42:02.334236Z",
|
"iopub.execute_input": "2023-04-30T01:48:23.869481Z",
|
||||||
"iopub.status.busy": "2022-12-11T08:42:02.333952Z",
|
"iopub.status.busy": "2023-04-30T01:48:23.868619Z",
|
||||||
"iopub.status.idle": "2022-12-11T08:42:02.357384Z",
|
"iopub.status.idle": "2023-04-30T01:48:23.882339Z",
|
||||||
"shell.execute_reply": "2022-12-11T08:42:02.355513Z",
|
"shell.execute_reply": "2023-04-30T01:48:23.881272Z",
|
||||||
"shell.execute_reply.started": "2022-12-11T08:42:02.334210Z"
|
"shell.execute_reply.started": "2023-04-30T01:48:23.869438Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -279,8 +233,8 @@
|
|||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"M50~59\n",
|
"M50~59\n",
|
||||||
"175.5,90.2\n",
|
"177.0,81.1\n",
|
||||||
"1\n"
|
"5\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -296,7 +250,7 @@
|
|||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"person = dict1['person']\n",
|
"person = dict1['person']\n",
|
||||||
"criteria = dict1['criteria']\n",
|
"criteria = dict1['criteria']\n",
|
||||||
"data = {'name':'张三','sex':'M','age':59,'item':'HeightWeight','result':'175.5,90.2'}\n",
|
"data = {'name':'张三','sex':'M','age':59,'item':'HeightWeight','result':'177.0,81.1'}\n",
|
||||||
"info = data['sex']+str(data['age'])\n",
|
"info = data['sex']+str(data['age'])\n",
|
||||||
"\n",
|
"\n",
|
||||||
"bz = person[info]\n",
|
"bz = person[info]\n",
|
||||||
@@ -319,10 +273,391 @@
|
|||||||
"print(score)"
|
"print(score)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "732161bb-98f2-4861-ab66-7a374678bcd8",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# 体质检测数据管理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "bb2db5e8-5dc6-4366-a39c-a3600ee5007c",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 数据导入Mycrm"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "bc98d772-5841-41a3-ad8f-f7d1ff3b5fde",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入系统人员信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "5167ef1b-8ea5-4079-9468-33ec52f2317e",
|
"id": "2cd93f45-6613-4a3f-97e4-5236068e1860",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import time\n",
|
||||||
|
"import csv\n",
|
||||||
|
"\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = 'data/person_134.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",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"for result in list1:\n",
|
||||||
|
" code = str(result[4])\n",
|
||||||
|
" if int(result[1]) == 0:\n",
|
||||||
|
" sex = '男'\n",
|
||||||
|
" else:\n",
|
||||||
|
" sex = '女'\n",
|
||||||
|
" \n",
|
||||||
|
" m_item = str(result[3]) \n",
|
||||||
|
" dict1.setdefault(code,{}) \n",
|
||||||
|
" dict1[code]['name'] = result[0]\n",
|
||||||
|
" dict1[code]['sex'] = sex\n",
|
||||||
|
" dict1[code]['birth'] = result[2]\n",
|
||||||
|
"filename = 'data/天津石化人员清单.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl, ensure_ascii=False) \n",
|
||||||
|
"print(len(dict1)) "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "2eb50f19-c15f-4a36-87b7-cd02551d248d",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入测试项目item"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "0eb37435-9c15-40ef-bd4c-2dffc026f59e",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import psycopg2\n",
|
||||||
|
"from psycopg2 import extras as ex\n",
|
||||||
|
"\n",
|
||||||
|
"filename = '../item.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" data_list.append((int(k),v['name'])) \n",
|
||||||
|
"conn = psycopg2.connect(database=\"mycrm\", user=\"postgres\", password=\"songyi\", host=\"localhost\", port=\"5432\")\n",
|
||||||
|
"cursor = conn.cursor()\n",
|
||||||
|
"sql = 'insert into tianjin_item (id,name) values %s'\n",
|
||||||
|
"ex.execute_values(cursor, sql, data_list, page_size=10000)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
"cursor.close()\n",
|
||||||
|
"conn.close()\n",
|
||||||
|
"print('ok!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "2ba97298-1e7e-4192-8d69-ea59f98e071a",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入一级部门"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "9f7ed380-95f3-47d4-9eb5-74937af7811f",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import psycopg2\n",
|
||||||
|
"from psycopg2 import extras as ex\n",
|
||||||
|
"\n",
|
||||||
|
"conn = psycopg2.connect(database=\"mycrm\", user=\"postgres\", password=\"songyi\", host=\"localhost\", port=\"5432\")\n",
|
||||||
|
"cursor = conn.cursor()\n",
|
||||||
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"unit = set()\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" #if 'sub_unit' not in v.keys():\n",
|
||||||
|
" # print(k,v['name'])\n",
|
||||||
|
" unit.add(v['unit'])\n",
|
||||||
|
"print(unit) \n",
|
||||||
|
"i = 1\n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for item in unit:\n",
|
||||||
|
" dict2[item] = i\n",
|
||||||
|
" i+=1\n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"for k, v in dict2.items():\n",
|
||||||
|
" data_list.append((v,k)) \n",
|
||||||
|
" \n",
|
||||||
|
"sql = 'insert into tianjin_unit (id,name) values %s'\n",
|
||||||
|
"ex.execute_values(cursor, sql, data_list, page_size=10000)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
"cursor.close()\n",
|
||||||
|
"conn.close()\n",
|
||||||
|
"print('ok!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "b8a1fa7f-08ff-49bb-8052-9f86b1f2ac18",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入二级部门"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "a13e81f2-467f-42c7-bb46-b547ef7bdd6c",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import psycopg2\n",
|
||||||
|
"from psycopg2 import extras as ex\n",
|
||||||
|
"\n",
|
||||||
|
"conn = psycopg2.connect(database=\"mycrm\", user=\"postgres\", password=\"songyi\", host=\"localhost\", port=\"5432\")\n",
|
||||||
|
"cursor = conn.cursor()\n",
|
||||||
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"unit = set()\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" #if 'sub_unit' not in v.keys():\n",
|
||||||
|
" # print(k,v['name'])\n",
|
||||||
|
" unit.add(v['unit'])\n",
|
||||||
|
"print(unit) \n",
|
||||||
|
"i = 1\n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for item in unit:\n",
|
||||||
|
" dict2[item] = i\n",
|
||||||
|
" i+=1\n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"dict3 = {}\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" dict3.setdefault(v['unit'],set())\n",
|
||||||
|
" dict3[v['unit']].add(v['sub_unit'])\n",
|
||||||
|
"i = 1 \n",
|
||||||
|
"for k, v in dict3.items():\n",
|
||||||
|
" unit_id = dict2[k]\n",
|
||||||
|
" for item in v:\n",
|
||||||
|
" data_list.append((i,item,unit_id))\n",
|
||||||
|
" i+=1\n",
|
||||||
|
"sql = 'insert into tianjin_sub_unit (id,name,unit_id) values %s'\n",
|
||||||
|
"ex.execute_values(cursor, sql, data_list, page_size=10000)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
"cursor.close()\n",
|
||||||
|
"conn.close()\n",
|
||||||
|
"print('ok!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "53bf98fe-0ae9-402f-b8d8-495e8f31df3d",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入人员信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "6af82fd2-b1d6-44b7-8b13-58883b58f8b0",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import psycopg2\n",
|
||||||
|
"from psycopg2 import extras as ex\n",
|
||||||
|
"\n",
|
||||||
|
"conn = psycopg2.connect(database=\"mycrm\", user=\"postgres\", password=\"songyi\", host=\"localhost\", port=\"5432\")\n",
|
||||||
|
"cursor = conn.cursor()\n",
|
||||||
|
"filename = 'data/天津石化人员清单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" person = json.load(fl)\n",
|
||||||
|
" \n",
|
||||||
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"unit = set()\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" #if 'sub_unit' not in v.keys():\n",
|
||||||
|
" # print(k,v['name'])\n",
|
||||||
|
" unit.add(v['unit'])\n",
|
||||||
|
"print(unit) \n",
|
||||||
|
"i = 1\n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for item in unit:\n",
|
||||||
|
" dict2[item] = i\n",
|
||||||
|
" i+=1\n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"dict3 = {}\n",
|
||||||
|
"dict4 = {}\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" dict3.setdefault(v['unit'],set())\n",
|
||||||
|
" dict3[v['unit']].add(v['sub_unit']) \n",
|
||||||
|
"i = 1 \n",
|
||||||
|
"for k, v in dict3.items():\n",
|
||||||
|
" unit_id = dict2[k]\n",
|
||||||
|
" for item in v:\n",
|
||||||
|
" data_list.append((i,item,unit_id))\n",
|
||||||
|
" i+=1\n",
|
||||||
|
"for item in data_list:\n",
|
||||||
|
" sub_id = item[0]\n",
|
||||||
|
" dict4[sub_id] = {'name':item[1],'unit':item[2]}\n",
|
||||||
|
"dict5 = {}\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" id_unit = dict2[v['unit']]\n",
|
||||||
|
" sub_name = v['sub_unit']\n",
|
||||||
|
" id_sub = 0\n",
|
||||||
|
" for k1, v1 in dict4.items():\n",
|
||||||
|
" if v1['name'] == sub_name and v1['unit'] == id_unit:\n",
|
||||||
|
" id_sub = int(k1)\n",
|
||||||
|
" if id_sub >0:\n",
|
||||||
|
" dict5[k] = {'unit':id_unit,'sub_unit':id_sub}\n",
|
||||||
|
" else:\n",
|
||||||
|
" print(k,'not fund')\n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"for k, v in dict5.items():\n",
|
||||||
|
" id = int(k)\n",
|
||||||
|
" name = person[k]['name']\n",
|
||||||
|
" sex = person[k]['sex']\n",
|
||||||
|
" birth = person[k]['birth']\n",
|
||||||
|
" phone = ''\n",
|
||||||
|
" note = ''\n",
|
||||||
|
" unit = v['sub_unit']\n",
|
||||||
|
" data_list.append((id,name,sex,birth,unit))\n",
|
||||||
|
"sql = 'insert into tianjin_person (id,name,sex,birth,unit_id) values %s'\n",
|
||||||
|
"ex.execute_values(cursor, sql, data_list, page_size=10000)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
"cursor.close()\n",
|
||||||
|
"conn.close()\n",
|
||||||
|
"print('ok!') \n",
|
||||||
|
" "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "fd95a45a-c6df-47c3-9941-2d0579b2c5d9",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 导入测试成绩及得分"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 50,
|
||||||
|
"id": "360e61e9-7895-484b-a9d6-333bdefa1a86",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-04-29T14:29:07.198753Z",
|
||||||
|
"iopub.status.busy": "2023-04-29T14:29:07.197888Z",
|
||||||
|
"iopub.status.idle": "2023-04-29T14:29:08.464741Z",
|
||||||
|
"shell.execute_reply": "2023-04-29T14:29:08.463607Z",
|
||||||
|
"shell.execute_reply.started": "2023-04-29T14:29:07.198711Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok!\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import psycopg2\n",
|
||||||
|
"from psycopg2 import extras as ex\n",
|
||||||
|
"\n",
|
||||||
|
"filename = '../item.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" dict2[v['name']] = int(k)\n",
|
||||||
|
"conn = psycopg2.connect(database=\"mycrm\", user=\"postgres\", password=\"songyi\", host=\"localhost\", port=\"5432\")\n",
|
||||||
|
"cursor = conn.cursor()\n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"filename = 'data/result_天津.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" for item in v.keys():\n",
|
||||||
|
" if item in dict2.keys():\n",
|
||||||
|
" item_id = dict2[item]\n",
|
||||||
|
" if v[item]['得分'] == '\\\\N':\n",
|
||||||
|
" score = None\n",
|
||||||
|
" else:\n",
|
||||||
|
" score = int(v[item]['得分'])\n",
|
||||||
|
" \n",
|
||||||
|
" data_list.append((v[item]['成绩'],score,int(k),item_id))\n",
|
||||||
|
" \n",
|
||||||
|
"sql = 'insert into tianjin_records (performance,score,avatar_id_id,item_id_id) values %s'\n",
|
||||||
|
"ex.execute_values(cursor, sql, data_list, page_size=10000)\n",
|
||||||
|
"conn.commit()\n",
|
||||||
|
"cursor.close()\n",
|
||||||
|
"conn.close()\n",
|
||||||
|
"print('ok!') \n",
|
||||||
|
" "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "cb747368-d3ac-4b29-ae4f-ce207d5fcd43",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if 'num_id' not in v.keys():\n",
|
||||||
|
" print(k,v['name'])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "51dc35a5-dc07-40a4-9ea7-375ca7f983c3",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
+102
-10
@@ -10,12 +10,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b",
|
"id": "1144aaac-92a0-4bcf-aba7-096f7dd3ad3b",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-04-28T08:05:05.494533Z",
|
||||||
|
"iopub.status.busy": "2023-04-28T08:05:05.494066Z",
|
||||||
|
"iopub.status.idle": "2023-04-28T08:05:06.489698Z",
|
||||||
|
"shell.execute_reply": "2023-04-28T08:05:06.488731Z",
|
||||||
|
"shell.execute_reply.started": "2023-04-28T08:05:05.494503Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -43,6 +58,60 @@
|
|||||||
"print('ok')"
|
"print('ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "93b9bfba-5404-4c9b-ac8f-48a3bf296669",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 合并人员信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 9,
|
||||||
|
"id": "d5171966-95ae-47ae-a75e-db08de772348",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-04-28T08:30:24.695022Z",
|
||||||
|
"iopub.status.busy": "2023-04-28T08:30:24.694269Z",
|
||||||
|
"iopub.status.idle": "2023-04-28T08:30:24.860969Z",
|
||||||
|
"shell.execute_reply": "2023-04-28T08:30:24.859964Z",
|
||||||
|
"shell.execute_reply.started": "2023-04-28T08:30:24.694992Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/天津石化人员231113_1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict2 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"for k, v in dict2.items():\n",
|
||||||
|
" if k not in dict1.keys():\n",
|
||||||
|
" dict1.setdefault(k,{})\n",
|
||||||
|
" dict1[k]['name'] = dict2[k]['name']\n",
|
||||||
|
" dict1[k]['sex'] = dict2[k]['sex']\n",
|
||||||
|
" dict1[k]['unit'] = dict2[k]['name']\n",
|
||||||
|
" dict1[k]['sub_unit'] = dict2[k]['sub_unit']\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",
|
"cell_type": "markdown",
|
||||||
"id": "5e648b69-40bf-4494-9079-e4e2b6ab8866",
|
"id": "5e648b69-40bf-4494-9079-e4e2b6ab8866",
|
||||||
@@ -58,7 +127,15 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import time\n",
|
"import time\n",
|
||||||
@@ -78,7 +155,7 @@
|
|||||||
"dict1 = {}\n",
|
"dict1 = {}\n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"#print(\"\\n运动项目信息:\")\n",
|
"#print(\"\\n运动项目信息:\")\n",
|
||||||
"filename = 'data/134_2210.csv'\n",
|
"filename = '体测单位/data/20230428_134.csv'\n",
|
||||||
"with open(filename,'r',newline='') as csv_file:\n",
|
"with open(filename,'r',newline='') as csv_file:\n",
|
||||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||||
" header = next(fl) \n",
|
" header = next(fl) \n",
|
||||||
@@ -172,12 +249,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 11,
|
||||||
"id": "27529013-f3de-4e23-980d-f62203e4df88",
|
"id": "27529013-f3de-4e23-980d-f62203e4df88",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-04-30T01:28:04.696517Z",
|
||||||
|
"iopub.status.busy": "2023-04-30T01:28:04.695670Z",
|
||||||
|
"iopub.status.idle": "2023-04-30T01:28:06.723602Z",
|
||||||
|
"shell.execute_reply": "2023-04-30T01:28:06.722564Z",
|
||||||
|
"shell.execute_reply.started": "2023-04-30T01:28:04.696475Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
@@ -188,13 +280,13 @@
|
|||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl)\n",
|
" dict1 = json.load(fl)\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"del dict1['1730253']\n",
|
||||||
"filename = 'data/天津石化人员名单.json'\n",
|
"filename = 'data/天津石化人员名单.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict2 = json.load(fl)\n",
|
" dict2 = json.load(fl)\n",
|
||||||
" \n",
|
" \n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"for k, v in dict1.items():\n",
|
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
|
||||||
" #print(k,dict2[str(k)]['name'])\n",
|
|
||||||
" list2 = []\n",
|
" list2 = []\n",
|
||||||
" list2.append(str(k).rjust(5,'0'))\n",
|
" list2.append(str(k).rjust(5,'0'))\n",
|
||||||
" list2.append(dict2[k]['name']) \n",
|
" list2.append(dict2[k]['name']) \n",
|
||||||
@@ -1449,7 +1541,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
@@ -1463,7 +1555,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.10"
|
"version": "3.10.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
+59
-53
@@ -10,15 +10,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 138,
|
"execution_count": 149,
|
||||||
"id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16",
|
"id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-27T11:13:41.777211Z",
|
"iopub.execute_input": "2023-04-28T23:44:56.066757Z",
|
||||||
"iopub.status.busy": "2023-04-27T11:13:41.776344Z",
|
"iopub.status.busy": "2023-04-28T23:44:56.065886Z",
|
||||||
"iopub.status.idle": "2023-04-27T11:13:44.240985Z",
|
"iopub.status.idle": "2023-04-28T23:44:58.568470Z",
|
||||||
"shell.execute_reply": "2023-04-27T11:13:44.239943Z",
|
"shell.execute_reply": "2023-04-28T23:44:58.567666Z",
|
||||||
"shell.execute_reply.started": "2023-04-27T11:13:41.777171Z"
|
"shell.execute_reply.started": "2023-04-28T23:44:56.066716Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -89,15 +89,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 141,
|
"execution_count": 150,
|
||||||
"id": "71e1ec6a-6797-4496-969a-1d1461b9ea58",
|
"id": "71e1ec6a-6797-4496-969a-1d1461b9ea58",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-27T11:17:30.688334Z",
|
"iopub.execute_input": "2023-04-28T23:45:21.332726Z",
|
||||||
"iopub.status.busy": "2023-04-27T11:17:30.687922Z",
|
"iopub.status.busy": "2023-04-28T23:45:21.331812Z",
|
||||||
"iopub.status.idle": "2023-04-27T11:17:31.209520Z",
|
"iopub.status.idle": "2023-04-28T23:45:21.591418Z",
|
||||||
"shell.execute_reply": "2023-04-27T11:17:31.208618Z",
|
"shell.execute_reply": "2023-04-28T23:45:21.590691Z",
|
||||||
"shell.execute_reply.started": "2023-04-27T11:17:30.688305Z"
|
"shell.execute_reply.started": "2023-04-28T23:45:21.332693Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -106,20 +106,10 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"358\n",
|
"335\n",
|
||||||
"1987 孙伟滨 已测试!\n",
|
"123 孙剑 已测试!\n",
|
||||||
"1402 郭力 已测试!\n",
|
"335\n",
|
||||||
"1968 项征 已测试!\n",
|
"4136\n"
|
||||||
"1980 张艳梅 已测试!\n",
|
|
||||||
"2243 李宁 已测试!\n",
|
|
||||||
"2252 张宝山 已测试!\n",
|
|
||||||
"1398 李海峰 已测试!\n",
|
|
||||||
"999 张术申 已测试!\n",
|
|
||||||
"6199 张杰 已测试!\n",
|
|
||||||
"1681 何志坚 已测试!\n",
|
|
||||||
"383 肖建国 已测试!\n",
|
|
||||||
"358\n",
|
|
||||||
"4229\n"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -142,7 +132,7 @@
|
|||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/places_result_20230427.csv'\n",
|
"filename = 'data/places_result_20230428.csv'\n",
|
||||||
"with open(filename,'r',newline='') as csv_file:\n",
|
"with open(filename,'r',newline='') as csv_file:\n",
|
||||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||||
" header = next(fl) \n",
|
" header = next(fl) \n",
|
||||||
@@ -175,7 +165,7 @@
|
|||||||
" else:\n",
|
" else:\n",
|
||||||
" for k1,v1 in v.items():\n",
|
" for k1,v1 in v.items():\n",
|
||||||
" dict2[k][k1] = v1\n",
|
" dict2[k][k1] = v1\n",
|
||||||
"filename = 'data/result_燕山石化(20230427).json'\n",
|
"filename = 'data/result_燕山石化(20230428).json'\n",
|
||||||
"with open(filename,'w') as fl:\n",
|
"with open(filename,'w') as fl:\n",
|
||||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||||
"print(len(re_ta))\n",
|
"print(len(re_ta))\n",
|
||||||
@@ -195,15 +185,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 143,
|
"execution_count": 151,
|
||||||
"id": "c24880ad-bbbd-4ad8-a894-cbcea389e822",
|
"id": "c24880ad-bbbd-4ad8-a894-cbcea389e822",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-27T11:20:46.486381Z",
|
"iopub.execute_input": "2023-04-28T23:46:14.648250Z",
|
||||||
"iopub.status.busy": "2023-04-27T11:20:46.485740Z",
|
"iopub.status.busy": "2023-04-28T23:46:14.647361Z",
|
||||||
"iopub.status.idle": "2023-04-27T11:20:46.658108Z",
|
"iopub.status.idle": "2023-04-28T23:46:14.803308Z",
|
||||||
"shell.execute_reply": "2023-04-27T11:20:46.657410Z",
|
"shell.execute_reply": "2023-04-28T23:46:14.802604Z",
|
||||||
"shell.execute_reply.started": "2023-04-27T11:20:46.486341Z"
|
"shell.execute_reply.started": "2023-04-28T23:46:14.648208Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -215,7 +205,7 @@
|
|||||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/result_燕山石化(20230427).json'\n",
|
"filename = 'data/result_燕山石化(20230428).json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl)\n",
|
" dict1 = json.load(fl)\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -240,7 +230,7 @@
|
|||||||
" else:\n",
|
" else:\n",
|
||||||
" list2.append('') \n",
|
" list2.append('') \n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"filename = 'data/燕山石化体测情况表(20230427).xlsx'\n",
|
"filename = 'data/燕山石化体测情况表(20230428).xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"sheet.append(title)\n",
|
"sheet.append(title)\n",
|
||||||
@@ -260,15 +250,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 144,
|
"execution_count": 152,
|
||||||
"id": "68454877-f1fe-4eed-8a48-265e428f892e",
|
"id": "68454877-f1fe-4eed-8a48-265e428f892e",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-27T11:21:48.040006Z",
|
"iopub.execute_input": "2023-04-28T23:46:28.786698Z",
|
||||||
"iopub.status.busy": "2023-04-27T11:21:48.039202Z",
|
"iopub.status.busy": "2023-04-28T23:46:28.786246Z",
|
||||||
"iopub.status.idle": "2023-04-27T11:21:48.069140Z",
|
"iopub.status.idle": "2023-04-28T23:46:28.816358Z",
|
||||||
"shell.execute_reply": "2023-04-27T11:21:48.068103Z",
|
"shell.execute_reply": "2023-04-28T23:46:28.815328Z",
|
||||||
"shell.execute_reply.started": "2023-04-27T11:21:48.039973Z"
|
"shell.execute_reply.started": "2023-04-28T23:46:28.786667Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -277,7 +267,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"{'合成橡胶厂工会': 30, '炼油厂工会': 95, '检验计量中心工会': 16, '烯烃厂工会': 115, '化学品厂工会': 29, '合成树脂厂': 10, '有机化工厂工会': 30, '储运厂工会': 12, '机关工会': 6, '高科公司工会': 9, '热电厂工会': 1, '物装中心工会': 5}\n"
|
"{'储运厂工会': 37, '炼油厂工会': 42, '化学品厂工会': 29, '高科公司工会': 69, '有机化工厂工会': 91, '物装中心工会': 3, '合成树脂厂': 10, '热电厂工会': 2, '合成橡胶厂工会': 27, '教育培训中心工会': 2, '烯烃厂工会': 11, '检验计量中心工会': 8, '机关工会': 2, '生产运行保障中心': 2}\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -285,7 +275,7 @@
|
|||||||
"import json\n",
|
"import json\n",
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/result_燕山石化(20230427).json'\n",
|
"filename = 'data/result_燕山石化(20230428).json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl)\n",
|
" dict1 = json.load(fl)\n",
|
||||||
"dict2 = {}\n",
|
"dict2 = {}\n",
|
||||||
@@ -300,7 +290,7 @@
|
|||||||
" list2 = []\n",
|
" list2 = []\n",
|
||||||
" list2 = [k,v]\n",
|
" list2 = [k,v]\n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"filename = 'data/燕山石化部门测试人数情况表(20230427).xlsx'\n",
|
"filename = 'data/燕山石化部门测试人数情况表(20230428).xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"sheet.append(title)\n",
|
"sheet.append(title)\n",
|
||||||
@@ -377,15 +367,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 118,
|
"execution_count": 148,
|
||||||
"id": "eddf7dab-b28d-402a-aeaf-27c120048ecb",
|
"id": "eddf7dab-b28d-402a-aeaf-27c120048ecb",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-26T10:55:40.757537Z",
|
"iopub.execute_input": "2023-04-27T12:02:16.168114Z",
|
||||||
"iopub.status.busy": "2023-04-26T10:55:40.756689Z",
|
"iopub.status.busy": "2023-04-27T12:02:16.167671Z",
|
||||||
"iopub.status.idle": "2023-04-26T10:55:41.510205Z",
|
"iopub.status.idle": "2023-04-27T12:02:16.802793Z",
|
||||||
"shell.execute_reply": "2023-04-26T10:55:41.509509Z",
|
"shell.execute_reply": "2023-04-27T12:02:16.802099Z",
|
||||||
"shell.execute_reply.started": "2023-04-26T10:55:40.757497Z"
|
"shell.execute_reply.started": "2023-04-27T12:02:16.168084Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -399,6 +389,22 @@
|
|||||||
"filename = 'data/result_燕山石化.json'\n",
|
"filename = 'data/result_燕山石化.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl)\n",
|
" dict1 = json.load(fl)\n",
|
||||||
|
"# 筛选重名剔除名单\n",
|
||||||
|
"chongming = []\n",
|
||||||
|
"filename = 'data/燕山石化重名人员测试情况.xlsx'\n",
|
||||||
|
"wb = openpyxl.load_workbook(filename)\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"for n in range(1, sheet.max_row+1,2):\n",
|
||||||
|
" if sheet.cell(n,1).value is not None:\n",
|
||||||
|
" code1 = int(sheet.cell(n, 1).value)\n",
|
||||||
|
" code2 = int(sheet.cell(n+1, 1).value)\n",
|
||||||
|
" bz1 = sheet.cell(n, 4).value\n",
|
||||||
|
" bz2 = sheet.cell(n+1, 4).value\n",
|
||||||
|
" if bz1 =='否' and bz2 =='否':\n",
|
||||||
|
" chongming.append(max(code1,code2))\n",
|
||||||
|
" else:\n",
|
||||||
|
" chongming.append(code1)\n",
|
||||||
|
" chongming.append(code2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/燕山石化人员名单.json'\n",
|
"filename = 'data/燕山石化人员名单.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
@@ -406,7 +412,7 @@
|
|||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"for k, v in dict2.items():\n",
|
"for k, v in dict2.items():\n",
|
||||||
" list2 = []\n",
|
" list2 = []\n",
|
||||||
" if k not in dict1.keys():\n",
|
" if k not in dict1.keys() and int(k) not in chongming:\n",
|
||||||
" list2.append(str(k).rjust(5,'0'))\n",
|
" list2.append(str(k).rjust(5,'0'))\n",
|
||||||
" list2.append(v['name']) \n",
|
" list2.append(v['name']) \n",
|
||||||
" list2.append(dict2[k]['sex'])\n",
|
" list2.append(dict2[k]['sex'])\n",
|
||||||
@@ -414,7 +420,7 @@
|
|||||||
" list2.append(dict2[k]['车间'])\n",
|
" list2.append(dict2[k]['车间'])\n",
|
||||||
" list2.append(dict2[k]['班组'])\n",
|
" list2.append(dict2[k]['班组'])\n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"filename = 'data/燕山石化未体测人员名单(截至20230426).xlsx'\n",
|
"filename = 'data/燕山石化未体测人员名单(截至20230427).xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"sheet.append(title)\n",
|
"sheet.append(title)\n",
|
||||||
|
|||||||
+16
-16
@@ -72,15 +72,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 12,
|
||||||
"id": "4b52477e-926a-44b5-b8a0-20bff98d101d",
|
"id": "4b52477e-926a-44b5-b8a0-20bff98d101d",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-26T02:03:49.859631Z",
|
"iopub.execute_input": "2023-04-28T02:29:30.505134Z",
|
||||||
"iopub.status.busy": "2023-04-26T02:03:49.858701Z",
|
"iopub.status.busy": "2023-04-28T02:29:30.504270Z",
|
||||||
"iopub.status.idle": "2023-04-26T02:03:49.891420Z",
|
"iopub.status.idle": "2023-04-28T02:29:30.603183Z",
|
||||||
"shell.execute_reply": "2023-04-26T02:03:49.890351Z",
|
"shell.execute_reply": "2023-04-28T02:29:30.602480Z",
|
||||||
"shell.execute_reply.started": "2023-04-26T02:03:49.859588Z"
|
"shell.execute_reply.started": "2023-04-28T02:29:30.505092Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -89,8 +89,8 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"6\n",
|
"33\n",
|
||||||
"6\n"
|
"33\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
"filename = 'data/长炼医院人员名单.json'\n",
|
"filename = 'data/长炼医院人员名单.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"rq = '20230425'\n",
|
"rq = '20230428'\n",
|
||||||
"filename = f'data/places_result_{rq}.csv'\n",
|
"filename = f'data/places_result_{rq}.csv'\n",
|
||||||
"with open(filename,'r',newline='') as csv_file:\n",
|
"with open(filename,'r',newline='') as csv_file:\n",
|
||||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||||
@@ -219,15 +219,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 13,
|
||||||
"id": "2ffa583b-be51-40a8-bb55-de6a89d1a54a",
|
"id": "2ffa583b-be51-40a8-bb55-de6a89d1a54a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-04-26T02:09:54.362083Z",
|
"iopub.execute_input": "2023-04-28T02:29:52.437982Z",
|
||||||
"iopub.status.busy": "2023-04-26T02:09:54.361227Z",
|
"iopub.status.busy": "2023-04-28T02:29:52.437174Z",
|
||||||
"iopub.status.idle": "2023-04-26T02:09:54.389991Z",
|
"iopub.status.idle": "2023-04-28T02:29:52.467779Z",
|
||||||
"shell.execute_reply": "2023-04-26T02:09:54.388984Z",
|
"shell.execute_reply": "2023-04-28T02:29:52.466907Z",
|
||||||
"shell.execute_reply.started": "2023-04-26T02:09:54.362051Z"
|
"shell.execute_reply.started": "2023-04-28T02:29:52.437947Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
"import json\n",
|
"import json\n",
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"\n",
|
"\n",
|
||||||
"rq = '20230425'\n",
|
"rq = '20230428'\n",
|
||||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
"filename = f'data/result_长炼医院({rq}).json'\n",
|
"filename = f'data/result_长炼医院({rq}).json'\n",
|
||||||
|
|||||||
Reference in new issue
Block a user