This commit is contained in:
512song committed 2025-06-06 22:40:27 +08:00
1 parent c2b6f9b675
commit 9ccc2271eb
3 files changed
+576 -119

No files matched your search

+149 -7
View File
@@ -2104,9 +2104,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"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": [],
"source": [
"import json\n",
@@ -2235,16 +2243,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "1acaf159-637e-4101-9881-f6bb79400136",
"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": []
},
"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": [
"import openpyxl\n",
"\n",
"filename = 'data/result_北海炼化2024.json'\n",
"filename = 'data/result_党建出版社2025-1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -2270,7 +2294,7 @@
" list3.append(item)\n",
" list2.append(list3)\n",
"print(list2)\n",
"filename = 'data/北海炼化中医情况明细表2024.xlsx'\n",
"filename = 'data/党建出版社中医情况明细表2024.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\n",
@@ -2436,10 +2460,128 @@
"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",
"execution_count": null,
"id": "1fcca066-04a7-41c1-8c5e-aea251b87250",
"id": "200d10a8-15a7-4ec9-b407-ffb06c0e19be",
"metadata": {},
"outputs": [],
"source": []