20240920
This commit is contained in:
1 parent
63f678daf4
commit
96f043313c
4 files changed
+445
-670
No files matched your search
+12
-395
@@ -61,7 +61,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"source": [
|
||||
"## 获取人员测试成绩"
|
||||
]
|
||||
@@ -176,7 +178,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d034a61d-1fbd-417b-99bd-277e43ebb678",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"source": [
|
||||
"## 导出测试人员信息"
|
||||
]
|
||||
@@ -248,7 +252,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d794e69d-9444-4765-9b7d-8dcb0f8c4343",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"source": [
|
||||
"## 导入问卷信息"
|
||||
]
|
||||
@@ -378,7 +384,9 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9f9111f1-8cf0-4d45-b9b2-e3b631023581",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true
|
||||
},
|
||||
"source": [
|
||||
"## 获取问卷人员信息"
|
||||
]
|
||||
@@ -557,397 +565,6 @@
|
||||
"## 核对人员成绩"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"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": null,
|
||||
"id": "37e24019-9b79-4748-ae6a-2bdb6052862d",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"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": "markdown",
|
||||
"id": "7ac62aed-6256-4bd2-a563-5f6e34504121",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 核对人员手机号码"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "42b7cd7d-3446-4abf-91f2-c85d447231e9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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/6.20日北体花名册.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"for n in range(3, sheet.max_row+1):\n",
|
||||
" phone = int(sheet.cell(n, 3).value)\n",
|
||||
" \n",
|
||||
" dict2[phone] = sheet.cell(n, 2).value\n",
|
||||
"i = 1\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" if 'phone' in v.keys() and v['phone'] in dict2.keys() :\n",
|
||||
" print(i,v['name'],dict2[v['phone']])\n",
|
||||
" i+=1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "bd4b91e9-289c-4f21-aab6-846b5f98c493",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%reset -f\n",
|
||||
"\n",
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/东营老年大学.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"dict2 = {}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" dict2[v['phone']] = v['name']\n",
|
||||
"wb = openpyxl.load_workbook('data/6.20日北体花名册.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"for n in range(3, sheet.max_row+1):\n",
|
||||
" phone = int(sheet.cell(n, 3).value)\n",
|
||||
" if phone not in dict2.keys():\n",
|
||||
" print(sheet.cell(n, 2).value)\n",
|
||||
" \n",
|
||||
"print(dict2) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "dacbf0e8-f456-478f-8253-2824d68d092c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 合并分日测试信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"id": "162364f8-8ae9-4bbb-8fb1-e9181ececf02",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:37:55.393433Z",
|
||||
"iopub.status.busy": "2024-09-14T12:37:55.392657Z",
|
||||
"iopub.status.idle": "2024-09-14T12:37:55.424141Z",
|
||||
"shell.execute_reply": "2024-09-14T12:37:55.423583Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:37:55.393359Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"170\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北体体质康健1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/result_北体体质康健2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"n = 50\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" dict1[n+int(k)] = v\n",
|
||||
" \n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False) \n",
|
||||
"print(len(dict1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ddda3101-052a-45c5-87af-65333b4ba141",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 补充问卷人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"id": "8e025cb5-8c9f-4eb9-a66e-863df32881c8",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:37:09.151657Z",
|
||||
"iopub.status.busy": "2024-09-14T12:37:09.150889Z",
|
||||
"iopub.status.idle": "2024-09-14T12:37:09.186568Z",
|
||||
"shell.execute_reply": "2024-09-14T12:37:09.186032Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:37:09.151586Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/北体体质康健.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for n in range(1, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" if code in dict1.keys(): \n",
|
||||
" if sheet.cell(n,5).value is not None:\n",
|
||||
" dict1[code]['phone'] = str(sheet.cell(n,5).value)\n",
|
||||
" else:\n",
|
||||
" dict1[code]= dict2[code]\n",
|
||||
" rq = '2024-09-14'\n",
|
||||
" birth = dict2[code]['birth']\n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[code]['age'] = int(days/365)\n",
|
||||
" dict1[code]['month'] = int(days/365*12)\n",
|
||||
" \n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"id": "ef75192e-a6ec-4d72-88b4-7645ce6d0aed",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:43:31.977618Z",
|
||||
"iopub.status.busy": "2024-09-14T12:43:31.976867Z",
|
||||
"iopub.status.idle": "2024-09-14T12:43:31.999628Z",
|
||||
"shell.execute_reply": "2024-09-14T12:43:31.999148Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:43:31.977549Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"filename = 'data/result_北体体质康健2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" if 'month' not in v.keys():\n",
|
||||
" rq = date.fromisoformat(v['rq'])\n",
|
||||
" birth = date.fromisoformat(v['birth'])\n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[k]['age'] = int(days/365)\n",
|
||||
" dict1[k]['month'] = int(days/365*12)\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"id": "99c612c8-aa47-4ed8-b866-c8d2edcaea4b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:45:56.907974Z",
|
||||
"iopub.status.busy": "2024-09-14T12:45:56.907231Z",
|
||||
"iopub.status.idle": "2024-09-14T12:46:35.198207Z",
|
||||
"shell.execute_reply": "2024-09-14T12:46:35.197069Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:45:56.907903Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"79\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_北体体质康健2.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'] = ''\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 : \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,
|
||||
|
||||
Reference in new issue
Block a user