20250611
This commit is contained in:
1 parent
d4c40dcab2
commit
db1359b2d0
4 files changed
+269
-130
No files matched your search
+106
-13
@@ -1407,15 +1407,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 1,
|
||||
"id": "d07d132b-dd74-458d-af0c-6a6ae005ad3a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-09T05:54:53.309142Z",
|
||||
"iopub.status.busy": "2025-06-09T05:54:53.308597Z",
|
||||
"iopub.status.idle": "2025-06-09T05:54:53.339265Z",
|
||||
"shell.execute_reply": "2025-06-09T05:54:53.338794Z",
|
||||
"shell.execute_reply.started": "2025-06-09T05:54:53.309094Z"
|
||||
"iopub.execute_input": "2025-06-09T08:13:09.484342Z",
|
||||
"iopub.status.busy": "2025-06-09T08:13:09.483682Z",
|
||||
"iopub.status.idle": "2025-06-09T08:13:09.516356Z",
|
||||
"shell.execute_reply": "2025-06-09T08:13:09.515813Z",
|
||||
"shell.execute_reply.started": "2025-06-09T08:13:09.484283Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -1440,6 +1440,7 @@
|
||||
"filename = 'data/marks_20250609.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_东营石油工程设计院2025.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
@@ -1456,15 +1457,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 2,
|
||||
"id": "971d592d-9ff5-4758-af68-2f60a986c2a2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-09T05:55:52.911728Z",
|
||||
"iopub.status.busy": "2025-06-09T05:55:52.910950Z",
|
||||
"iopub.status.idle": "2025-06-09T05:55:52.934192Z",
|
||||
"shell.execute_reply": "2025-06-09T05:55:52.933606Z",
|
||||
"shell.execute_reply.started": "2025-06-09T05:55:52.911653Z"
|
||||
"iopub.execute_input": "2025-06-09T08:13:24.385566Z",
|
||||
"iopub.status.busy": "2025-06-09T08:13:24.384878Z",
|
||||
"iopub.status.idle": "2025-06-09T08:13:24.414310Z",
|
||||
"shell.execute_reply": "2025-06-09T08:13:24.413783Z",
|
||||
"shell.execute_reply.started": "2025-06-09T08:13:24.385501Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -1583,10 +1584,102 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1f2c3e94-e14b-4c68-b5c7-a71b95fc2f86",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成报告"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "cf15813a-02de-4dc9-95fe-912d9a5d9025",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-06-09T08:14:41.869403Z",
|
||||
"iopub.status.busy": "2025-06-09T08:14:41.868754Z",
|
||||
"iopub.status.idle": "2025-06-09T08:16:55.156384Z",
|
||||
"shell.execute_reply": "2025-06-09T08:16:55.155379Z",
|
||||
"shell.execute_reply.started": "2025-06-09T08:14:41.869343Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"245\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_东营石油工程设计院2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./东营石油设计院2025/'\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','psy57','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",
|
||||
" if len(mydata['fits']) >2 : \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": "code",
|
||||
"execution_count": null,
|
||||
"id": "d6e1066a-7779-407f-8b8d-109ada157acc",
|
||||
"id": "a7eb6a67-a31d-43cf-a44b-8c36c4686de4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user