From 4ea26985c43726600e71bd8f765c2878c7a71631 Mon Sep 17 00:00:00 2001 From: 512song Date: Sun, 24 Mar 2024 16:42:53 +0800 Subject: [PATCH] 20240324 --- 体测单位/东营老年大学.ipynb | 187 ++++++++++++++++++++++++++++++++---- 体测单位/体测数据管理.ipynb | 26 ++--- 2 files changed, 182 insertions(+), 31 deletions(-) diff --git a/体测单位/东营老年大学.ipynb b/体测单位/东营老年大学.ipynb index 15a8819..39247b3 100644 --- a/体测单位/东营老年大学.ipynb +++ b/体测单位/东营老年大学.ipynb @@ -347,27 +347,12 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "d1d02189-e01a-4d7f-9fbb-09b5e72a38df", "metadata": { - "execution": { - "iopub.execute_input": "2024-03-21T12:23:16.473152Z", - "iopub.status.busy": "2024-03-21T12:23:16.472676Z", - "iopub.status.idle": "2024-03-21T12:23:16.513844Z", - "shell.execute_reply": "2024-03-21T12:23:16.512801Z", - "shell.execute_reply.started": "2024-03-21T12:23:16.473113Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -526,10 +511,176 @@ " json.dump(dict1, fl, ensure_ascii=False) " ] }, + { + "cell_type": "markdown", + "id": "a8dbc7ae-cf00-4591-8572-600c39b37750", + "metadata": {}, + "source": [ + "## 核对人员成绩" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "8a4632b0-ab3a-47c4-b43c-7aefb84f4138", + "id": "ee84a3ce-deb7-4345-a4a4-877872996e1c", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['bmi','lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", + "bmi = ['height','weight']\n", + "\n", + "\n", + "filename = 'data/727410_pdf.json'\n", + "with open(filename,'r') as fl:\n", + " list2 = json.load(fl)\n", + "\n", + "filename = 'data/result_东营老年大学1.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + " \n", + "\n", + "for xm in list2: \n", + " id = xm['id']\n", + " if str(id) in dict1.keys():\n", + " #print(id,xm['name'])\n", + " for item in xm['fits'].keys():\n", + " y_score = xm['fits'][item]['score']\n", + " if item not in dict1[str(id)].keys() or y_score != dict1[str(id)][item]['score']:\n", + " print(id,xm['name'],item,'no')" + ] + }, + { + "cell_type": "markdown", + "id": "e76ef95a-25dc-45f2-8b8c-617acbf546c1", + "metadata": {}, + "source": [ + "## 更新人员手机号码" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "37e24019-9b79-4748-ae6a-2bdb6052862d", + "metadata": { + "execution": { + "iopub.execute_input": "2024-03-24T08:04:28.111191Z", + "iopub.status.busy": "2024-03-24T08:04:28.110709Z", + "iopub.status.idle": "2024-03-24T08:04:28.151253Z", + "shell.execute_reply": "2024-03-24T08:04:28.149811Z", + "shell.execute_reply.started": "2024-03-24T08:04:28.111154Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "13375466638 1 13375466638\n", + "13589432668 2 13589432668\n", + "13054619993 3 13054619993\n", + "18554686537 4 18554686537\n", + "15805460500 5 15805460500\n", + "13705468382 6 13705468382\n", + "18654618688 7 18654618688\n", + "13505466886 9 13505466886\n", + "13361529316 10 13361529316\n", + "18654605758 11 18654605758\n", + "13963369251 12 13963369251\n", + "13854666193 13 13854666193\n", + "13963381767 14 13963381767\n", + "13562277783 15 13562277783\n", + "13854664965 16 13854664965\n", + "18506464679 17 18506464679\n", + "18865467010 18 18865467010\n", + "18505460998 19 18505460998\n", + "15266083778 20 15266083778\n", + "15865469239 21 15865469239\n", + "15154607897 22 15154607897\n", + "13963359091 23 13963359091\n", + "13685469953 24 13685469953\n", + "18615463569 25 18615463569\n", + "13518666896 27 13518666896\n", + "13668615983 28 13668615983\n", + "13562269069 29 13562269069\n", + "15066075216 30 15066075216\n", + "18754687658 31 18754687658\n", + "13668618731 32 18254610712\n", + "15552721566 33 15552721566\n", + "18678690907 34 18678690907\n", + "13082610996 35 13082610996\n", + "13563351026 36 13563351026\n", + "13506369296 37 13506369296\n", + "13589986263 38 13589986263\n", + "13589996697 39 13589996697\n", + "18905465618 40 18905465618\n", + "18954035397 41 18954035397\n", + "13906472659 42 13906472659\n", + "15618032716 43 15618032716\n", + "18661382930 44 18661382930\n", + "13505465335 45 13505465335\n", + "13854622388 47 13854622388\n", + "13589961161 48 13589961161\n", + "18860657259 49 18860657259\n", + "13963358011 50 13963358011\n", + "13605466080 51 13605466080\n", + "13505461565 53 13505461565\n", + "15550539718 54 15550539718\n", + "15698085191 55 15698985191\n", + "18562110866 56 1856210866\n", + "13376472932 58 13376472932\n", + "18653690626 59 18653690626\n", + "13515466253 60 13515466253\n", + "13054652092 61 13054652092\n", + "13280380156 62 13280380156\n", + "18254621588 63 18254621588\n", + "13854620482 65 13854620482\n", + "13376473932 66 13376473932\n", + "18654335533 67 18654335533\n", + "16605466518 68 16605466518\n", + "13706364787 69 13706364787\n", + "ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "from datetime import date\n", + "\n", + "filename = 'data/东营老年大学.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \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", + " code = str(sheet.cell(n, 3).value)\n", + " phone = sheet.cell(n, 1).value\n", + " if code in dict1.keys():\n", + " print(phone,code,dict1[code]['phone'])\n", + " dict1[code]['phone'] = phone\n", + " \n", + " \n", + "filename = 'data/东营老年大学.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "26ef04ee-fdf4-40de-a3ed-30cba6525f06", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/体测数据管理.ipynb b/体测单位/体测数据管理.ipynb index f8fb767..72b3fb3 100644 --- a/体测单位/体测数据管理.ipynb +++ b/体测单位/体测数据管理.ipynb @@ -23,9 +23,9 @@ "mydb = myclient[\"baogao\"]\n", "mycol = mydb[\"place\"]\n", "\n", - "id = 136\n", - "code = \"07\"\n", - "name = \"中国石化安庆石化公司\"\n", + "id = 727410\n", + "code = \"08\"\n", + "name = \"北体体质康健实验班\"\n", "myquery = { \"id\": id }\n", "num = mycol.count_documents(myquery)\n", "if num>0:\n", @@ -64,9 +64,9 @@ "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", "mydb = myclient[\"baogao\"]\n", "\n", - "place_id = 136\n", - "place_code = '07'\n", - "dw_name = '中国石化安庆石化公司'\n", + "place_id = 727410\n", + "place_code = '08'\n", + "dw_name = '北体体质康健实验班'\n", "fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n", "fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n", "\n", @@ -77,7 +77,7 @@ "list1 = []\n", "i = 0\n", "while i < len(fls):\n", - " code = random.sample(code_list,4) #随机取4位数\n", + " code = random.sample(code_list,3) #随机取4位数\n", " code_num = ''.join(code) \n", " if place_code+code_num not in list1:\n", " list1.append(place_code+code_num)\n", @@ -126,11 +126,11 @@ "mydb = myclient[\"baogao\"]\n", "mycol = mydb[\"pdf\"]\n", "\n", - "filename = 'data/安庆职工健康提升志愿者.json'\n", + "filename = 'data/东营老年大学.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "dict2 = {}\n", - "place_id = 136\n", + "place_id = 727410\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", @@ -161,7 +161,7 @@ " req.SmsSdkAppId = \"1400140089\"\n", " req.SignName = \"坤铭教育\"\n", " req.TemplateId = \"1875765\" \n", - " req.TemplateParamSet = [\"安庆健康提升职工\",yzm]\n", + " req.TemplateParamSet = [\"北体体质康健实验班学员\",yzm]\n", " req.PhoneNumberSet = [phone]\n", " req.SessionContext = \"\"\n", " req.ExtendCode = \"\"\n", @@ -205,11 +205,11 @@ "mydb = myclient[\"baogao\"]\n", "mycol = mydb[\"pdf\"]\n", "\n", - "filename = 'data/安庆职工健康提升志愿者.json'\n", + "filename = 'data/东营老年大学.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "dict2 = {}\n", - "place_id = 136\n", + "place_id = 727410\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", @@ -240,7 +240,7 @@ " req.SmsSdkAppId = \"1400140089\"\n", " req.SignName = \"坤铭教育\"\n", " req.TemplateId = \"1875765\" \n", - " req.TemplateParamSet = [\"安庆健康提升职工\",yzm]\n", + " req.TemplateParamSet = [\"北体体质康健实验班学员\",yzm]\n", " req.PhoneNumberSet = [phone]\n", " req.SessionContext = \"\"\n", " req.ExtendCode = \"\"\n",