diff --git a/体测单位/东营石油工程设计院.ipynb b/体测单位/东营石油工程设计院.ipynb index d8473d5..d37ab49 100644 --- a/体测单位/东营石油工程设计院.ipynb +++ b/体测单位/东营石油工程设计院.ipynb @@ -853,26 +853,10 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "096e2b97-b83c-46bb-a070-c816e47da331", - "metadata": { - "execution": { - "iopub.execute_input": "2024-10-10T04:16:54.343310Z", - "iopub.status.busy": "2024-10-10T04:16:54.342554Z", - "iopub.status.idle": "2024-10-10T04:16:54.374304Z", - "shell.execute_reply": "2024-10-10T04:16:54.373814Z", - "shell.execute_reply.started": "2024-10-10T04:16:54.343239Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -980,17 +964,9 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "808e65e9-a9e3-44ea-9c0b-359375dceb3d", - "metadata": { - "execution": { - "iopub.execute_input": "2024-10-10T04:19:58.591580Z", - "iopub.status.busy": "2024-10-10T04:19:58.591086Z", - "iopub.status.idle": "2024-10-10T04:19:58.613839Z", - "shell.execute_reply": "2024-10-10T04:19:58.613230Z", - "shell.execute_reply.started": "2024-10-10T04:19:58.591535Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -1067,30 +1043,10 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "47f53bdf-ac6a-44f1-9f5f-852eb2d61127", - "metadata": { - "execution": { - "iopub.execute_input": "2024-10-10T04:17:31.723532Z", - "iopub.status.busy": "2024-10-10T04:17:31.722782Z", - "iopub.status.idle": "2024-10-10T04:17:31.746149Z", - "shell.execute_reply": "2024-10-10T04:17:31.745576Z", - "shell.execute_reply.started": "2024-10-10T04:17:31.723459Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "15542678894\n", - "18562090935\n", - "16688150490\n", - "13181954355\n", - "13381366350\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -1153,47 +1109,10 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "c633a37c-0f0e-4b81-83cb-a9fa49efbe36", - "metadata": { - "execution": { - "iopub.execute_input": "2024-10-10T04:18:31.164865Z", - "iopub.status.busy": "2024-10-10T04:18:31.164336Z", - "iopub.status.idle": "2024-10-10T04:18:31.173833Z", - "shell.execute_reply": "2024-10-10T04:18:31.172840Z", - "shell.execute_reply.started": "2024-10-10T04:18:31.164818Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 188 张世玉\n", - "2 37 孙傲\n", - "3 4 戴玮鹏\n", - "4 22 刘子童\n", - "5 52 李国欣\n", - "6 30 彭如旭\n", - "7 53 师立军\n", - "8 55 王瑞林\n", - "9 196 廉鹤\n", - "10 76 李春艳\n", - "11 26 沈妍\n", - "12 9 李霞\n", - "13 70 张双星\n", - "14 69 许晓东\n", - "15 3 余永姝\n", - "16 193 陈猛\n", - "17 36 牟宝磊\n", - "18 77 黄钰苹\n", - "19 71 吕晟琨\n", - "20 73 龚屹鹏\n", - "21 35 王思瑶\n", - "22 201 常鹏兵\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import csv\n", @@ -1214,17 +1133,9 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "3f68bad7-e2ba-47e1-9ae0-08fce2ad79d1", - "metadata": { - "execution": { - "iopub.execute_input": "2024-10-10T04:18:20.092613Z", - "iopub.status.busy": "2024-10-10T04:18:20.092142Z", - "iopub.status.idle": "2024-10-10T04:18:20.099516Z", - "shell.execute_reply": "2024-10-10T04:18:20.098866Z", - "shell.execute_reply.started": "2024-10-10T04:18:20.092588Z" - } - }, + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -1264,6 +1175,90 @@ "metadata": {}, "outputs": [], "source": [] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "5cb11459-4719-4cbf-9735-510436b8bd49", + "metadata": { + "execution": { + "iopub.execute_input": "2024-10-11T09:20:31.256635Z", + "iopub.status.busy": "2024-10-11T09:20:31.255869Z", + "iopub.status.idle": "2024-10-11T09:20:31.299121Z", + "shell.execute_reply": "2024-10-11T09:20:31.298616Z", + "shell.execute_reply.started": "2024-10-11T09:20:31.256566Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", + "bmi = ['height','weight']\n", + "title = ['编号','姓名','性别','单位/部门','身高','体重','bmi','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n", + "\n", + "filename = 'data/result_东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "list1 = []\n", + "for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(dict1[k]['name']) \n", + " list2.append(dict1[k]['sex'])\n", + " list2.append(dict1[k]['unit'])\n", + " i = 0\n", + " if 'bmi' in dict1[k].keys():\n", + " list2.append(dict1[k]['height']['成绩'])\n", + " list2.append(dict1[k]['weight']['成绩'])\n", + " list2.append(dict1[k]['bmi']['score'])\n", + " i+=1\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " list2.append('') \n", + " \n", + " \n", + " for item in items:\n", + " if item in dict1[k].keys():\n", + " list2.append(dict1[k][item]['成绩'])\n", + " list2.append(dict1[k][item]['score']) \n", + " i+=1\n", + " elif item =='name':\n", + " list2.append(dict1[k][item])\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " if i>2:\n", + " list1.append(list2)\n", + "filename = 'data/东营工程设计院体测情况明细表.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)\n", + "print('ok') " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b089745c-504b-4593-a6be-5d1da1321c95", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index b1c3dd3..0aab25e 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -431,15 +431,15 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 23, "id": "3e614f4a-a623-48e2-97f8-b31f62c9a983", "metadata": { "execution": { - "iopub.execute_input": "2024-10-10T04:19:31.792657Z", - "iopub.status.busy": "2024-10-10T04:19:31.791903Z", - "iopub.status.idle": "2024-10-10T04:19:31.845405Z", - "shell.execute_reply": "2024-10-10T04:19:31.844817Z", - "shell.execute_reply.started": "2024-10-10T04:19:31.792583Z" + "iopub.execute_input": "2024-10-11T07:48:39.710342Z", + "iopub.status.busy": "2024-10-11T07:48:39.709657Z", + "iopub.status.idle": "2024-10-11T07:48:39.737255Z", + "shell.execute_reply": "2024-10-11T07:48:39.736634Z", + "shell.execute_reply.started": "2024-10-11T07:48:39.710281Z" }, "tags": [] }, @@ -508,7 +508,7 @@ " l_xm = ['weight','height','lung','grip','flexion','jump','pushup','balance','reaction','step']\n", " else:\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'])\n", " #nian = int(birth[0].strip())\n", @@ -544,15 +544,15 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 24, "id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917", "metadata": { "execution": { - "iopub.execute_input": "2024-10-10T04:19:34.936239Z", - "iopub.status.busy": "2024-10-10T04:19:34.935929Z", - "iopub.status.idle": "2024-10-10T04:19:34.954873Z", - "shell.execute_reply": "2024-10-10T04:19:34.954373Z", - "shell.execute_reply.started": "2024-10-10T04:19:34.936209Z" + "iopub.execute_input": "2024-10-11T07:48:42.774725Z", + "iopub.status.busy": "2024-10-11T07:48:42.773914Z", + "iopub.status.idle": "2024-10-11T07:48:42.795168Z", + "shell.execute_reply": "2024-10-11T07:48:42.794010Z", + "shell.execute_reply.started": "2024-10-11T07:48:42.774652Z" }, "tags": [] }, @@ -699,15 +699,15 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 19, "id": "b123ee6b-85d2-4660-b226-321832a6b796", "metadata": { "execution": { - "iopub.execute_input": "2024-10-10T04:22:38.050651Z", - "iopub.status.busy": "2024-10-10T04:22:38.049905Z", - "iopub.status.idle": "2024-10-10T04:23:20.183719Z", - "shell.execute_reply": "2024-10-10T04:23:20.182527Z", - "shell.execute_reply.started": "2024-10-10T04:22:38.050579Z" + "iopub.execute_input": "2024-10-11T07:25:22.814095Z", + "iopub.status.busy": "2024-10-11T07:25:22.812877Z", + "iopub.status.idle": "2024-10-11T07:26:04.375164Z", + "shell.execute_reply": "2024-10-11T07:26:04.373942Z", + "shell.execute_reply.started": "2024-10-11T07:25:22.814016Z" }, "tags": [] }, @@ -733,7 +733,7 @@ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./东营石油设计院2024/'\n", + "file_path ='./中石化石油工程设计有限公司1/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -743,7 +743,7 @@ " \n", " id = str(k).rjust(4,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", - " mydata['title'] = '东营石油设计院'\n", + " mydata['title'] = '中石化石油工程设计有限公司'\n", " mydata['subtitle'] = v['unit']\n", " mydata['id'] = id\n", " mydata['name'] = v['name']\n", @@ -782,6 +782,90 @@ "print(i)" ] }, + { + "cell_type": "code", + "execution_count": 25, + "id": "4c1b3696-ab24-44bd-894a-e271ecfe4e38", + "metadata": { + "execution": { + "iopub.execute_input": "2024-10-11T07:49:38.996411Z", + "iopub.status.busy": "2024-10-11T07:49:38.995809Z", + "iopub.status.idle": "2024-10-11T07:50:20.766115Z", + "shell.execute_reply": "2024-10-11T07:50:20.765301Z", + "shell.execute_reply.started": "2024-10-11T07:49:38.996354Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "77\n" + ] + } + ], + "source": [ + "import requests\n", + "import json\n", + "import openpyxl\n", + "\n", + "\n", + "headers = {\n", + " \"Content-Type\": \"application/json; charset=UTF-8\"\n", + " }\n", + "filename = 'data/result_东营工程设计院2024_all.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "file_path ='./中石化石油工程设计有限公司/'\n", + "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", + "i=0\n", + "list2 = []\n", + "for k, v in dict1.items():\n", + " list1 = []\n", + " mydata = {}\n", + " \n", + " id = str(k).rjust(4,\"0\")\n", + " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", + " mydata['title'] = '中石化石油工程设计有限公司'\n", + " mydata['subtitle'] = v['unit']\n", + " mydata['id'] = id\n", + " mydata['name'] = v['name']\n", + " if v['sex'] == '男':\n", + " mydata['gender'] = 'male'\n", + " else:\n", + " mydata['gender'] = 'female'\n", + " \n", + " mydata['month'] = v['month']\n", + " mydata['fits'] = {}\n", + " survey_list = ['tcm','psy','spine']\n", + " for item in survey_list:\n", + " if item in v.keys():\n", + " mydata.setdefault('surveys',{})\n", + " mydata['surveys'][item] = v[item]\n", + " \n", + " \n", + " #mydata['fits'] = {}\n", + " for item in list_item:\n", + " if item in v.keys():\n", + " mydata.setdefault('fits',{})\n", + " if item in ['lung','pushup','step','situp']:\n", + " mark = v[item]['成绩'].split()[0].split('.')[0]\n", + " else:\n", + " mark = v[item]['成绩'].split()[0]\n", + " mydata['fits'][item] = {'mark':mark,'score':v[item]['score']}\n", + " #if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n", + " \n", + " list1.append(mydata)\n", + " list2.append([k,v['name']])\n", + " i+=1\n", + " x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\n", + " #print(id,v['name'],x.text)\n", + " #print(mydata)\n", + " #x.close()\n", + "print(i)" + ] + }, { "cell_type": "markdown", "id": "4642faf7-52bf-40e9-9af3-7555d4eef10b", @@ -792,15 +876,15 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 26, "id": "d913a531-51b3-4795-adc3-f4fc858d7401", "metadata": { "execution": { - "iopub.execute_input": "2024-06-06T03:56:47.359615Z", - "iopub.status.busy": "2024-06-06T03:56:47.359270Z", - "iopub.status.idle": "2024-06-06T03:56:47.566463Z", - "shell.execute_reply": "2024-06-06T03:56:47.565918Z", - "shell.execute_reply.started": "2024-06-06T03:56:47.359581Z" + "iopub.execute_input": "2024-10-11T07:54:08.868059Z", + "iopub.status.busy": "2024-10-11T07:54:08.867441Z", + "iopub.status.idle": "2024-10-11T07:54:08.898253Z", + "shell.execute_reply": "2024-10-11T07:54:08.897678Z", + "shell.execute_reply.started": "2024-10-11T07:54:08.867998Z" }, "tags": [] }, @@ -811,12 +895,12 @@ "import glob\n", "from pathlib import Path\n", "\n", - "fi_path = '/home/songyi/pdf-typescript/中安联合'\n", - "new_path = 'file/中安联合'\n", + "fi_path = '/home/songyi/pdf-typescript/中石化石油工程设计有限公司'\n", + "new_path = 'file/中石化石油工程设计有限公司'\n", "old = []\n", "dict2 = {}\n", "\n", - "filename = 'data/中安联合.json'\n", + "filename = 'data/东营工程设计院2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n",