This commit is contained in:
512song committed 2023-03-13 13:15:53 +00:00
1 parent 4342ad8e57
commit b421a81abd
1 file changed
+258 -33
+258 -33
View File
@@ -3,7 +3,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "4b749231-7ab9-4dcd-8cfd-7b9be485d3c6", "id": "4b749231-7ab9-4dcd-8cfd-7b9be485d3c6",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"## 低碳院人员信息对应关系及导出" "## 低碳院人员信息对应关系及导出"
] ]
@@ -84,7 +87,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "2494ff3b-f52f-4933-9879-1b47857d8c67", "id": "2494ff3b-f52f-4933-9879-1b47857d8c67",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"## 低碳院人员体质分组" "## 低碳院人员体质分组"
] ]
@@ -224,16 +230,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 85, "execution_count": null,
"id": "ad88fd2a-39ce-4a88-bd4a-7699264fd47d", "id": "ad88fd2a-39ce-4a88-bd4a-7699264fd47d",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-08-02T00:02:15.159762Z",
"iopub.status.busy": "2022-08-02T00:02:15.159231Z",
"iopub.status.idle": "2022-08-02T00:02:15.980533Z",
"shell.execute_reply": "2022-08-02T00:02:15.979419Z",
"shell.execute_reply.started": "2022-08-02T00:02:15.159712Z"
},
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [],
@@ -284,7 +283,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "231a0872-34ac-4121-870e-ba398a158576", "id": "231a0872-34ac-4121-870e-ba398a158576",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"## 合并人员成绩" "## 合并人员成绩"
] ]
@@ -347,7 +349,10 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "0bef4bd3-99e8-4a2d-a418-77f832b1254a", "id": "0bef4bd3-99e8-4a2d-a418-77f832b1254a",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"## 导出人员信息表" "## 导出人员信息表"
] ]
@@ -397,34 +402,22 @@
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "b1462a26-59f8-4e5f-8fb9-d927059e0747", "id": "b1462a26-59f8-4e5f-8fb9-d927059e0747",
"metadata": {}, "metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [ "source": [
"## 获取第一次报告人员情况" "## 获取第一次报告人员情况"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"id": "a09d16d7-62a8-4628-9df3-4658a78a9a14", "id": "a09d16d7-62a8-4628-9df3-4658a78a9a14",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2022-08-09T01:55:02.666968Z",
"iopub.status.busy": "2022-08-09T01:55:02.666453Z",
"iopub.status.idle": "2022-08-09T01:55:02.676595Z",
"shell.execute_reply": "2022-08-09T01:55:02.675414Z",
"shell.execute_reply.started": "2022-08-09T01:55:02.666920Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"332\n"
]
}
],
"source": [ "source": [
"import json\n", "import json\n",
" \n", " \n",
@@ -435,10 +428,242 @@
"print(len(m_xx.keys()))" "print(len(m_xx.keys()))"
] ]
}, },
{
"cell_type": "markdown",
"id": "bb3448ff-a8d3-417d-ab3a-4b54e28aaca0",
"metadata": {},
"source": [
"## 2023年体测情况"
]
},
{
"cell_type": "markdown",
"id": "d7ad01ef-93c3-4735-b609-bb5d38f85a25",
"metadata": {},
"source": [
"### 导入最新人员手机信息"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "dfa3f093-25a7-4a8d-b4d6-22e0f6fcbb92",
"metadata": {
"execution": {
"iopub.execute_input": "2023-03-13T11:16:03.723835Z",
"iopub.status.busy": "2023-03-13T11:16:03.722922Z",
"iopub.status.idle": "2023-03-13T11:16:03.822603Z",
"shell.execute_reply": "2023-03-13T11:16:03.821845Z",
"shell.execute_reply.started": "2023-03-13T11:16:03.723794Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 郝国政 18813095526 501\n",
"2 杜鹏 15910618307 506\n",
"3 魏垚 18765506895 232\n",
"4 赵亮亮 18610066890 507\n"
]
}
],
"source": [
"import openpyxl\n",
"import math\n",
"import json\n",
"import pymysql\n",
"\n",
"fi_xls = 'data/低碳院多点账号20230217.xlsx'\n",
"chongming = ['王锐','王楠','郭强','王涛','张静']\n",
"dict1 = {}\n",
"dict2 = {}\n",
"dict3 = {}\n",
"\n",
"db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"ydyb\" )\n",
"cursor = db.cursor()\n",
"sql = \"SELECT a.name ,a.phone,b.avatar_id FROM people as a,places_people as b WHERE a.id =b.people_id AND b.place_id = 139\"\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"for result in results:\n",
" if result[0] not in chongming:\n",
" dict2[result[0]] = [str(result[1]).strip(),result[2]]\n",
"#print(dict2)\n",
"\n",
"wb = openpyxl.load_workbook(fi_xls)\n",
"sheet = wb.active\n",
"for n in range(2,sheet.max_row+1):\n",
" if sheet.cell(n,2).value is not None:\n",
" dict1[int(sheet.cell(n,1).value)] = [sheet.cell(n,2).value,sheet.cell(n,3).value,str(sheet.cell(n,4).value).strip()]\n",
"#print(dict1)\n",
"i = 1\n",
"for k, v in dict1.items():\n",
" if v[0] in dict2.keys() and v[2]!=dict2[v[0]][0]:\n",
" print(i,v[0],v[2],dict2[v[0]][1])\n",
" i+= 1"
]
},
{
"cell_type": "markdown",
"id": "c27c6f4b-d0ed-40e8-aed9-09662edd21c6",
"metadata": {},
"source": [
"### 统计问卷人员信息"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "8ccee97e-60e0-4363-b706-d4a71f214142",
"metadata": {
"execution": {
"iopub.execute_input": "2023-03-13T11:40:04.102953Z",
"iopub.status.busy": "2023-03-13T11:40:04.102098Z",
"iopub.status.idle": "2023-03-13T11:40:04.275805Z",
"shell.execute_reply": "2023-03-13T11:40:04.274943Z",
"shell.execute_reply.started": "2023-03-13T11:40:04.102912Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"15210715398\n",
"13810886698\n"
]
}
],
"source": [
"import json\n",
"import pymysql\n",
"import openpyxl\n",
"\n",
"\n",
"dict1 = {}\n",
"dict2 = {}\n",
"dict3 = {}\n",
"list1 = []\n",
"fi_xls = 'data/低碳院多点账号20230217.xlsx'\n",
"wb = openpyxl.load_workbook(fi_xls)\n",
"sheet = wb.active\n",
"for n in range(2,sheet.max_row+1):\n",
" if sheet.cell(n,2).value is not None:\n",
" list1.append(str(sheet.cell(n,4).value).strip())\n",
"#print(list1)\n",
"list2 = []\n",
"list3 = []\n",
"\n",
"\n",
"db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"ydyb\" )\n",
"cursor = db.cursor()\n",
"sql = \"select * FROM Survey s WHERE s.surveyId IN ('psy6') AND s.updatedAt >'2022-11-01'\"\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"for result in results: \n",
" #dict2[result[0]] = [str(result[2]).strip(),result[1]]\n",
" dict2[result[0]] = str(result[2]).strip()\n",
"#print(dict2)\n",
"for k, v in dict2.items():\n",
" if v not in list1:\n",
" list2.append(v)\n",
"sql = \"SELECT a.phone FROM people as a,places_people as b WHERE a.id =b.people_id AND b.place_id = 139\"\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"for result in results:\n",
" list3.append(result[0])\n",
"#print(dict2)\n",
"for item in list2:\n",
" if item not in list3:\n",
" print(item)\n"
]
},
{
"cell_type": "markdown",
"id": "9ba6ea9a-28f5-43c7-9dd7-74a626838303",
"metadata": {},
"source": [
"### 统计2022年问卷人员信息"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "2339b885-e885-499a-a078-5a2a1fb818bd",
"metadata": {
"execution": {
"iopub.execute_input": "2023-03-13T12:25:35.400570Z",
"iopub.status.busy": "2023-03-13T12:25:35.399705Z",
"iopub.status.idle": "2023-03-13T12:25:35.531463Z",
"shell.execute_reply": "2023-03-13T12:25:35.530708Z",
"shell.execute_reply.started": "2023-03-13T12:25:35.400529Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"15210715398\n",
"15006594388\n",
"15210715398\n",
"17326968610\n",
"17326968610\n"
]
}
],
"source": [
"import json\n",
"import pymysql\n",
"import openpyxl\n",
"\n",
"\n",
"dict1 = {}\n",
"dict2 = {}\n",
"dict3 = {}\n",
"list1 = []\n",
"fi_xls = 'data/低碳院多点账号20230217.xlsx'\n",
"wb = openpyxl.load_workbook(fi_xls)\n",
"sheet = wb.active\n",
"for n in range(2,sheet.max_row+1):\n",
" if sheet.cell(n,2).value is not None:\n",
" list1.append(str(sheet.cell(n,4).value).strip())\n",
"#print(list1)\n",
"list2 = []\n",
"list3 = []\n",
"\n",
"\n",
"db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"ydyb\" )\n",
"cursor = db.cursor()\n",
"sql = \"select * FROM Survey s WHERE s.surveyId IN ('psy4','tcmv2') AND s.updatedAt >'2022-11-01'\"\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"for result in results: \n",
" #dict2[result[0]] = [str(result[2]).strip(),result[1]]\n",
" dict2[result[0]] = str(result[2]).strip()\n",
"#print(dict2)\n",
"for k, v in dict2.items():\n",
" if v not in list1:\n",
" list2.append(v)\n",
"sql = \"SELECT a.phone FROM people as a,places_people as b WHERE a.id =b.people_id AND b.place_id = 139\"\n",
"cursor.execute(sql)\n",
"results = cursor.fetchall()\n",
"for result in results:\n",
" list3.append(result[0])\n",
"#print(dict2)\n",
"for item in list2:\n",
" if item not in list3:\n",
" print(item)\n"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "199c011d-a253-429a-ad51-645b37f679a1", "id": "30704310-351a-406d-a0fe-02a5cefe6012",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
@@ -446,7 +671,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@@ -460,7 +685,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.10" "version": "3.10.6"
} }
}, },
"nbformat": 4, "nbformat": 4,