This commit is contained in:
512song committed 2025-04-07 20:50:39 +08:00
1 parent b030391f58
commit f6dd5f0da5
7 files changed
+744 -1120

No files matched your search

+213 -103
View File
@@ -10,15 +10,15 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 81,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:07:40.941181Z",
"iopub.status.busy": "2025-03-14T08:07:40.940504Z",
"iopub.status.idle": "2025-03-14T08:07:40.971889Z",
"shell.execute_reply": "2025-03-14T08:07:40.971330Z",
"shell.execute_reply.started": "2025-03-14T08:07:40.941123Z"
"iopub.execute_input": "2025-03-19T11:10:38.156756Z",
"iopub.status.busy": "2025-03-19T11:10:38.156425Z",
"iopub.status.idle": "2025-03-19T11:10:38.173971Z",
"shell.execute_reply": "2025-03-19T11:10:38.173494Z",
"shell.execute_reply.started": "2025-03-19T11:10:38.156730Z"
},
"tags": []
},
@@ -27,7 +27,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"96\n",
"37\n",
"ok\n"
]
}
@@ -37,7 +37,7 @@
"import json\n",
"from datetime import date\n",
"\n",
"wb = openpyxl.load_workbook('data/东营市老年大学第三期体质班.xlsx')\n",
"wb = openpyxl.load_workbook('data/2025级油田老年大学体质康健基础班.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
@@ -48,15 +48,15 @@
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n, 3).value\n",
" dict1['unit'] = '第三期体质班'\n",
" dict1['unit'] = '2025级'\n",
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
" #dict1['age'] = sheet.cell(n, 6).value\n",
" if sheet.cell(n,6).value is not None:\n",
" dict1['phone'] = str(sheet.cell(n,6).value) \n",
" if sheet.cell(n,5).value is not None:\n",
" dict1['id'] = str(sheet.cell(n,5).value)\n",
" dict1['phone'] = str(sheet.cell(n,5).value) \n",
" if sheet.cell(n,6).value is not None:\n",
" dict1['id'] = str(sheet.cell(n,6).value)\n",
" person[code] = dict1\n",
"filename = 'data/东营市老年大学第三期体质班.json'\n",
"filename = 'data/2025级油田老年大学体质康健基础班.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person))\n",
@@ -65,15 +65,15 @@
},
{
"cell_type": "code",
"execution_count": 57,
"id": "5a98acbe-5f00-4ee0-99b2-7ff8d0caa3bc",
"execution_count": 88,
"id": "a14eed8b-0f7f-44f6-9d99-ce7f48e0cf50",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-04T01:28:11.977681Z",
"iopub.status.busy": "2025-03-04T01:28:11.976966Z",
"iopub.status.idle": "2025-03-04T01:28:12.007482Z",
"shell.execute_reply": "2025-03-04T01:28:12.006967Z",
"shell.execute_reply.started": "2025-03-04T01:28:11.977599Z"
"iopub.execute_input": "2025-03-19T11:40:25.979499Z",
"iopub.status.busy": "2025-03-19T11:40:25.978815Z",
"iopub.status.idle": "2025-03-19T11:40:26.001966Z",
"shell.execute_reply": "2025-03-19T11:40:26.001013Z",
"shell.execute_reply.started": "2025-03-19T11:40:25.979436Z"
}
},
"outputs": [
@@ -81,7 +81,62 @@
"name": "stdout",
"output_type": "stream",
"text": [
"125\n",
"13\n",
"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",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n, 3).value\n",
" dict1['unit'] = ' '\n",
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
" #dict1['age'] = sheet.cell(n, 6).value\n",
" if sheet.cell(n,5).value is not None:\n",
" dict1['phone'] = str(sheet.cell(n,5).value) \n",
" if sheet.cell(n,6).value is not None:\n",
" dict1['id'] = str(sheet.cell(n,6).value)\n",
" person[code] = dict1\n",
"filename = 'data/萃苑社区党群服务中心.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print(len(person))\n",
"print('ok')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5a98acbe-5f00-4ee0-99b2-7ff8d0caa3bc",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-07T09:45:18.579990Z",
"iopub.status.busy": "2025-04-07T09:45:18.579417Z",
"iopub.status.idle": "2025-04-07T09:45:18.655025Z",
"shell.execute_reply": "2025-04-07T09:45:18.654445Z",
"shell.execute_reply.started": "2025-04-07T09:45:18.579942Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"492\n",
"ok\n"
]
}
@@ -130,15 +185,15 @@
},
{
"cell_type": "code",
"execution_count": 71,
"execution_count": 89,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:07:44.886839Z",
"iopub.status.busy": "2025-03-14T08:07:44.886215Z",
"iopub.status.idle": "2025-03-14T08:07:44.904464Z",
"shell.execute_reply": "2025-03-14T08:07:44.903941Z",
"shell.execute_reply.started": "2025-03-14T08:07:44.886779Z"
"iopub.execute_input": "2025-03-19T11:41:10.193763Z",
"iopub.status.busy": "2025-03-19T11:41:10.193066Z",
"iopub.status.idle": "2025-03-19T11:41:10.208195Z",
"shell.execute_reply": "2025-03-19T11:41:10.207239Z",
"shell.execute_reply.started": "2025-03-19T11:41:10.193698Z"
},
"tags": []
},
@@ -147,7 +202,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"93\n"
"13\n"
]
}
],
@@ -160,11 +215,11 @@
"\n",
"re_ta = {}\n",
"list1 = []\n",
"filename = 'data/东营市老年大学第三期体质班.json'\n",
"filename = 'data/萃苑社区党群服务中心.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/marks_20250314.csv'\n",
"filename = 'data/marks_20250319.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -201,7 +256,7 @@
" score = result[4] \n",
" re_ta[user][item_name]['成绩'] = score\n",
"\n",
"filename = 'data/result_东营市老年大学第三期体质班.json'\n",
"filename = 'data/result_萃苑社区党群服务中心.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
@@ -209,15 +264,15 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": 20,
"id": "e2526429-e779-4ec5-8a0e-bea623f54f29",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:07:48.554811Z",
"iopub.status.busy": "2025-03-14T08:07:48.554094Z",
"iopub.status.idle": "2025-03-14T08:07:48.579590Z",
"shell.execute_reply": "2025-03-14T08:07:48.579110Z",
"shell.execute_reply.started": "2025-03-14T08:07:48.554748Z"
"iopub.execute_input": "2025-04-07T12:39:20.625284Z",
"iopub.status.busy": "2025-04-07T12:39:20.624668Z",
"iopub.status.idle": "2025-04-07T12:39:20.645248Z",
"shell.execute_reply": "2025-04-07T12:39:20.644732Z",
"shell.execute_reply.started": "2025-04-07T12:39:20.625230Z"
}
},
"outputs": [
@@ -225,7 +280,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"115\n"
"57\n"
]
}
],
@@ -242,7 +297,7 @@
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/marks_20250304.csv'\n",
"filename = 'data/marks_20250326.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -254,6 +309,7 @@
" user = str(result[2])\n",
" rq = date.fromisoformat(result[5].replace('/','-'))\n",
" if user in dict1.keys():\n",
" #print(user)\n",
" l_xm = []\n",
" m_item = str(result[3]) \n",
" re_ta.setdefault(user,{}) \n",
@@ -279,7 +335,7 @@
" score = result[4] \n",
" re_ta[user][item_name]['成绩'] = score\n",
"\n",
"filename = 'data/result_陈庄检测人员.json'\n",
"filename = 'data/result_陈庄检测人员-2.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
@@ -295,15 +351,15 @@
},
{
"cell_type": "code",
"execution_count": 73,
"execution_count": 21,
"id": "c3b99428-00d5-45ea-9803-261194525fa4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:08:03.162240Z",
"iopub.status.busy": "2025-03-14T08:08:03.161488Z",
"iopub.status.idle": "2025-03-14T08:08:03.178033Z",
"shell.execute_reply": "2025-03-14T08:08:03.177422Z",
"shell.execute_reply.started": "2025-03-14T08:08:03.162173Z"
"iopub.execute_input": "2025-04-07T12:39:35.778154Z",
"iopub.status.busy": "2025-04-07T12:39:35.777362Z",
"iopub.status.idle": "2025-04-07T12:39:35.793555Z",
"shell.execute_reply": "2025-04-07T12:39:35.792548Z",
"shell.execute_reply.started": "2025-04-07T12:39:35.778096Z"
}
},
"outputs": [
@@ -322,7 +378,7 @@
"\n",
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_东营市老年大学第三期体质班.json'\n",
"filename = 'data/result_陈庄检测人员-2.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -345,7 +401,7 @@
" dict2[k][item_en]['score'] = My.cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_东营市老年大学第三期体质班.json'\n",
"filename = f'data/result_陈庄检测人员-2.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -433,15 +489,15 @@
},
{
"cell_type": "code",
"execution_count": 78,
"execution_count": 91,
"id": "891347c4-cd65-41f8-b5dd-b3ff3d1e249f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:17:25.959454Z",
"iopub.status.busy": "2025-03-14T08:17:25.958763Z",
"iopub.status.idle": "2025-03-14T08:17:25.994196Z",
"shell.execute_reply": "2025-03-14T08:17:25.993587Z",
"shell.execute_reply.started": "2025-03-14T08:17:25.959390Z"
"iopub.execute_input": "2025-03-19T11:41:43.991964Z",
"iopub.status.busy": "2025-03-19T11:41:43.991276Z",
"iopub.status.idle": "2025-03-19T11:41:44.009884Z",
"shell.execute_reply": "2025-03-19T11:41:44.008939Z",
"shell.execute_reply.started": "2025-03-19T11:41:43.991901Z"
}
},
"outputs": [
@@ -449,7 +505,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"87\n"
"7\n"
]
}
],
@@ -462,10 +518,10 @@
"\n",
"dict1 = {}\n",
"\n",
"filename = 'data/result_东营市老年大学第三期体质班.json'\n",
"filename = 'data/result_萃苑社区党群服务中心.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"filename = 'data/东营市老年大学第三期体质班.json'\n",
"filename = 'data/萃苑社区党群服务中心.json'\n",
"with open(filename,'r') as fl:\n",
" dict3 = json.load(fl)\n",
"\n",
@@ -475,7 +531,7 @@
" phone[v['phone']] = k\n",
"\n",
"list1 = []\n",
"filename = 'data/Survey_20250314.csv'\n",
"filename = 'data/Survey_20250319.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -531,7 +587,7 @@
" dict1[phone[item[2]]]['month'] = int(days/365*12)\n",
" #print(phone[item[2]])\n",
" nn+=1\n",
"filename = 'data/result_东营市老年大学第三期体质班-1.json'\n",
"filename = 'data/result_萃苑社区党群服务中心-1.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
@@ -828,15 +884,15 @@
},
{
"cell_type": "code",
"execution_count": 79,
"execution_count": 92,
"id": "327c33e2-7437-4421-b70c-ec98234a5e88",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-14T08:19:54.589069Z",
"iopub.status.busy": "2025-03-14T08:19:54.588348Z",
"iopub.status.idle": "2025-03-14T08:20:46.467552Z",
"shell.execute_reply": "2025-03-14T08:20:46.466556Z",
"shell.execute_reply.started": "2025-03-14T08:19:54.589004Z"
"iopub.execute_input": "2025-03-19T11:42:35.430535Z",
"iopub.status.busy": "2025-03-19T11:42:35.429862Z",
"iopub.status.idle": "2025-03-19T11:42:43.062551Z",
"shell.execute_reply": "2025-03-19T11:42:43.062030Z",
"shell.execute_reply.started": "2025-03-19T11:42:35.430472Z"
}
},
"outputs": [
@@ -844,7 +900,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"95\n"
"13\n"
]
}
],
@@ -857,11 +913,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_东营市老年大学第三期体质班-1.json'\n",
"filename = 'data/result_萃苑社区党群服务中心-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./东营市老年大学第三期体质班/'\n",
"file_path ='./萃苑社区党群服务中心/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -871,7 +927,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",
@@ -913,27 +969,18 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 18,
"id": "44a209a2-ca22-4a80-bbd9-37717347dfd5",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-03T06:41:43.203179Z",
"iopub.status.busy": "2025-03-03T06:41:43.202419Z",
"iopub.status.idle": "2025-03-03T06:41:43.225384Z",
"shell.execute_reply": "2025-03-03T06:41:43.224812Z",
"shell.execute_reply.started": "2025-03-03T06:41:43.203107Z"
"iopub.execute_input": "2025-04-07T12:35:07.556776Z",
"iopub.status.busy": "2025-04-07T12:35:07.556176Z",
"iopub.status.idle": "2025-04-07T12:35:08.133474Z",
"shell.execute_reply": "2025-04-07T12:35:08.132966Z",
"shell.execute_reply.started": "2025-04-07T12:35:07.556719Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"91\n",
"ok\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -943,11 +990,11 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_陈庄检测人员-1.json'\n",
"filename = 'data/result_陈庄检测人员-3.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"file_path ='./东营陈庄/'\n",
"file_path ='./东营陈庄3/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=0\n",
"list2 = []\n",
@@ -967,15 +1014,7 @@
" mydata['gender'] = 'female'\n",
" \n",
" mydata['month'] = v['month']\n",
" mydata['fits'] = {}\n",
" survey_list = ['tcm','psy_yangmiao_old','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",
@@ -985,20 +1024,91 @@
" 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",
" if len(mydata['fits']) >2 or 'surveys' in mydata.keys():\n",
" if len(mydata['fits']) >2 : \n",
" #if len(mydata['fits']) >2 or 'surveys' in mydata.keys():\n",
" list2.append(mydata)\n",
" \n",
" i+=1\n",
" #x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\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"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "7ee80847-2bc0-4cbe-9534-c5dcf97c2833",
"metadata": {
"execution": {
"iopub.execute_input": "2025-04-07T12:40:25.086716Z",
"iopub.status.busy": "2025-04-07T12:40:25.086178Z",
"iopub.status.idle": "2025-04-07T12:40:51.228212Z",
"shell.execute_reply": "2025-04-07T12:40:51.227012Z",
"shell.execute_reply.started": "2025-04-07T12:40:25.086666Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"56\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 ='./东营陈庄2/'\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",
" \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",
"filename = 'data/data_陈庄检测人员.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(list2, fl, ensure_ascii=False)\n",
"print(len(list2))\n",
"print('ok')"
"print(i)"
]
},
{