This commit is contained in:
512song committed 2024-07-13 08:32:59 +08:00
1 parent daceb1e68d
commit 527c1710aa
5 files changed
+830 -776

No files matched your search

+184 -33
View File
@@ -10,9 +10,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 50,
"id": "360f0a97-d73d-43f3-9f7a-0f9582103c82", "id": "360f0a97-d73d-43f3-9f7a-0f9582103c82",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:10:05.405006Z",
"iopub.status.busy": "2024-07-12T02:10:05.404238Z",
"iopub.status.idle": "2024-07-12T02:10:05.421154Z",
"shell.execute_reply": "2024-07-12T02:10:05.420149Z",
"shell.execute_reply.started": "2024-07-12T02:10:05.404936Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -23,16 +30,16 @@
"mydb = myclient[\"baogao\"]\n", "mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"place\"]\n", "mycol = mydb[\"place\"]\n",
"\n", "\n",
"place_id = 727410\n", "place_id = 496534\n",
"place_code = \"08\"\n", "place_code = \"12\"\n",
"dw_name = \"北体体质康健实验班\"\n", "dw_name = \"天宫院社区\"\n",
"dw_jc = \"北体体质康健实验班\"\n", "dw_jc = \"天宫院社区\"\n",
"myquery = { \"id\": place_id }\n", "myquery = { \"id\": place_id }\n",
"num = mycol.count_documents(myquery)\n", "num = mycol.count_documents(myquery)\n",
"if num>0:\n", "if num>0:\n",
" print(num)\n", " print(num)\n",
"else:\n", "else:\n",
" mydict = { \"id\":place_id,\"dw_name\": name, \"code\": place_code }\n", " mydict = { \"id\":place_id,\"name\": dw_name, \"code\": place_code }\n",
" x = mycol.insert_one(mydict) " " x = mycol.insert_one(mydict) "
] ]
}, },
@@ -46,10 +53,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 52,
"id": "6ce2cbc7-435a-461c-bdb8-abd9a6962fbc", "id": "6ce2cbc7-435a-461c-bdb8-abd9a6962fbc",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2024-07-12T02:14:38.695650Z",
"iopub.status.busy": "2024-07-12T02:14:38.694885Z",
"iopub.status.idle": "2024-07-12T02:14:38.722206Z",
"shell.execute_reply": "2024-07-12T02:14:38.721109Z",
"shell.execute_reply.started": "2024-07-12T02:14:38.695579Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import os,sys,shutil\n", "import os,sys,shutil\n",
@@ -63,10 +86,10 @@
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"baogao\"]\n", "mydb = myclient[\"baogao\"]\n",
"\n", "\n",
"place_id = 727410\n", "place_id = 496534\n",
"place_code = \"08\"\n", "place_code = \"12\"\n",
"dw_name = \"北体体质康健实验班\"\n", "dw_name = \"天宫院社区\"\n",
"dw_jc = \"北体体质康健实验班\"\n", "dw_jc = \"天宫院社区\"\n",
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n", "fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n",
"fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n", "fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n",
"\n", "\n",
@@ -154,12 +177,48 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 55,
"id": "5f665c0f-8d30-4759-b7f8-fb7e13b98efa", "id": "5f665c0f-8d30-4759-b7f8-fb7e13b98efa",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:22:32.688999Z",
"iopub.status.busy": "2024-07-12T02:22:32.688234Z",
"iopub.status.idle": "2024-07-12T02:22:32.714379Z",
"shell.execute_reply": "2024-07-12T02:22:32.713270Z",
"shell.execute_reply.started": "2024-07-12T02:22:32.688928Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"118 no phone\n",
"1 17692029838 0131-陈女士.pdf\n",
"2 13126853113 0130-徐女士.pdf\n",
"3 18612722507 0025-孟女士.pdf\n",
"4 18210976084 0078-朱女士.pdf\n",
"5 13521767089 0039-韩先生.pdf\n",
"6 15829199503 0128-张女士.pdf\n",
"7 13552463605 0041-朱女士.pdf\n",
"8 13381478769 0132-梁先生.pdf\n",
"9 18618393655 0094-谢先生.pdf\n",
"10 13717668119 0093-李女士.pdf\n",
"11 13366130427 0044-星先生.pdf\n",
"12 15532789326 0102-王先生.pdf\n",
"13 18141916681 0126-马女士.pdf\n",
"14 13261687266 0129-薛女士.pdf\n",
"15 13019252687 0037-张女士.pdf\n",
"16 13522476263 0007-李女士.pdf\n",
"17 13681204538 0038-路女士.pdf\n",
"18 13611211739 0124-苗女士.pdf\n",
"19 13716042706 0096-薛女士.pdf\n",
"20 13716323886 0040-杨女士.pdf\n",
"21 13464928996 0083-张先生.pdf\n"
]
}
],
"source": [ "source": [
"from tencentcloud.common import credential\n", "from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -173,13 +232,13 @@
"mydb = myclient[\"baogao\"]\n", "mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n", "mycol = mydb[\"pdf\"]\n",
"\n", "\n",
"dw_jc = \"北体体质康健实验班\"\n", "dw_jc = \"天宫院社区测试者\"\n",
"filename = 'data/东营老年大学.json'\n", "filename = 'data/天宫院街道2024.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",
"#place_id = 571315\n", "#place_id = 571315\n",
"myquery = { \"place_id\": place_id,'rq':'20240622' }\n", "myquery = { \"place_id\": place_id }\n",
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n", "for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
" code = int(x['fn'].split('-')[0])\n", " code = int(x['fn'].split('-')[0])\n",
" if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n", " if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n",
@@ -234,12 +293,48 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 56,
"id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3", "id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:23:52.611111Z",
"iopub.status.busy": "2024-07-12T02:23:52.610366Z",
"iopub.status.idle": "2024-07-12T02:23:57.139855Z",
"shell.execute_reply": "2024-07-12T02:23:57.138449Z",
"shell.execute_reply.started": "2024-07-12T02:23:52.611041Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"no phone\n",
"17692029838 send success\n",
"13126853113 send success\n",
"18612722507 send success\n",
"18210976084 send success\n",
"13521767089 send success\n",
"15829199503 send success\n",
"13552463605 send success\n",
"13381478769 send success\n",
"18618393655 send success\n",
"13717668119 send success\n",
"13366130427 send success\n",
"15532789326 send success\n",
"18141916681 send success\n",
"13261687266 send success\n",
"13019252687 send success\n",
"13522476263 send success\n",
"13681204538 send success\n",
"13611211739 send success\n",
"13716042706 send success\n",
"13716323886 send success\n",
"13464928996 send success\n"
]
}
],
"source": [ "source": [
"from tencentcloud.common import credential\n", "from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -253,12 +348,12 @@
"mydb = myclient[\"baogao\"]\n", "mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n", "mycol = mydb[\"pdf\"]\n",
"\n", "\n",
"filename = 'data/东营老年大学.json'\n", "filename = 'data/天宫院街道2024.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",
"#place_id = 571315\n", "#place_id = 571315\n",
"myquery = { \"place_id\": place_id,'rq':'20240622' }\n", "myquery = { \"place_id\": place_id }\n",
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n", "for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
" code = int(x['fn'].split('-')[0])\n", " code = int(x['fn'].split('-')[0])\n",
" if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n", " if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n",
@@ -266,7 +361,7 @@
" else:\n", " else:\n",
" print('no phone')\n", " print('no phone')\n",
"#print(dict2)\n", "#print(dict2)\n",
"dw_jc = \"北体体质康健实验班\"\n", "dw_jc = \"天宫院社区测试者\"\n",
"#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n", "#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n",
"for k, v in dict2.items():\n", "for k, v in dict2.items():\n",
" phone = '+86'+v['phone']\n", " phone = '+86'+v['phone']\n",
@@ -322,12 +417,28 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 54,
"id": "25a269c3-758f-4e79-ae6d-a6e6f161d64b", "id": "25a269c3-758f-4e79-ae6d-a6e6f161d64b",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:20:13.833627Z",
"iopub.status.busy": "2024-07-12T02:20:13.832897Z",
"iopub.status.idle": "2024-07-12T02:20:14.097306Z",
"shell.execute_reply": "2024-07-12T02:20:14.095871Z",
"shell.execute_reply.started": "2024-07-12T02:20:13.833565Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"no phone\n",
"+8613793180751 send success\n"
]
}
],
"source": [ "source": [
"from tencentcloud.common import credential\n", "from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -341,12 +452,12 @@
"mydb = myclient[\"baogao\"]\n", "mydb = myclient[\"baogao\"]\n",
"mycol = mydb[\"pdf\"]\n", "mycol = mydb[\"pdf\"]\n",
"\n", "\n",
"filename = 'data/东营老年大学.json'\n", "filename = 'data/天宫院街道2024.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",
"\n", "\n",
"myquery = { \"place_id\": place_id,'rq':'20240622' }\n", "myquery = { \"place_id\": place_id }\n",
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n", "for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
" code = int(x['fn'].split('-')[0])\n", " code = int(x['fn'].split('-')[0])\n",
" if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n", " if str(code) in dict1.keys() and 'phone' in dict1[str(code)].keys():\n",
@@ -354,10 +465,10 @@
" else:\n", " else:\n",
" print('no phone')\n", " print('no phone')\n",
"#print(dict2)\n", "#print(dict2)\n",
"dw_jc = \"北体体质康健实验班\"\n", "dw_jc = \"天宫院社区\"\n",
"\n", "\n",
"phone = '+86'+'13793180751'\n", "phone = '+86'+'13793180751'\n",
"yzm = '08507'\n", "yzm = '12164'\n",
"try: \n", "try: \n",
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n", " secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n", " secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
@@ -434,12 +545,34 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 57,
"id": "411e89ed-8bb2-478b-b180-52188f800adc", "id": "411e89ed-8bb2-478b-b180-52188f800adc",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:30:44.525202Z",
"iopub.status.busy": "2024-07-12T02:30:44.524449Z",
"iopub.status.idle": "2024-07-12T02:30:44.747772Z",
"shell.execute_reply": "2024-07-12T02:30:44.746311Z",
"shell.execute_reply.started": "2024-07-12T02:30:44.525114Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"SendStatusStatistics\": {\n",
" \"FeeCount\": 120,\n",
" \"RequestCount\": 120,\n",
" \"RequestSuccessCount\": 120\n",
" },\n",
" \"RequestId\": \"6324eb3d-4a13-46ff-b555-c4e815f89f1f\"\n",
"}\n"
]
}
],
"source": [ "source": [
"from tencentcloud.common import credential\n", "from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
@@ -500,12 +633,30 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 58,
"id": "50183bba-2f9d-4003-98a7-0ecda96670ef", "id": "50183bba-2f9d-4003-98a7-0ecda96670ef",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2024-07-12T02:30:54.613078Z",
"iopub.status.busy": "2024-07-12T02:30:54.612334Z",
"iopub.status.idle": "2024-07-12T02:30:54.837767Z",
"shell.execute_reply": "2024-07-12T02:30:54.836760Z",
"shell.execute_reply.started": "2024-07-12T02:30:54.613006Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"PullSmsSendStatusSet\": [],\n",
" \"RequestId\": \"55765a6f-95a1-4c79-b55b-3fd3521df119\"\n",
"}\n"
]
}
],
"source": [ "source": [
"from tencentcloud.common import credential\n", "from tencentcloud.common import credential\n",
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n", "from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
+30 -30
View File
@@ -431,15 +431,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 38,
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983", "id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2024-07-08T07:09:55.402103Z", "iopub.execute_input": "2024-07-11T02:15:15.011907Z",
"iopub.status.busy": "2024-07-08T07:09:55.401378Z", "iopub.status.busy": "2024-07-11T02:15:15.011411Z",
"iopub.status.idle": "2024-07-08T07:09:55.420303Z", "iopub.status.idle": "2024-07-11T02:15:15.033470Z",
"shell.execute_reply": "2024-07-08T07:09:55.419806Z", "shell.execute_reply": "2024-07-11T02:15:15.032441Z",
"shell.execute_reply.started": "2024-07-08T07:09:55.402036Z" "shell.execute_reply.started": "2024-07-11T02:15:15.011858Z"
}, },
"tags": [] "tags": []
}, },
@@ -448,8 +448,8 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"80\n", "47\n",
"80\n" "47\n"
] ]
} }
], ],
@@ -482,11 +482,11 @@
"re_ta = {}\n", "re_ta = {}\n",
"dict1 = {}\n", "dict1 = {}\n",
"list1 = []\n", "list1 = []\n",
"filename = 'data/湖南石化青年体质检测.json'\n", "filename = 'data/天宫院街道2024.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",
"filename = 'data/places_result_20240705.csv'\n", "filename = 'data/places_result_20240710.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",
@@ -508,7 +508,7 @@
" l_xm = ['weight','height','lung','grip','flexion','jump','pushup','balance','reaction','step']\n", " l_xm = ['weight','height','lung','grip','flexion','jump','pushup','balance','reaction','step']\n",
" else:\n", " else:\n",
" l_xm = ['weight','height','lung','grip','flexion','jump','balance','reaction','step','situp']\n", " l_xm = ['weight','height','lung','grip','flexion','jump','balance','reaction','step','situp']\n",
" re_ta[user]['unit'] = dict1[user]['unit']\n", " re_ta[user]['unit'] = ''#dict1[user]['unit']\n",
" #birth = date.fromisoformat(dict1[user]['birth'].replace('/','-'))\n", " #birth = date.fromisoformat(dict1[user]['birth'].replace('/','-'))\n",
" birth = date.fromisoformat(dict1[user]['birth'])\n", " birth = date.fromisoformat(dict1[user]['birth'])\n",
" #nian = int(birth[0].strip())\n", " #nian = int(birth[0].strip())\n",
@@ -527,7 +527,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n", " score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\n", "print(len(re_ta))\n",
"filename = 'data/result_湖南石化青年.json'\n", "filename = 'data/result_天宫院社区2024.json'\n",
"\n", "\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",
@@ -544,15 +544,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 40,
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917", "id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2024-07-08T07:10:41.383092Z", "iopub.execute_input": "2024-07-11T02:17:12.600627Z",
"iopub.status.busy": "2024-07-08T07:10:41.382308Z", "iopub.status.busy": "2024-07-11T02:17:12.599890Z",
"iopub.status.idle": "2024-07-08T07:10:41.404375Z", "iopub.status.idle": "2024-07-11T02:17:12.621489Z",
"shell.execute_reply": "2024-07-08T07:10:41.403415Z", "shell.execute_reply": "2024-07-11T02:17:12.621025Z",
"shell.execute_reply.started": "2024-07-08T07:10:41.383013Z" "shell.execute_reply.started": "2024-07-11T02:17:12.600557Z"
}, },
"tags": [] "tags": []
}, },
@@ -662,7 +662,7 @@
"\n", "\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','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_湖南石化青年.json'\n", "filename = 'data/result_天宫院社区2024.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",
"for k, v in dict2.items():\n", "for k, v in dict2.items():\n",
@@ -683,7 +683,7 @@
" dict2[k][item_en]['score'] = cal_score(data1)\n", " dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n", " #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n", "\n",
"filename = f'data/result_湖南石化青年.json'\n", "filename = f'data/result_天宫院街道1.json'\n",
"with open(filename,'w') as fl:\n", "with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n", " json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') " "print('ok!') "
@@ -846,15 +846,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 41,
"id": "b123ee6b-85d2-4660-b226-321832a6b796", "id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2024-07-08T09:19:02.767495Z", "iopub.execute_input": "2024-07-11T02:18:04.079962Z",
"iopub.status.busy": "2024-07-08T09:19:02.766758Z", "iopub.status.busy": "2024-07-11T02:18:04.079156Z",
"iopub.status.idle": "2024-07-08T09:19:45.858591Z", "iopub.status.idle": "2024-07-11T02:18:13.608066Z",
"shell.execute_reply": "2024-07-08T09:19:45.857695Z", "shell.execute_reply": "2024-07-11T02:18:13.606969Z",
"shell.execute_reply.started": "2024-07-08T09:19:02.767428Z" "shell.execute_reply.started": "2024-07-11T02:18:04.079886Z"
}, },
"tags": [] "tags": []
}, },
@@ -863,7 +863,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"80\n" "22\n"
] ]
} }
], ],
@@ -876,11 +876,11 @@
"headers = {\n", "headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n", " }\n",
"filename = 'data/result_湖南石化青年.json'\n", "filename = 'data/result_天宫院街道1.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",
"list1 = []\n", "list1 = []\n",
"file_path ='./湖南石化青年/'\n", "file_path ='./天宫院2024/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n", "i=0\n",
"list2 = []\n", "list2 = []\n",
@@ -890,7 +890,7 @@
" \n", " \n",
" id = str(k).rjust(4,\"0\")\n", " id = str(k).rjust(4,\"0\")\n",
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
" mydata['title'] = '湖南石化青年职工'\n", " mydata['title'] = '天宫院社区'\n",
" mydata['subtitle'] = v['unit']\n", " mydata['subtitle'] = v['unit']\n",
" mydata['id'] = id\n", " mydata['id'] = id\n",
" mydata['name'] = v['name']\n", " mydata['name'] = v['name']\n",
+287 -45
View File
@@ -21,12 +21,11 @@
"import json\n", "import json\n",
"\n", "\n",
"\n", "\n",
"wb = openpyxl.load_workbook('data/天宫院体测人员名单.xlsx')\n", "wb = openpyxl.load_workbook('data/天宫院街道2024.xlsx')\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"# sheets = wb.sheetnames\n", "# sheets = wb.sheetnames\n",
"person = {}\n", "person = {}\n",
"\n", "\n",
"\n",
"for n in range(2, sheet.max_row+1):\n", "for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n", " if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value)\n", " code = int(sheet.cell(n, 1).value)\n",
@@ -34,16 +33,62 @@
" dict1 = {}\n", " dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n", " dict1['name'] = sheet.cell(n, 2).value\n",
" \n", " \n",
" if sheet.cell(n,4).value is not None:\n", " \n",
" dict1['sex'] = sheet.cell(n,4).value\n", " dict1['sex'] = sheet.cell(n,3).value\n",
" else:\n", " birth = str(sheet.cell(n, 4).value).split()[0]\n",
" dict1['sex'] = ''\n", " dict1['birth'] = birth.replace('/','-')\n",
" dict1['birth'] = sheet.cell(n, 3).value\n", " \n",
" person[code] = dict1\n",
" if sheet.cell(n,5).value is not None:\n", " if sheet.cell(n,5).value is not None:\n",
" dict1['phone'] = sheet.cell(n,5).value\n", " dict1['phone'] = sheet.cell(n,5).value\n",
"\n", "\n",
" person[code] = dict1\n", " person[code] = dict1\n",
"filename = 'data/天宫院社区人员名单.json'\n", "filename = 'data/天宫院街道2024.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"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"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/天宫院街道.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" person[code] = dict1\n",
"filename = 'data/天宫院街道all.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')"
@@ -122,14 +167,14 @@
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
"for k,v in dict1.items():\n", "for k,v in dict1.items():\n",
" item[k] = v\n", " item[k] = v\n",
"filename = 'data/天宫院社区人员名单.json'\n", "re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/天宫院街道2024.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",
"re_ta = {}\n", "\n",
"dict2 = {}\n", "filename = 'data/places_result_20240710.csv'\n",
"list1 = []\n",
"#print(\"\\n运动项目信息:\")\n",
"filename = 'data/places_result_20230422.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",
@@ -140,23 +185,88 @@
"for result in list1:\n", "for result in list1:\n",
" user = str(result[2])\n", " user = str(result[2])\n",
" if user in dict1.keys(): \n", " if user in dict1.keys(): \n",
" \n",
" m_item = str(result[3]) \n", " m_item = str(result[3]) \n",
" re_ta.setdefault(user,{}) \n", " re_ta.setdefault(user,{}) \n",
" re_ta[user]['name'] = dict1[user]['name']\n", " re_ta[user]['name'] = dict1[user]['name']\n",
" if 'sex' in dict1[user].keys():\n",
" re_ta[user]['sex'] = dict1[user]['sex'] \n", " re_ta[user]['sex'] = dict1[user]['sex'] \n",
" else:\n",
" re_ta[user]['sex'] = ' '\n",
" item_name = item[m_item]['name']\n", " item_name = item[m_item]['name']\n",
" re_ta[user].setdefault(item_name,{}) \n", " re_ta[user].setdefault(item_name,{}) \n",
" score = int(result[4])/item[m_item]['divisor'] \n", " score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
" re_ta[user][item_name]['得分'] =result[2]\n", "print(len(re_ta))\n",
"filename = 'data/result_天宫院.json'\n", "filename = 'data/result_天宫院街道2024.json'\n",
"\n",
"with open(filename,'w') as fl:\n", "with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl) \n", " json.dump(re_ta, fl, ensure_ascii=False) \n",
"print('ok')" "print(len(re_ta))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"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"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"61\n",
"61\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"filename = '../item.json'\n",
"item = {}\n",
"unit = {}\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for k,v in dict1.items():\n",
" item[k] = v\n",
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/天宫院街道all.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20240710.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",
"for result in list1:\n",
" user = str(result[2])\n",
" if user in dict1.keys(): \n",
" m_item = str(result[3]) \n",
" re_ta.setdefault(user,{}) \n",
" re_ta[user]['name'] = dict1[user]['name']\n",
" item_name = item[m_item]['name']\n",
" re_ta[user].setdefault(item_name,{}) \n",
" 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",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
] ]
}, },
{ {
@@ -169,23 +279,49 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 10,
"id": "c2ee2c71-7e28-4201-af85-ed7f001c6872", "id": "c2ee2c71-7e28-4201-af85-ed7f001c6872",
"metadata": { "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"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"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'"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
"import openpyxl\n", "import openpyxl\n",
"\n", "\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "title = ['编号','姓名','性别','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"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", "\n",
"filename = 'data/天宫院社区人员名单.json'\n", "filename = 'data/天宫院街道all.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",
@@ -206,7 +342,128 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/天宫院社区体测情况表.xlsx'\n", "filename = 'data/天宫院社区体测情况表_all.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"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"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_天宫院街道all.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/天宫院街道all.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" print(k,v['name'])\n",
" list2.append(str(k).rjust(3,'0'))\n",
" list2.append(v['name']) \n",
" \n",
" for item in items:\n",
" if item in v.keys():\n",
" list2.append(v[item]['成绩']) \n",
" elif item =='name':\n",
" list2.append(v[item])\n",
" else:\n",
" list2.append('') \n",
" list1.append(list2)\n",
"filename = 'data/天宫院社区体测情况表_all.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",
@@ -267,27 +524,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": null,
"id": "08ce9a37-b40c-4cb7-8c12-f18e2ecfc462", "id": "08ce9a37-b40c-4cb7-8c12-f18e2ecfc462",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-04-23T08:52:01.769840Z",
"iopub.status.busy": "2023-04-23T08:52:01.768890Z",
"iopub.status.idle": "2023-04-23T08:52:01.785005Z",
"shell.execute_reply": "2023-04-23T08:52:01.783964Z",
"shell.execute_reply.started": "2023-04-23T08:52:01.769799Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [ "source": [
"import os,sys,shutil\n", "import os,sys,shutil\n",
"import json\n", "import json\n",
@@ -343,7 +585,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.6" "version": "3.12.3"
} }
}, },
"nbformat": 4, "nbformat": 4,
+20 -4
View File
@@ -1232,12 +1232,28 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 51,
"id": "75e8d016-deba-4177-9036-01bfd77002a9", "id": "75e8d016-deba-4177-9036-01bfd77002a9",
"metadata": {}, "metadata": {
"outputs": [], "execution": {
"iopub.execute_input": "2024-07-10T01:21:37.432195Z",
"iopub.status.busy": "2024-07-10T01:21:37.431398Z",
"iopub.status.idle": "2024-07-10T01:21:37.438630Z",
"shell.execute_reply": "2024-07-10T01:21:37.437238Z",
"shell.execute_reply.started": "2024-07-10T01:21:37.432103Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"宋文帝使人赍药赐王景文死\n"
]
}
],
"source": [ "source": [
"s = '鬭造出種種'\n", "s = '宋文帝使人齎藥賜王景文死'\n",
"print(cc.convert(s))" "print(cc.convert(s))"
] ]
}, },
File diff suppressed because it is too large. Load diff