This commit is contained in:
512song committed 2026-01-22 22:08:19 +08:00
1 parent 72a94b8de3
commit 262b081f94
6 files changed
+958 -650

No files matched your search

+54 -427
View File
@@ -3,9 +3,7 @@
{
"cell_type": "markdown",
"id": "a3a2e21f-e62e-465b-818d-8acea289434f",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"# 体质检测"
]
@@ -1018,26 +1016,10 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"id": "7261e146-03f5-4943-8a3a-479d0e4a025d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-09T09:50:57.787016Z",
"iopub.status.busy": "2025-12-09T09:50:57.786321Z",
"iopub.status.idle": "2025-12-09T09:50:57.827675Z",
"shell.execute_reply": "2025-12-09T09:50:57.827125Z",
"shell.execute_reply.started": "2025-12-09T09:50:57.786958Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"204 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -1051,7 +1033,7 @@
" \n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/sql_20251209.csv'\n",
"filename = 'data/sql_20260113.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -1090,7 +1072,7 @@
" dict1[code]['waist'] = dict2['waist']\n",
" dict1[code]['hip'] = dict2['hip']\n",
" dict1[code]['tcm'] = tcm\n",
"filename = 'data/survey_宁夏能化高危风险干预人员.json'\n",
"filename = 'data/survey_宁夏能化高危风险干预人员(20260113).json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
@@ -1099,26 +1081,10 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "02d82c2a-2319-4c0b-be58-0a1b107fdc35",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T07:38:35.217789Z",
"iopub.status.busy": "2025-12-22T07:38:35.217210Z",
"iopub.status.idle": "2025-12-22T07:38:35.238667Z",
"shell.execute_reply": "2025-12-22T07:38:35.238165Z",
"shell.execute_reply.started": "2025-12-22T07:38:35.217760Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"111 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -1132,7 +1098,7 @@
" \n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/sql_20251222.csv'\n",
"filename = 'data/sql_20260113.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -1163,7 +1129,7 @@
" dict1[code]['tcm'] = tcm \n",
" \n",
"\n",
"filename = 'data/survey_宁夏能化高危风险干预人员(202512).json'\n",
"filename = 'data/survey_宁夏能化高危风险干预人员(20601).json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
@@ -1180,17 +1146,9 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"id": "34cb26d7-cd7b-4ad5-bb7b-71cfcce16c24",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T07:39:25.697010Z",
"iopub.status.busy": "2025-12-22T07:39:25.696512Z",
"iopub.status.idle": "2025-12-22T07:39:25.707108Z",
"shell.execute_reply": "2025-12-22T07:39:25.706358Z",
"shell.execute_reply.started": "2025-12-22T07:39:25.696961Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -1254,23 +1212,15 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"id": "d78c0f3f-cd1a-4c6c-9f5b-b1b874a95fe3",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T07:40:30.226248Z",
"iopub.status.busy": "2025-12-22T07:40:30.225697Z",
"iopub.status.idle": "2025-12-22T07:40:30.260291Z",
"shell.execute_reply": "2025-12-22T07:40:30.259853Z",
"shell.execute_reply.started": "2025-12-22T07:40:30.226194Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/survey_宁夏能化高危风险干预人员(202512).json'\n",
"filename = 'data/survey_宁夏能化高危风险干预人员(20601).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"data_list = []\n",
@@ -1308,7 +1258,7 @@
" i+=1\n",
" \n",
" data_list.append(list6)\n",
"filename = 'data/宁夏能化高危风险干预人员体质问卷明细表(20251222).xlsx'\n",
"filename = 'data/宁夏能化高危风险干预人员体质问卷明细表(20260113).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"title = ['编号', '姓名', '性别', '单位/部门', '年龄', '腰围', '臀围', '中医体质', '是否倾向', '平和', '气虚', '阳虚', '阴虚', '痰湿', '湿热', '血瘀', '气郁', '特禀']\n",
@@ -1383,15 +1333,15 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 6,
"id": "22be8f39-afbb-448a-8ae6-c825c7d38757",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T03:43:54.245786Z",
"iopub.status.busy": "2025-12-22T03:43:54.245059Z",
"iopub.status.idle": "2025-12-22T03:43:54.418251Z",
"shell.execute_reply": "2025-12-22T03:43:54.417770Z",
"shell.execute_reply.started": "2025-12-22T03:43:54.245721Z"
"iopub.execute_input": "2026-01-21T07:58:19.506695Z",
"iopub.status.busy": "2026-01-21T07:58:19.506209Z",
"iopub.status.idle": "2026-01-21T07:58:19.652782Z",
"shell.execute_reply": "2026-01-21T07:58:19.652243Z",
"shell.execute_reply.started": "2026-01-21T07:58:19.506650Z"
}
},
"outputs": [],
@@ -1401,8 +1351,9 @@
"\n",
"\n",
"title = []\n",
"riqi = '2026-01-21'\n",
"\n",
"filename = 'data/surveys_records_2025-12-22.json'\n",
"filename = f'data/surveys_records_{riqi}.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
@@ -1427,7 +1378,7 @@
" \n",
" list1.append(list2)\n",
"all_title = ['id', 'date_created','name', 'gender', 'birth', 'code', 'unit', 'height', 'weight', 'next_weight', 'waist', 'hip', 'level4', 'level3', 'level2', 'recipe', 'level1', 'last_level4', 'last_level3', 'last_level2', 'last_level1', 'last_recipe', 'last_lose', 'last_sport', 'sport_type', 'sport_duration', 'last_sport_time', 'last_lose-Comment', 'last_recipe-Comment', 'last_lose_weight', 'last_sport-Comment', 'sport_type-Comment']\n",
"filename = 'data/宁夏能化干预人员问卷(20251222).xlsx'\n",
"filename = f'data/宁夏能化干预人员问卷({riqi}).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(all_title)\n",
@@ -1463,15 +1414,15 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 7,
"id": "91c53866-3725-4ceb-b0eb-23fb14e20561",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T03:44:05.908310Z",
"iopub.status.busy": "2025-12-22T03:44:05.907768Z",
"iopub.status.idle": "2025-12-22T03:44:06.062310Z",
"shell.execute_reply": "2025-12-22T03:44:06.061610Z",
"shell.execute_reply.started": "2025-12-22T03:44:05.908261Z"
"iopub.execute_input": "2026-01-21T07:58:22.208413Z",
"iopub.status.busy": "2026-01-21T07:58:22.208109Z",
"iopub.status.idle": "2026-01-21T07:58:22.348694Z",
"shell.execute_reply": "2026-01-21T07:58:22.348158Z",
"shell.execute_reply.started": "2026-01-21T07:58:22.208379Z"
}
},
"outputs": [
@@ -1479,26 +1430,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"('汪晖', '男', '销售中心', '1971-02-01', '02019646', 1)\n",
"('马燕金', '男', '销售中心', '1983-04-01', '02018528', 1)\n",
"('孙皓', '男', '销售中心', '1990-10-01', '02019111', 1)\n",
"('李润良', '男', '环保建材运行部', '1992-06-01', '03427471', 1)\n",
"('王春光', '男', '环保建材运行部', '1969-12-01', '02020528', 1)\n",
"('户利平', '男', '环保建材运行部', '1969-08-01', '02020512', 1)\n",
"('马婉婷', '女', '公用工程运行部', '2001-11-01', '03561578', 1)\n",
"('储方伟', '男', '环保建材运行部', '1976-01-01', '02020483', 1)\n",
"('马斯勇', '男', '环保建材运行部', '1987-08-01', '02020525', 1)\n",
"('康磊', '男', '公用工程运行部', '1987-07-01', '02020289', 1)\n",
"('王涛', '男', '环保建材运行部', '1982-07-01', '00000521', 1)\n",
"('杨德忠', '男', '公用工程运行部', '1972-11-01', '02020306', 1)\n",
"('杨思国', '男', '电气仪表中心', '1981-04-01', '02018877', 1)\n",
"('党金广', '男', '电气仪表中心', '1987-08-01', '02018839', 1)\n",
"('张锋', '男', '电气仪表中心', '1971-05-01', '02020003', 1)\n",
"('张磊', '男', '电气仪表中心', '1989-12-01', '02018949', 1)\n",
"('秦国振', '男', '电气仪表中心', '1997-07-01', '03462294', 1)\n",
"('陈龙', '男', '电气仪表中心', '1981-05-01', '02018914', 1)\n",
"('朱岳峰', '男', '电气仪表中心', '1988-02-01', '02018865', 1)\n",
"19\n"
"('马伟', '男', '电气仪表中心', '1997-02-01', '03442537', 1)\n",
"('应二超', '男', '公用工程运行部', '1989-02-01', '02020323', 1)\n",
"2\n"
]
}
],
@@ -1514,7 +1448,7 @@
" password=\"songyi\"\n",
")\n",
"cur = conn.cursor()\n",
"wb = openpyxl.load_workbook('data/宁夏能化干预人员问卷(20251222).xlsx',data_only=True)\n",
"wb = openpyxl.load_workbook(f'data/宁夏能化干预人员问卷({riqi}).xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"org_id = 1\n",
@@ -1648,15 +1582,15 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 8,
"id": "b7133988-213c-4b52-8d6b-17b56b8ea310",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T03:49:22.646173Z",
"iopub.status.busy": "2025-12-22T03:49:22.645514Z",
"iopub.status.idle": "2025-12-22T03:49:22.842656Z",
"shell.execute_reply": "2025-12-22T03:49:22.842110Z",
"shell.execute_reply.started": "2025-12-22T03:49:22.646116Z"
"iopub.execute_input": "2026-01-21T07:58:41.923296Z",
"iopub.status.busy": "2026-01-21T07:58:41.922694Z",
"iopub.status.idle": "2026-01-21T07:58:42.106793Z",
"shell.execute_reply": "2026-01-21T07:58:42.106233Z",
"shell.execute_reply.started": "2026-01-21T07:58:41.923241Z"
}
},
"outputs": [
@@ -1664,313 +1598,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"02019646\n",
"2018434\n",
"02018586\n",
"02018444\n",
"02020443\n",
"02020415\n",
"02018446\n",
"2018447\n",
"03533284\n",
"02020243\n",
"02019374\n",
"02020238\n",
"02019952\n",
"03497967\n",
"02018709\n",
"02019342\n",
"02019620\n",
"02020203\n",
"02018528\n",
"02019111\n",
"02018482\n",
"02018481\n",
"02018628\n",
"02018498\n",
"02018499\n",
"964089\n",
"0214545\n",
"02020481\n",
"2018609\n",
"01348929\n",
"02020526\n",
"03427471\n",
"02020196\n",
"02020528\n",
"2019094\n",
"02020512\n",
"02020476\n",
"03561578\n",
"0003533364\n",
"02019294\n",
"02020483\n",
"02020527\n",
"02020467\n",
"02020296\n",
"02020525\n",
"02020289\n",
"03434760\n",
"02018435\n",
"2019094\n",
"02019688\n",
"02019688\n",
"03561564\n",
"02020346\n",
"02020458\n",
"00000521\n",
"02020306\n",
"02019655\n",
"02020189\n",
"02019787\n",
"02019787\n",
"02018611\n",
"02018566\n",
"02018645\n",
"02019485\n",
"02020127\n",
"02019054\n",
"2019006\n",
"028415\n",
"03462271\n",
"02028323\n",
"02020492\n",
"02018794\n",
"02018877\n",
"02018926\n",
"02018809\n",
"02018938\n",
"02020083\n",
"02018839\n",
"2018985\n",
"02019866\n",
"02018793\n",
"03428863\n",
"02019017\n",
"02018981\n",
"02020003\n",
"03462285\n",
"02018626\n",
"02018604\n",
"02018892\n",
"02018827\n",
"02018949\n",
"02019599\n",
"02019622\n",
"02018575\n",
"2018438\n",
"02019613\n",
"03363370\n",
"01702447\n",
"020186\n",
"02018709\n",
"03497967\n",
"0201968\n",
"02019641\n",
"02018709\n",
"02019697\n",
"02019021\n",
"0435\n",
"02018685\n",
"02018772\n",
"02019620\n",
"03497960\n",
"02019888\n",
"02019682\n",
"03391642\n",
"03462294\n",
"02018914\n",
"2019961\n",
"02018859\n",
"02019377\n",
"02017961\n",
"02018607\n",
"02018865\n",
"02020277\n",
"02020251\n",
"02020321\n",
"03391661\n",
"02020276\n",
"02019062\n",
"02019887\n",
"03148213\n",
"2019822\n",
"02019840\n",
"02019790\n",
"02019819\n",
"02019754\n",
"03437945\n",
"02019749\n",
"02019111\n",
"03418292\n",
"02019764\n",
"02019744\n",
"02019734\n",
"02019374\n",
"02019778\n",
"02019788\n",
"02019725\n",
"02017961\n",
"02019751\n",
"02020282\n",
"02019856\n",
"02019832\n",
"02019848\n",
"03437965\n",
"02019954\n",
"02020052\n",
"02019820\n",
"02019893\n",
"02019752\n",
"02019784\n",
"02020343\n",
"02019810\n",
"2019735\n",
"02019023\n",
"02020327\n",
"02019852\n",
"02018538\n",
"02018977\n",
"2018942\n",
"02019898\n",
"02019794\n",
"02019805\n",
"02019342\n",
"02019895\n",
"02019154\n",
"02019775\n",
"3391687\n",
"02019917\n",
"02018754\n",
"03418302\n",
"02019738\n",
"03462274\n",
"03561561\n",
"02019783\n",
"02018967\n",
"2019324\n",
"02019355\n",
"02019003\n",
"02019377\n",
"02019803\n",
"02019311\n",
"02019346\n",
"02019525\n",
"02020502\n",
"03497957\n",
"02020242\n",
"02019347\n",
"3418215\n",
"02019340\n",
"02019773\n",
"0219181\n",
"02019336\n",
"02019340\n",
"02018999\n",
"02019357\n",
"02019100\n",
"02019430\n",
"02019356\n",
"03418230\n",
"03437952\n",
"03437952\n",
"02019231\n",
"03497937\n",
"03497917\n",
"02019318\n",
"03462262\n",
"02019110\n",
"2019919\n",
"02019382\n",
"03497562\n",
"02019369\n",
"03391686\n",
"02019736\n",
"02019786\n",
"02019411\n",
"3391674\n",
"02018727\n",
"02019035\n",
"02019350\n",
"02019414\n",
"2019353\n",
"2019353\n",
"2019493\n",
"02019903\n",
"02019825\n",
"02019802\n",
"03394941\n",
"02020243\n",
"2019914\n",
"02019164\n",
"02019467\n",
"03437937\n",
"02019366\n",
"02019344\n",
"2019930\n",
"02019910\n",
"02019647\n",
"02019843\n",
"01825596\n",
"02019882\n",
"03409694\n",
"02019391\n",
"02019389\n",
"02019301\n",
"02020005\n",
"02019920\n",
"02019498\n",
"02019373\n",
"02019733\n",
"2019998\n",
"02020000\n",
"02019401\n",
"02019901\n",
"03418242\n",
"02019383\n",
"02019438\n",
"02019871\n",
"02019193\n",
"02019635\n",
"02020203\n",
"02019098\n",
"02019459\n",
"02018996\n",
"02019499\n",
"02019687\n",
"02018674\n",
"02019059\n",
"02019059\n",
"2019845\n",
"2018609\n",
"02019379\n",
"02020006\n",
"2019923\n",
"02019774\n",
"02019068\n",
"020294\n",
"03403228\n",
"3019337\n",
"02018711\n",
"03462315\n",
"02019739\n",
"02019278\n",
"02019416\n",
"2018973\n",
"02019256\n",
"02019878\n",
"02019664\n",
"02019404\n",
"02019058\n",
"02019504\n",
"02019361\n",
"02019600\n",
"02019381\n",
"02019248\n",
"02019543\n",
"02019648\n",
"02020260\n",
"287 ok\n"
"260 ok\n"
]
}
],
@@ -1978,13 +1606,12 @@
"import json\n",
"import openpyxl\n",
"\n",
"wb = openpyxl.load_workbook('data/宁夏能化干预人员问卷(20251222).xlsx',data_only=True)\n",
"wb = openpyxl.load_workbook(f'data/宁夏能化干预人员问卷({riqi}).xlsx',data_only=True)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" code = str(sheet.cell(n, 6).value)\n",
" print(code)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
@@ -2002,7 +1629,7 @@
" person[code] = dict1\n",
"#print(person)\n",
"\n",
"filename = 'data/surveys_records_2025-12-22.json'\n",
"filename = f'data/surveys_records_{riqi}.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
@@ -2013,6 +1640,7 @@
" dict2 = {}\n",
" data = json.loads(item['data'])\n",
" code = data['code']\n",
" #print(code)\n",
" rq = item['date_created'].split()[0]\n",
" dict2['height'] = str('%.2f' % data['height'])\n",
" dict2['weight'] = str('%.2f' %data['weight'])\n",
@@ -2060,7 +1688,7 @@
" dict2['last_lose-Comment'] = data['last_lose-Comment']\n",
" if code in person.keys():\n",
" person[code][rq] = dict2\n",
"filename = 'data/宁夏能化干预人员问卷情况(20251222).json'\n",
"filename = f'data/宁夏能化干预人员问卷情况({riqi}).json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
@@ -2078,15 +1706,15 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 9,
"id": "55b20059-ae36-493e-b0c5-c7e35473efc7",
"metadata": {
"execution": {
"iopub.execute_input": "2025-12-22T03:49:42.115930Z",
"iopub.status.busy": "2025-12-22T03:49:42.114895Z",
"iopub.status.idle": "2025-12-22T03:49:43.037249Z",
"shell.execute_reply": "2025-12-22T03:49:43.036729Z",
"shell.execute_reply.started": "2025-12-22T03:49:42.115872Z"
"iopub.execute_input": "2026-01-21T07:58:45.779363Z",
"iopub.status.busy": "2026-01-21T07:58:45.778644Z",
"iopub.status.idle": "2026-01-21T07:58:46.618870Z",
"shell.execute_reply": "2026-01-21T07:58:46.618242Z",
"shell.execute_reply.started": "2026-01-21T07:58:45.779302Z"
}
},
"outputs": [],
@@ -2105,7 +1733,7 @@
"cur = conn.cursor()\n",
"event_id = 1\n",
"org_id = 1\n",
"filename = 'data/宁夏能化干预人员问卷情况(20251222).json'\n",
"filename = f'data/宁夏能化干预人员问卷情况({riqi}).json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = ['name','sex','birth','unit']\n",
@@ -2139,7 +1767,6 @@
" data1.append(v[rq]['sport_type'])\n",
" else:\n",
" data1.append('')\n",
" \n",
" if 'sport_duration' in v[rq].keys():\n",
" data1.append(v[rq]['sport_duration'])\n",
" else:\n",