20220302
This commit is contained in:
1 parent
89a3cfb257
commit
04e6aa54aa
2 files changed
+1792
-30
No files matched your search
+385
-25
@@ -21,7 +21,10 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "0b8d5cc0-e549-4547-98cc-a753f3a729d1",
|
"id": "0b8d5cc0-e549-4547-98cc-a753f3a729d1",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 安庆炼化信息导入"
|
"### 安庆炼化信息导入"
|
||||||
]
|
]
|
||||||
@@ -71,7 +74,10 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "944372ff-9dc1-47e0-bfc0-a7d783fa9f43",
|
"id": "944372ff-9dc1-47e0-bfc0-a7d783fa9f43",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 石家庄炼化信息导入"
|
"### 石家庄炼化信息导入"
|
||||||
]
|
]
|
||||||
@@ -116,6 +122,214 @@
|
|||||||
" print('该单位已存在!')"
|
" print('该单位已存在!')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "a6147f12-5dd6-46a1-9b66-0d02d2d59197",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 北海炼化信息导入"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "e03f8ef7-a1c6-415c-914a-c426476aa71a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"unit\"]\n",
|
||||||
|
"\n",
|
||||||
|
"name = '中国石油化工股份有限公司北海炼化分公司'\n",
|
||||||
|
"short_name = '北海炼化'\n",
|
||||||
|
"myquery = {\"name\": name}\n",
|
||||||
|
"if mycol.find_one(myquery) is None:\n",
|
||||||
|
" wb = openpyxl.load_workbook('北海炼化名单表(202110).xlsx')\n",
|
||||||
|
" sheet = wb.active\n",
|
||||||
|
" # sheets = wb.sheetnames\n",
|
||||||
|
" depart = []\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" new_code = []\n",
|
||||||
|
" for n in range(2, sheet.max_row+1):\n",
|
||||||
|
" m_depart = sheet.cell(n,5).value\n",
|
||||||
|
" if m_depart not in depart:\n",
|
||||||
|
" depart.append(sheet.cell(n,5).value)\n",
|
||||||
|
" # print(sheet.cell(n,5).value)\n",
|
||||||
|
"\n",
|
||||||
|
" dict1['name'] = '中国石油化工股份有限公司北海炼化分公司'\n",
|
||||||
|
" dict1['short_name'] = '北海炼化'\n",
|
||||||
|
" dict1['depart'] = depart\n",
|
||||||
|
" mycol.insert_one(dict1)\n",
|
||||||
|
" print('ok!')\n",
|
||||||
|
"else:\n",
|
||||||
|
" print('该单位已存在!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "15024574-745e-400c-8aac-6f1b6f635362",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 济南炼化信息导入"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "a3cbaf21-a9cb-4066-a5cc-4375d25fcc86",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"unit\"]\n",
|
||||||
|
"\n",
|
||||||
|
"name = '中国石油化工股份有限公司济南炼化分公司'\n",
|
||||||
|
"short_name = '北海炼化'\n",
|
||||||
|
"myquery = {\"name\": name}\n",
|
||||||
|
"if mycol.find_one(myquery) is None:\n",
|
||||||
|
" wb = openpyxl.load_workbook('data/济南炼化.xlsx')\n",
|
||||||
|
" sheet = wb.active\n",
|
||||||
|
" # sheets = wb.sheetnames\n",
|
||||||
|
" depart = []\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" new_code = []\n",
|
||||||
|
" for n in range(2, sheet.max_row+1):\n",
|
||||||
|
" m_depart = sheet.cell(n,5).value\n",
|
||||||
|
" if m_depart not in depart:\n",
|
||||||
|
" depart.append(sheet.cell(n,5).value)\n",
|
||||||
|
" # print(sheet.cell(n,5).value)\n",
|
||||||
|
"\n",
|
||||||
|
" dict1['name'] = '中国石油化工股份有限公司济南炼化分公司'\n",
|
||||||
|
" dict1['short_name'] = '济南炼化'\n",
|
||||||
|
" dict1['depart'] = depart\n",
|
||||||
|
" mycol.insert_one(dict1)\n",
|
||||||
|
" print('ok!')\n",
|
||||||
|
"else:\n",
|
||||||
|
" print('该单位已存在!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "80c42a26-cdc2-4078-93e7-6b8557f41ba2",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 中石化石油工程设计信息导入"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "82a80c63-42b6-4f92-beba-274e2da2bb38",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"unit\"]\n",
|
||||||
|
"\n",
|
||||||
|
"name = '中石化石油工程设计'\n",
|
||||||
|
"short_name = '中石化石油工程设计'\n",
|
||||||
|
"myquery = {\"name\": name}\n",
|
||||||
|
"if mycol.find_one(myquery) is None:\n",
|
||||||
|
" wb = openpyxl.load_workbook('data/东营.xlsx')\n",
|
||||||
|
" sheet = wb.active\n",
|
||||||
|
" # sheets = wb.sheetnames\n",
|
||||||
|
" depart = []\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" new_code = []\n",
|
||||||
|
" for n in range(2, sheet.max_row+1):\n",
|
||||||
|
" m_depart = sheet.cell(n,5).value\n",
|
||||||
|
" if m_depart not in depart:\n",
|
||||||
|
" depart.append(sheet.cell(n,5).value)\n",
|
||||||
|
" # print(sheet.cell(n,5).value)\n",
|
||||||
|
"\n",
|
||||||
|
" dict1['name'] = '中国石油化工股份有限公司济南炼化分公司'\n",
|
||||||
|
" dict1['short_name'] = '济南炼化'\n",
|
||||||
|
" dict1['depart'] = depart\n",
|
||||||
|
" mycol.insert_one(dict1)\n",
|
||||||
|
" print('ok!')\n",
|
||||||
|
"else:\n",
|
||||||
|
" print('该单位已存在!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "c0ec85f6-e897-4f94-af46-1007d58ad1e3",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 沧州炼化信息导入"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "a083426f-9946-47ec-8b2a-ea0a7f287def",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2022-03-02T01:42:37.728967Z",
|
||||||
|
"iopub.status.busy": "2022-03-02T01:42:37.727574Z",
|
||||||
|
"iopub.status.idle": "2022-03-02T01:42:43.639433Z",
|
||||||
|
"shell.execute_reply": "2022-03-02T01:42:43.635863Z",
|
||||||
|
"shell.execute_reply.started": "2022-03-02T01:42:37.728712Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok!\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"unit\"]\n",
|
||||||
|
"\n",
|
||||||
|
"name = '中国石油化工股份有限公司沧州炼化分公司'\n",
|
||||||
|
"short_name = '沧州炼化'\n",
|
||||||
|
"myquery = {\"name\": name}\n",
|
||||||
|
"if mycol.find_one(myquery) is None:\n",
|
||||||
|
" wb = openpyxl.load_workbook('data/沧州.xlsx')\n",
|
||||||
|
" sheet = wb.active\n",
|
||||||
|
" # sheets = wb.sheetnames\n",
|
||||||
|
" depart = []\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" new_code = []\n",
|
||||||
|
" for n in range(2, sheet.max_row+1):\n",
|
||||||
|
" m_depart = sheet.cell(n,5).value\n",
|
||||||
|
" if m_depart not in depart:\n",
|
||||||
|
" depart.append(sheet.cell(n,5).value)\n",
|
||||||
|
" # print(sheet.cell(n,5).value)\n",
|
||||||
|
"\n",
|
||||||
|
" dict1['name'] = '中国石油化工股份有限公司沧州炼化分公司'\n",
|
||||||
|
" dict1['short_name'] = '沧州炼化'\n",
|
||||||
|
" dict1['depart'] = depart\n",
|
||||||
|
" mycol.insert_one(dict1)\n",
|
||||||
|
" print('ok!')\n",
|
||||||
|
"else:\n",
|
||||||
|
" print('该单位已存在!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "bf42e8af-a506-4e60-a661-b4281e3fef54",
|
"id": "bf42e8af-a506-4e60-a661-b4281e3fef54",
|
||||||
@@ -143,14 +357,14 @@
|
|||||||
"mycol1 = mydb[\"event\"]\n",
|
"mycol1 = mydb[\"event\"]\n",
|
||||||
"dict1 = {}\n",
|
"dict1 = {}\n",
|
||||||
"dict2 = {}\n",
|
"dict2 = {}\n",
|
||||||
"code = '119'\n",
|
"code = '122'\n",
|
||||||
"name = '中国石油化工股份有限公司石家庄炼化分公司'\n",
|
"name = '中国石油化工股份有限公司济南炼化分公司'\n",
|
||||||
"myquery = {\"name\": name}\n",
|
"myquery = {\"name\": name}\n",
|
||||||
"\n",
|
"\n",
|
||||||
"dict2['unit'] = '中国石油化工股份有限公司石家庄炼化分公司'\n",
|
"dict2['unit'] = '中国石油化工股份有限公司济南炼化分公司'\n",
|
||||||
"dict2['address'] = '河北石家庄'\n",
|
"dict2['address'] = '山东济南'\n",
|
||||||
"dict2['date_begin'] = '2021-08-03'\n",
|
"dict2['date_begin'] = '2021-11-30'\n",
|
||||||
"dict2['date_end'] = '2021-08-20'\n",
|
"dict2['date_end'] = '2021-12-10'\n",
|
||||||
"dict1[code] = dict2\n",
|
"dict1[code] = dict2\n",
|
||||||
"if mycol.find_one(myquery) is None:\n",
|
"if mycol.find_one(myquery) is None:\n",
|
||||||
" print('体测单位不存在!')\n",
|
" print('体测单位不存在!')\n",
|
||||||
@@ -189,14 +403,14 @@
|
|||||||
"mydb = myclient[\"tice\"]\n",
|
"mydb = myclient[\"tice\"]\n",
|
||||||
"mycol = mydb[\"person\"]\n",
|
"mycol = mydb[\"person\"]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"wb = openpyxl.load_workbook('data/中国石油化工股份有限公司安庆炼化分公司员工在职人员名单.xlsx')\n",
|
"wb = openpyxl.load_workbook('data/济南炼化.xlsx')\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"# sheets = wb.sheetnames\n",
|
"# sheets = wb.sheetnames\n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"person = {}\n",
|
"person = {}\n",
|
||||||
"new_code = []\n",
|
"new_code = []\n",
|
||||||
"for n in range(2, sheet.max_row+1):\n",
|
"for n in range(2, sheet.max_row+1):\n",
|
||||||
" code = sheet.cell(n, 1).value\n",
|
" code = str(sheet.cell(n, 1).value).rjust(5,\"0\")\n",
|
||||||
" person.setdefault(code, {})\n",
|
" person.setdefault(code, {})\n",
|
||||||
" dict1 = {}\n",
|
" dict1 = {}\n",
|
||||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||||
@@ -207,7 +421,7 @@
|
|||||||
" else:\n",
|
" else:\n",
|
||||||
" dict1['id_num'] = sheet.cell(n, 4).value\n",
|
" dict1['id_num'] = sheet.cell(n, 4).value\n",
|
||||||
" person[code] = dict1\n",
|
" person[code] = dict1\n",
|
||||||
"filename = '安庆炼化人员名单.json'\n",
|
"filename = 'data/济南炼化人员名单.json'\n",
|
||||||
"with open(filename, 'w') as fl:\n",
|
"with open(filename, 'w') as fl:\n",
|
||||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||||
"print('ok')"
|
"print('ok')"
|
||||||
@@ -224,7 +438,9 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "611d2cc4-26c3-4c42-82ad-21f843f2c699",
|
"id": "611d2cc4-26c3-4c42-82ad-21f843f2c699",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 安庆炼化"
|
"### 安庆炼化"
|
||||||
]
|
]
|
||||||
@@ -300,7 +516,10 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "edc06db7-9ae5-441a-8273-88ad598096ba",
|
"id": "edc06db7-9ae5-441a-8273-88ad598096ba",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 石家庄炼化"
|
"### 石家庄炼化"
|
||||||
]
|
]
|
||||||
@@ -368,6 +587,154 @@
|
|||||||
"print('ok!')"
|
"print('ok!')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "46dfdcbb-face-4269-a1c7-d43f36cbf906",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"### 北海炼化"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "d4bc0dc6-8835-425a-9f3f-97d2163e7d73",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"from bson.objectid import ObjectId\n",
|
||||||
|
"import os,sys,shutil\n",
|
||||||
|
"import pymysql\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"person\"]\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"fi_path = os.getcwd() + '/file/210803'\n",
|
||||||
|
"filename = '石家庄炼化人员名单.json'\n",
|
||||||
|
"code = '121'\n",
|
||||||
|
"fl=os.listdir(fi_path)\n",
|
||||||
|
"old = []\n",
|
||||||
|
"for fn in fl:\n",
|
||||||
|
" if os.path.isfile(fi_path + '/' + fn):\n",
|
||||||
|
" ofn = fn.split('.')[0].rjust(5,\"0\")\n",
|
||||||
|
" old.append(ofn) \n",
|
||||||
|
"old.sort()\n",
|
||||||
|
"\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" all_person = json.load(fl)\n",
|
||||||
|
"with open('result1.json','r') as fl1:\n",
|
||||||
|
" res = json.load(fl1)\n",
|
||||||
|
"for k, v in all_person.items():\n",
|
||||||
|
" if k in old:\n",
|
||||||
|
" dict2 = {}\n",
|
||||||
|
" dict3 = {}\n",
|
||||||
|
" dict2['name'] = v['name']\n",
|
||||||
|
" if v['sex'] == '男':\n",
|
||||||
|
" dict2['sex'] = 'M'\n",
|
||||||
|
" else:\n",
|
||||||
|
" dict2['sex'] = 'F'\n",
|
||||||
|
" if 'birth' in v:\n",
|
||||||
|
" s = str(v['birth'])\n",
|
||||||
|
" dict2['birth'] = f'{s[:4]}-{s[4:6]}-{s[6:8]}'\n",
|
||||||
|
" if 'id_num' in v:\n",
|
||||||
|
" s = v['id_num']\n",
|
||||||
|
" dict2['id_num'] = s\n",
|
||||||
|
" dict2['birth'] = f'{s[6:10]}-{s[10:12]}-{s[12:14]}'\n",
|
||||||
|
" dict2.setdefault('exam',{})\n",
|
||||||
|
" \n",
|
||||||
|
" #dict3['code'] = 120\n",
|
||||||
|
" dict3['sn'] = k\n",
|
||||||
|
" dict3['result'] = res[k]\n",
|
||||||
|
" dict2['exam'][code] = dict3\n",
|
||||||
|
" list1.append(dict2)\n",
|
||||||
|
"x = mycol.insert_many(list1)\n",
|
||||||
|
"\n",
|
||||||
|
"print('ok!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "3dbdfb94-e823-43e2-a7ea-16f094c6f03b",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### 济南炼化"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "2d01b42b-41cf-4b53-bbbc-f4ccb2bc5a0a",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"from bson.objectid import ObjectId\n",
|
||||||
|
"import os,sys,shutil\n",
|
||||||
|
"import pymysql\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||||
|
"mydb = myclient[\"tice\"]\n",
|
||||||
|
"mycol = mydb[\"person\"]\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"fi_path = os.getcwd() + '/file/211130'\n",
|
||||||
|
"filename = 'data/济南炼化人员名单.json'\n",
|
||||||
|
"code = '122'\n",
|
||||||
|
"fl=os.listdir(fi_path)\n",
|
||||||
|
"old = []\n",
|
||||||
|
"for fn in fl:\n",
|
||||||
|
" if os.path.isfile(fi_path + '/' + fn):\n",
|
||||||
|
" ofn = fn.split('.')[0].rjust(5,\"0\")\n",
|
||||||
|
" old.append(ofn) \n",
|
||||||
|
"old.sort()\n",
|
||||||
|
"\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" all_person = json.load(fl)\n",
|
||||||
|
"with open('data/result_jn.json','r') as fl1:\n",
|
||||||
|
" res = json.load(fl1)\n",
|
||||||
|
"for k, v in all_person.items():\n",
|
||||||
|
" if k in old:\n",
|
||||||
|
" dict2 = {}\n",
|
||||||
|
" dict3 = {}\n",
|
||||||
|
" dict2['name'] = v['name']\n",
|
||||||
|
" if v['sex'] == '男':\n",
|
||||||
|
" dict2['sex'] = 'M'\n",
|
||||||
|
" else:\n",
|
||||||
|
" dict2['sex'] = 'F'\n",
|
||||||
|
" if 'birth' in v:\n",
|
||||||
|
" s = str(v['birth'])\n",
|
||||||
|
" dict2['birth'] = f'{s[:4]}-{s[4:6]}-{s[6:8]}'\n",
|
||||||
|
" if 'id_num' in v:\n",
|
||||||
|
" s = v['id_num']\n",
|
||||||
|
" dict2['id_num'] = s\n",
|
||||||
|
" dict2['birth'] = f'{s[6:10]}-{s[10:12]}-{s[12:14]}'\n",
|
||||||
|
" dict2.setdefault('exam',{})\n",
|
||||||
|
" \n",
|
||||||
|
" #dict3['code'] = 120\n",
|
||||||
|
" dict3['sn'] = k\n",
|
||||||
|
" dict3['result'] = res[str(k)]\n",
|
||||||
|
" dict2['exam'][code] = dict3\n",
|
||||||
|
" list1.append(dict2)\n",
|
||||||
|
"x = mycol.insert_many(list1)\n",
|
||||||
|
"\n",
|
||||||
|
"print('ok!')"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "95ad1920-1393-4830-a48a-540070b51a09",
|
"id": "95ad1920-1393-4830-a48a-540070b51a09",
|
||||||
@@ -441,7 +808,7 @@
|
|||||||
"for k,v in dict1.items():\n",
|
"for k,v in dict1.items():\n",
|
||||||
" item[k] = v\n",
|
" item[k] = v\n",
|
||||||
"user_id = 5\n",
|
"user_id = 5\n",
|
||||||
"place_id =120\n",
|
"place_id =122\n",
|
||||||
"#user = '包永'\n",
|
"#user = '包永'\n",
|
||||||
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
|
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
|
||||||
"cursor = db.cursor()\n",
|
"cursor = db.cursor()\n",
|
||||||
@@ -470,7 +837,7 @@
|
|||||||
" \n",
|
" \n",
|
||||||
" #re_ta[user] = dict1\n",
|
" #re_ta[user] = dict1\n",
|
||||||
" #print(re_ta)\n",
|
" #print(re_ta)\n",
|
||||||
"filename = 'result.json'\n",
|
"filename = 'data/result_jn.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('ok')\n"
|
"print('ok')\n"
|
||||||
@@ -705,7 +1072,7 @@
|
|||||||
"mydb = myclient[\"tice\"]\n",
|
"mydb = myclient[\"tice\"]\n",
|
||||||
"mycol = mydb[\"person\"]\n",
|
"mycol = mydb[\"person\"]\n",
|
||||||
"#体质监测编号\n",
|
"#体质监测编号\n",
|
||||||
"code = '119'\n",
|
"code = '122'\n",
|
||||||
"UploadCache = \"uploadcache\"\n",
|
"UploadCache = \"uploadcache\"\n",
|
||||||
"dbURL = \"mongodb://localhost:27017\"\n",
|
"dbURL = \"mongodb://localhost:27017\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -735,7 +1102,7 @@
|
|||||||
"dict1 = {}\n",
|
"dict1 = {}\n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"\n",
|
"\n",
|
||||||
"fl_path = 'file/210803'\n",
|
"fl_path = 'file/211130'\n",
|
||||||
"fl=glob.glob(f'{fl_path}/*.pdf')\n",
|
"fl=glob.glob(f'{fl_path}/*.pdf')\n",
|
||||||
"fl.sort()\n",
|
"fl.sort()\n",
|
||||||
"for fi in fl:\n",
|
"for fi in fl:\n",
|
||||||
@@ -797,16 +1164,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": null,
|
||||||
"id": "ed6b40e9-4c5f-4d1f-8810-9f519a8755b0",
|
"id": "ed6b40e9-4c5f-4d1f-8810-9f519a8755b0",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2021-12-21T14:57:58.154705Z",
|
|
||||||
"iopub.status.busy": "2021-12-21T14:57:58.153424Z",
|
|
||||||
"iopub.status.idle": "2021-12-21T14:57:59.771235Z",
|
|
||||||
"shell.execute_reply": "2021-12-21T14:57:59.767942Z",
|
|
||||||
"shell.execute_reply.started": "2021-12-21T14:57:58.154596Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
|
|||||||
+1407
-5
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user