This commit is contained in:
512song committed 2025-06-09 14:02:43 +08:00
1 parent 9ccc2271eb
commit d4c40dcab2
2 files changed
+245 -65

No files matched your search

+198 -9
View File
@@ -838,7 +838,9 @@
{
"cell_type": "markdown",
"id": "d3649684-3eab-49ad-8b3d-ebb452289e51",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# 2024年体质检测"
]
@@ -1295,15 +1297,15 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "3e6da1e5-4b4e-448a-9663-815372da636b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-01T02:24:52.000744Z",
"iopub.status.busy": "2025-06-01T02:24:52.000187Z",
"iopub.status.idle": "2025-06-01T02:24:52.059953Z",
"shell.execute_reply": "2025-06-01T02:24:52.059389Z",
"shell.execute_reply.started": "2025-06-01T02:24:52.000689Z"
"iopub.execute_input": "2025-06-08T01:20:13.742945Z",
"iopub.status.busy": "2025-06-08T01:20:13.742373Z",
"iopub.status.idle": "2025-06-08T01:20:13.794862Z",
"shell.execute_reply": "2025-06-08T01:20:13.794371Z",
"shell.execute_reply.started": "2025-06-08T01:20:13.742894Z"
}
},
"outputs": [
@@ -1333,8 +1335,9 @@
" dict1['sex'] = sheet.cell(n, 4).value\n",
" dict1['unit'] = sheet.cell(n, 6).value\n",
" dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n",
" if sheet.cell(n, 7).value is not None:\n",
" dict1['phone'] = sheet.cell(n,7).value\n",
" dict1['id'] = str(sheet.cell(n,2).value)\n",
" #dict1['id'] = str(sheet.cell(n,2).value)\n",
" person[code] = dict1\n",
"filename = 'data/东营石油工程设计院2025.json'\n",
"with open(filename, 'w') as fl:\n",
@@ -1394,10 +1397,196 @@
"print('ok')"
]
},
{
"cell_type": "markdown",
"id": "e185883c-5c98-4090-883d-7ea643279b06",
"metadata": {},
"source": [
"## 获取人员测试成绩"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "d07d132b-dd74-458d-af0c-6a6ae005ad3a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-09T05:54:53.309142Z",
"iopub.status.busy": "2025-06-09T05:54:53.308597Z",
"iopub.status.idle": "2025-06-09T05:54:53.339265Z",
"shell.execute_reply": "2025-06-09T05:54:53.338794Z",
"shell.execute_reply.started": "2025-06-09T05:54:53.309094Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"246\n"
]
}
],
"source": [
"import json\n",
"import datetime\n",
"import csv\n",
"from datetime import date\n",
"import my_module as My\n",
"\n",
"filename = 'data/东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20250609.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"filename = 'data/result_东营石油工程设计院2025.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
]
},
{
"cell_type": "markdown",
"id": "a558472a-8428-476a-932a-3e723c9aa76b",
"metadata": {},
"source": [
"## 生成测试得分"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "971d592d-9ff5-4758-af68-2f60a986c2a2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-09T05:55:52.911728Z",
"iopub.status.busy": "2025-06-09T05:55:52.910950Z",
"iopub.status.idle": "2025-06-09T05:55:52.934192Z",
"shell.execute_reply": "2025-06-09T05:55:52.933606Z",
"shell.execute_reply.started": "2025-06-09T05:55:52.911653Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"import my_module as My\n",
"\n",
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
" #print(k)\n",
" if v['sex'] == '男':\n",
" sex = 'M'\n",
" else:\n",
" sex = 'F' \n",
" if 'bmi' in v.keys():\n",
" #bmi_data = v['height']['成绩'].split()[0]+','+ v['weight']['成绩'].split()[0]\n",
" bmi_data = v['bmi']['成绩']\n",
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':'HeightWeight','result':bmi_data}\n",
" dict2[k]['bmi'] = {}\n",
" dict2[k]['bmi']['成绩'] = bmi_data\n",
" dict2[k]['bmi']['score'] = My.cal_bmi(data1)\n",
" for item_en in list_item:\n",
" if item_en in v.keys(): \n",
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':item_en,'result':float(v[item_en]['成绩'].split()[0])}\n",
" #print(k,v['name'])\n",
" dict2[k][item_en]['score'] = My.cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_东营石油工程设计院2025.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "91afcf8e-9a70-438a-b956-8a195ddb0de8",
"metadata": {},
"source": [
"## 导出测试人员信息"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "fe5dc201-ee74-40a6-a7e3-4d9f8c0e05ed",
"metadata": {
"execution": {
"iopub.execute_input": "2025-06-09T05:57:30.861539Z",
"iopub.status.busy": "2025-06-09T05:57:30.860835Z",
"iopub.status.idle": "2025-06-09T05:57:30.983605Z",
"shell.execute_reply": "2025-06-09T05:57:30.983113Z",
"shell.execute_reply.started": "2025-06-09T05:57:30.861474Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n",
"filename = 'data/result_东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/东营石油工程设计院2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
" \n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(v['name']) \n",
" list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['unit'])\n",
" if 'bmi' in v.keys():\n",
" height = v['bmi']['成绩'].split(',')[0]\n",
" weight = v['bmi']['成绩'].split(',')[1]\n",
" list2.append(height)\n",
" list2.append(weight)\n",
" else:\n",
" list2.append('')\n",
" list2.append('')\n",
" for item in items:\n",
" if item in v.keys():\n",
" list2.append(v[item]['成绩']) \n",
" elif item =='name':\n",
" list2.append(v[item])\n",
" else:\n",
" list2.append('')\n",
" \n",
" list1.append(list2)\n",
"filename = 'data/东营石油工程设计院情况表2025.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d7bcbeb2-2e6e-40a4-b1ef-35b95462dc44",
"id": "d6e1066a-7779-407f-8b8d-109ada157acc",
"metadata": {},
"outputs": [],
"source": []
+47 -56
View File
@@ -15,7 +15,6 @@
"cell_type": "markdown",
"id": "112d80f4-607b-41f9-bb30-ac2eb8f52ee2",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@@ -382,6 +381,45 @@
"print(score)"
]
},
{
"cell_type": "markdown",
"id": "84e0cce3-d2f4-4489-a95e-2a00c3c3fc70",
"metadata": {},
"source": [
"### 生成手工成绩sql语言"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d6498431-2103-4d27-bba9-f1669b710361",
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/手工数据.xlsx',data_only=True)\n",
"sheet = wb.active\n",
"s = ''\n",
"list1 = []\n",
"for n in range(2, sheet.max_row+1):\n",
" ss = ''\n",
" list2 = []\n",
" list2.append(\"'\"+str(sheet.cell(n, 1).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 2).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 3).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 4).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 5).value)+\"'\")\n",
" list2.append(\"'\"+str(sheet.cell(n, 6).value)+\"'\")\n",
" ss = ','.join(list2)\n",
" list1.append(\"(\"+ss+\")\")\n",
"s = ','.join(list1)\n",
"print(s) \n",
" "
]
},
{
"cell_type": "markdown",
"id": "7fe0ffe8-c3d1-4843-9765-87d4a12b7c39",
@@ -828,27 +866,12 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "02319955-7fb6-4791-ae45-55b03bdadd54",
"metadata": {
"execution": {
"iopub.execute_input": "2025-03-26T08:57:29.670864Z",
"iopub.status.busy": "2025-03-26T08:57:29.670184Z",
"iopub.status.idle": "2025-03-26T08:57:29.848770Z",
"shell.execute_reply": "2025-03-26T08:57:29.848268Z",
"shell.execute_reply.started": "2025-03-26T08:57:29.670807Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import os,sys,shutil\n",
"import json\n",
@@ -2104,17 +2127,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19",
"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"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -2243,28 +2258,12 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"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": [
{
"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"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
@@ -2470,17 +2469,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"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"
}
},
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",