This commit is contained in:
512song committed 2024-10-11 17:24:38 +08:00
1 parent 31482fb2f5
commit 4455c45565
2 files changed
+211 -132

No files matched your search

+114 -30
View File
@@ -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",