20250304
This commit is contained in:
1 parent
82acaa07a8
commit
4da01b8af8
3 files changed
+901
-276
No files matched your search
+486
-96
@@ -10,15 +10,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"execution_count": 41,
|
||||
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T05:16:55.108154Z",
|
||||
"iopub.status.busy": "2024-12-23T05:16:55.107437Z",
|
||||
"iopub.status.idle": "2024-12-23T05:16:55.138579Z",
|
||||
"shell.execute_reply": "2024-12-23T05:16:55.138007Z",
|
||||
"shell.execute_reply.started": "2024-12-23T05:16:55.108086Z"
|
||||
"iopub.execute_input": "2025-03-03T06:31:35.177159Z",
|
||||
"iopub.status.busy": "2025-03-03T06:31:35.176415Z",
|
||||
"iopub.status.idle": "2025-03-03T06:31:35.214675Z",
|
||||
"shell.execute_reply": "2025-03-03T06:31:35.214069Z",
|
||||
"shell.execute_reply.started": "2025-03-03T06:31:35.177089Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -61,6 +61,63 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 57,
|
||||
"id": "5a98acbe-5f00-4ee0-99b2-7ff8d0caa3bc",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"125\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",
|
||||
" 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'] = sheet.cell(n, 7).value\n",
|
||||
" if sheet.cell(n,7).value is not None:\n",
|
||||
" dict1['unit'] = str(sheet.cell(n,7).value) \n",
|
||||
" else:\n",
|
||||
" dict1['unit'] = ' ' \n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\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": "markdown",
|
||||
"id": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f",
|
||||
@@ -71,27 +128,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 51,
|
||||
"execution_count": null,
|
||||
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T02:18:32.436129Z",
|
||||
"iopub.status.busy": "2024-12-23T02:18:32.435385Z",
|
||||
"iopub.status.idle": "2024-12-23T02:18:32.449327Z",
|
||||
"shell.execute_reply": "2024-12-23T02:18:32.448323Z",
|
||||
"shell.execute_reply.started": "2024-12-23T02:18:32.436058Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"67\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -148,6 +190,84 @@
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"id": "e2526429-e779-4ec5-8a0e-bea623f54f29",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-03-04T01:28:20.346704Z",
|
||||
"iopub.status.busy": "2025-03-04T01:28:20.345188Z",
|
||||
"iopub.status.idle": "2025-03-04T01:28:20.368327Z",
|
||||
"shell.execute_reply": "2025-03-04T01:28:20.367809Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:28:20.346598Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"115\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
"import csv\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"re_ta = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/marks_20250304.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",
|
||||
" #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n",
|
||||
" list1.append(line)\n",
|
||||
"\n",
|
||||
"for result in list1:\n",
|
||||
" user = str(result[2])\n",
|
||||
" rq = date.fromisoformat(result[5].replace('/','-'))\n",
|
||||
" if user in dict1.keys():\n",
|
||||
" l_xm = []\n",
|
||||
" m_item = str(result[3]) \n",
|
||||
" re_ta.setdefault(user,{}) \n",
|
||||
" re_ta[user]['name'] = dict1[user]['name']\n",
|
||||
" re_ta[user]['sex'] = dict1[user]['sex']\n",
|
||||
" re_ta[user]['birth'] = dict1[user]['birth']\n",
|
||||
" re_ta[user]['unit'] = dict1[user]['unit']\n",
|
||||
" if 'phone' in dict1[user].keys():\n",
|
||||
" re_ta[user]['phone'] = dict1[user]['phone']\n",
|
||||
" if dict1[user]['sex'] == '男':\n",
|
||||
" l_xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step']\n",
|
||||
" else:\n",
|
||||
" l_xm = ['bmi','lung','grip','flexion','jump','balance','reaction','step','situp']\n",
|
||||
" #re_ta[user]['unit'] = dict1[user]['unit']\n",
|
||||
" birth = date.fromisoformat(dict1[user]['birth'].replace('/','-'))\n",
|
||||
" item_name = result[3] \n",
|
||||
" if item_name in l_xm: \n",
|
||||
" days = (rq-birth).days \n",
|
||||
" re_ta[user]['age'] = int(days/365)\n",
|
||||
" re_ta[user]['month'] = int(days/365*12)\n",
|
||||
" re_ta[user]['rq'] = result[5]\n",
|
||||
" re_ta[user].setdefault(item_name,{}) \n",
|
||||
" score = result[4] \n",
|
||||
" re_ta[user][item_name]['成绩'] = score\n",
|
||||
"\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))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "74ec60b7-b1d9-488d-95fa-4ddd020c2a4c",
|
||||
@@ -158,15 +278,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 52,
|
||||
"execution_count": 59,
|
||||
"id": "c3b99428-00d5-45ea-9803-261194525fa4",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T02:18:35.914475Z",
|
||||
"iopub.status.busy": "2024-12-23T02:18:35.913744Z",
|
||||
"iopub.status.idle": "2024-12-23T02:18:35.934796Z",
|
||||
"shell.execute_reply": "2024-12-23T02:18:35.933710Z",
|
||||
"shell.execute_reply.started": "2024-12-23T02:18:35.914405Z"
|
||||
"iopub.execute_input": "2025-03-04T01:28:24.460728Z",
|
||||
"iopub.status.busy": "2025-03-04T01:28:24.459968Z",
|
||||
"iopub.status.idle": "2025-03-04T01:28:24.473509Z",
|
||||
"shell.execute_reply": "2025-03-04T01:28:24.472999Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:28:24.460657Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -185,7 +305,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_北体体质康健班202412.json'\n",
|
||||
"filename = 'data/result_陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for k, v in dict2.items():\n",
|
||||
@@ -208,7 +328,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_北体体质康健班202412.json'\n",
|
||||
"filename = f'data/result_陈庄检测人员.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2,fl , ensure_ascii=False) \n",
|
||||
"print('ok!') "
|
||||
@@ -224,15 +344,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 53,
|
||||
"execution_count": 60,
|
||||
"id": "0c60a509-dfc0-426a-a44e-e9a760139463",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T02:18:43.101468Z",
|
||||
"iopub.status.busy": "2024-12-23T02:18:43.100822Z",
|
||||
"iopub.status.idle": "2024-12-23T02:18:43.133068Z",
|
||||
"shell.execute_reply": "2024-12-23T02:18:43.132432Z",
|
||||
"shell.execute_reply.started": "2024-12-23T02:18:43.101408Z"
|
||||
"iopub.execute_input": "2025-03-04T01:28:32.981359Z",
|
||||
"iopub.status.busy": "2025-03-04T01:28:32.980597Z",
|
||||
"iopub.status.idle": "2025-03-04T01:28:33.024339Z",
|
||||
"shell.execute_reply": "2025-03-04T01:28:33.023768Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:28:32.981288Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -244,11 +364,11 @@
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北体体质康健班202412.json'\n",
|
||||
"filename = 'data/result_陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北体体质康健班202412.json'\n",
|
||||
"filename = 'data/陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
@@ -276,7 +396,7 @@
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/北体体质康健班体测情况表202412.xlsx'\n",
|
||||
"filename = 'data/陈庄检测人员20250303.xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -296,27 +416,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"execution_count": null,
|
||||
"id": "79fb7799-3693-4b7b-ae82-c0d8dee98d36",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-22T07:18:34.575061Z",
|
||||
"iopub.status.busy": "2024-12-22T07:18:34.574259Z",
|
||||
"iopub.status.idle": "2024-12-22T07:18:34.606759Z",
|
||||
"shell.execute_reply": "2024-12-22T07:18:34.606260Z",
|
||||
"shell.execute_reply.started": "2024-12-22T07:18:34.574981Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"71\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
@@ -326,10 +431,10 @@
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北体体质康健班202412.json'\n",
|
||||
"filename = 'data/result_陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"filename = 'data/北体体质康健班202412.json'\n",
|
||||
"filename = 'data/陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
@@ -339,7 +444,7 @@
|
||||
" phone[v['phone']] = k\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20241220.csv'\n",
|
||||
"filename = 'data/Survey_20250303.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -348,7 +453,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"nn = 0\n",
|
||||
"for item in list1:\n",
|
||||
" if item[2] in phone.keys():\n",
|
||||
" psy =[]\n",
|
||||
@@ -400,11 +505,120 @@
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[phone[item[2]]]['age'] = int(days/365)\n",
|
||||
" dict1[phone[item[2]]]['month'] = int(days/365*12)\n",
|
||||
"filename = 'data/result_北体体质康健班202412-1.json'\n",
|
||||
" #print(phone[item[2]])\n",
|
||||
" nn+=1\n",
|
||||
"filename = 'data/result_陈庄检测人员-1.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print(len(dict1))"
|
||||
"print(nn)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"id": "891347c4-cd65-41f8-b5dd-b3ff3d1e249f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-03-04T01:34:28.818217Z",
|
||||
"iopub.status.busy": "2025-03-04T01:34:28.817471Z",
|
||||
"iopub.status.idle": "2025-03-04T01:34:28.854884Z",
|
||||
"shell.execute_reply": "2025-03-04T01:34:28.854277Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:34:28.818153Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"83\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\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",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
"phone = {}\n",
|
||||
"for k,v in dict3.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" phone[v['phone']] = k\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20250303.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",
|
||||
"\n",
|
||||
"\n",
|
||||
"nn = 0\n",
|
||||
"for item in list1:\n",
|
||||
" if item[2] in phone.keys():\n",
|
||||
" psy =[]\n",
|
||||
" tcm = []\n",
|
||||
" spine = []\n",
|
||||
" for i in range(0,30):\n",
|
||||
" psy.append(0)\n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" for i in range(0,26):\n",
|
||||
" spine.append(0)\n",
|
||||
" \n",
|
||||
" content = json.loads(item[5])\n",
|
||||
" if phone[item[2]] not in dict1.keys():\n",
|
||||
" dict1[phone[item[2]]] = dict3[phone[item[2]]]\n",
|
||||
" rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
|
||||
" dict1[phone[item[2]]]['rq'] = item[6].replace('/','-').split(' ')[0]\n",
|
||||
" for k, v in content.items():\n",
|
||||
" if 'psyOld' in k:\n",
|
||||
" i = int(k[6:])\n",
|
||||
" psy[i-1] = int(v)\n",
|
||||
" if 'tcm' in k:\n",
|
||||
" i = int(k[3:])\n",
|
||||
" tcm[i-1] = int(v)\n",
|
||||
" if 'spine' in k:\n",
|
||||
" i = int(k[5:])\n",
|
||||
" spine[i-1] = int(v)\n",
|
||||
" if 'psyOld' in item[5]:\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" dict1[phone[item[2]]]['psy_yangmiao_old'] = psy\n",
|
||||
" if 'tcm' in item[5]:\n",
|
||||
" \n",
|
||||
" dict1[phone[item[2]]]['tcm'] = tcm\n",
|
||||
" if 'spine' in item[5]:\n",
|
||||
" for ii in range(25,23,-1):\n",
|
||||
" spine[ii] = spine[ii-1]\n",
|
||||
" spine[22] = 0 \n",
|
||||
" dict1[phone[item[2]]]['spine'] = spine\n",
|
||||
" birth = date.fromisoformat(dict3[phone[item[2]]]['birth'].replace('/','-'))\n",
|
||||
" \n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[phone[item[2]]]['age'] = int(days/365)\n",
|
||||
" dict1[phone[item[2]]]['month'] = int(days/365*12)\n",
|
||||
" #print(phone[item[2]])\n",
|
||||
" nn+=1\n",
|
||||
"filename = 'data/result_陈庄检测人员-1.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print(nn)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -468,16 +682,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"id": "eb4091f4-9823-4361-acb2-f3e898f9524b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-22T00:37:03.115402Z",
|
||||
"iopub.status.busy": "2024-12-22T00:37:03.114604Z",
|
||||
"iopub.status.idle": "2024-12-22T00:37:03.144709Z",
|
||||
"shell.execute_reply": "2024-12-22T00:37:03.144175Z",
|
||||
"shell.execute_reply.started": "2024-12-22T00:37:03.115323Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -588,6 +795,112 @@
|
||||
" json.dump(dict1, fl, ensure_ascii=False) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a26a0a2b-c10e-4acf-bce9-902d16669b91",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北体体质康健班202412.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20241220.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",
|
||||
"#print(list1)\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"for item in list1:\n",
|
||||
" psy = []\n",
|
||||
" tcm = []\n",
|
||||
" spine = []\n",
|
||||
" for i in range(0,45):\n",
|
||||
" psy.append(0)\n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" for i in range(0,26):\n",
|
||||
" spine.append(0)\n",
|
||||
" phone = item[2]\n",
|
||||
" for k1, v1 in dict3.items():\n",
|
||||
" if 'phone' in v1.keys() and phone ==v1['phone']: \n",
|
||||
" dict1[k1] = dict3[k1]\n",
|
||||
" #dict1[k1]['month'] = dict1[k1]['age'] *12\n",
|
||||
"#print(dict1)\n",
|
||||
"for item in list1:\n",
|
||||
" #print(item)\n",
|
||||
" psy = []\n",
|
||||
" tcm = []\n",
|
||||
" spine = []\n",
|
||||
" for i in range(0,45):\n",
|
||||
" psy.append(0)\n",
|
||||
" for i in range(0,60):\n",
|
||||
" tcm.append(0)\n",
|
||||
" for i in range(0,26):\n",
|
||||
" spine.append(0)\n",
|
||||
" phone = item[2]\n",
|
||||
" for k1, v1 in dict1.items():\n",
|
||||
" #print((k1,v1))\n",
|
||||
" if 'phone' in v1.keys() and phone ==v1['phone']: \n",
|
||||
" content = json.loads(item[5])\n",
|
||||
" #print(content)\n",
|
||||
" \n",
|
||||
" rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
|
||||
" #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
|
||||
" for k, v in content.items():\n",
|
||||
" #print('k:',k,'v:',v)\n",
|
||||
" if 'psyOld' in k: \n",
|
||||
" i = int(k[6:])\n",
|
||||
" psy[i-1] = int(v)\n",
|
||||
" if 'tcm' in k: \n",
|
||||
" i = int(k[3:])\n",
|
||||
" tcm[i-1] = int(v)\n",
|
||||
" if 'spine' in k:\n",
|
||||
" i = int(k[5:])\n",
|
||||
" spine[i-1] = int(v)\n",
|
||||
" if 'psyOld' in item[5]:\n",
|
||||
" \n",
|
||||
" dict1[k1]['psy'] = psy\n",
|
||||
" if 'tcm' in item[5]:\n",
|
||||
" \n",
|
||||
" dict1[k1]['tcm'] = tcm\n",
|
||||
" if 'spine' in item[5]:\n",
|
||||
" for ii in range(25,23,-1):\n",
|
||||
" \n",
|
||||
" spine[ii] = spine[ii-1]\n",
|
||||
" \n",
|
||||
" spine[22] = 0\n",
|
||||
" \n",
|
||||
" \n",
|
||||
" \n",
|
||||
" dict1[k1]['spine'] = spine\n",
|
||||
" #birth = date.fromisoformat(dict3[k1]['birth'].replace('/','-'))\n",
|
||||
"\n",
|
||||
" #days = (rq-birth).days \n",
|
||||
" #dict1[k1]['age'] = int(days/365)\n",
|
||||
" \n",
|
||||
" dict1[k1]['rq'] = item[6].replace('/','-').split(' ')[0]\n",
|
||||
"#print(dict1)\n",
|
||||
"filename = 'data/result_北体体质康健班202412-1.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "85d087e3-c469-409e-893b-a22789d73613",
|
||||
@@ -598,15 +911,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 50,
|
||||
"execution_count": 62,
|
||||
"id": "327c33e2-7437-4421-b70c-ec98234a5e88",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-22T07:18:54.900729Z",
|
||||
"iopub.status.busy": "2024-12-22T07:18:54.899962Z",
|
||||
"iopub.status.idle": "2024-12-22T07:19:29.111150Z",
|
||||
"shell.execute_reply": "2024-12-22T07:19:29.110336Z",
|
||||
"shell.execute_reply.started": "2024-12-22T07:18:54.900656Z"
|
||||
"iopub.execute_input": "2025-03-04T01:34:56.351921Z",
|
||||
"iopub.status.busy": "2025-03-04T01:34:56.351159Z",
|
||||
"iopub.status.idle": "2025-03-04T01:36:01.625317Z",
|
||||
"shell.execute_reply": "2025-03-04T01:36:01.624114Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:34:56.351849Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -614,7 +927,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"71\n"
|
||||
"116\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -627,11 +940,11 @@
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_北体体质康健班202412-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 ='./北体体质康健班202412/'\n",
|
||||
"file_path ='./东营陈庄/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
@@ -641,7 +954,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",
|
||||
@@ -668,8 +981,9 @@
|
||||
" 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 : \n",
|
||||
" if len(mydata['fits']) >2 or 'surveys' in mydata.keys():\n",
|
||||
" list1.append(mydata)\n",
|
||||
" list2.append([k,v['name']])\n",
|
||||
" i+=1\n",
|
||||
@@ -681,24 +995,100 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "raw",
|
||||
"id": "640b2865-5739-464b-ac51-0ffc49adb00f",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"91\n",
|
||||
"ok\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_陈庄检测人员-1.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_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",
|
||||
" 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",
|
||||
" 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",
|
||||
" #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')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 88,
|
||||
"execution_count": null,
|
||||
"id": "46ff1333-f051-4022-a765-e0964a2ee427",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-24T14:45:09.893552Z",
|
||||
"iopub.status.busy": "2024-12-24T14:45:09.892819Z",
|
||||
"iopub.status.idle": "2024-12-24T14:45:09.940625Z",
|
||||
"shell.execute_reply": "2024-12-24T14:45:09.940171Z",
|
||||
"shell.execute_reply.started": "2024-12-24T14:45:09.893481Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
|
||||
+270
-180
@@ -14,11 +14,11 @@
|
||||
"id": "360f0a97-d73d-43f3-9f7a-0f9582103c82",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T02:35:15.481801Z",
|
||||
"iopub.status.busy": "2024-12-23T02:35:15.481073Z",
|
||||
"iopub.status.idle": "2024-12-23T02:35:15.588908Z",
|
||||
"shell.execute_reply": "2024-12-23T02:35:15.588281Z",
|
||||
"shell.execute_reply.started": "2024-12-23T02:35:15.481732Z"
|
||||
"iopub.execute_input": "2025-03-04T01:13:15.511726Z",
|
||||
"iopub.status.busy": "2025-03-04T01:13:15.510982Z",
|
||||
"iopub.status.idle": "2025-03-04T01:13:15.594359Z",
|
||||
"shell.execute_reply": "2025-03-04T01:13:15.593901Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:13:15.511654Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -30,10 +30,10 @@
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"mycol = mydb[\"place\"]\n",
|
||||
"\n",
|
||||
"place_id = 141002\n",
|
||||
"place_code = \"15\"\n",
|
||||
"dw_name = \"北体体质康健班\"\n",
|
||||
"dw_jc = \"北体体质康健班\"\n",
|
||||
"place_id = 250226\n",
|
||||
"place_code = \"16\"\n",
|
||||
"dw_name = \"山东东营陈庄镇\"\n",
|
||||
"dw_jc = \"山东东营陈庄镇\"\n",
|
||||
"myquery = { \"id\": place_id }\n",
|
||||
"num = mycol.count_documents(myquery)\n",
|
||||
"if num>0:\n",
|
||||
@@ -53,15 +53,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 2,
|
||||
"id": "6ce2cbc7-435a-461c-bdb8-abd9a6962fbc",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T02:37:43.114677Z",
|
||||
"iopub.status.busy": "2024-12-23T02:37:43.113786Z",
|
||||
"iopub.status.idle": "2024-12-23T02:37:43.138884Z",
|
||||
"shell.execute_reply": "2024-12-23T02:37:43.138013Z",
|
||||
"shell.execute_reply.started": "2024-12-23T02:37:43.114598Z"
|
||||
"iopub.execute_input": "2025-03-04T01:47:46.378353Z",
|
||||
"iopub.status.busy": "2025-03-04T01:47:46.377604Z",
|
||||
"iopub.status.idle": "2025-03-04T01:47:46.556327Z",
|
||||
"shell.execute_reply": "2025-03-04T01:47:46.555855Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:47:46.378281Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -69,7 +69,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"71 ok\n"
|
||||
"116 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -86,10 +86,10 @@
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"\n",
|
||||
"place_id = 141002\n",
|
||||
"place_code = \"15\"\n",
|
||||
"dw_name = \"北体体质康健班\"\n",
|
||||
"dw_jc = \"北体体质康健班\"\n",
|
||||
"place_id = 250226\n",
|
||||
"place_code = \"16\"\n",
|
||||
"dw_name = \"山东东营陈庄镇\"\n",
|
||||
"dw_jc = \"山东东营陈庄镇\"\n",
|
||||
"fi_path = '/home/songyi/python/mycrm/flask/pdf/files'\n",
|
||||
"fls = glob.glob(f'{fi_path}/{str(place_id)}/*.pdf')\n",
|
||||
"\n",
|
||||
@@ -137,15 +137,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 3,
|
||||
"id": "5f665c0f-8d30-4759-b7f8-fb7e13b98efa",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T05:43:17.023291Z",
|
||||
"iopub.status.busy": "2024-12-23T05:43:17.022726Z",
|
||||
"iopub.status.idle": "2024-12-23T05:43:17.056324Z",
|
||||
"shell.execute_reply": "2024-12-23T05:43:17.055498Z",
|
||||
"shell.execute_reply.started": "2024-12-23T05:43:17.023237Z"
|
||||
"iopub.execute_input": "2025-03-04T01:54:43.144665Z",
|
||||
"iopub.status.busy": "2025-03-04T01:54:43.143709Z",
|
||||
"iopub.status.idle": "2025-03-04T01:54:43.267863Z",
|
||||
"shell.execute_reply": "2025-03-04T01:54:43.267357Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:54:43.144573Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -154,77 +154,122 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1 15552778879 87-韩秋春.pdf 157481\n",
|
||||
"2 13176607576 40-聂秋香.pdf 150269\n",
|
||||
"3 13515466253 20-成桂艳.pdf 154130\n",
|
||||
"4 13356838977 45-齐立红.pdf 159017\n",
|
||||
"5 15505463267 6-刘来珍.pdf 151957\n",
|
||||
"6 15618032716 72-林娟.pdf 153582\n",
|
||||
"7 13001564985 23-李慧珠.pdf 153760\n",
|
||||
"8 13854609739 85-连海燕.pdf 156827\n",
|
||||
"9 13605461196 50-刘瑛.pdf 159238\n",
|
||||
"10 13697833655 48-刘其英.pdf 157409\n",
|
||||
"11 18654608681 68-张桂芝.pdf 157534\n",
|
||||
"12 13561099637 9-吕建国.pdf 157281\n",
|
||||
"13 13589970661 30-王争华.pdf 151934\n",
|
||||
"14 15666215813 5-刘晓红.pdf 152476\n",
|
||||
"15 15954638716 41-胡桂凤.pdf 153278\n",
|
||||
"16 13793983616 80-董希娥.pdf 150362\n",
|
||||
"17 18661395568 56-娄金华.pdf 153028\n",
|
||||
"18 15006966879 38-耿宏勋.pdf 154872\n",
|
||||
"19 13006548397 15-宋立君.pdf 155673\n",
|
||||
"20 13054610560 88-马国丽.pdf 153905\n",
|
||||
"21 13864711691 11-吴晓燕.pdf 156580\n",
|
||||
"22 13013569039 39-耿红霞.pdf 155263\n",
|
||||
"23 13356615748 17-张桂荣.pdf 150152\n",
|
||||
"24 13589961337 35-王霞.pdf 152574\n",
|
||||
"25 13678611392 34-王金美.pdf 152549\n",
|
||||
"26 13963356165 31-王春爱.pdf 156502\n",
|
||||
"27 13589986778 26-杨素华.pdf 158590\n",
|
||||
"28 13361512362 77-秦春霞.pdf 154059\n",
|
||||
"29 13054658622 86-郗桂红.pdf 157145\n",
|
||||
"30 18661378656 54-周春萍.pdf 154763\n",
|
||||
"31 15154636366 25-李红霞.pdf 156873\n",
|
||||
"32 18654698789 37-罗秀艳.pdf 150825\n",
|
||||
"33 13054652092 8-卢霞.pdf 159367\n",
|
||||
"34 15610063229 7-刘英.pdf 159386\n",
|
||||
"35 13963359769 1-万秀香.pdf 156540\n",
|
||||
"36 18554659267 47-任大华.pdf 156039\n",
|
||||
"37 18661376637 18-张秀玉.pdf 157206\n",
|
||||
"38 18611391991 71-朱兰生.pdf 153617\n",
|
||||
"39 13563399566 67-张伟.pdf 158436\n",
|
||||
"40 15263888916 36-生月华.pdf 150476\n",
|
||||
"41 13210319979 33-王海燕.pdf 155632\n",
|
||||
"42 13561020118 84-赵立静.pdf 156825\n",
|
||||
"43 13371503039 53-吕鸿义.pdf 159602\n",
|
||||
"44 13864791829 75-王翠云.pdf 151079\n",
|
||||
"45 18705469686 42-范晓英.pdf 157035\n",
|
||||
"46 13706366656 57-孙家祥.pdf 153718\n",
|
||||
"47 18554718350 63-宋秀娟.pdf 152087\n",
|
||||
"48 13792060709 76-盖荣.pdf 153519\n",
|
||||
"49 18860629985 46-于瑞先.pdf 154058\n",
|
||||
"50 15314347726 55-姜英.pdf 151762\n",
|
||||
"51 13854650187 32-王毅.pdf 159436\n",
|
||||
"52 15020597108 78-程茂霞.pdf 153264\n",
|
||||
"53 15606470366 73-温建华.pdf 155470\n",
|
||||
"54 13945664258 49-刘桂君.pdf 150794\n",
|
||||
"55 18554660557 65-巴建云.pdf 154836\n",
|
||||
"56 15105468997 14-宋清贤.pdf 151746\n",
|
||||
"57 13963370053 16-张德芳.pdf 158790\n",
|
||||
"58 13864707888 60-宁振莹.pdf 151487\n",
|
||||
"59 13906472659 64-尚国勋.pdf 150875\n",
|
||||
"60 13963350118 12-唐慧芳.pdf 152738\n",
|
||||
"61 13356645705 29-牛春芳.pdf 153915\n",
|
||||
"62 13054625519 89-黄启江.pdf 150912\n",
|
||||
"63 15666210207 81-袁庆敏.pdf 157248\n",
|
||||
"64 15954620216 44-雒云秀.pdf 156738\n",
|
||||
"65 13562277856 22-朱振峰.pdf 155413\n",
|
||||
"66 13181996942 70-曹玉英.pdf 151820\n",
|
||||
"67 18653699788 27-林乐武.pdf 151893\n",
|
||||
"68 13589432668 83-赵福珍.pdf 156124\n",
|
||||
"69 13563376888 3-伊茂胜.pdf 156285\n",
|
||||
"70 13375466356 13-孟凡业.pdf 150571\n",
|
||||
"71 13854664965 4-刘学农.pdf 151763\n"
|
||||
"1 17354672396 0108-徐中华.pdf 160486\n",
|
||||
"2 13563358955 0103-薄友梅.pdf 163176\n",
|
||||
"3 13561096259 0095-王天成.pdf 162197\n",
|
||||
"4 13371558516 0047-刘芳.pdf 160524\n",
|
||||
"5 14768999777 0112-杨国良.pdf 168926\n",
|
||||
"6 17754600886 0094-崔明波.pdf 167621\n",
|
||||
"7 18562083357 0053-梁文硕.pdf 162163\n",
|
||||
"8 15550539133 0097-李燕.pdf 166914\n",
|
||||
"9 18254652100 0074-王鲁笑.pdf 160615\n",
|
||||
"10 13625462769 0005-李卫忠.pdf 167935\n",
|
||||
"11 15266065108 0044-纪荣平.pdf 166395\n",
|
||||
"12 17754684486 0063-孙霞.pdf 165102\n",
|
||||
"13 15318307578 0018-冯海华.pdf 163802\n",
|
||||
"14 13561011787 0033-石振波.pdf 168039\n",
|
||||
"15 13561006241 0041-薛真.pdf 167614\n",
|
||||
"16 15965466216 0111-李培荣.pdf 167615\n",
|
||||
"17 18562961538 0093-李乐.pdf 168561\n",
|
||||
"18 13465269869 0015-王翠霞.pdf 163169\n",
|
||||
"19 17754629112 0054-孟玲.pdf 162869\n",
|
||||
"20 18554626567 0122-刘建云.pdf 161832\n",
|
||||
"21 15318391717 0080-李小青.pdf 166590\n",
|
||||
"22 17754629138 0067-牟艳红.pdf 166379\n",
|
||||
"23 17754629077 0062-胡振云.pdf 162831\n",
|
||||
"24 17754651259 0124-王学晴.pdf 169650\n",
|
||||
"25 15254633988 0009-张伟花.pdf 164287\n",
|
||||
"26 18562007818 0083-蔻艳.pdf 167918\n",
|
||||
"27 18654691866 0001-陈彤彤.pdf 166271\n",
|
||||
"28 18954628871 0100-张玉荣.pdf 167910\n",
|
||||
"29 19854689029 0082-陈希珍.pdf 164523\n",
|
||||
"30 15154681871 0010-王兰玉.pdf 167460\n",
|
||||
"31 13780756776 0023-张仕荣.pdf 164763\n",
|
||||
"32 15154622086 0077-孙义芬.pdf 164789\n",
|
||||
"33 13455721686 0036-陈光梅.pdf 162051\n",
|
||||
"34 13475465246 0064-李铭悦.pdf 164913\n",
|
||||
"35 13181857658 0116-韩书贞.pdf 165482\n",
|
||||
"36 13562298356 0084-胡冰叶.pdf 165170\n",
|
||||
"37 18562961552 0101-王乃玲.pdf 161429\n",
|
||||
"38 13371528169 0042-刘志芳.pdf 167682\n",
|
||||
"39 17754629165 0048-徐雪花.pdf 165471\n",
|
||||
"40 13256477708 0117-崔树红.pdf 161758\n",
|
||||
"41 13356619896 0114-陈延红.pdf 167963\n",
|
||||
"42 13287371168 0038-王守美.pdf 166920\n",
|
||||
"43 15715468750 0006-韩小荣.pdf 168734\n",
|
||||
"44 15154619169 0079-刘桂.pdf 164271\n",
|
||||
"45 17754629082 0070-王芳.pdf 168370\n",
|
||||
"46 15306476627 0055-张韶岩.pdf 166984\n",
|
||||
"47 13705467605 0126-巴月华.pdf 160364\n",
|
||||
"48 17754629057 0065-商孟加.pdf 161934\n",
|
||||
"49 19963763561 0123-陈建正.pdf 160236\n",
|
||||
"50 13325059838 0025-崔志猛.pdf 162853\n",
|
||||
"51 15318328975 0040-王元.pdf 163259\n",
|
||||
"52 13205471255 0029-张秀奎.pdf 165897\n",
|
||||
"53 13361503856 0102-宋珊珊.pdf 167024\n",
|
||||
"54 18954680512 0059-孟祥菊.pdf 162648\n",
|
||||
"55 13465275185 0060-张春先.pdf 169518\n",
|
||||
"56 13361522787 0069-王明杰.pdf 165038\n",
|
||||
"57 13054610918 0057-郭立凯.pdf 168106\n",
|
||||
"58 18506466571 0091-赵培芬.pdf 166937\n",
|
||||
"59 13181854171 0107-董强.pdf 168902\n",
|
||||
"60 13210388535 0071-刘俊志.pdf 161024\n",
|
||||
"61 13306475903 0072-王芹.pdf 163160\n",
|
||||
"62 15965465758 0043-郭振芹.pdf 165241\n",
|
||||
"63 13355460615 0035-李跃粉.pdf 165670\n",
|
||||
"64 18266665051 0052-王一涵.pdf 162679\n",
|
||||
"65 13054600511 0125-季书奎.pdf 164526\n",
|
||||
"66 15314325556 0045-张绪民.pdf 163645\n",
|
||||
"67 13963355696 0118-王兴业.pdf 163275\n",
|
||||
"68 13081417578 0028-李召兰.pdf 168653\n",
|
||||
"69 15965466030 0086-陈春华.pdf 165723\n",
|
||||
"70 15254639986 0014-陈召云.pdf 164920\n",
|
||||
"71 13792069959 0016-崔士叶.pdf 163204\n",
|
||||
"72 13905465022 0075-孙丽.pdf 165792\n",
|
||||
"73 17754629228 0088-陈奎霞.pdf 164810\n",
|
||||
"74 15154623768 0017-崔业常.pdf 166814\n",
|
||||
"75 15965466216 0032-李培荣.pdf 164150\n",
|
||||
"76 13864785309 0115-杨建军.pdf 162097\n",
|
||||
"77 15990986892 0104-林燕燕.pdf 169407\n",
|
||||
"78 18764586870 0056-曹志捷.pdf 168719\n",
|
||||
"79 15315038808 0119-韩永强.pdf 165184\n",
|
||||
"80 18562961530 0106-张玉军.pdf 169036\n",
|
||||
"81 13054673678 0039-王新娥.pdf 167120\n",
|
||||
"82 13706470006 0024-毕玉江.pdf 165769\n",
|
||||
"83 13954696798 0008-陈振玉.pdf 163164\n",
|
||||
"84 18766719018 0092-程艳娟.pdf 162109\n",
|
||||
"85 17754629160 0090-徐妮.pdf 162709\n",
|
||||
"86 15954759855 0019-陈新英.pdf 162859\n",
|
||||
"87 13375461776 0022-盖新茂.pdf 164270\n",
|
||||
"88 15954671399 0121-韩秀娥.pdf 168275\n",
|
||||
"89 18954680397 0046-尚玉兰.pdf 161083\n",
|
||||
"90 13561016489 0020-王乐花.pdf 164631\n",
|
||||
"91 18860673506 0012-崔桂灵.pdf 163906\n",
|
||||
"92 15665876948 0051-薄尊敏.pdf 165219\n",
|
||||
"93 17754629197 0096-吴松.pdf 167890\n",
|
||||
"94 18865467781 0098-徐雪梅.pdf 167148\n",
|
||||
"95 17754629133 0068-李艳红.pdf 161483\n",
|
||||
"96 17754600676 0066-吴根林.pdf 166370\n",
|
||||
"97 13561086165 0004-李伟军.pdf 164165\n",
|
||||
"98 15605469730 0089-曹莹莹.pdf 164137\n",
|
||||
"99 17754629176 0050-徐凤霞.pdf 161527\n",
|
||||
"100 13220505818 0026-霍卫华.pdf 160537\n",
|
||||
"101 15154655057 0085-左连亮.pdf 168761\n",
|
||||
"102 15275640625 0120-石东初.pdf 164391\n",
|
||||
"103 13562257108 0081-李英霞.pdf 165483\n",
|
||||
"104 15318382108 0087-刘肖丽.pdf 160973\n",
|
||||
"105 13625462769 0109-李卫忠.pdf 167350\n",
|
||||
"106 17754600760 0061-胡菲菲.pdf 169176\n",
|
||||
"107 13006548466 0037-李振琴.pdf 162870\n",
|
||||
"108 18954676358 0058-赵凯.pdf 167032\n",
|
||||
"109 15552779321 0105-刘胜彩.pdf 163867\n",
|
||||
"110 13563395385 0027-王振泉.pdf 164018\n",
|
||||
"111 19854689027 0078-张卫卫.pdf 164520\n",
|
||||
"112 17754629226 0049-蔡立庆.pdf 169251\n",
|
||||
"113 13406089611 0076-王宪芳.pdf 168925\n",
|
||||
"114 17754665865 0073-韩霞.pdf 161576\n",
|
||||
"115 13963351053 0099-韩英.pdf 160826\n",
|
||||
"116 17754629175 0034-段德引.pdf 162306\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -242,8 +287,8 @@
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"mycol = mydb[\"pdf\"]\n",
|
||||
"\n",
|
||||
"dw_jc = \"北体体质康健班学员\"\n",
|
||||
"filename = 'data/北体体质康健班202412.json'\n",
|
||||
"dw_jc = \"山东东营陈庄镇测试者\"\n",
|
||||
"filename = 'data/陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"dict2 = {}\n",
|
||||
@@ -303,15 +348,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 4,
|
||||
"id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-12-23T05:43:33.444175Z",
|
||||
"iopub.status.busy": "2024-12-23T05:43:33.443420Z",
|
||||
"iopub.status.idle": "2024-12-23T06:01:33.534050Z",
|
||||
"shell.execute_reply": "2024-12-23T06:01:33.532110Z",
|
||||
"shell.execute_reply.started": "2024-12-23T05:43:33.444103Z"
|
||||
"iopub.execute_input": "2025-03-04T01:57:31.101633Z",
|
||||
"iopub.status.busy": "2025-03-04T01:57:31.100873Z",
|
||||
"iopub.status.idle": "2025-03-04T02:07:35.250788Z",
|
||||
"shell.execute_reply": "2025-03-04T02:07:35.248854Z",
|
||||
"shell.execute_reply.started": "2025-03-04T01:57:31.101547Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -320,77 +365,122 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"15552778879 157481 send success\n",
|
||||
"13176607576 150269 send success\n",
|
||||
"13515466253 154130 send success\n",
|
||||
"13356838977 159017 send success\n",
|
||||
"15505463267 151957 send success\n",
|
||||
"15618032716 153582 send success\n",
|
||||
"13001564985 153760 send success\n",
|
||||
"13854609739 156827 send success\n",
|
||||
"13605461196 159238 send success\n",
|
||||
"13697833655 157409 send success\n",
|
||||
"18654608681 157534 send success\n",
|
||||
"13561099637 157281 send success\n",
|
||||
"13589970661 151934 send success\n",
|
||||
"15666215813 152476 send success\n",
|
||||
"15954638716 153278 send success\n",
|
||||
"13793983616 150362 send success\n",
|
||||
"18661395568 153028 send success\n",
|
||||
"15006966879 154872 send success\n",
|
||||
"13006548397 155673 send success\n",
|
||||
"13054610560 153905 send success\n",
|
||||
"13864711691 156580 send success\n",
|
||||
"13013569039 155263 send success\n",
|
||||
"13356615748 150152 send success\n",
|
||||
"13589961337 152574 send success\n",
|
||||
"13678611392 152549 send success\n",
|
||||
"13963356165 156502 send success\n",
|
||||
"13589986778 158590 send success\n",
|
||||
"13361512362 154059 send success\n",
|
||||
"13054658622 157145 send success\n",
|
||||
"18661378656 154763 send success\n",
|
||||
"15154636366 156873 send success\n",
|
||||
"18654698789 150825 send success\n",
|
||||
"13054652092 159367 send success\n",
|
||||
"15610063229 159386 send success\n",
|
||||
"13963359769 156540 send success\n",
|
||||
"18554659267 156039 send success\n",
|
||||
"18661376637 157206 send success\n",
|
||||
"18611391991 153617 send success\n",
|
||||
"13563399566 158436 send success\n",
|
||||
"15263888916 150476 send success\n",
|
||||
"13210319979 155632 send success\n",
|
||||
"13561020118 156825 send success\n",
|
||||
"13371503039 159602 send success\n",
|
||||
"13864791829 151079 send success\n",
|
||||
"18705469686 157035 send success\n",
|
||||
"13706366656 153718 send success\n",
|
||||
"18554718350 152087 send success\n",
|
||||
"13792060709 153519 send success\n",
|
||||
"18860629985 154058 send success\n",
|
||||
"15314347726 151762 send success\n",
|
||||
"13854650187 159436 send success\n",
|
||||
"15020597108 153264 send success\n",
|
||||
"15606470366 155470 send success\n",
|
||||
"13945664258 150794 send success\n",
|
||||
"18554660557 154836 send success\n",
|
||||
"15105468997 151746 send success\n",
|
||||
"13963370053 158790 send success\n",
|
||||
"13864707888 151487 send success\n",
|
||||
"13906472659 150875 send success\n",
|
||||
"13963350118 152738 send success\n",
|
||||
"13356645705 153915 send success\n",
|
||||
"13054625519 150912 send success\n",
|
||||
"15666210207 157248 send success\n",
|
||||
"15954620216 156738 send success\n",
|
||||
"13562277856 155413 send success\n",
|
||||
"13181996942 151820 send success\n",
|
||||
"18653699788 151893 send success\n",
|
||||
"13589432668 156124 send success\n",
|
||||
"13563376888 156285 send success\n",
|
||||
"13375466356 150571 send success\n",
|
||||
"13854664965 151763 send success\n"
|
||||
"17354672396 160486 send success\n",
|
||||
"13563358955 163176 send success\n",
|
||||
"13561096259 162197 send success\n",
|
||||
"13371558516 160524 send success\n",
|
||||
"14768999777 168926 send success\n",
|
||||
"17754600886 167621 send success\n",
|
||||
"18562083357 162163 send success\n",
|
||||
"15550539133 166914 send success\n",
|
||||
"18254652100 160615 send success\n",
|
||||
"13625462769 167935 send success\n",
|
||||
"15266065108 166395 send success\n",
|
||||
"17754684486 165102 send success\n",
|
||||
"15318307578 163802 send success\n",
|
||||
"13561011787 168039 send success\n",
|
||||
"13561006241 167614 send success\n",
|
||||
"15965466216 167615 send success\n",
|
||||
"18562961538 168561 send success\n",
|
||||
"13465269869 163169 send success\n",
|
||||
"17754629112 162869 send success\n",
|
||||
"18554626567 161832 send success\n",
|
||||
"15318391717 166590 send success\n",
|
||||
"17754629138 166379 send success\n",
|
||||
"17754629077 162831 send success\n",
|
||||
"17754651259 169650 send success\n",
|
||||
"15254633988 164287 send success\n",
|
||||
"18562007818 167918 send success\n",
|
||||
"18654691866 166271 send success\n",
|
||||
"18954628871 167910 send success\n",
|
||||
"19854689029 164523 send success\n",
|
||||
"15154681871 167460 send success\n",
|
||||
"13780756776 164763 send success\n",
|
||||
"15154622086 164789 send success\n",
|
||||
"13455721686 162051 send success\n",
|
||||
"13475465246 164913 send success\n",
|
||||
"13181857658 165482 send success\n",
|
||||
"13562298356 165170 send success\n",
|
||||
"18562961552 161429 send success\n",
|
||||
"13371528169 167682 send success\n",
|
||||
"17754629165 165471 send success\n",
|
||||
"13256477708 161758 send success\n",
|
||||
"13356619896 167963 send success\n",
|
||||
"13287371168 166920 send success\n",
|
||||
"15715468750 168734 send success\n",
|
||||
"15154619169 164271 send success\n",
|
||||
"17754629082 168370 send success\n",
|
||||
"15306476627 166984 send success\n",
|
||||
"13705467605 160364 send success\n",
|
||||
"17754629057 161934 send success\n",
|
||||
"19963763561 160236 send success\n",
|
||||
"13325059838 162853 send success\n",
|
||||
"15318328975 163259 send success\n",
|
||||
"13205471255 165897 send success\n",
|
||||
"13361503856 167024 send success\n",
|
||||
"18954680512 162648 send success\n",
|
||||
"13465275185 169518 send success\n",
|
||||
"13361522787 165038 send success\n",
|
||||
"13054610918 168106 send success\n",
|
||||
"18506466571 166937 send success\n",
|
||||
"13181854171 168902 send success\n",
|
||||
"13210388535 161024 send success\n",
|
||||
"13306475903 163160 send success\n",
|
||||
"15965465758 165241 send success\n",
|
||||
"13355460615 165670 send success\n",
|
||||
"18266665051 162679 send success\n",
|
||||
"13054600511 164526 send success\n",
|
||||
"15314325556 163645 send success\n",
|
||||
"13963355696 163275 send success\n",
|
||||
"13081417578 168653 send success\n",
|
||||
"15965466030 165723 send success\n",
|
||||
"15254639986 164920 send success\n",
|
||||
"13792069959 163204 send success\n",
|
||||
"13905465022 165792 send success\n",
|
||||
"17754629228 164810 send success\n",
|
||||
"15154623768 166814 send success\n",
|
||||
"15965466216 164150 send success\n",
|
||||
"13864785309 162097 send success\n",
|
||||
"15990986892 169407 send success\n",
|
||||
"18764586870 168719 send success\n",
|
||||
"15315038808 165184 send success\n",
|
||||
"18562961530 169036 send success\n",
|
||||
"13054673678 167120 send success\n",
|
||||
"13706470006 165769 send success\n",
|
||||
"13954696798 163164 send success\n",
|
||||
"18766719018 162109 send success\n",
|
||||
"17754629160 162709 send success\n",
|
||||
"15954759855 162859 send success\n",
|
||||
"13375461776 164270 send success\n",
|
||||
"15954671399 168275 send success\n",
|
||||
"18954680397 161083 send success\n",
|
||||
"13561016489 164631 send success\n",
|
||||
"18860673506 163906 send success\n",
|
||||
"15665876948 165219 send success\n",
|
||||
"17754629197 167890 send success\n",
|
||||
"18865467781 167148 send success\n",
|
||||
"17754629133 161483 send success\n",
|
||||
"17754600676 166370 send success\n",
|
||||
"13561086165 164165 send success\n",
|
||||
"15605469730 164137 send success\n",
|
||||
"17754629176 161527 send success\n",
|
||||
"13220505818 160537 send success\n",
|
||||
"15154655057 168761 send success\n",
|
||||
"15275640625 164391 send success\n",
|
||||
"13562257108 165483 send success\n",
|
||||
"15318382108 160973 send success\n",
|
||||
"13625462769 167350 send success\n",
|
||||
"17754600760 169176 send success\n",
|
||||
"13006548466 162870 send success\n",
|
||||
"18954676358 167032 send success\n",
|
||||
"15552779321 163867 send success\n",
|
||||
"13563395385 164018 send success\n",
|
||||
"19854689027 164520 send success\n",
|
||||
"17754629226 169251 send success\n",
|
||||
"13406089611 168925 send success\n",
|
||||
"17754665865 161576 send success\n",
|
||||
"13963351053 160826 send success\n",
|
||||
"17754629175 162306 send success\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -408,12 +498,12 @@
|
||||
"mydb = myclient[\"baogao\"]\n",
|
||||
"mycol = mydb[\"pdf\"]\n",
|
||||
"\n",
|
||||
"dw_jc = \"北体体质康健班学员\"\n",
|
||||
"filename = 'data/北体体质康健班202412.json'\n",
|
||||
"dw_jc = \"山东东营陈庄镇测试者\"\n",
|
||||
"filename = 'data/陈庄检测人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"dict2 = {}\n",
|
||||
"place_id = 141002\n",
|
||||
"place_id = 250226\n",
|
||||
"myquery = { \"place_id\": place_id }\n",
|
||||
"for x in mycol.find(myquery,{ \"_id\": 0, \"place_id\": 0}):\n",
|
||||
" code = int(x['fn'].split('-')[0])\n",
|
||||
@@ -452,7 +542,7 @@
|
||||
" resp = client.SendSms(req)\n",
|
||||
" dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
||||
" print(v['phone'], v['code'],dict3['SendStatusSet'][0][\"Message\"])\n",
|
||||
" time.sleep(15)\n",
|
||||
" time.sleep(5)\n",
|
||||
" except TencentCloudSDKException as err:\n",
|
||||
" print(v['phone'],err)"
|
||||
]
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4c41a2bd-7340-4a3b-9257-8d8615a20a09",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 体测人员导入"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "eb9aa782-ce2c-4814-bdf6-92c7e892854d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-03-04T04:48:50.513279Z",
|
||||
"iopub.status.busy": "2025-03-04T04:48:50.512517Z",
|
||||
"iopub.status.idle": "2025-03-04T04:48:50.542095Z",
|
||||
"shell.execute_reply": "2025-03-04T04:48:50.541445Z",
|
||||
"shell.execute_reply.started": "2025-03-04T04:48:50.513207Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"49\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(3, 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, 3).value\n",
|
||||
" dict1['unit'] = '第一期'\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
|
||||
" dict1['id'] = sheet.cell(n, 5).value\n",
|
||||
" if sheet.cell(n,6).value is not None:\n",
|
||||
" dict1['phone'] = 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": "markdown",
|
||||
"id": "40f2c77d-1504-4288-9ed0-a0a4678579ee",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 生成读卡系统文件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "4e0de75e-6957-434a-9591-da96c21f4659",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-03-03T07:21:43.877959Z",
|
||||
"iopub.status.busy": "2025-03-03T07:21:43.877156Z",
|
||||
"iopub.status.idle": "2025-03-03T07:21:43.888327Z",
|
||||
"shell.execute_reply": "2025-03-03T07:21:43.887102Z",
|
||||
"shell.execute_reply.started": "2025-03-03T07:21:43.877887Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/海淀区老干部大学第一期.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" dict2 = {}\n",
|
||||
" #if dict1['sex'] =='男':\n",
|
||||
" # sex = 1\n",
|
||||
" \n",
|
||||
" dict2 = {'id':k,'name':v['name'],'gender':v['sex'],'birth':v['birth'],'unit':v['unit']}\n",
|
||||
" list1.append(dict2)\n",
|
||||
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
|
||||
"\n",
|
||||
"# 将 json 数据写入文件\n",
|
||||
"with open(\"data/card_海淀区老干部大学.json\", \"w\",encoding = 'utf-8') as file:\n",
|
||||
" file.write(json_data) \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "26dbb945-2b62-4a46-9c72-aa321be7321d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in new issue
Block a user