20230608
This commit is contained in:
1 parent
da12135bd4
commit
94d6b1116a
5 files changed
+518
-213
No files matched your search
+225
-112
@@ -10,27 +10,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 17,
|
"execution_count": null,
|
||||||
"id": "202a0266-f578-4d75-b04c-5ae9957391bf",
|
"id": "202a0266-f578-4d75-b04c-5ae9957391bf",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2023-05-22T08:51:23.135343Z",
|
|
||||||
"iopub.status.busy": "2023-05-22T08:51:23.134459Z",
|
|
||||||
"iopub.status.idle": "2023-05-22T08:51:23.150352Z",
|
|
||||||
"shell.execute_reply": "2023-05-22T08:51:23.149334Z",
|
|
||||||
"shell.execute_reply.started": "2023-05-22T08:51:23.135304Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -71,27 +56,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 41,
|
"execution_count": null,
|
||||||
"id": "857ca433-556a-4152-af7e-5f81434d11a7",
|
"id": "857ca433-556a-4152-af7e-5f81434d11a7",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2023-05-22T13:35:16.464666Z",
|
|
||||||
"iopub.status.busy": "2023-05-22T13:35:16.463814Z",
|
|
||||||
"iopub.status.idle": "2023-05-22T13:35:16.476027Z",
|
|
||||||
"shell.execute_reply": "2023-05-22T13:35:16.474929Z",
|
|
||||||
"shell.execute_reply.started": "2023-05-22T13:35:16.464626Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -123,87 +93,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 43,
|
"execution_count": null,
|
||||||
"id": "f5c6a39a-3e3e-4844-8ff8-b9ebb7e8f8af",
|
"id": "f5c6a39a-3e3e-4844-8ff8-b9ebb7e8f8af",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2023-05-22T13:36:57.660765Z",
|
|
||||||
"iopub.status.busy": "2023-05-22T13:36:57.660192Z",
|
|
||||||
"iopub.status.idle": "2023-05-22T13:36:57.673702Z",
|
|
||||||
"shell.execute_reply": "2023-05-22T13:36:57.672666Z",
|
|
||||||
"shell.execute_reply.started": "2023-05-22T13:36:57.660720Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"13718887655\n",
|
|
||||||
"您的性别 女性\n",
|
|
||||||
"您的年龄 39\n",
|
|
||||||
"您的身高(cm) 160\n",
|
|
||||||
"您的体重(kg) 52\n",
|
|
||||||
"您的血压(BP) 临界偏低(收缩压90-94mmHg和/或舒张压60-65mmHg)\n",
|
|
||||||
"您的空腹血糖(FPG) 正常(3.89-6.1mmol/L)\n",
|
|
||||||
"您的白细胞计数(WBC) 临界偏高(9.6-10×10^9/L)\n",
|
|
||||||
"您的血红蛋白(HGB) 临界偏低(110-114g/L)\n",
|
|
||||||
"您的血小板(PLT) 正常(125-350×10^9/L)\n",
|
|
||||||
"您的低密度脂蛋白(LDL-C) 临界偏高(5.18-6.19mmol/L)\n",
|
|
||||||
"您的甘油三酯(TG) 正常(0.45-1.69mmol/L)\n",
|
|
||||||
"您的尿酸(UA) 正常(155.00- 350.00 μmol/L)\n",
|
|
||||||
"您的肌酐(Cr) 正常(44.00- 73.00μmol/L)\n",
|
|
||||||
"您的谷丙转氨酶(ALT) 正常(7.00- 19.00U/L)\n",
|
|
||||||
"您的谷草转氨酶(AST) 正常(13.00- 35.00U/L)\n",
|
|
||||||
"您的甲状腺功能 正常\n",
|
|
||||||
"您的尿蛋白 阴性\n",
|
|
||||||
"您的便潜血 阴性\n",
|
|
||||||
"您的幽门螺旋杆菌 阴性\n",
|
|
||||||
"囊肿(选做题,没有囊肿问题的请跳过) ['卵巢囊肿']\n",
|
|
||||||
"结节(选做题,没有结节问题的请跳过) ['肺结节']\n",
|
|
||||||
"息肉(选做题,没有息肉问题的请跳过) ['其他息肉']\n",
|
|
||||||
"您的其他问题(选做题,没有这些问题的请跳过) ['过敏性鼻炎']\n",
|
|
||||||
"您的饮食口味 ['清淡']\n",
|
|
||||||
"您吸烟吗 不吸烟\n",
|
|
||||||
"您喝酒吗 不喝\n",
|
|
||||||
"您参加规律的体育锻炼吗 不参加\n",
|
|
||||||
"您的睡眠状况如何 非常好\n",
|
|
||||||
"您的排便频率如何 2天一次\n",
|
|
||||||
"您的职业 管理人员\n",
|
|
||||||
"您的父母或兄弟姐妹是否患有明确诊断的疾病?(选做题,没有遗传病史的请跳过) ['高血压', '冠心病', '脑卒中']\n",
|
|
||||||
"15210715398\n",
|
|
||||||
"您的性别 女性\n",
|
|
||||||
"您的年龄 36\n",
|
|
||||||
"您的身高(cm) 162\n",
|
|
||||||
"您的体重(kg) 56\n",
|
|
||||||
"您的血压(BP) 正常(收缩压95-130mmHg和舒张压65-85mmHg)\n",
|
|
||||||
"您的空腹血糖(FPG) 正常(3.89-6.1mmol/L)\n",
|
|
||||||
"您的白细胞计数(WBC) 正常(4-9.5×10^9/L)\n",
|
|
||||||
"您的血红蛋白(HGB) 正常(115-145g/L)\n",
|
|
||||||
"您的血小板(PLT) 正常(125-350×10^9/L)\n",
|
|
||||||
"您的低密度脂蛋白(LDL-C) 正常(3.1-5.18mmol/L)\n",
|
|
||||||
"您的甘油三酯(TG) 正常(0.45-1.69mmol/L)\n",
|
|
||||||
"您的尿酸(UA) 正常(155.00- 350.00 μmol/L)\n",
|
|
||||||
"您的肌酐(Cr) 正常(44.00- 73.00μmol/L)\n",
|
|
||||||
"您的谷丙转氨酶(ALT) 正常(7.00- 19.00U/L)\n",
|
|
||||||
"您的谷草转氨酶(AST) 正常(13.00- 35.00U/L)\n",
|
|
||||||
"您的甲状腺功能 正常\n",
|
|
||||||
"您的尿蛋白 阴性\n",
|
|
||||||
"您的便潜血 阴性\n",
|
|
||||||
"您的幽门螺旋杆菌 阴性\n",
|
|
||||||
"您的心脏(选做题,没有心脏问题的请跳过) ['窦性心律不齐']\n",
|
|
||||||
"您的饮食口味 ['辛辣']\n",
|
|
||||||
"您吸烟吗 不吸烟\n",
|
|
||||||
"您喝酒吗 不喝\n",
|
|
||||||
"您参加规律的体育锻炼吗 经常参加(平均每周锻炼3次及以上,每次锻炼>30分钟)\n",
|
|
||||||
"您的睡眠状况如何 非常好\n",
|
|
||||||
"您的排便频率如何 2天一次\n",
|
|
||||||
"您的职业 行政工作\n",
|
|
||||||
"您的父母或兄弟姐妹是否患有明确诊断的疾病?(选做题,没有遗传病史的请跳过) ['高血压']\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"filename = 'data/淄博交警体质问卷参数.json'\n",
|
"filename = 'data/淄博交警体质问卷参数.json'\n",
|
||||||
@@ -234,10 +129,228 @@
|
|||||||
" print(title,value) "
|
" print(title,value) "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "366adf62-e2b1-4e14-8164-9511aec571aa",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 生成淄博警察人员信息汇总表"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 56,
|
||||||
|
"id": "0a92a167-0d8d-4c49-a696-fd4dbd04eb64",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-05-30T06:48:26.236906Z",
|
||||||
|
"iopub.status.busy": "2023-05-30T06:48:26.236417Z",
|
||||||
|
"iopub.status.idle": "2023-05-30T06:48:26.553550Z",
|
||||||
|
"shell.execute_reply": "2023-05-30T06:48:26.552825Z",
|
||||||
|
"shell.execute_reply.started": "2023-05-30T06:48:26.236874Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"13853361818 已经存在!\n",
|
||||||
|
"05332138406 已经存在!\n",
|
||||||
|
"18705333980 已经存在!\n",
|
||||||
|
"13070645243 已经存在!\n",
|
||||||
|
"18705336013 已经存在!\n",
|
||||||
|
"ok\n",
|
||||||
|
"17805337253 已经存在!\n",
|
||||||
|
"13305335697 已经存在!\n",
|
||||||
|
"18705333572 已经存在!\n",
|
||||||
|
"17805337157 已经存在!\n",
|
||||||
|
"17805337611 已经存在!\n",
|
||||||
|
"13964355603 已经存在!\n",
|
||||||
|
"17805337215 已经存在!\n",
|
||||||
|
"17805337257 已经存在!\n",
|
||||||
|
"17615773020 已经存在!\n",
|
||||||
|
"15505337203 已经存在!\n",
|
||||||
|
"13869397003 已经存在!\n",
|
||||||
|
"18053386976 已经存在!\n",
|
||||||
|
"18053386979 已经存在!\n",
|
||||||
|
"15253357267 已经存在!\n",
|
||||||
|
"15206676826 已经存在!\n",
|
||||||
|
"15265333315 已经存在!\n",
|
||||||
|
"13011637601 已经存在!\n",
|
||||||
|
"17805337235 已经存在!\n",
|
||||||
|
"13153362550 已经存在!\n",
|
||||||
|
"17685603319 已经存在!\n",
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"import glob,os,shutil\n",
|
||||||
|
"from pathlib2 import Path\n",
|
||||||
|
"import csv\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,2).value is None:\n",
|
||||||
|
" break\n",
|
||||||
|
" else: \n",
|
||||||
|
" phone = str(sheet.cell(n, 5).value)\n",
|
||||||
|
" if phone in person.keys():\n",
|
||||||
|
" print(phone,'已经存在!')\n",
|
||||||
|
" else:\n",
|
||||||
|
" person.setdefault(phone, {})\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" dict1['name'] = sheet.cell(n, 2).value \n",
|
||||||
|
" xb = str(sheet.cell(n, 3).value)\n",
|
||||||
|
" if xb == '1':\n",
|
||||||
|
" sex = '男'\n",
|
||||||
|
" elif xb =='2':\n",
|
||||||
|
" sex = '女'\n",
|
||||||
|
" dict1['sex'] = sex\n",
|
||||||
|
" dict1['单位'] = \"交警支队\"\n",
|
||||||
|
" dict1['部门'] = sheet.cell(n, 1).value\n",
|
||||||
|
" person[phone] = dict1\n",
|
||||||
|
"print('ok')\n",
|
||||||
|
"filename = 'data/高新区.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict2 = json.load(fl) \n",
|
||||||
|
"for k,v in dict2.items():\n",
|
||||||
|
" if 'phone' in v.keys():\n",
|
||||||
|
" phone = str(v['phone'])\n",
|
||||||
|
" if phone in person.keys():\n",
|
||||||
|
" print(phone,'已经存在!')\n",
|
||||||
|
" else:\n",
|
||||||
|
" person.setdefault(phone, {})\n",
|
||||||
|
" dict1 = {}\n",
|
||||||
|
" dict1['name'] = v['name'] \n",
|
||||||
|
" dict1['sex'] = v['sex']\n",
|
||||||
|
" dict1['单位'] = \"高新区\"\n",
|
||||||
|
" if 'unit' in v.keys():\n",
|
||||||
|
" dict1['部门'] = v['unit']\n",
|
||||||
|
" person[phone] = dict1\n",
|
||||||
|
"filename = 'data/淄博警察汇总.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||||
|
"print('ok') "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "c76b5512-699c-4051-88c5-e3f725fa9a0b",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 核对参加问卷人员"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 62,
|
||||||
|
"id": "9e0f66ea-09d6-41ec-8284-9a5e712c6cee",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-05-30T06:55:04.917464Z",
|
||||||
|
"iopub.status.busy": "2023-05-30T06:55:04.916603Z",
|
||||||
|
"iopub.status.idle": "2023-05-30T06:55:04.935262Z",
|
||||||
|
"shell.execute_reply": "2023-05-30T06:55:04.934185Z",
|
||||||
|
"shell.execute_reply.started": "2023-05-30T06:55:04.917424Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1 13718887655 未有记录\n",
|
||||||
|
"2 15210715398 未有记录\n",
|
||||||
|
"3 18600297579 未有记录\n",
|
||||||
|
"4 付峰 交警支队\n",
|
||||||
|
"5 孙长宁 交警支队\n",
|
||||||
|
"6 张学军 交警支队\n",
|
||||||
|
"7 李平 交警支队\n",
|
||||||
|
"8 谢珺扬 交警支队\n",
|
||||||
|
"9 高维成 交警支队\n",
|
||||||
|
"10 张海天 交警支队\n",
|
||||||
|
"11 董景发 交警支队\n",
|
||||||
|
"12 陈庆永 交警支队\n",
|
||||||
|
"13 魏玉兵 交警支队\n",
|
||||||
|
"14 崔瑞房 交警支队\n",
|
||||||
|
"15 韩俊达 交警支队\n",
|
||||||
|
"16 宋道军 交警支队\n",
|
||||||
|
"17 王若镔 交警支队\n",
|
||||||
|
"18 邵珠峰 交警支队\n",
|
||||||
|
"19 贾备 交警支队\n",
|
||||||
|
"20 于会萍 交警支队\n",
|
||||||
|
"21 王静 交警支队\n",
|
||||||
|
"22 15054176063 未有记录\n",
|
||||||
|
"23 高建红 交警支队\n",
|
||||||
|
"24 巩本波 交警支队\n",
|
||||||
|
"25 邵杰 交警支队\n",
|
||||||
|
"26 宋业金 交警支队\n",
|
||||||
|
"27 安兵 交警支队\n",
|
||||||
|
"28 岳科学 交警支队\n",
|
||||||
|
"29 戴维靖 交警支队\n",
|
||||||
|
"30 闫仲荣 交警支队\n",
|
||||||
|
"31 陈振国 交警支队\n",
|
||||||
|
"32 王拥军 交警支队\n",
|
||||||
|
"33 胡永吉 交警支队\n",
|
||||||
|
"34 赵军 交警支队\n",
|
||||||
|
"35 任振华 交警支队\n",
|
||||||
|
"36 魏鹂娴 交警支队\n",
|
||||||
|
"37 李春红 交警支队\n",
|
||||||
|
"38 赵书辰 交警支队\n",
|
||||||
|
"39 耿玥 交警支队\n",
|
||||||
|
"40 甘军 交警支队\n",
|
||||||
|
"41 姚秀波 交警支队\n",
|
||||||
|
"42 张言辉 交警支队\n",
|
||||||
|
"43 张明 交警支队\n",
|
||||||
|
"44 韦璟 交警支队\n",
|
||||||
|
"45 王学征 交警支队\n",
|
||||||
|
"46 孙庆章 交警支队\n",
|
||||||
|
"47 张天姿 交警支队\n",
|
||||||
|
"48 张明易 交警支队\n",
|
||||||
|
"49 王凌云 交警支队\n",
|
||||||
|
"50 魏亮 交警支队\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import csv\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/淄博警察汇总.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = 'data/Survey_20230530.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",
|
||||||
|
"i = 0\n",
|
||||||
|
"for item in list1:\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" phone = item[2]\n",
|
||||||
|
" if phone in dict1.keys():\n",
|
||||||
|
" print(i,dict1[phone]['name'],dict1[phone]['单位'])\n",
|
||||||
|
" else:\n",
|
||||||
|
" print(i,phone,'未有记录')"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "2bb69139-b4be-4fd1-ae44-461f62b09503",
|
"id": "4203377b-579d-4267-a4a7-e27d2ef4a87c",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
+160
-51
@@ -10,12 +10,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 52,
|
||||||
"id": "dea5e486-6927-469f-aa57-e5efac4670be",
|
"id": "dea5e486-6927-469f-aa57-e5efac4670be",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-05-31T05:19:09.972334Z",
|
||||||
|
"iopub.status.busy": "2023-05-31T05:19:09.971473Z",
|
||||||
|
"iopub.status.idle": "2023-05-31T05:19:10.054344Z",
|
||||||
|
"shell.execute_reply": "2023-05-31T05:19:10.053621Z",
|
||||||
|
"shell.execute_reply.started": "2023-05-31T05:19:09.972292Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -240,15 +255,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 26,
|
"execution_count": 53,
|
||||||
"id": "c925d850-ff06-4be5-bf9f-31f4385c37c0",
|
"id": "c925d850-ff06-4be5-bf9f-31f4385c37c0",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-25T09:39:32.123643Z",
|
"iopub.execute_input": "2023-05-31T05:19:14.796522Z",
|
||||||
"iopub.status.busy": "2023-05-25T09:39:32.122802Z",
|
"iopub.status.busy": "2023-05-31T05:19:14.795763Z",
|
||||||
"iopub.status.idle": "2023-05-25T09:39:32.189169Z",
|
"iopub.status.idle": "2023-05-31T05:19:14.859923Z",
|
||||||
"shell.execute_reply": "2023-05-25T09:39:32.188132Z",
|
"shell.execute_reply": "2023-05-31T05:19:14.858869Z",
|
||||||
"shell.execute_reply.started": "2023-05-25T09:39:32.123602Z"
|
"shell.execute_reply.started": "2023-05-31T05:19:14.796492Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -257,7 +272,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"162\n"
|
"163\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -298,15 +313,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 35,
|
"execution_count": 54,
|
||||||
"id": "a87384c6-dc46-4d09-b757-b42462ed818d",
|
"id": "a87384c6-dc46-4d09-b757-b42462ed818d",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-25T09:51:28.611776Z",
|
"iopub.execute_input": "2023-05-31T05:19:18.950211Z",
|
||||||
"iopub.status.busy": "2023-05-25T09:51:28.610914Z",
|
"iopub.status.busy": "2023-05-31T05:19:18.949352Z",
|
||||||
"iopub.status.idle": "2023-05-25T09:51:28.626319Z",
|
"iopub.status.idle": "2023-05-31T05:19:18.965945Z",
|
||||||
"shell.execute_reply": "2023-05-25T09:51:28.625266Z",
|
"shell.execute_reply": "2023-05-31T05:19:18.964916Z",
|
||||||
"shell.execute_reply.started": "2023-05-25T09:51:28.611734Z"
|
"shell.execute_reply.started": "2023-05-31T05:19:18.950168Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -315,8 +330,8 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"162\n",
|
"164\n",
|
||||||
"['6085', '5304', '3071', '8954', '4051', '2348', '7629', '3607', '2095', '8107', '7905', '2791', '8460', '5096', '4062', '1978', '0976', '8492', '0197', '0287', '3764', '6589', '5439', '5607', '0541', '8629', '3275', '7620', '4795', '3025', '5862', '5410', '1438', '2408', '2167', '1094', '4026', '3184', '9104', '7694', '1862', '7286', '6170', '6578', '6587', '5179', '2043', '4813', '2597', '3207', '6859', '8920', '1268', '4860', '9627', '2918', '3841', '4193', '9281', '7961', '3510', '6912', '4921', '7520', '8930', '8271', '2163', '3457', '8713', '1962', '7480', '4138', '2504', '7490', '7285', '4029', '2496', '4920', '3572', '9305', '7512', '6324', '5731', '4719', '6895', '4591', '0679', '5287', '3817', '4063', '2108', '9153', '2401', '2897', '6782', '3875', '8014', '4753', '2146', '2483', '5012', '5803', '9425', '3578', '5628', '9245', '4835', '7052', '8654', '3586', '1693', '3086', '7609', '3021', '1794', '2865', '1739', '7435', '4135', '5240', '0374', '6583', '0856', '0812', '5837', '7106', '0268', '8376', '5346', '0753', '4158', '1756', '2473', '6139', '3178', '7824', '3201', '6304', '6109', '0735', '8573', '9857', '3240', '5340', '0438', '7415', '2783', '3127', '5497', '8542', '9764', '6107', '9016', '0248', '2195', '5149', '7982', '4750', '4023', '9684', '0823', '0692']\n"
|
"['659821', '079384', '876923', '387406', '694158', '563974', '628540', '281407', '798056', '274185', '705316', '571698', '693240', '650329', '481397', '610492', '250746', '619873', '675018', '619204', '984351', '279548', '027154', '856432', '296138', '290486', '218396', '973605', '269043', '653487', '528397', '031947', '370415', '872591', '018592', '251794', '718203', '869254', '408517', '071948', '536729', '259430', '867310', '285413', '805216', '405192', '630721', '386219', '504216', '418752', '402398', '231947', '850743', '901378', '394175', '431092', '157489', '961378', '305921', '620417', '352906', '629380', '417086', '086149', '804693', '342580', '310827', '637102', '128635', '346780', '325076', '643917', '710548', '046732', '762390', '350712', '368419', '342701', '245107', '087136', '023185', '759846', '346758', '514976', '570482', '781935', '210987', '340615', '075891', '810596', '430689', '920785', '815347', '917562', '295817', '765238', '058479', '674159', '567894', '109842', '851943', '703918', '073489', '403958', '578492', '798046', '502876', '943180', '498306', '835760', '726305', '490867', '709413', '275683', '256934', '721830', '973841', '729685', '021349', '265413', '321597', '064187', '136794', '708352', '710928', '657129', '962105', '905436', '513749', '257361', '420691', '941567', '839574', '906358', '218095', '364152', '562149', '109823', '560942', '293561', '194053', '509246', '026951', '243561', '093154', '654083', '519048', '459136', '914362', '605834', '508693', '823906', '349725', '572390', '541236', '419570', '513467', '724063', '164823', '890712', '529840', '641958', '678590', '648951']\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -331,8 +346,8 @@
|
|||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"#print(code_num)\n",
|
"#print(code_num)\n",
|
||||||
"i = 1\n",
|
"i = 1\n",
|
||||||
"while i < 163:\n",
|
"while i < 165:\n",
|
||||||
" code = random.sample(code_list,4) #随机取6位数\n",
|
" code = random.sample(code_list,6) #随机取6位数\n",
|
||||||
" code_num = ''.join(code)\n",
|
" code_num = ''.join(code)\n",
|
||||||
" if code_num not in list1:\n",
|
" if code_num not in list1:\n",
|
||||||
" list1.append(code_num)\n",
|
" list1.append(code_num)\n",
|
||||||
@@ -350,6 +365,52 @@
|
|||||||
" json.dump(dict1, fl, ensure_ascii=False) "
|
" json.dump(dict1, fl, ensure_ascii=False) "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "6efc1c2b-7af1-49ec-9b48-8930a8dd2801",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 生成下载链接"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 55,
|
||||||
|
"id": "10845b90-48b4-4418-9dac-dd4a6f0147c0",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-05-31T05:19:22.535432Z",
|
||||||
|
"iopub.status.busy": "2023-05-31T05:19:22.534590Z",
|
||||||
|
"iopub.status.idle": "2023-05-31T05:19:22.546728Z",
|
||||||
|
"shell.execute_reply": "2023-05-31T05:19:22.545447Z",
|
||||||
|
"shell.execute_reply.started": "2023-05-31T05:19:22.535392Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"163\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"filename = 'data/农业银行测试手机号码.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"dict2 = {}\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" dict2.setdefault(v['yzm'],{})\n",
|
||||||
|
" dict2[v['yzm']]['code'] = v['code']\n",
|
||||||
|
" dict2[v['yzm']]['name'] = v['name']\n",
|
||||||
|
"print(len(dict2))\n",
|
||||||
|
"filename = 'data/yzm.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict2, fl, ensure_ascii=False) \n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "fba0a0c4-edf2-45c2-9199-c6a86919f191",
|
"id": "fba0a0c4-edf2-45c2-9199-c6a86919f191",
|
||||||
@@ -398,63 +459,32 @@
|
|||||||
"from tencentcloud.common import credential\n",
|
"from tencentcloud.common import credential\n",
|
||||||
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
||||||
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
||||||
"\n",
|
|
||||||
"# 导入可选配置类\n",
|
|
||||||
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
||||||
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
||||||
"try: \n",
|
"try: \n",
|
||||||
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
||||||
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
||||||
" cred = credential.Credential(secretId, secretKey) \n",
|
" cred = credential.Credential(secretId, secretKey) \n",
|
||||||
" \n",
|
|
||||||
"\n",
|
|
||||||
" # 实例化一个http选项,可选的,没有特殊需求可以跳过。\n",
|
|
||||||
" httpProfile = HttpProfile()\n",
|
" httpProfile = HttpProfile()\n",
|
||||||
" # 如果需要指定proxy访问接口,可以按照如下方式初始化hp(无需要直接忽略)\n",
|
|
||||||
" # httpProfile = HttpProfile(proxy=\"http://用户名:密码@代理IP:代理端口\")\n",
|
|
||||||
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
||||||
" httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)\n",
|
" httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)\n",
|
||||||
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
||||||
"\n",
|
|
||||||
" # 非必要步骤:\n",
|
|
||||||
" # 实例化一个客户端配置对象,可以指定超时时间等配置\n",
|
|
||||||
" clientProfile = ClientProfile()\n",
|
" clientProfile = ClientProfile()\n",
|
||||||
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
||||||
" clientProfile.language = \"en-US\"\n",
|
" clientProfile.language = \"en-US\"\n",
|
||||||
" clientProfile.httpProfile = httpProfile\n",
|
" clientProfile.httpProfile = httpProfile\n",
|
||||||
"\n",
|
|
||||||
" # 实例化要请求产品(以sms为例)的client对象\n",
|
|
||||||
" # 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,支持的地域列表参考 https://cloud.tencent.com/document/api/382/52071#.E5.9C.B0.E5.9F.9F.E5.88.97.E8.A1.A8\n",
|
|
||||||
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
||||||
" req = models.SendSmsRequest()\n",
|
" req = models.SendSmsRequest()\n",
|
||||||
"\n",
|
|
||||||
" \n",
|
|
||||||
" # 短信应用ID: 短信SdkAppId在 [短信控制台] 添加应用后生成的实际SdkAppId,示例如1400006666\n",
|
|
||||||
" # 应用 ID 可前往 [短信控制台](https://console.cloud.tencent.com/smsv2/app-manage) 查看\n",
|
|
||||||
" req.SmsSdkAppId = \"1400140089\"\n",
|
" req.SmsSdkAppId = \"1400140089\"\n",
|
||||||
" # 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名\n",
|
|
||||||
" # 签名信息可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-sign) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-sign) 的签名管理查看\n",
|
|
||||||
" req.SignName = \"坤铭教育\"\n",
|
" req.SignName = \"坤铭教育\"\n",
|
||||||
" # 模板 ID: 必须填写已审核通过的模板 ID\n",
|
|
||||||
" # 模板 ID 可前往 [国内短信](https://console.cloud.tencent.com/smsv2/csms-template) 或 [国际/港澳台短信](https://console.cloud.tencent.com/smsv2/isms-template) 的正文模板管理查看\n",
|
|
||||||
" req.TemplateId = \"1808914\" \n",
|
" req.TemplateId = \"1808914\" \n",
|
||||||
" # 模板参数: 模板参数的个数需要与 TemplateId 对应模板的变量个数保持一致,,若无模板参数,则设置为空\n",
|
|
||||||
" req.TemplateParamSet = [\"1234\"]\n",
|
" req.TemplateParamSet = [\"1234\"]\n",
|
||||||
" # 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]\n",
|
|
||||||
" # 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号\n",
|
|
||||||
" req.PhoneNumberSet = [\"+8613793180751\"]\n",
|
" req.PhoneNumberSet = [\"+8613793180751\"]\n",
|
||||||
" # 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回\n",
|
|
||||||
" req.SessionContext = \"\"\n",
|
" req.SessionContext = \"\"\n",
|
||||||
" # 短信码号扩展号(无需要可忽略): 默认未开通,如需开通请联系 [腾讯云短信小助手]\n",
|
|
||||||
" req.ExtendCode = \"\"\n",
|
" req.ExtendCode = \"\"\n",
|
||||||
" # 国内短信无需填写该项;国际/港澳台短信已申请独立 SenderId 需要填写该字段,默认使用公共 SenderId,无需填写该字段。注:月度使用量达到指定量级可申请独立 SenderId 使用,详情请联系 [腾讯云短信小助手](https://cloud.tencent.com/document/product/382/3773#.E6.8A.80.E6.9C.AF.E4.BA.A4.E6.B5.81)。\n",
|
|
||||||
" req.SenderId = \"\"\n",
|
" req.SenderId = \"\"\n",
|
||||||
"\n",
|
|
||||||
" resp = client.SendSms(req)\n",
|
" resp = client.SendSms(req)\n",
|
||||||
"\n",
|
|
||||||
" # 输出json格式的字符串回包\n",
|
|
||||||
" print(resp.to_json_string(indent=2))\n",
|
" print(resp.to_json_string(indent=2))\n",
|
||||||
"\n",
|
|
||||||
"except TencentCloudSDKException as err:\n",
|
"except TencentCloudSDKException as err:\n",
|
||||||
" print(err)"
|
" print(err)"
|
||||||
]
|
]
|
||||||
@@ -487,10 +517,89 @@
|
|||||||
"print(dict1['SendStatusSet'][0][\"Message\"])"
|
"print(dict1['SendStatusSet'][0][\"Message\"])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "c55a8af0-4e4d-4bd4-b5b1-0a7d9170958c",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 批量发送短信(测试)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 57,
|
||||||
|
"id": "910d1881-d090-48dc-ac87-685ccaaf9553",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-06-07T02:57:09.482569Z",
|
||||||
|
"iopub.status.busy": "2023-06-07T02:57:09.481698Z",
|
||||||
|
"iopub.status.idle": "2023-06-07T02:57:10.568979Z",
|
||||||
|
"shell.execute_reply": "2023-06-07T02:57:10.567913Z",
|
||||||
|
"shell.execute_reply.started": "2023-06-07T02:57:09.482528Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"亓宇航 send success\n",
|
||||||
|
"李伟丽 send success\n",
|
||||||
|
"高松 send success\n",
|
||||||
|
"张树伟 send success\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
|
"from tencentcloud.common import credential\n",
|
||||||
|
"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\n",
|
||||||
|
"from tencentcloud.sms.v20210111 import sms_client, models\n",
|
||||||
|
"from tencentcloud.common.profile.client_profile import ClientProfile\n",
|
||||||
|
"from tencentcloud.common.profile.http_profile import HttpProfile\n",
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/短信测试手机号码.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" phone = '+86'+str(k)\n",
|
||||||
|
" yzm = v['yzm']\n",
|
||||||
|
" try: \n",
|
||||||
|
" secretId = \"AKID22rVyvSqbikXFFvav31ykc9YmqjN6KYc\"\n",
|
||||||
|
" secretKey = \"51XVL1YxDKI6mJh8au6DDuTskS1RhwJX\"\n",
|
||||||
|
" cred = credential.Credential(secretId, secretKey) \n",
|
||||||
|
" httpProfile = HttpProfile()\n",
|
||||||
|
" httpProfile.reqMethod = \"POST\" # post请求(默认为post请求)\n",
|
||||||
|
" httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)\n",
|
||||||
|
" httpProfile.endpoint = \"sms.tencentcloudapi.com\" # 指定接入地域域名(默认就近接入)\n",
|
||||||
|
" clientProfile = ClientProfile()\n",
|
||||||
|
" clientProfile.signMethod = \"TC3-HMAC-SHA256\" # 指定签名算法\n",
|
||||||
|
" clientProfile.language = \"en-US\"\n",
|
||||||
|
" clientProfile.httpProfile = httpProfile\n",
|
||||||
|
" client = sms_client.SmsClient(cred, \"ap-guangzhou\", clientProfile)\n",
|
||||||
|
" req = models.SendSmsRequest()\n",
|
||||||
|
" req.SmsSdkAppId = \"1400140089\"\n",
|
||||||
|
" req.SignName = \"坤铭教育\"\n",
|
||||||
|
" req.TemplateId = \"1808914\" \n",
|
||||||
|
" req.TemplateParamSet = [yzm]\n",
|
||||||
|
" req.PhoneNumberSet = [phone]\n",
|
||||||
|
" req.SessionContext = \"\"\n",
|
||||||
|
" req.ExtendCode = \"\"\n",
|
||||||
|
" req.SenderId = \"\"\n",
|
||||||
|
" resp = client.SendSms(req)\n",
|
||||||
|
" dict2 = json.loads(resp.to_json_string(indent=2))\n",
|
||||||
|
"\n",
|
||||||
|
" print(v['name'],dict2['SendStatusSet'][0][\"Message\"])\n",
|
||||||
|
" except TencentCloudSDKException as err:\n",
|
||||||
|
" print(v['name'],err)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "90242d3b-c719-4c23-a3e8-a718f86b14f3",
|
"id": "759cad53-8745-4862-8874-cf35f13ab0b3",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
+101
-18
@@ -10,27 +10,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": null,
|
||||||
"id": "07f7e97e-670e-4301-b83d-1304514f15d5",
|
"id": "07f7e97e-670e-4301-b83d-1304514f15d5",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2023-05-26T05:19:23.222114Z",
|
|
||||||
"iopub.status.busy": "2023-05-26T05:19:23.221226Z",
|
|
||||||
"iopub.status.idle": "2023-05-26T05:19:23.315408Z",
|
|
||||||
"shell.execute_reply": "2023-05-26T05:19:23.314480Z",
|
|
||||||
"shell.execute_reply.started": "2023-05-26T05:19:23.222072Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -65,10 +50,108 @@
|
|||||||
"print('ok')"
|
"print('ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "25ffcc7a-5709-4377-b821-bce5097cbd78",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导入脊柱问卷信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "53ebce2b-2ff0-4617-ad56-293143b417a0",
|
"id": "85599cf2-3673-4d3b-ae77-f5ef77217f71",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"wb = openpyxl.load_workbook('data/西藏手工记录.xlsx')\n",
|
||||||
|
"sheet = wb['Sheet1']\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"data1 =list(sheet.values)\n",
|
||||||
|
"list_bh = data1[0][1:]\n",
|
||||||
|
"del data1[0]\n",
|
||||||
|
"for i in range(1,len(list_bh)+1):\n",
|
||||||
|
" list2 = []\n",
|
||||||
|
" dict1.setdefault(int(list_bh[i-1]),{})\n",
|
||||||
|
" for item in data1:\n",
|
||||||
|
" list2.append(item[i])\n",
|
||||||
|
" dict1[int(list_bh[i-1])]['wenjuan'] = list2\n",
|
||||||
|
"print(dict1)\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": "56538b71-aedc-4880-b655-a814778bda07",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导入体测信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 31,
|
||||||
|
"id": "fa2fe417-cd1d-47c1-bcf6-2e711d49af20",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-06-06T06:23:30.367063Z",
|
||||||
|
"iopub.status.busy": "2023-06-06T06:23:30.366639Z",
|
||||||
|
"iopub.status.idle": "2023-06-06T06:23:30.426132Z",
|
||||||
|
"shell.execute_reply": "2023-06-06T06:23:30.425296Z",
|
||||||
|
"shell.execute_reply.started": "2023-06-06T06:23:30.367035Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{'1': {'wenjuan': [2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 173, 'item11': 86, 'item1': 3893, 'item2': 33, 'item3': -15, 'item6': 16.85, 'item7': 0.44, 'yao': 101, 'tun': 106}, '2': {'wenjuan': [2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 153, 'item11': 60, 'item1': 1749, 'item2': 19.2, 'item3': 0, 'item6': 6.6, 'item7': 0.611, 'yao': 79, 'tun': 96}, '3': {'wenjuan': [2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2], 'item10': 162, 'item11': 46, 'item1': 2654, 'item2': 15.9, 'item3': -9, 'item6': 7.65, 'item7': 0.415, 'yao': 71, 'tun': 87}, '4': {'wenjuan': [2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2], 'item10': 160, 'item11': 58, 'item1': 2591, 'item2': 14.4, 'item6': 0.924, 'item7': 0.527, 'yao': 78, 'tun': 99}, '5': {'wenjuan': [2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 156, 'item11': 51, 'item1': 2059, 'item2': 17.4, 'item3': -6.5, 'item6': 10.23, 'item7': 0.57, 'yao': 86, 'tun': 94}, '6': {'wenjuan': [1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 2, 2], 'item10': 158, 'item11': 51, 'item1': 1924, 'item2': 23.7, 'item3': -8.5, 'item6': 44.62, 'item7': 0.553, 'yao': 80, 'tun': 91}, '7': {'wenjuan': [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2], 'item10': 159, 'item11': 60, 'item1': 1988, 'item2': 21.3, 'item3': -10, 'item6': 6.7, 'item7': 0.671, 'yao': 81, 'tun': 99}, '8': {'wenjuan': [2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2], 'item10': 151, 'item11': 47, 'item1': 1922, 'item2': 24.7, 'item3': 0, 'item6': 15.33, 'item7': 0.466, 'yao': 65, 'tun': 88}, '9': {'wenjuan': [2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2], 'item10': 168, 'item11': 48, 'item1': 1516, 'item2': 17.5, 'item3': 0, 'item6': 9.43, 'item7': 0.501, 'yao': 65, 'tun': 93.5}, '10': {'wenjuan': [2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2], 'item10': 172, 'item11': 86, 'item1': 3970, 'item2': 41.2, 'item3': -2, 'item6': 20.9, 'item7': 0.466, 'yao': 101, 'tun': 105}, '11': {'wenjuan': [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 165, 'item11': 80, 'item1': 2978, 'item2': 26, 'item3': 0, 'item6': 218, 'item7': 0.624, 'yao': 89, 'tun': 112}, '12': {'wenjuan': [2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 2, 2], 'item10': 162, 'item11': 68.5, 'item1': 2297, 'item2': 30.3, 'item3': -16, 'item6': 5.21, 'item7': 0.628, 'yao': 86, 'tun': 104}, '13': {'wenjuan': [2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2], 'item10': 160, 'item11': 62, 'item1': 1621, 'item2': 25.7, 'item3': -23, 'item6': 4.63, 'item7': 0.584, 'yao': 80, 'tun': 95}, '14': {'wenjuan': [2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2], 'item10': 158, 'item11': 60, 'item1': 2091, 'item2': 27.5, 'item3': -2, 'item6': 4.8, 'item7': 0.622, 'yao': 84, 'tun': 101}, '15': {'wenjuan': [2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 177, 'item11': 62, 'item1': 3442, 'item2': 33.9, 'item3': 0, 'item6': 19.57, 'item7': 0.545, 'yao': 77, 'tun': 92}, '16': {'wenjuan': [1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2], 'item10': 172, 'item11': 92.5, 'item1': 3240, 'item2': 35, 'item3': -6, 'item6': 18.17, 'item7': 0.793, 'yao': 103, 'tun': 102}, '17': {'wenjuan': [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2], 'item10': 162, 'item11': 72.5, 'item1': 1995, 'item2': 32.5, 'item3': 0, 'item6': 4.4, 'item7': 0.448, 'yao': 89, 'tun': 96.5}, '18': {'wenjuan': [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 170, 'item11': 70, 'item1': 3427, 'item2': 40.2, 'item3': 13, 'item6': 14.88, 'item7': 0.564, 'yao': 88, 'tun': 101}, '19': {'wenjuan': [2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 178, 'item11': 62, 'item1': 3125, 'item2': 45.6, 'item3': 11, 'item6': 31.75, 'item7': 0.529, 'yao': 74, 'tun': 97}, '20': {'wenjuan': [2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2], 'item10': 154, 'item11': 49, 'item1': 1877, 'item2': 28, 'item3': 14, 'item6': 46.3, 'item7': 0.522, 'yao': 68, 'tun': 86}, '21': {'wenjuan': [2, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2], 'item10': 160, 'item11': 58, 'item1': 1930, 'item2': 25.1, 'item3': -5, 'item6': 25.59, 'item7': 0.559, 'yao': 76, 'tun': 94}, '22': {'wenjuan': [2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], 'item10': 170, 'item11': 56, 'item1': 2693, 'item2': 34.4, 'item3': 10, 'item6': 11.76, 'item7': 0.556, 'yao': 83, 'tun': 98}, '23': {'wenjuan': [2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, Line truncated
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"wb = openpyxl.load_workbook('data/西藏手工记录.xlsx')\n",
|
||||||
|
"sheet = wb['Sheet2']\n",
|
||||||
|
"filename = 'data/西藏脊柱问卷原始信息.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"data1 =list(sheet.values)\n",
|
||||||
|
"\n",
|
||||||
|
"for item in data1:\n",
|
||||||
|
" bh = str(item[0])\n",
|
||||||
|
" dict1.setdefault(bh,{})\n",
|
||||||
|
" xm = item[1]\n",
|
||||||
|
" result = item[2]\n",
|
||||||
|
" dict1[bh][xm] = result\n",
|
||||||
|
"filename = 'data/西藏脊柱问卷原始信息.json'\n",
|
||||||
|
"with open(filename, 'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||||
|
"print('ok')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "f453a437-5217-4db5-bc6f-695e0822960f",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
+24
-24
@@ -72,15 +72,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 14,
|
||||||
"id": "5cea2f5e-37fc-4857-8455-090a634a1c0a",
|
"id": "5cea2f5e-37fc-4857-8455-090a634a1c0a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-26T10:04:21.856051Z",
|
"iopub.execute_input": "2023-06-07T05:49:26.121460Z",
|
||||||
"iopub.status.busy": "2023-05-26T10:04:21.855163Z",
|
"iopub.status.busy": "2023-06-07T05:49:26.121014Z",
|
||||||
"iopub.status.idle": "2023-05-26T10:04:22.498099Z",
|
"iopub.status.idle": "2023-06-07T05:49:26.306153Z",
|
||||||
"shell.execute_reply": "2023-05-26T10:04:22.497093Z",
|
"shell.execute_reply": "2023-06-07T05:49:26.305167Z",
|
||||||
"shell.execute_reply.started": "2023-05-26T10:04:21.856007Z"
|
"shell.execute_reply.started": "2023-06-07T05:49:26.121430Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -89,9 +89,9 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"528\n",
|
"1307\n",
|
||||||
"ok\n",
|
"ok\n",
|
||||||
"992\n"
|
"1508\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"wb = openpyxl.load_workbook('data/长炼医院新增监测花名册.xlsx')\n",
|
"wb = openpyxl.load_workbook('data/长炼医院新增监测花名册(热电部).xlsx')\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"# sheets = wb.sheetnames\n",
|
"# sheets = wb.sheetnames\n",
|
||||||
"filename = 'data/长炼医院人员名单.json'\n",
|
"filename = 'data/长炼医院人员名单.json'\n",
|
||||||
@@ -139,15 +139,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 15,
|
||||||
"id": "4b52477e-926a-44b5-b8a0-20bff98d101d",
|
"id": "4b52477e-926a-44b5-b8a0-20bff98d101d",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-26T10:04:49.499896Z",
|
"iopub.execute_input": "2023-06-07T05:49:47.049684Z",
|
||||||
"iopub.status.busy": "2023-05-26T10:04:49.499463Z",
|
"iopub.status.busy": "2023-06-07T05:49:47.048824Z",
|
||||||
"iopub.status.idle": "2023-05-26T10:04:49.522644Z",
|
"iopub.status.idle": "2023-06-07T05:49:47.083923Z",
|
||||||
"shell.execute_reply": "2023-05-26T10:04:49.521747Z",
|
"shell.execute_reply": "2023-06-07T05:49:47.082861Z",
|
||||||
"shell.execute_reply.started": "2023-05-26T10:04:49.499867Z"
|
"shell.execute_reply.started": "2023-06-07T05:49:47.049642Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -156,8 +156,8 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"73\n",
|
"91\n",
|
||||||
"73\n"
|
"91\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
"filename = 'data/长炼医院人员名单.json'\n",
|
"filename = 'data/长炼医院人员名单.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict1 = json.load(fl) \n",
|
" dict1 = json.load(fl) \n",
|
||||||
"rq = '20230526'\n",
|
"rq = '20230607'\n",
|
||||||
"filename = f'data/places_result_{rq}.csv'\n",
|
"filename = f'data/places_result_{rq}.csv'\n",
|
||||||
"with open(filename,'r',newline='') as csv_file:\n",
|
"with open(filename,'r',newline='') as csv_file:\n",
|
||||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||||
@@ -318,15 +318,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 16,
|
||||||
"id": "2ffa583b-be51-40a8-bb55-de6a89d1a54a",
|
"id": "2ffa583b-be51-40a8-bb55-de6a89d1a54a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-26T10:05:01.804203Z",
|
"iopub.execute_input": "2023-06-07T05:49:53.089318Z",
|
||||||
"iopub.status.busy": "2023-05-26T10:05:01.803362Z",
|
"iopub.status.busy": "2023-06-07T05:49:53.088484Z",
|
||||||
"iopub.status.idle": "2023-05-26T10:05:01.863171Z",
|
"iopub.status.idle": "2023-06-07T05:49:53.156536Z",
|
||||||
"shell.execute_reply": "2023-05-26T10:05:01.862349Z",
|
"shell.execute_reply": "2023-06-07T05:49:53.155525Z",
|
||||||
"shell.execute_reply.started": "2023-05-26T10:05:01.804161Z"
|
"shell.execute_reply.started": "2023-06-07T05:49:53.089276Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
|
|||||||
+8
-8
@@ -364,14 +364,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 11,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2023-05-26T09:39:22.980282Z",
|
"iopub.execute_input": "2023-05-29T10:35:05.758138Z",
|
||||||
"iopub.status.busy": "2023-05-26T09:39:22.979405Z",
|
"iopub.status.busy": "2023-05-29T10:35:05.757286Z",
|
||||||
"iopub.status.idle": "2023-05-26T09:39:23.099441Z",
|
"iopub.status.idle": "2023-05-29T10:35:05.830677Z",
|
||||||
"shell.execute_reply": "2023-05-26T09:39:23.098684Z",
|
"shell.execute_reply": "2023-05-29T10:35:05.829666Z",
|
||||||
"shell.execute_reply.started": "2023-05-26T09:39:22.980241Z"
|
"shell.execute_reply.started": "2023-05-29T10:35:05.758096Z"
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@@ -388,12 +388,12 @@
|
|||||||
"import yaml\n",
|
"import yaml\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/西藏石油中医、心理测评量表.yaml'\n",
|
"filename = 'data/全维健康中医体质检测问卷.yaml'\n",
|
||||||
"with open(filename, 'r', encoding='utf-8') as f:\n",
|
"with open(filename, 'r', encoding='utf-8') as f:\n",
|
||||||
" result = yaml.load(f.read(), Loader=yaml.FullLoader)\n",
|
" result = yaml.load(f.read(), Loader=yaml.FullLoader)\n",
|
||||||
"i = 1\n",
|
"i = 1\n",
|
||||||
"#print(result)\n",
|
"#print(result)\n",
|
||||||
"filename = 'data/西藏石油中医、心理测评量表.json'\n",
|
"filename = 'data/全维健康中医体质检测问卷.json'\n",
|
||||||
"with open(filename, 'w') as fl:\n",
|
"with open(filename, 'w') as fl:\n",
|
||||||
" json.dump(result, fl, ensure_ascii=False)\n",
|
" json.dump(result, fl, ensure_ascii=False)\n",
|
||||||
"print('ok')"
|
"print('ok')"
|
||||||
|
|||||||
Reference in new issue
Block a user