20211018
This commit is contained in:
1 parent
7799058124
commit
3585e7e9c8
2 files changed
+180
-116
No files matched your search
@@ -0,0 +1 @@
|
||||
{"00005": {"date": "2021-09-15", "台阶指数": {"成绩": "65.0 分", "得分": 4}, "身高": {"成绩": "174.7 厘米", "得分": null}, "体重": {"成绩": "73.6 千克", "得分": 5}, "肺活量": {"成绩": "3812.0 毫升", "得分": 4}, "握力": {"成绩": "51.0 千克", "得分": 4}, "单脚站立": {"成绩": "13.2 秒", "得分": 3}, "坐位体前屈": {"成绩": "20.0 厘米", "得分": 5}, "选择反应时": {"成绩": "0.554 秒", "得分": 3}, "俯卧撑": {"成绩": "39.0 次", "得分": 5}, "纵跳": {"成绩": "38.4 厘米", "得分": 4}}, "00007": {"date": "2021-09-15", "身高": {"成绩": "172.5 厘米", "得分": null}, "体重": {"成绩": "71.5 千克", "得分": 5}, "肺活量": {"成绩": "3219.0 毫升", "得分": 4}, "握力": {"成绩": "36.5 千克", "得分": 2}, "坐位体前屈": {"成绩": "-13.8 厘米", "得分": 0}, "选择反应时": {"成绩": "0.506 秒", "得分": 4}, "纵跳": {"成绩": "26.3 厘米", "得分": 2}, "台阶指数": {"成绩": "46.0 分", "得分": 2}, "俯卧撑": {"成绩": "11.0 次", "得分": 2}, "单脚站立": {"成绩": "37.2 秒", "得分": 5}}, "00009": {"date": "2021-09-15", "身高": {"成绩": "162.0 厘米", "得分": null}, "体重": {"成绩": "53.2 千克", "得分": 3}, "坐位体前屈": {"成绩": "15.4 厘米", "得分": 4}, "握力": {"成绩": "21.0 千克", "得分": 1}, "肺活量": {"成绩": "2194.0 毫升", "得分": 3}, "纵跳": {"成绩": "18.0 厘米", "得分": 3}, "一分钟仰卧起坐": {"成绩": "21.0 次", "得分": 4}, "选择反应时": {"成绩": "0.447 秒", "得分": 4}, "台阶指数": {"成绩": "58.0 分", "得分": 3}, "单脚站立": {"成绩": "5.1 秒", "得分": 2}}, "00011": {"date": "2021-09-15", "身高": {"成绩": "166.6 厘米", "得分": null}, "体重": {"成绩": "73.6 千克", "得分": 5}, "肺活量": {"成绩": "3089.0 毫升", "得分": 3}, "单脚站立": {"成绩": "37.8 秒", "得分": 4}, "选择反应时": {"成绩": "0.411 秒", "得分": 5}, "坐位体前屈": {"成绩": "14.9 厘米", "得分": 5}, "握力": {"成绩": "38.0 千克", "得分": 2}}, "00013": {"date": "2021-09-29", "身高": {"成绩": "175.6 厘米", "得分": null}, "体重": {"成绩": "56.3 千克", "得分": 3}, "肺活量": {"成绩": "3603.0 毫升", "得分": 3}, "握力": {"成绩": "39.1 千克", "得分": 2}, "选择反应时": {"成绩": "0.458 秒", "得分": 4}, "纵跳": {"成绩": "38.4 厘米", "得分": 4}, "台阶指数": {"成绩": "51.0 分", "得分": 2}, "坐位体前屈": {"成绩": "16.3 厘米", "得分": 4}, "俯卧撑": {"成绩": "16.0 次", "得分": 3}}, "00014": {"date": "2021-09-16", "身高": {"成绩": "164.4 厘米", "得分": null}, "体重": {"成绩": "58.7 千克", "得分": 5}, "肺活量": {"成绩": "2678.0 毫升", "得分": 4}, "握力": {"成绩": "18.3 千克", "得分": 1}, "单脚站立": {"成绩": "3.0 秒", "得分": 2}, "坐位体前屈": {"成绩": "10.6 厘米", "得分": 3}, "选择反应时": {"成绩": "0.664 秒", "得分": 2}, "纵跳": {"成绩": "18.0 厘米", "得分": 3}, "一分钟仰卧起坐": {"成绩": "10.0 次", "得分": 3}, "台阶指数": {"成绩": "60.0 分", "得分": 3}}, "00015": {"date": "2021-09-15", "身高": {"成绩": "173.1 厘米", "得分": null}, "体重": {"成绩": "62.5 千克", "得分": 5}, "单脚站立": {"成绩": "13.3 秒", "得分": 3}, "握力": {"成绩": "41.3 千克", "得分": 2}, "肺活量": {"成绩": "4788.0 毫升", "得分": 5}, "坐位体前屈": {"成绩": "2.9 厘米", "得分": 2}, "俯卧撑": {"成绩": "15.0 次", "得分": 2}, "纵跳": {"成绩": "22.8 厘米", "得分": 2}, "选择反应时": {"成绩": "0.547 秒", "得分": 2}, "台阶指数": {"成绩": "47.0 分", "得分": 2}}, "00016": {"date": "2021-09-16", "身高": {"成绩": "157.4 厘米", "得分": null}, "体重": {"成绩": "59.5 千克", "得分": 5}, "肺活量": {"成绩": "1579.0 毫升", "得分": 2}, "握力": {"成绩": "21.6 千克", "得分": 2}, "单脚站立": {"成绩": "8.3 秒", "得分": 3}, "坐位体前屈": {"成绩": "18.7 厘米", "得分": 5}, "选择反应时": {"成绩": "0.682 秒", "得分": 2}, "纵跳": {"成绩": "15.1 厘米", "得分": 2}, "一分钟仰卧起坐": {"成绩": "10.0 次", "得分": 3}, "台阶指数": {"成绩": "55.0 分", "得分": 3}}, "00017": {"date": "2021-09-15", "肺活量": {"成绩": "1797.0 毫升", "得分": 2}, "身高": {"成绩": "152.0 厘米", "得分": null}, "体重": {"成绩": "61.3 千克", "得分": 5}, "单脚站立": {"成绩": "15.5 秒", "得分": 3}, "坐位体前屈": {"成绩": "-6.9 厘米", "得分": 0}, "选择反应时": {"成绩": "0.517 秒", "得分": 4}, "纵跳": {"成绩": "15.1 厘米", "得分": 2}, "一分钟仰卧起坐": {"成绩": "9.0 次", "得分": 3}, "握力": {"成绩": "20.7 千克", "得分": 1}, "台阶指数": {"成绩": "53.0 分", "得分": 2}}, "00018": {"date": "2021-09-15", "身高": {"成绩": "157.7 厘米", "得分": null}Line truncated
|
||||
+179
-116
@@ -69,12 +69,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 77,
|
||||
"id": "91a8f4f4-c417-4db7-94ba-2d3404e5c2c9",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-18T02:34:07.188682Z",
|
||||
"iopub.status.busy": "2021-10-18T02:34:07.187761Z",
|
||||
"iopub.status.idle": "2021-10-18T02:34:07.230533Z",
|
||||
"shell.execute_reply": "2021-10-18T02:34:07.227725Z",
|
||||
"shell.execute_reply.started": "2021-10-18T02:34:07.188577Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pymongo\n",
|
||||
"from bson.objectid import ObjectId\n",
|
||||
@@ -109,32 +124,17 @@
|
||||
"id": "0c144068-4f2d-4901-bd28-725ecb260fd4",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入单位员工信息"
|
||||
"## 导出单位员工信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "d80c482d-aee2-45cf-8ac8-c357171f17f7",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-14T02:37:23.916203Z",
|
||||
"iopub.status.busy": "2021-10-14T02:37:23.915266Z",
|
||||
"iopub.status.idle": "2021-10-14T02:37:27.064162Z",
|
||||
"shell.execute_reply": "2021-10-14T02:37:27.062406Z",
|
||||
"shell.execute_reply.started": "2021-10-14T02:37:23.916098Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -169,17 +169,25 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "54d4790d-973f-4ee6-abff-3d5ff962de23",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 获取测试人员名单导入数据库"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "adf13de2-8205-4511-a655-75989440967e",
|
||||
"execution_count": 79,
|
||||
"id": "82e1b982-3c88-4f01-ad94-49177c4a46f6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-14T02:37:55.876237Z",
|
||||
"iopub.status.busy": "2021-10-14T02:37:55.875300Z",
|
||||
"iopub.status.idle": "2021-10-14T02:37:55.956149Z",
|
||||
"shell.execute_reply": "2021-10-14T02:37:55.953871Z",
|
||||
"shell.execute_reply.started": "2021-10-14T02:37:55.876131Z"
|
||||
"iopub.execute_input": "2021-10-18T02:36:32.491973Z",
|
||||
"iopub.status.busy": "2021-10-18T02:36:32.491036Z",
|
||||
"iopub.status.idle": "2021-10-18T02:36:34.395918Z",
|
||||
"shell.execute_reply": "2021-10-18T02:36:34.393177Z",
|
||||
"shell.execute_reply.started": "2021-10-18T02:36:32.491866Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -188,18 +196,121 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'00001': {'name': '汪东球', 'sex': '男', 'unit': '办公室', 'id_num': '340803196511112679'}, '00002': {'name': '华传伦', 'sex': '男', 'unit': '办公室', 'id_num': '340803196409212673'}, '00003': {'name': '徐乐', 'sex': '男', 'unit': '办公室', 'id_num': '340803198007292235'}, '00004': {'name': '汪向东', 'sex': '男', 'unit': '办公室', 'id_num': '620104196907150538'}, '00005': {'name': '包永', 'sex': '男', 'unit': '办公室', 'id_num': '370102197706143753'}, '00006': {'name': '黄晓华', 'sex': '男', 'unit': '办公室', 'id_num': '340803196310022693'}, '00007': {'name': '刘晓华', 'sex': '男', 'unit': '办公室', 'id_num': '340803196509112776'}, '00008': {'name': '成雷', 'sex': '男', 'unit': '办公室', 'id_num': '340803196303062697'}, '00009': {'name': '周琼', 'sex': '女', 'unit': '办公室', 'id_num': '340202197301150023'}, '00010': {'name': '张业金', 'sex': '男', 'unit': '办公室', 'id_num': '110105196501045451'}, '00011': {'name': '宫超', 'sex': '男', 'unit': '办公室', 'id_num': '340803196908042672'}, '00012': {'name': '周小龙', 'sex': '男', 'unit': '办公室', 'id_num': '362202197505135015'}, '00013': {'name': '关广磊', 'sex': '男', 'unit': '办公室', 'id_num': '340421198808294813'}, '00014': {'name': '何健健', 'sex': '女', 'unit': '办公室', 'id_num': '340803196708042766'}, '00015': {'name': '李险峰', 'sex': '男', 'unit': '办公室', 'id_num': '342401199003138515'}, '00016': {'name': '佘才慧', 'sex': '女', 'unit': '办公室', 'id_num': '340803197207062667'}, '00017': {'name': '张莉', 'sex': '女', 'unit': '办公室', 'id_num': '340803197305242223'}, '00018': {'name': '高智红', 'sex': '女', 'unit': '办公室', 'id_num': '340803197401012700'}, '00019': {'name': '吴伟', 'sex': '男', 'unit': '办公室', 'id_num': '340803197710252775'}, '00020': {'name': '夏锐', 'sex': '男', 'unit': '办公室', 'id_num': '340803196511022673'}, '00021': {'name': '刘军', 'sex': '男', 'unit': '办公室', 'id_num': '340802196710300019'}, '00022': {'name': '刘丹', 'sex': '女', 'unit': '办公室', 'id_num': '340822198810202648'}, '00023': {'name': '夏来福', 'sex': '男', 'unit': '办公室', 'id_num': '340803197206022970'}, '00024': {'name': '陈倞', 'sex': '男', 'unit': '办公室', 'id_num': '340803197206082316'}, '00025': {'name': '谢琼', 'sex': '女', 'unit': '办公室', 'id_num': '340803196803122668'}, '00026': {'name': '周继红', 'sex': '女', 'unit': '办公室', 'id_num': '340823196706010029'}, '00027': {'name': '潘涛', 'sex': '男', 'unit': '办公室', 'id_num': '340803196812312033'}, '00028': {'name': '张胜利', 'sex': '男', 'unit': '办公室', 'id_num': '340803196909162676'}, '00029': {'name': '单军', 'sex': '男', 'unit': '办公室', 'id_num': '340803196404152413'}, '00030': {'name': '陈刚', 'sex': '男', 'unit': '办公室', 'id_num': '340803196712292776'}, '00031': {'name': '王斌', 'sex': '男', 'unit': '办公室', 'id_num': '340802196802070230'}, '00032': {'name': '王宇', 'sex': '男', 'unit': '办公室', 'id_num': '340803196501272679'}, '00033': {'name': '王剑', 'sex': '男', 'unit': '办公室', 'id_num': '34080219650403061X'}, '00034': {'name': '王官成', 'sex': '男', 'unit': '办公室', 'id_num': '340803196207032770'}, '00035': {'name': '杨健', 'sex': '男', 'unit': '办公室', 'id_num': '340803196901022417'}, '00036': {'name': '姚振辉', 'sex': '男', 'unit': '办公室', 'id_num': '340803196306032434'}, '00037': {'name': '邹丹军', 'sex': '男', 'unit': '办公室', 'id_num': '340803196901302670'}, '00038': {'name': '赵军', 'sex': '男', 'unit': '办公室', 'id_num': '340803196708032517'}, '00039': {'name': '江启任', 'sex': '男', 'unit': '办公室', 'id_num': '34080319630419267X'}, '00040': {'name': '陈宏伟', 'sex': '男', 'unit': '办公室', 'id_num': '340803196306292674'}, '00041': {'name': '汪斌', 'sex': '男', 'unit': '办公室', 'id_num': '340803196904242677'}, '00042': {'name': '朱金才', 'sex': '男', 'unit': '办公室', 'id_num': '340803196508072792'}, '00043': {'name': '汪涛', 'sex': '男', 'unit': '办公室', 'id_num': '340803196411062678'}, '00044': {'name': '孙小宁', 'sex': '男', 'unit': '办公室', 'id_num': '340802196408150419'}, '00045': {'name': '武飞', 'sex': '男', 'unit': '办公室', 'id_num': '340803196308122679'}, '00046': {'name': '刘波', 'sex': '男', 'unit': '办公室', 'id_num': '340803196604252873'}, '00047': {'name': '张文生', 'sex': '男', 'unit': '办公室', 'id_num': '340803196812252691'}, '00048': {'name': '潘刚', 'sex': '男', 'unit': '办公室', 'id_num': '340802196209170636'}, '00049': {'name': '赵晓春', 'sex': '男', 'unit': '办公室', 'id_num': '340803196404122214'}, '00050': {'name': '王自昆', 'sex': '男', 'unit': '办公室', 'id_num': '340803196503262677'}, '00051': {'name': '杨雷', 'sex': '男', 'unit': '办公室', 'id_num': '340803197007122696'}, '00052': {'name': 'Line truncated
|
||||
"<pymongo.results.InsertManyResult object at 0x7f6f28531ec0>\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pymongo\n",
|
||||
"from bson.objectid import ObjectId\n",
|
||||
"\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"tice\"]\n",
|
||||
"mycol = mydb[\"person\"]\n",
|
||||
"\n",
|
||||
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
|
||||
"cursor = db.cursor()\n",
|
||||
"\n",
|
||||
"place_id = 120\n",
|
||||
"exam_person = []\n",
|
||||
"sql = f'SELECT distinct a.avatar_id FROM places_result AS a WHERE a.place_id={place_id} and a.avatar_id < 4999 ORDER BY a.avatar_id '\n",
|
||||
"cursor.execute(sql)\n",
|
||||
"results = cursor.fetchall()\n",
|
||||
"cursor.close\n",
|
||||
"for result in results:\n",
|
||||
" exam_person.append(str(result[0]).rjust(5,'0'))\n",
|
||||
"\n",
|
||||
"filename = '安庆炼化人员名单.json'\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"list2 = []\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" list1 = json.load(fl) \n",
|
||||
"print(list1)"
|
||||
" all_person = json.load(fl)\n",
|
||||
"with open('result.json','r') as fl1:\n",
|
||||
" res = json.load(fl1)\n",
|
||||
"for k,v in all_person.items():\n",
|
||||
" if k in exam_person:\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",
|
||||
" dict3['code'] = 120\n",
|
||||
" dict3['sn'] = k\n",
|
||||
" dict3['result'] = res[k]\n",
|
||||
" dict2['exam'].append(dict3)\n",
|
||||
"\n",
|
||||
" list1.append(dict2)\n",
|
||||
"x = mycol.insert_many(list1)\n",
|
||||
"mycol1 = mydb[\"event\"]\n",
|
||||
"myquery = {'code':120}\n",
|
||||
"mycol1.update_one(myquery,{'$push':{'persons':x.inserted_ids}})\n",
|
||||
"print('ok!')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "95ad1920-1393-4830-a48a-540070b51a09",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 测试项目添加测试人员名单"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "adf13de2-8205-4511-a655-75989440967e",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from bson.objectid import ObjectId\n",
|
||||
"import pymongo\n",
|
||||
"import pymysql\n",
|
||||
"\n",
|
||||
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
|
||||
"cursor = db.cursor()\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"sql = f'SELECT distinct a.avatar_id FROM places_result AS a WHERE a.place_id={place_id} and a.avatar_id < 4999 ORDER BY a.avatar_id '\n",
|
||||
"cursor.execute(sql)\n",
|
||||
"results = cursor.fetchall()\n",
|
||||
"cursor.close\n",
|
||||
"for result in results:\n",
|
||||
" list1.append(str(result[0]).rjust(5,'0'))\n",
|
||||
"\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"tice\"]\n",
|
||||
"mycol = mydb[\"event\"]\n",
|
||||
"myquery = {'code':120}\n",
|
||||
"mycol.update_one(myquery,{'$push':{'persons':list1}})\n",
|
||||
" \n",
|
||||
"print('ok')\n",
|
||||
" \n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "44149ba0-1730-43d4-b07f-82a53dca4ce4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2bb3cbdd-9fe1-4345-8c5a-53acb1a386de",
|
||||
@@ -210,15 +321,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 75,
|
||||
"id": "910c3fcd-121a-42c0-9465-ad79a5829239",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-13T07:09:10.932437Z",
|
||||
"iopub.status.busy": "2021-10-13T07:09:10.931304Z",
|
||||
"iopub.status.idle": "2021-10-13T07:09:11.647770Z",
|
||||
"shell.execute_reply": "2021-10-13T07:09:11.644666Z",
|
||||
"shell.execute_reply.started": "2021-10-13T07:09:10.932172Z"
|
||||
"iopub.execute_input": "2021-10-18T02:29:20.586805Z",
|
||||
"iopub.status.busy": "2021-10-18T02:29:20.585860Z",
|
||||
"iopub.status.idle": "2021-10-18T02:29:24.051120Z",
|
||||
"shell.execute_reply": "2021-10-18T02:29:24.049117Z",
|
||||
"shell.execute_reply.started": "2021-10-18T02:29:20.586699Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -229,13 +340,15 @@
|
||||
"text": [
|
||||
"\n",
|
||||
"运动项目信息:\n",
|
||||
"{'包永': {'台阶指数': {'成绩': '65.0 分', '得分': 4, 'date': datetime.date(2021, 9, 15)}, '身高': {'成绩': '174.7 厘米', '得分': None, 'date': datetime.date(2021, 9, 15)}, '体重': {'成绩': '73.6 千克', '得分': 5, 'date': datetime.date(2021, 9, 15)}, '肺活量': {'成绩': '3812.0 毫升', '得分': 4, 'date': datetime.date(2021, 9, 15)}, '握力': {'成绩': '51.0 千克', '得分': 4, 'date': datetime.date(2021, 9, 15)}, '单脚站立': {'成绩': '13.2 秒', '得分': 3, 'date': datetime.date(2021, 9, 15)}, '坐位体前屈': {'成绩': '20.0 厘米', '得分': 5, 'date': datetime.date(2021, 9, 15)}, '选择反应时': {'成绩': '0.554 秒', '得分': 3, 'date': datetime.date(2021, 9, 15)}, '俯卧撑': {'成绩': '39.0 次', '得分': 5, 'date': datetime.date(2021, 9, 15)}, '纵跳': {'成绩': '38.4 厘米', '得分': 4, 'date': datetime.date(2021, 9, 15)}}}\n"
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pymysql\n",
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
"\n",
|
||||
"filename = 'item.json'\n",
|
||||
"item = {}\n",
|
||||
"unit = {}\n",
|
||||
@@ -245,26 +358,38 @@
|
||||
" item[k] = v\n",
|
||||
"user_id = 5\n",
|
||||
"place_id =120\n",
|
||||
"user = '包永'\n",
|
||||
"#user = '包永'\n",
|
||||
"db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"ydyb\" )\n",
|
||||
"cursor = db.cursor()\n",
|
||||
"sql = f'SELECT a.item_id,a.performance,a.score,a.date FROM places_result AS a WHERE a.place_id={place_id} AND a.avatar_id={user_id}'\n",
|
||||
"\n",
|
||||
"sql = f'SELECT a.item_id,a.performance,a.score,DATE_FORMAT(a.date,\"%Y-%m-%d\") as date1,a.avatar_id FROM places_result AS a WHERE a.place_id={place_id} AND a.avatar_id < 4999 ORDER BY a.avatar_id,date1'\n",
|
||||
"cursor.execute(sql)\n",
|
||||
"re_ta = {}\n",
|
||||
"dict1 = {}\n",
|
||||
"print(\"\\n运动项目信息:\")\n",
|
||||
"results = cursor.fetchall()\n",
|
||||
"for result in results:\n",
|
||||
" re_ta.setdefault(user,{})\n",
|
||||
"for result in results: \n",
|
||||
" user = str(result[4]).rjust(5,'0')\n",
|
||||
" m_item = str(result[0])\n",
|
||||
" dict1.setdefault(item[m_item]['name'],{})\n",
|
||||
" \n",
|
||||
" re_ta.setdefault(user,{})\n",
|
||||
" re_ta[user]['date'] =result[3]\n",
|
||||
" item_name = item[m_item]['name']\n",
|
||||
" re_ta[user].setdefault(item_name,{})\n",
|
||||
" \n",
|
||||
" #dict1.setdefault(item[m_item]['name'],{})\n",
|
||||
" score = result[1]/item[m_item]['divisor']\n",
|
||||
" dict1[item[m_item]['name']]['成绩'] =f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
" dict1[item[m_item]['name']]['得分'] =result[2]\n",
|
||||
" dict1[item[m_item]['name']]['date'] =result[3]\n",
|
||||
" re_ta[user] = dict1\n",
|
||||
"\n",
|
||||
"print(re_ta)\n"
|
||||
" #dict1[item[m_item]['name']]['成绩'] =f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
" #dict1[item[m_item]['name']]['得分'] =result[2]\n",
|
||||
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
" re_ta[user][item_name]['得分'] =result[2]\n",
|
||||
" \n",
|
||||
" #re_ta[user] = dict1\n",
|
||||
" #print(re_ta)\n",
|
||||
"filename = 'result.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl,ensure_ascii=False) \n",
|
||||
"print('ok')\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -363,60 +488,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 91,
|
||||
"execution_count": null,
|
||||
"id": "6531259c-9727-44f7-9ec3-d6dbe9b76987",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-12T14:49:29.798699Z",
|
||||
"iopub.status.busy": "2021-10-12T14:49:29.797765Z",
|
||||
"iopub.status.idle": "2021-10-12T14:49:29.861989Z",
|
||||
"shell.execute_reply": "2021-10-12T14:49:29.859902Z",
|
||||
"shell.execute_reply.started": "2021-10-12T14:49:29.798590Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1 {'name': '肺活量', 'unit': '毫升', 'divisor': 1}\n",
|
||||
"2 {'name': '握力', 'unit': '千克', 'divisor': 1000}\n",
|
||||
"3 {'name': '坐位体前屈', 'unit': '厘米', 'divisor': 10}\n",
|
||||
"4 {'name': '纵跳', 'unit': '厘米', 'divisor': 10}\n",
|
||||
"5 {'name': '俯卧撑', 'unit': '次', 'divisor': 1}\n",
|
||||
"6 {'name': '单脚站立', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"7 {'name': '选择反应时', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"8 {'name': '台阶指数', 'unit': '分', 'divisor': 10}\n",
|
||||
"9 {'name': '一分钟仰卧起坐', 'unit': '次', 'divisor': 1}\n",
|
||||
"10 {'name': '身高', 'unit': '厘米', 'divisor': 10}\n",
|
||||
"11 {'name': '体重', 'unit': '千克', 'divisor': 1000}\n",
|
||||
"12 {'name': '立定跳远', 'unit': '厘米', 'divisor': 10}\n",
|
||||
"13 {'name': '网球掷远', 'unit': '米', 'divisor': 1000}\n",
|
||||
"14 {'name': '双脚连续跳', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"15 {'name': '10米折返跑', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"16 {'name': '走平衡木', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"17 {'name': '50米跑', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"18 {'name': '一分钟跳绳', 'unit': '次', 'divisor': 1}\n",
|
||||
"19 {'name': '50米*8往返跑', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"20 {'name': '高压', 'unit': 'mmHg', 'divisor': 1}\n",
|
||||
"21 {'name': '低压', 'unit': 'mmHg', 'divisor': 1}\n",
|
||||
"22 {'name': '心率', 'unit': '次', 'divisor': 1}\n",
|
||||
"23 {'name': '长跑', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"24 {'name': '引体向上', 'unit': '次', 'divisor': 1}\n",
|
||||
"27 {'name': '实心球', 'unit': '米', 'divisor': 1000}\n",
|
||||
"28 {'name': '篮球运球', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"29 {'name': '足球运球', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"30 {'name': '足球垫球', 'unit': '次', 'divisor': 1}\n",
|
||||
"31 {'name': '排球垫球', 'unit': '次', 'divisor': 1}\n",
|
||||
"32 {'name': '25米×2往返跑', 'unit': '秒', 'divisor': 1000}\n",
|
||||
"33 {'name': '左右眼视力', 'unit': '分', 'divisor': 10}\n",
|
||||
"34 {'name': '测试', 'unit': '毫升', 'divisor': 1}\n",
|
||||
"37 {'name': '跪卧撑', 'unit': '次', 'divisor': 1}\n",
|
||||
"38 {'name': '功率车', 'unit': '毫升/千克/分钟', 'divisor': 10}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pymysql\n",
|
||||
"import json\n",
|
||||
@@ -448,27 +525,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"execution_count": null,
|
||||
"id": "9af74d66-b410-4fbf-afcd-9884174e6841",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2021-10-12T14:35:04.928544Z",
|
||||
"iopub.status.busy": "2021-10-12T14:35:04.927553Z",
|
||||
"iopub.status.idle": "2021-10-12T14:35:04.945489Z",
|
||||
"shell.execute_reply": "2021-10-12T14:35:04.943664Z",
|
||||
"shell.execute_reply.started": "2021-10-12T14:35:04.928432Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'name': '肺活量', 'unit': '毫升', 'divisor': 1, 'info': '肺活量(vital capacity)是指在最大吸气后尽力呼气的气量。包括潮气量、补吸气量和补呼气量三部分。潮气量是指一次呼吸周期中肺吸量或呼出的气量,在潮气量之外再吸入的最大气量为补吸气量,在潮气量之外再呼出的最最大量为补呼气量,最大呼气后残留在肺内的气量为余气量。\\r\\n肺活量与人的呼吸密切相关。生理学研究表明:人体的各器官、系统、组织、细胞每时每刻都在消耗氧,机体只有在氧供应充足的情况下才能正常工作。人体内部的氧供给全部靠肺的呼吸来获得,在呼吸过程中,肺不仅要摄入氧气,还要将体内代谢出的二氧化碳排出。\\r\\n可以这样认为:肺是机体气体交换的中转站,这个中转站的容积大小直接决定着每次呼吸气体交换的量,这是检测肺功能的最直观、也是最客观的指标。'}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"filename = 'item.json'\n",
|
||||
@@ -506,7 +568,8 @@
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"toc-showtags": false
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
|
||||
Reference in new issue
Block a user