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

+53 -62
View File
@@ -10,15 +10,15 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 29,
"id": "3d5ddc7a-a331-438d-aa8d-1ad74c7250d0",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-15T11:30:29.780788Z",
"iopub.status.busy": "2025-03-15T11:30:29.780027Z",
"iopub.status.idle": "2025-03-15T11:30:29.813663Z",
"shell.execute_reply": "2025-03-15T11:30:29.813167Z",
"shell.execute_reply.started": "2025-03-15T11:30:29.780712Z"
"iopub.execute_input": "2025-03-23T12:04:07.998224Z",
"iopub.status.busy": "2025-03-23T12:04:07.997422Z",
"iopub.status.idle": "2025-03-23T12:04:08.037664Z",
"shell.execute_reply": "2025-03-23T12:04:08.037059Z",
"shell.execute_reply.started": "2025-03-23T12:04:07.998155Z"
}
},
"outputs": [
@@ -38,17 +38,21 @@
"wb = openpyxl.load_workbook('data/延庆测试名单.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"filename = 'data/延庆人员.json'\n",
"with open(filename,'r') as fl:\n",
" person = json.load(fl) \n",
"\n",
"\n",
"for n in range(2, sheet.max_row+1):\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, 4).value\n",
" dict1['birth'] = str(sheet.cell(n, 3).value).replace('/','-').split(' ')[0] \n",
" dict1['phone'] = str(sheet.cell(n, 5).value)\n",
" person[code] = dict1\n",
" if code not in person.keys():\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value\n",
" dict1['sex'] = sheet.cell(n, 4).value\n",
" dict1['birth'] = str(sheet.cell(n, 3).value).replace('/','-').split(' ')[0] \n",
" dict1['phone'] = str(sheet.cell(n, 5).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",
@@ -65,15 +69,15 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 30,
"id": "36aa14f9-cdfd-4ad4-a84e-9809c9db9958",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-15T11:53:27.327555Z",
"iopub.status.busy": "2025-03-15T11:53:27.327111Z",
"iopub.status.idle": "2025-03-15T11:53:27.348436Z",
"shell.execute_reply": "2025-03-15T11:53:27.347781Z",
"shell.execute_reply.started": "2025-03-15T11:53:27.327503Z"
"iopub.execute_input": "2025-03-23T12:05:05.752592Z",
"iopub.status.busy": "2025-03-23T12:05:05.751930Z",
"iopub.status.idle": "2025-03-23T12:05:05.764094Z",
"shell.execute_reply": "2025-03-23T12:05:05.763087Z",
"shell.execute_reply.started": "2025-03-23T12:05:05.752534Z"
}
},
"outputs": [
@@ -81,7 +85,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"14\n"
"34\n"
]
}
],
@@ -95,7 +99,7 @@
"filename = 'data/延庆人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20250315.csv'\n",
"filename = 'data/marks_20250323.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"filename = 'data/result_延庆人员.json'\n",
@@ -114,15 +118,15 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 31,
"id": "8f459ed3-fc14-404f-998b-5ed2a15958c3",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-15T11:30:35.367110Z",
"iopub.status.busy": "2025-03-15T11:30:35.366428Z",
"iopub.status.idle": "2025-03-15T11:30:35.380746Z",
"shell.execute_reply": "2025-03-15T11:30:35.379748Z",
"shell.execute_reply.started": "2025-03-15T11:30:35.367051Z"
"iopub.execute_input": "2025-03-23T12:05:25.676321Z",
"iopub.status.busy": "2025-03-23T12:05:25.673408Z",
"iopub.status.idle": "2025-03-23T12:05:25.698862Z",
"shell.execute_reply": "2025-03-23T12:05:25.697358Z",
"shell.execute_reply.started": "2025-03-23T12:05:25.676245Z"
}
},
"outputs": [
@@ -326,15 +330,15 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 27,
"id": "7c170e0e-e618-42b2-99ee-7b6f2ee34bb4",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-15T11:30:50.221964Z",
"iopub.status.busy": "2025-03-15T11:30:50.221472Z",
"iopub.status.idle": "2025-03-15T11:30:50.229690Z",
"shell.execute_reply": "2025-03-15T11:30:50.229155Z",
"shell.execute_reply.started": "2025-03-15T11:30:50.221936Z"
"iopub.execute_input": "2025-03-19T06:03:51.230034Z",
"iopub.status.busy": "2025-03-19T06:03:51.229318Z",
"iopub.status.idle": "2025-03-19T06:03:51.242666Z",
"shell.execute_reply": "2025-03-19T06:03:51.241497Z",
"shell.execute_reply.started": "2025-03-19T06:03:51.229965Z"
}
},
"outputs": [
@@ -342,7 +346,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"7\n"
"8\n"
]
}
],
@@ -355,7 +359,6 @@
"import my_module as My\n",
"\n",
"dict1 = {}\n",
"\n",
"filename = 'data/result_延庆人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
@@ -368,21 +371,13 @@
" if 'phone' in v.keys():\n",
" phone[v['phone']] = k\n",
"\n",
"list1 = []\n",
"filename = 'data/Survey_20250315.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
" for line in fl:\n",
" list1.append(line)\n",
"\n",
"data1 = My.get_wenjuan(list1,phone,dict1,dict3)\n",
"\n",
"data1 = My.get_wenjuan(filename,phone,dict1,dict3)\n",
"\n",
"filename = 'data/result_延庆人员-1.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(data1[0], fl, ensure_ascii=False)\n",
"print(data1[1])\n"
"print(data1[1])"
]
},
{
@@ -395,15 +390,15 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 32,
"id": "9e843585-fef3-4f5c-baae-76e711f2a42f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-15T11:31:04.247327Z",
"iopub.status.busy": "2025-03-15T11:31:04.246569Z",
"iopub.status.idle": "2025-03-15T11:31:12.426034Z",
"shell.execute_reply": "2025-03-15T11:31:12.425404Z",
"shell.execute_reply.started": "2025-03-15T11:31:04.247255Z"
"iopub.execute_input": "2025-03-23T12:06:54.063669Z",
"iopub.status.busy": "2025-03-23T12:06:54.062938Z",
"iopub.status.idle": "2025-03-23T12:07:09.016508Z",
"shell.execute_reply": "2025-03-23T12:07:09.015300Z",
"shell.execute_reply.started": "2025-03-23T12:06:54.063585Z"
}
},
"outputs": [
@@ -411,7 +406,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"14\n"
"32\n"
]
}
],
@@ -424,7 +419,7 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_延庆人员-1.json'\n",
"filename = 'data/result_延庆人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
@@ -445,8 +440,7 @@
" if v['sex'] == '男':\n",
" mydata['gender'] = 'male'\n",
" else:\n",
" mydata['gender'] = 'female'\n",
" \n",
" mydata['gender'] = 'female' \n",
" mydata['month'] = v['month']\n",
" mydata['fits'] = {}\n",
" survey_list = ['tcm','psy','spine']\n",
@@ -454,9 +448,6 @@
" 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",
@@ -465,14 +456,14 @@
" 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 or len(mydata['surveys']) >0:\n",
" if len(mydata['fits']) >2 or 'surveys' in mydata.keys():\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)"
]
@@ -480,7 +471,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7143c16b-6e45-4a10-a04c-6b90631ddfb0",
"id": "e67464a4-a588-4be4-9983-ac2555db08c4",
"metadata": {},
"outputs": [],
"source": []