20250606
This commit is contained in:
1 parent
c2b6f9b675
commit
9ccc2271eb
3 files changed
+576
-119
No files matched your search
+14
-14
@@ -1295,15 +1295,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 8,
|
||||||
"id": "3e6da1e5-4b4e-448a-9663-815372da636b",
|
"id": "3e6da1e5-4b4e-448a-9663-815372da636b",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-05-30T06:30:09.042788Z",
|
"iopub.execute_input": "2025-06-01T02:24:52.000744Z",
|
||||||
"iopub.status.busy": "2025-05-30T06:30:09.041974Z",
|
"iopub.status.busy": "2025-06-01T02:24:52.000187Z",
|
||||||
"iopub.status.idle": "2025-05-30T06:30:09.102061Z",
|
"iopub.status.idle": "2025-06-01T02:24:52.059953Z",
|
||||||
"shell.execute_reply": "2025-05-30T06:30:09.101519Z",
|
"shell.execute_reply": "2025-06-01T02:24:52.059389Z",
|
||||||
"shell.execute_reply.started": "2025-05-30T06:30:09.042708Z"
|
"shell.execute_reply.started": "2025-06-01T02:24:52.000689Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1320,7 +1320,7 @@
|
|||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"wb = openpyxl.load_workbook('data/石油工程设计有限公司人员2025.xlsx')\n",
|
"wb = openpyxl.load_workbook('data/石油工程设计有限公司人员2025.xlsx',data_only=True)\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"# sheets = wb.sheetnames\n",
|
"# sheets = wb.sheetnames\n",
|
||||||
"person = {}\n",
|
"person = {}\n",
|
||||||
@@ -1352,15 +1352,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 7,
|
||||||
"id": "93610ae6-098d-434a-a19a-6071aaa65500",
|
"id": "93610ae6-098d-434a-a19a-6071aaa65500",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
"execution": {
|
||||||
"iopub.execute_input": "2025-05-30T06:32:05.818838Z",
|
"iopub.execute_input": "2025-06-01T02:19:35.342854Z",
|
||||||
"iopub.status.busy": "2025-05-30T06:32:05.818215Z",
|
"iopub.status.busy": "2025-06-01T02:19:35.342124Z",
|
||||||
"iopub.status.idle": "2025-05-30T06:32:05.831425Z",
|
"iopub.status.idle": "2025-06-01T02:19:35.355636Z",
|
||||||
"shell.execute_reply": "2025-05-30T06:32:05.830336Z",
|
"shell.execute_reply": "2025-06-01T02:19:35.354344Z",
|
||||||
"shell.execute_reply.started": "2025-05-30T06:32:05.818778Z"
|
"shell.execute_reply.started": "2025-06-01T02:19:35.342790Z"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
@@ -1389,7 +1389,7 @@
|
|||||||
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
|
"json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n",
|
||||||
"\n",
|
"\n",
|
||||||
"# 将 json 数据写入文件\n",
|
"# 将 json 数据写入文件\n",
|
||||||
"with open(\"data/data_东营石油工程设计院2025.json\", \"w\",encoding = 'utf-8') as file:\n",
|
"with open(\"data/card_东营石油工程设计院2025.json\", \"w\",encoding = 'utf-8') as file:\n",
|
||||||
" file.write(json_data) \n",
|
" file.write(json_data) \n",
|
||||||
"print('ok')"
|
"print('ok')"
|
||||||
]
|
]
|
||||||
|
|||||||
+149
-7
@@ -2104,9 +2104,17 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 2,
|
||||||
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
|
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T07:00:45.640632Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T07:00:45.640094Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T07:00:45.650567Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T07:00:45.649389Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T07:00:45.640569Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -2235,16 +2243,32 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"id": "1acaf159-637e-4101-9881-f6bb79400136",
|
"id": "1acaf159-637e-4101-9881-f6bb79400136",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T07:01:23.261374Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T07:01:23.260702Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T07:01:23.288993Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T07:01:23.288447Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T07:01:23.261310Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[['1', '气虚', False, 40, 59, 35, 37, 50, 25, 28, 53, 14], ['2', '平和', False, 71, 6, 17, 28, 18, 8, 10, 0, 21], ['3', '气虚', True, 81, 37, 0, 31, 18, 8, 7, 21, 0], ['4', '痰湿', False, 50, 50, 7, 34, 62, 50, 60, 28, 17], ['5', '湿热', False, 71, 21, 14, 18, 21, 58, 7, 14, 3], ['8', '血瘀', True, 78, 28, 10, 28, 18, 25, 39, 21, 7], ['10', '特禀', False, 81, 18, 7, 18, 15, 20, 25, 21, 42], ['11', '湿热', False, 50, 40, 42, 46, 46, 62, 17, 35, 42], ['12', '平和', False, 68, 28, 25, 28, 25, 20, 17, 21, 3], ['13', '阳虚', False, 71, 31, 42, 34, 31, 20, 25, 21, 35], ['15', '湿热', False, 68, 18, 32, 28, 25, 50, 32, 14, 0], ['16', '阳虚', False, 59, 46, 53, 34, 21, 12, 32, 28, 35], ['17', '血瘀', False, 53, 50, 25, 43, 53, 45, 57, 53, 28], ['18', '平和', False, 78, 18, 10, 25, 15, 29, 10, 3, 17], ['19', '阳虚', False, 81, 18, 53, 21, 21, 20, 32, 14, 35], ['21', '阴虚', True, 84, 25, 17, 31, 15, 0, 28, 28, 21], ['23', '阴虚', False, 68, 25, 3, 43, 34, 41, 42, 28, 10], ['27', '痰湿', False, 87, 15, 10, 28, 40, 29, 14, 14, 14], ['29', '阳虚', False, 34, 65, 82, 25, 31, 16, 71, 53, 21], ['30', '平和', False, 78, 18, 17, 3, 15, 4, 21, 14, 17], ['35', '湿热', False, 53, 46, 25, 34, 46, 66, 35, 28, 25], ['36', '阴虚', True, 65, 31, 32, 37, 15, 12, 21, 3, 25], ['37', '阴虚', False, 68, 34, 28, 50, 34, 45, 25, 25, 17], ['39', '阳虚', True, 68, 34, 35, 21, 18, 8, 3, 25, 7], ['40', '阴虚', False, 68, 34, 25, 46, 34, 41, 28, 21, 14], ['43', '湿热', False, 65, 31, 7, 15, 34, 54, 17, 28, 28], ['45', '特禀', True, 68, 9, 32, 34, 18, 25, 21, 10, 35], ['46', '痰湿', False, 43, 56, 71, 59, 75, 66, 50, 67, 64], ['49', '湿热', False, 62, 37, 46, 21, 31, 50, 39, 28, 25], ['51', '痰湿', False, 62, 43, 25, 31, 56, 50, 28, 28, 21], ['52', '气虚', True, 68, 34, 32, 25, 18, 12, 25, 25, 7], ['53', '气郁', False, 59, 46, 32, 50, 40, 41, 46, 53, 28], ['55', '平和', False, 90, 9, 0, 3, 0, 0, 3, 0, 0], ['56', '阳虚', True, 75, 21, 35, 18, 21, 16, 10, 7, 14], ['58', '平和', False, 90, 15, 3, 18, 21, 20, 0, 7, 14], ['61', '阴虚', True, 75, 28, 14, 31, 25, 25, 25, 25, 14], ['62', '气虚', False, 50, 68, 50, 56, 59, 54, 50, 50, 14], ['66', '阳虚', False, 53, 37, 67, 43, 34, 29, 32, 35, 42], ['67', '平和', False, 71, 6, 14, 12, 6, 25, 10, 14, 0], ['68', '阳虚', False, 46, 46, 75, 37, 59, 50, 60, 50, 53], ['69', '阴虚', False, 53, 40, 46, 50, 31, 33, 17, 46, 42], ['71', '气郁', False, 53, 50, 53, 43, 53, 54, 32, 64, 25], ['72', '湿热', False, 62, 18, 17, 31, 37, 45, 17, 32, 14], ['74', '阳虚', False, 43, 59, 78, 40, 65, 41, 39, 78, 67], ['75', '气郁', False, 40, 56, 42, 28, 53, 45, 53, 67, 21], ['76', '阳虚', False, 40, 50, 75, 37, 34, 33, 35, 50, 21], ['77', '阳虚', False, 28, 68, 85, 84, 75, 75, 78, 64, 46], ['78', '湿热', False, 43, 43, 14, 46, 50, 70, 39, 60, 39], ['20', '湿热', False, 68, 37, 35, 34, 46, 66, 39, 17, 10], ['31', '阳虚', False, 59, 40, 50, 40, 31, 12, 32, 7, 17], ['33', '湿热', False, 50, 40, 21, 50, 56, 58, 53, 53, 53], ['54', '痰湿', False, 65, 40, 28, 46, 59, 41, 28, 35, 14], ['34', '阳虚', False, 65, 34, 50, 21, 37, 25, 35, 3, 3]]\n",
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"\n",
|
"\n",
|
||||||
"filename = 'data/result_北海炼化2024.json'\n",
|
"filename = 'data/result_党建出版社2025-1.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",
|
||||||
"i = 1\n",
|
"i = 1\n",
|
||||||
@@ -2270,7 +2294,7 @@
|
|||||||
" list3.append(item)\n",
|
" list3.append(item)\n",
|
||||||
" list2.append(list3)\n",
|
" list2.append(list3)\n",
|
||||||
"print(list2)\n",
|
"print(list2)\n",
|
||||||
"filename = 'data/北海炼化中医情况明细表2024.xlsx'\n",
|
"filename = 'data/党建出版社中医情况明细表2024.xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
"sheet = wb.active\n",
|
"sheet = wb.active\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -2436,10 +2460,128 @@
|
|||||||
"print('ok') "
|
"print('ok') "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "5fcd0a68-b6c7-4456-9ae7-7bbc4daecc99",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导出体质监测情况表"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T07:11:15.798769Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T07:11:15.797324Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T07:11:15.845006Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T07:11:15.844504Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T07:11:15.798674Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"\n",
|
||||||
|
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
|
||||||
|
"filename = 'data/result_党建出版社2025-1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"data_list = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" list6 = []\n",
|
||||||
|
" list6.append(str(k).rjust(4,'0'))\n",
|
||||||
|
" list6.append(v['name'])\n",
|
||||||
|
" list6.append(v['sex'])\n",
|
||||||
|
" #list6.append(v['unit'])\n",
|
||||||
|
" list6.append(v['age'])\n",
|
||||||
|
" if 'bmi' in v.keys():\n",
|
||||||
|
" bmi = v['bmi']['成绩']\n",
|
||||||
|
" list6.append(bmi.split(',')[0]+' 厘米')\n",
|
||||||
|
" list6.append(bmi.split(',')[1]+' 千克')\n",
|
||||||
|
" list6.append(v['bmi']['score'])\n",
|
||||||
|
" else:\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" for xm in list_item:\n",
|
||||||
|
" if xm in v.keys():\n",
|
||||||
|
" list6.append(v[xm]['成绩'])\n",
|
||||||
|
" list6.append(v[xm]['score'])\n",
|
||||||
|
" else:\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" \n",
|
||||||
|
" if 'tcm' in v.keys():\n",
|
||||||
|
" list1 = []\n",
|
||||||
|
" tcm =v['tcm']\n",
|
||||||
|
" for item in tcm:\n",
|
||||||
|
" list1.append(item)\n",
|
||||||
|
" score = tcm_calc(list1)\n",
|
||||||
|
"\n",
|
||||||
|
" result = tcm_kind(score)\n",
|
||||||
|
" kind = result['kind']\n",
|
||||||
|
" near = result['near']\n",
|
||||||
|
" #print(k,kinds[kind], near, score)\n",
|
||||||
|
" list6.append(kinds[kind])\n",
|
||||||
|
" if near:\n",
|
||||||
|
" list6.append('是')\n",
|
||||||
|
" else:\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" for item in score:\n",
|
||||||
|
" list6.append(item)\n",
|
||||||
|
" else:\n",
|
||||||
|
" for i in range(0,11):\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" if 'psy' in v.keys():\n",
|
||||||
|
" psy=v['psy']\n",
|
||||||
|
" for i in range(26,40):\n",
|
||||||
|
" new_valve = psy[i]-1\n",
|
||||||
|
" psy[i] = new_valve\n",
|
||||||
|
" dict3 = {}\n",
|
||||||
|
" \n",
|
||||||
|
" i = 0\n",
|
||||||
|
" for item in qb:\n",
|
||||||
|
" dict3.setdefault(item,0)\n",
|
||||||
|
" dict3[item] +=psy[i]\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" \n",
|
||||||
|
" for i in range(0,6):\n",
|
||||||
|
" score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n",
|
||||||
|
" list6.append(score)\n",
|
||||||
|
" else:\n",
|
||||||
|
" for i in range(0,6):\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" if 'spine' in v.keys():\n",
|
||||||
|
" spine = v['spine']\n",
|
||||||
|
" for i in range(0,4):\n",
|
||||||
|
" score = 0\n",
|
||||||
|
" for ii in range(list5[i][0],list5[i][1]):\n",
|
||||||
|
" score+= spine[ii]\n",
|
||||||
|
" list6.append(int(score/list5[i][2]*100)-100)\n",
|
||||||
|
" else:\n",
|
||||||
|
" for i in range(0,4):\n",
|
||||||
|
" list6.append('')\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" data_list.append(list6)\n",
|
||||||
|
"filename = 'data/党建出版社测试情况表2025.xlsx'\n",
|
||||||
|
"wb = openpyxl.Workbook()\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"#sheet.append(title)\n",
|
||||||
|
"for row in data_list:\n",
|
||||||
|
" sheet.append(row)\n",
|
||||||
|
" \n",
|
||||||
|
"wb.save(filename) "
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "1fcca066-04a7-41c1-8c5e-aea251b87250",
|
"id": "200d10a8-15a7-4ec9-b407-ffb06c0e19be",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
+413
-98
@@ -10,27 +10,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": null,
|
||||||
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
|
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2023-11-26T12:30:54.402556Z",
|
|
||||||
"iopub.status.busy": "2023-11-26T12:30:54.402097Z",
|
|
||||||
"iopub.status.idle": "2023-11-26T12:30:54.454920Z",
|
|
||||||
"shell.execute_reply": "2023-11-26T12:30:54.453841Z",
|
|
||||||
"shell.execute_reply.started": "2023-11-26T12:30:54.402519Z"
|
|
||||||
},
|
|
||||||
"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",
|
||||||
@@ -59,26 +44,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": null,
|
||||||
"id": "9448933d-527c-410d-ba55-4ce1819a8c1e",
|
"id": "9448933d-527c-410d-ba55-4ce1819a8c1e",
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"execution": {
|
"outputs": [],
|
||||||
"iopub.execute_input": "2025-05-28T01:56:09.248016Z",
|
|
||||||
"iopub.status.busy": "2025-05-28T01:56:09.247344Z",
|
|
||||||
"iopub.status.idle": "2025-05-28T01:56:09.438873Z",
|
|
||||||
"shell.execute_reply": "2025-05-28T01:56:09.438386Z",
|
|
||||||
"shell.execute_reply.started": "2025-05-28T01:56:09.247957Z"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -113,27 +82,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": null,
|
||||||
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
|
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2025-05-28T01:57:01.051560Z",
|
|
||||||
"iopub.status.busy": "2025-05-28T01:57:01.050181Z",
|
|
||||||
"iopub.status.idle": "2025-05-28T01:57:01.063491Z",
|
|
||||||
"shell.execute_reply": "2025-05-28T01:57:01.062383Z",
|
|
||||||
"shell.execute_reply.started": "2025-05-28T01:57:01.051490Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -166,27 +120,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": null,
|
||||||
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2025-05-30T06:04:13.081538Z",
|
|
||||||
"iopub.status.busy": "2025-05-30T06:04:13.080855Z",
|
|
||||||
"iopub.status.idle": "2025-05-30T06:04:13.108682Z",
|
|
||||||
"shell.execute_reply": "2025-05-30T06:04:13.107978Z",
|
|
||||||
"shell.execute_reply.started": "2025-05-30T06:04:13.081474Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"60\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import datetime\n",
|
"import datetime\n",
|
||||||
@@ -216,27 +155,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 2,
|
"execution_count": null,
|
||||||
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
|
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2025-05-30T06:06:04.468199Z",
|
|
||||||
"iopub.status.busy": "2025-05-30T06:06:04.467495Z",
|
|
||||||
"iopub.status.idle": "2025-05-30T06:06:04.482491Z",
|
|
||||||
"shell.execute_reply": "2025-05-30T06:06:04.481540Z",
|
|
||||||
"shell.execute_reply.started": "2025-05-30T06:06:04.468131Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"ok!\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import time\n",
|
"import time\n",
|
||||||
@@ -283,17 +207,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": null,
|
||||||
"id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b",
|
"id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b",
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2025-05-30T06:07:24.191486Z",
|
|
||||||
"iopub.status.busy": "2025-05-30T06:07:24.190813Z",
|
|
||||||
"iopub.status.idle": "2025-05-30T06:07:24.386100Z",
|
|
||||||
"shell.execute_reply": "2025-05-30T06:07:24.385612Z",
|
|
||||||
"shell.execute_reply.started": "2025-05-30T06:07:24.191424Z"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -344,10 +260,409 @@
|
|||||||
"wb.save(filename)"
|
"wb.save(filename)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "b1c9377b-0da3-481a-9334-b85aa0487374",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导入问卷信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 21,
|
||||||
|
"id": "e454f645-e593-4619-9fce-eabe0fa9f2a9",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T06:49:32.523392Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T06:49:32.522703Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T06:49:32.550951Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T06:49:32.550460Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T06:49:32.523324Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import csv\n",
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import time\n",
|
||||||
|
"from datetime import date\n",
|
||||||
|
"#import my_module as My\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"filename = 'data/result_党建出版社2025.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"filename = 'data/党建出版社2025.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[str(v['phone'])] = k\n",
|
||||||
|
"\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = 'data/survey_records_20250605.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",
|
||||||
|
"psy =[]\n",
|
||||||
|
"tcm = []\n",
|
||||||
|
"spine = []\n",
|
||||||
|
"for i in range(0,57):\n",
|
||||||
|
" psy.append(0)\n",
|
||||||
|
"\n",
|
||||||
|
"for i in range(0,60):\n",
|
||||||
|
" tcm.append(0)\n",
|
||||||
|
"for i in range(0,26):\n",
|
||||||
|
" spine.append(0)\n",
|
||||||
|
"i= 1\n",
|
||||||
|
"for item in list1:\n",
|
||||||
|
" if item[3] in phone.keys():\n",
|
||||||
|
" psy =[]\n",
|
||||||
|
" tcm = []\n",
|
||||||
|
" spine = []\n",
|
||||||
|
" for i in range(0,57):\n",
|
||||||
|
" psy.append(0)\n",
|
||||||
|
" #psy[44] = []\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[4])\n",
|
||||||
|
" if phone[item[3]] not in dict1.keys():\n",
|
||||||
|
" dict1[phone[item[3]]] = dict3[phone[item[3]]]\n",
|
||||||
|
" rq = date.fromisoformat(item[5].replace('/','-').split(' ')[0])\n",
|
||||||
|
" #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
|
||||||
|
" else:\n",
|
||||||
|
" rq = date.fromisoformat('2025-05-30')\n",
|
||||||
|
" for k, v in content.items():\n",
|
||||||
|
" if 'psy' in k:\n",
|
||||||
|
" i = int(k[3:])\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 'psy' in item[4]:\n",
|
||||||
|
" #for i in range(5,26):\n",
|
||||||
|
" # new_valve = 5-psy[i]\n",
|
||||||
|
" # psy[i] = new_valve\n",
|
||||||
|
" \n",
|
||||||
|
" \n",
|
||||||
|
" dict1[phone[item[3]]]['psy57'] = psy\n",
|
||||||
|
" if 'tcm' in item[4]:\n",
|
||||||
|
" dict1[phone[item[3]]]['tcm'] = tcm\n",
|
||||||
|
" if 'spine' in item[4]:\n",
|
||||||
|
" dict1[phone[item[3]]]['spine'] = spine\n",
|
||||||
|
" birth = date.fromisoformat(dict3[phone[item[3]]]['birth'].replace('/','-'))\n",
|
||||||
|
" \n",
|
||||||
|
" days = (rq-birth).days \n",
|
||||||
|
" dict1[phone[item[3]]]['age'] = int(days/365)\n",
|
||||||
|
" dict1[phone[item[3]]]['month'] = int(days/365*12)\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_党建出版社2025-1.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||||
|
"#print(data1[1])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "41a8ef94-57a1-4697-b99b-cb546adb09e5",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 统计参加问卷人员"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 20,
|
||||||
|
"id": "2ea13ff2-a675-41b2-b104-0f5cd1c9a0b5",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T01:06:25.708014Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T01:06:25.707173Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T01:06:25.734176Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T01:06:25.733170Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T01:06:25.707934Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"85\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import csv\n",
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import time\n",
|
||||||
|
"from datetime import date\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/党建出版社2025.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"phone1 = set()\n",
|
||||||
|
"phone2 = set()\n",
|
||||||
|
"for k,v in dict1.items():\n",
|
||||||
|
" phone1.add(v['phone'])\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = 'data/survey_records_20250605.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(len(phone1))\n",
|
||||||
|
"i =1\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"for item in list1:\n",
|
||||||
|
" code = int(item[3])\n",
|
||||||
|
" for k, v in dict1.items():\n",
|
||||||
|
" list3 = []\n",
|
||||||
|
" if v['phone'] == code: \n",
|
||||||
|
" list3.append(k)\n",
|
||||||
|
" list3.append(v['name'])\n",
|
||||||
|
" list3.append(v['sex'])\n",
|
||||||
|
" list3.append(v['unit'])\n",
|
||||||
|
" list3.append(code)\n",
|
||||||
|
" list2.append(list3)\n",
|
||||||
|
"filename = 'data/党建出版社问卷情况表2025.xlsx'\n",
|
||||||
|
"wb = openpyxl.Workbook()\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"#sheet.append(title)\n",
|
||||||
|
"for row in list2:\n",
|
||||||
|
" sheet.append(row)\n",
|
||||||
|
" \n",
|
||||||
|
"wb.save(filename) "
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "0db73bab-bd7b-4446-ab8e-432f918288b7",
|
"id": "7c2ef41d-bba9-4776-9a0e-71e14cd7d3fe",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import csv\n",
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import time\n",
|
||||||
|
"from datetime import date\n",
|
||||||
|
"\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/党建出版社2025.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"\n",
|
||||||
|
"phone1 = set()\n",
|
||||||
|
"phone2 = set()\n",
|
||||||
|
"for k,v in dict1.items():\n",
|
||||||
|
" phone1.add(v['phone'])\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"filename = 'data/survey_records_20250605.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(len(phone1))\n",
|
||||||
|
"i =1\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"for item in list1:\n",
|
||||||
|
" code = int(item[3])\n",
|
||||||
|
" if code not in phone1:\n",
|
||||||
|
" print(code)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "ffb387e1-41b5-4a4d-a9ca-89e1c5650880",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 生成报告"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 22,
|
||||||
|
"id": "462bc4e8-1659-43a0-9cbf-a87a4dfc5376",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T06:50:13.169871Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T06:50:13.168552Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T06:50:51.648786Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T06:50:51.647689Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T06:50:13.169789Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"65\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_党建出版社2025-1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl)\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"file_path ='./党建出版社2025/'\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'] = ' '\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','psy57','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",
|
||||||
|
" list1.append(mydata)\n",
|
||||||
|
" list2.append([k,v['name']])\n",
|
||||||
|
" i+=1\n",
|
||||||
|
" x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\n",
|
||||||
|
" #print(id,v['name'],x.text)\n",
|
||||||
|
" #print(mydata)\n",
|
||||||
|
" #x.close()\n",
|
||||||
|
"print(i)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "f28bb6dd-c8de-4761-a8a1-83b65a504a7d",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 计算中医体质"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 24,
|
||||||
|
"id": "0f393c7d-26b2-4bb2-8f18-702f5ee52abf",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2025-06-05T06:59:54.308502Z",
|
||||||
|
"iopub.status.busy": "2025-06-05T06:59:54.307891Z",
|
||||||
|
"iopub.status.idle": "2025-06-05T06:59:54.340029Z",
|
||||||
|
"shell.execute_reply": "2025-06-05T06:59:54.339248Z",
|
||||||
|
"shell.execute_reply.started": "2025-06-05T06:59:54.308441Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"ename": "NameError",
|
||||||
|
"evalue": "name 'tcm_calc' is not defined",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"Cell \u001b[0;32mIn[24], line 15\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m tcm:\n\u001b[1;32m 14\u001b[0m list1\u001b[38;5;241m.\u001b[39mappend(item)\n\u001b[0;32m---> 15\u001b[0m score \u001b[38;5;241m=\u001b[39m \u001b[43mtcm_calc\u001b[49m(list1)\n\u001b[1;32m 17\u001b[0m result \u001b[38;5;241m=\u001b[39m tcm_kind(score)\n\u001b[1;32m 18\u001b[0m kind \u001b[38;5;241m=\u001b[39m result[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mkind\u001b[39m\u001b[38;5;124m'\u001b[39m]\n",
|
||||||
|
"\u001b[0;31mNameError\u001b[0m: name 'tcm_calc' is not defined"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import openpyxl\n",
|
||||||
|
"import my_module as My\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_党建出版社2025-1.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"i = 1\n",
|
||||||
|
"list2 = []\n",
|
||||||
|
"for k, v in dict1.items():\n",
|
||||||
|
" if 'tcm' in v.keys():\n",
|
||||||
|
" list1 = []\n",
|
||||||
|
" tcm =v['tcm']\n",
|
||||||
|
" for item in tcm:\n",
|
||||||
|
" list1.append(item)\n",
|
||||||
|
" score = tcm_calc(list1)\n",
|
||||||
|
"\n",
|
||||||
|
" result = tcm_kind(score)\n",
|
||||||
|
" kind = result['kind']\n",
|
||||||
|
" near = result['near']\n",
|
||||||
|
" #print(i,k,kinds[kind], near, score)\n",
|
||||||
|
" #i+=1\n",
|
||||||
|
" list3 = []\n",
|
||||||
|
" list3.append(k)\n",
|
||||||
|
" list3.append(kinds[kind])\n",
|
||||||
|
" list3.append(near)\n",
|
||||||
|
" for item in score:\n",
|
||||||
|
" list3.append(item)\n",
|
||||||
|
" list2.append(list3)\n",
|
||||||
|
"print(list2)\n",
|
||||||
|
"filename = 'data/党建出版社中医情况明细表2025.xlsx'\n",
|
||||||
|
"wb = openpyxl.Workbook()\n",
|
||||||
|
"sheet = wb.active\n",
|
||||||
|
"\n",
|
||||||
|
"for row in list2:\n",
|
||||||
|
" sheet.append(row)\n",
|
||||||
|
" \n",
|
||||||
|
"wb.save(filename)\n",
|
||||||
|
"print('ok') "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "02057c2d-f2e5-4c09-8c2d-508bedb95817",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
Reference in new issue
Block a user