This commit is contained in:
512song committed 2024-09-24 19:37:04 +08:00
1 parent 96f043313c
commit 3a9cb48f1e
5 files changed
+1697 -229

No files matched your search

+89 -21
View File
@@ -10,9 +10,16 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "360f0a97-d73d-43f3-9f7a-0f9582103c82",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-24T09:50:41.703850Z",
"iopub.status.busy": "2024-09-24T09:50:41.703095Z",
"iopub.status.idle": "2024-09-24T09:50:41.720718Z",
"shell.execute_reply": "2024-09-24T09:50:41.719536Z",
"shell.execute_reply.started": "2024-09-24T09:50:41.703777Z"
},
"tags": []
},
"outputs": [],
@@ -23,10 +30,10 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"place\"]\n",
"\n",
"place_id = 727411\n",
"place_code = \"13\"\n",
"dw_name = \"北体体质康健班\"\n",
"dw_jc = \"北体体质康健班\"\n",
"place_id = 345321\n",
"place_code = \"14\"\n",
"dw_name = \"中国石化镇海炼化公司\"\n",
"dw_jc = \"中国石化镇海炼化公司\"\n",
"myquery = { \"id\": place_id }\n",
"num = mycol.count_documents(myquery)\n",
"if num>0:\n",
@@ -46,10 +53,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "6ce2cbc7-435a-461c-bdb8-abd9a6962fbc",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-23T09:16:02.614379Z",
"iopub.status.busy": "2024-09-23T09:16:02.613463Z",
"iopub.status.idle": "2024-09-23T09:16:02.633416Z",
"shell.execute_reply": "2024-09-23T09:16:02.632423Z",
"shell.execute_reply.started": "2024-09-23T09:16:02.614298Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import os,sys,shutil\n",
@@ -63,10 +86,10 @@
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"baogao\"]\n",
"\n",
"place_id = 727411\n",
"place_code = \"13\"\n",
"dw_name = \"北体体质康健班\"\n",
"dw_jc = \"北体体质康健班\"\n",
"place_id = 496534\n",
"place_code = \"12\"\n",
"dw_name = \"天宫院社区\"\n",
"dw_jc = \"天宫院社区\"\n",
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n",
"fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n",
"\n",
@@ -97,7 +120,7 @@
" #fi_name =Path(fn).stem\n",
" code = int(fi_name)\n",
" dxm = list1[i]\n",
" dict2 = {'place_id':place_id,'code':dxm,'fn':Path(fn).name,'rq':'20240914'}\n",
" dict2 = {'place_id':place_id,'code':dxm,'fn':Path(fn).name}\n",
" list2.append(dict2)\n",
" i +=1\n",
"x = mycol.insert_many(list2)\n",
@@ -114,12 +137,57 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "5f665c0f-8d30-4759-b7f8-fb7e13b98efa",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-24T06:02:00.787106Z",
"iopub.status.busy": "2024-09-24T06:02:00.786300Z",
"iopub.status.idle": "2024-09-24T06:02:00.838883Z",
"shell.execute_reply": "2024-09-24T06:02:00.838280Z",
"shell.execute_reply.started": "2024-09-24T06:02:00.787028Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 13488820384 0014-舒浩轩.pdf\n",
"2 18612703139 0025-李嘉睿.pdf\n",
"3 13522895654 0003-杨宾.pdf\n",
"4 13718367043 0012-杨玉芬.pdf\n",
"5 15210713283 0005-王红柳.pdf\n",
"6 15101087817 0024-茅晴晴.pdf\n",
"7 18810111978 0008-段丽阳.pdf\n",
"8 15224991657 0026-郑慧敏.pdf\n",
"9 15210713283 0006-高天蕴.pdf\n",
"10 15010699019 0021-董润华.pdf\n",
"11 13671026339 0013-王柱明.pdf\n",
"12 15551006319 0029-林景平.pdf\n",
"13 13522895654 0004-武馨怡.pdf\n",
"14 18660799298 0023-程军妮.pdf\n",
"15 18233207289 0019-张傲楠.pdf\n",
"16 13910932179 0017-朱芷祁.pdf\n",
"17 18210661187 0011-张耀聪.pdf\n",
"18 18232370815 0020-尹晓晴.pdf\n",
"19 13426267482 0018-卢浥尘.pdf\n",
"20 13552494958 0031-魏丽.pdf\n",
"21 13681380585 0007-刘颖.pdf\n",
"22 13311183808 0016-张玉后.pdf\n",
"23 18210661187 0001-李雪莉.pdf\n",
"24 17665174761 0027-郑文结.pdf\n",
"25 15588818169 0022-刘小云.pdf\n",
"26 13011189787 0028-潘妍.pdf\n",
"27 13770726975 0030-宋元宵.pdf\n",
"28 18210661187 0002-张进刚.pdf\n",
"29 13671271202 0010-范文兰.pdf\n",
"30 18810111978 0009-段宇辰.pdf\n",
"31 13581907290 0015-罗靖卓.pdf\n"
]
}
],
"source": [
"from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -133,13 +201,13 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n",
"\n",
"dw_jc = \"北体体质康健班\"\n",
"filename = 'data/北体体质康健.json'\n",
"dw_jc = \"天宫院社区\"\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
"#place_id = 571315\n",
"myquery = { \"place_id\": place_id,\"rq\":'20240914' }\n",
"myquery = { \"place_id\": place_id}\n",
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
" code = int(x['fn'].split('-')[0])\n",
" if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n",
@@ -214,13 +282,13 @@
"mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n",
"\n",
"dw_jc = \"北体体质康健班测试者\"\n",
"filename = 'data/北体体质康健.json'\n",
"dw_jc = \"天宫院社区测试者\"\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
"#place_id = 571315\n",
"myquery = { \"place_id\": place_id,\"rq\":'20240914' }\n",
"myquery = { \"place_id\": place_id }\n",
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
" code = int(x['fn'].split('-')[0])\n",
" if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n",
+27 -27
View File
@@ -431,15 +431,15 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 1,
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T02:15:15.011907Z",
"iopub.status.busy": "2024-07-11T02:15:15.011411Z",
"iopub.status.idle": "2024-07-11T02:15:15.033470Z",
"shell.execute_reply": "2024-07-11T02:15:15.032441Z",
"shell.execute_reply.started": "2024-07-11T02:15:15.011858Z"
"iopub.execute_input": "2024-09-23T09:01:55.163463Z",
"iopub.status.busy": "2024-09-23T09:01:55.162587Z",
"iopub.status.idle": "2024-09-23T09:01:55.182154Z",
"shell.execute_reply": "2024-09-23T09:01:55.181668Z",
"shell.execute_reply.started": "2024-09-23T09:01:55.163386Z"
},
"tags": []
},
@@ -448,8 +448,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"47\n",
"47\n"
"31\n",
"31\n"
]
}
],
@@ -482,11 +482,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/天宫院街道2024.json'\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240710.csv'\n",
"filename = 'data/places_result_20240923.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -527,7 +527,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\n",
"filename = 'data/result_天宫院社区2024.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -548,11 +548,11 @@
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-14T12:17:16.275045Z",
"iopub.status.busy": "2024-09-14T12:17:16.274382Z",
"iopub.status.idle": "2024-09-14T12:17:16.304051Z",
"shell.execute_reply": "2024-09-14T12:17:16.303490Z",
"shell.execute_reply.started": "2024-09-14T12:17:16.274984Z"
"iopub.execute_input": "2024-09-23T09:02:38.046594Z",
"iopub.status.busy": "2024-09-23T09:02:38.045904Z",
"iopub.status.idle": "2024-09-23T09:02:38.070709Z",
"shell.execute_reply": "2024-09-23T09:02:38.070026Z",
"shell.execute_reply.started": "2024-09-23T09:02:38.046526Z"
},
"tags": []
},
@@ -662,7 +662,7 @@
"\n",
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_北体体质康健1.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -683,7 +683,7 @@
" dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_北体体质康健2.json'\n",
"filename = f'data/result_天宫院社区240922.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -846,15 +846,15 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 3,
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T02:18:04.079962Z",
"iopub.status.busy": "2024-07-11T02:18:04.079156Z",
"iopub.status.idle": "2024-07-11T02:18:13.608066Z",
"shell.execute_reply": "2024-07-11T02:18:13.606969Z",
"shell.execute_reply.started": "2024-07-11T02:18:04.079886Z"
"iopub.execute_input": "2024-09-23T09:03:50.560872Z",
"iopub.status.busy": "2024-09-23T09:03:50.560147Z",
"iopub.status.idle": "2024-09-23T09:04:05.194187Z",
"shell.execute_reply": "2024-09-23T09:04:05.193055Z",
"shell.execute_reply.started": "2024-09-23T09:03:50.560801Z"
},
"tags": []
},
@@ -863,7 +863,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"22\n"
"31\n"
]
}
],
@@ -876,11 +876,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_天宫院街道1.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./天宫院2024/'\n",
"file_path ='./天宫院240922/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
+98 -141
View File
@@ -10,18 +10,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "a03a5289-9766-4a60-9d38-245deb2ee4e6",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-23T08:54:21.300838Z",
"iopub.status.busy": "2024-09-23T08:54:21.300070Z",
"iopub.status.idle": "2024-09-23T08:54:21.477586Z",
"shell.execute_reply": "2024-09-23T08:54:21.476575Z",
"shell.execute_reply.started": "2024-09-23T08:54:21.300765Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/天宫院街道2024.xlsx')\n",
"wb = openpyxl.load_workbook('data/240922名单.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
@@ -36,14 +51,13 @@
" \n",
" dict1['sex'] = sheet.cell(n,3).value\n",
" birth = str(sheet.cell(n, 4).value).split()[0]\n",
" dict1['birth'] = birth.replace('/','-')\n",
" dict1['birth'] = birth.replace('/','-') \n",
" \n",
" person[code] = dict1\n",
" if sheet.cell(n,5).value is not None:\n",
" dict1['phone'] = sheet.cell(n,5).value\n",
"\n",
" person[code] = dict1\n",
"filename = 'data/天宫院街道2024.json'\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
@@ -51,26 +65,10 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "b29a6f3c-035c-4c74-bbac-61e83be2b37c",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T08:18:28.633340Z",
"iopub.status.busy": "2024-07-11T08:18:28.632568Z",
"iopub.status.idle": "2024-07-11T08:18:28.654035Z",
"shell.execute_reply": "2024-07-11T08:18:28.653382Z",
"shell.execute_reply.started": "2024-07-11T08:18:28.633268Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -149,12 +147,28 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "db39190f-47d4-4a7c-b727-c79e2a64452f",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-23T08:55:23.555758Z",
"iopub.status.busy": "2024-09-23T08:55:23.554865Z",
"iopub.status.idle": "2024-09-23T08:55:23.569912Z",
"shell.execute_reply": "2024-09-23T08:55:23.568888Z",
"shell.execute_reply.started": "2024-09-23T08:55:23.555680Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"31\n",
"31\n"
]
}
],
"source": [
"import json\n",
"import time\n",
@@ -170,11 +184,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/天宫院街道2024.json'\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240710.csv'\n",
"filename = 'data/places_result_20240923.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -194,7 +208,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\n",
"filename = 'data/result_天宫院街道2024.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -203,15 +217,15 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 3,
"id": "590775c3-16ef-43ad-99a2-85e847fe4079",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T08:19:29.653063Z",
"iopub.status.busy": "2024-07-11T08:19:29.652598Z",
"iopub.status.idle": "2024-07-11T08:19:29.662479Z",
"shell.execute_reply": "2024-07-11T08:19:29.661939Z",
"shell.execute_reply.started": "2024-07-11T08:19:29.653037Z"
"iopub.execute_input": "2024-09-23T08:57:30.916080Z",
"iopub.status.busy": "2024-09-23T08:57:30.915319Z",
"iopub.status.idle": "2024-09-23T08:57:30.930835Z",
"shell.execute_reply": "2024-09-23T08:57:30.929793Z",
"shell.execute_reply.started": "2024-09-23T08:57:30.916010Z"
}
},
"outputs": [
@@ -219,8 +233,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"61\n",
"61\n"
"31\n",
"31\n"
]
}
],
@@ -239,11 +253,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/天宫院街道all.json'\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240710.csv'\n",
"filename = 'data/places_result_20240923.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -262,7 +276,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\n",
"filename = 'data/result_天宫院街道all.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -279,15 +293,15 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"id": "c2ee2c71-7e28-4201-af85-ed7f001c6872",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T08:19:59.192307Z",
"iopub.status.busy": "2024-07-11T08:19:59.191555Z",
"iopub.status.idle": "2024-07-11T08:19:59.221577Z",
"shell.execute_reply": "2024-07-11T08:19:59.220830Z",
"shell.execute_reply.started": "2024-07-11T08:19:59.192234Z"
"iopub.execute_input": "2024-09-23T08:58:27.504156Z",
"iopub.status.busy": "2024-09-23T08:58:27.503390Z",
"iopub.status.idle": "2024-09-23T08:58:27.530165Z",
"shell.execute_reply": "2024-09-23T08:58:27.529383Z",
"shell.execute_reply.started": "2024-09-23T08:58:27.504064Z"
},
"tags": []
},
@@ -296,18 +310,37 @@
"name": "stdout",
"output_type": "stream",
"text": [
"101 李先生\n"
]
},
{
"ename": "KeyError",
"evalue": "'sex'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[10], line 20\u001b[0m\n\u001b[1;32m 18\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(\u001b[38;5;28mstr\u001b[39m(k)\u001b[38;5;241m.\u001b[39mrjust(\u001b[38;5;241m3\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m0\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m 19\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(v[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m]) \n\u001b[0;32m---> 20\u001b[0m list2\u001b[38;5;241m.\u001b[39mappend(\u001b[43mdict2\u001b[49m\u001b[43m[\u001b[49m\u001b[43mk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43msex\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m)\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m items:\n\u001b[1;32m 24\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m v\u001b[38;5;241m.\u001b[39mkeys():\n",
"\u001b[0;31mKeyError\u001b[0m: 'sex'"
"31 魏丽\n",
"1 李雪莉\n",
"2 张进刚\n",
"3 杨宾\n",
"4 武馨怡\n",
"6 高天蕴\n",
"5 王红柳\n",
"7 刘颖\n",
"8 段丽阳\n",
"9 段宇辰\n",
"10 范文兰\n",
"11 张耀聪\n",
"12 杨玉芬\n",
"13 王柱明\n",
"14 舒浩轩\n",
"15 罗靖卓\n",
"16 张玉后\n",
"17 朱芷祁\n",
"18 卢浥尘\n",
"19 张傲楠\n",
"20 尹晓晴\n",
"21 董润华\n",
"22 刘小云\n",
"23 程军妮\n",
"24 茅晴晴\n",
"25 李嘉睿\n",
"26 郑慧敏\n",
"27 郑文结\n",
"28 潘妍\n",
"29 林景平\n",
"30 宋元宵\n"
]
}
],
@@ -317,11 +350,11 @@
"\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_天宫院街道.json'\n",
"filename = 'data/result_天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/天宫院街道all.json'\n",
"filename = 'data/天宫院社区240922.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
@@ -342,7 +375,7 @@
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/天宫院社区体测情况表_all.xlsx'\n",
"filename = 'data/天宫院社区体测情况表_240922.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -354,86 +387,10 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "ddba1233-6ab2-480d-8bde-ed8e1c34e48e",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-11T08:20:48.587834Z",
"iopub.status.busy": "2024-07-11T08:20:48.587065Z",
"iopub.status.idle": "2024-07-11T08:20:48.615936Z",
"shell.execute_reply": "2024-07-11T08:20:48.615410Z",
"shell.execute_reply.started": "2024-07-11T08:20:48.587764Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"101 李有才\n",
"44 星众豪\n",
"94 谢红印\n",
"14 孙一萂\n",
"132 梁正文\n",
"123 刘\n",
"93 李洪芝\n",
"71 李羽馨\n",
"91 孙婧祎\n",
"8 王红晶\n",
"126 马\n",
"125 陈\n",
"6 刘艳\n",
"96 薛颖\n",
"2 刘书本\n",
"40 杨春华\n",
"9 霍思诺\n",
"124 苗\n",
"128 张\n",
"78 朱蕊\n",
"10 李晨曦\n",
"5 李芳\n",
"100 聂彦芹\n",
"4 富红\n",
"68 冯瑞文\n",
"108 杨\n",
"130 徐\n",
"86 阎树芹\n",
"83 张万成\n",
"116 白景香\n",
"103 王梓涵\n",
"15 王慧兰\n",
"36 冯玉红\n",
"118 王玉芬\n",
"102 王岩东\n",
"19 张竹辰\n",
"38 路德慧\n",
"111 张\n",
"37 张影\n",
"25 孟现春\n",
"41 朱朝云\n",
"85 武宜国\n",
"107 刘连英\n",
"20 王韵琪\n",
"7 李雪\n",
"18 王真秀\n",
"98 张建霞\n",
"131 陈艳莉\n",
"106 沈建新\n",
"43 杨桂兰\n",
"127 张\n",
"39 韩润壮\n",
"129 薛\n",
"110 赵\n",
"79 郭忠臣\n",
"81 赵淑芬\n",
"115 朱\n",
"114 王淑云\n",
"62 赵秀香\n",
"31 张成林\n",
"99 张东喜\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
+1450 -40
View File
File diff suppressed because it is too large. Load diff
+33
View File
@@ -557,6 +557,39 @@
"print(dict1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 生成导入数据库语句"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"from datetime import date\n",
"\n",
"wb = openpyxl.load_workbook('data/镇海体测手工数据.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"dict1 = {}\n",
"list1 = []\n",
"for n in range(1, sheet.max_row+1):\n",
" id = int(sheet.cell(n, 1).value)\n",
" item = int(sheet.cell(n, 2).value)\n",
" perf = int(sheet.cell(n, 3).value)\n",
" s = f'(345321,{id},{item},{perf},\"2024-09-22\",\"2024-09-22 18:00:00\")'\n",
" list1.append(s)\n",
"ss = ','.join(list1)\n",
"print(ss)\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {