diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index bbbd639..4556d1a 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -391,26 +391,10 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "d6498431-2103-4d27-bba9-f1669b710361", - "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T10:23:26.493123Z", - "iopub.status.busy": "2025-06-20T10:23:26.492405Z", - "iopub.status.idle": "2025-06-20T10:23:26.517341Z", - "shell.execute_reply": "2025-06-20T10:23:26.516599Z", - "shell.execute_reply.started": "2025-06-20T10:23:26.493058Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "('141002','648960','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','570566','pushup','23','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491887','pushup','6','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','574298','pushup','17','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491960','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491662','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','575445','pushup','43','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','560212','pushup','40','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491851','pushup','11','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491871','pushup','17','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491724','pushup','13','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','573863','pushup','16','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','701505','pushup','15','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491852','pushup','44','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491792','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491628','pushup','5','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491730','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491857','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491909','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491644','pushup','1','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491659','pushup','21','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491991','pushup','12','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','567279','pushup','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491979','pushup','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491815','pushup','5','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','570113','pushup','51','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','697697','pushup','28','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491842','pushup','10','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491638','situp','24','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491797','situp','18','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491837','situp','18','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491964','situp','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491701','situp','23','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491634','situp','16','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491929','situp','7','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491873','situp','11','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491947','situp','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491816','situp','14','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491664','situp','25','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491715','situp','22','2025-06-20','2025-06-20 19:00:00.000 +0800'),('141002','491896','situp','11','2025-06-20','2025-06-20 19:00:00.000 +0800')\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -1568,32 +1552,16 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842", - "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:02:57.467110Z", - "iopub.status.busy": "2025-06-20T07:02:57.466845Z", - "iopub.status.idle": "2025-06-20T07:02:57.734080Z", - "shell.execute_reply": "2025-06-20T07:02:57.733499Z", - "shell.execute_reply.started": "2025-06-20T07:02:57.467082Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "245\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import openpyxl\n", "\n", "\n", - "filename = 'data/result_东营石油工程设计院2025.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -1646,7 +1614,7 @@ " mydata['score'] = round(score/len(mydata['fits']),2)\n", " if len(mydata['fits']) >2:\n", " dict2[str(k)] = mydata\n", - "filename = f'data/data_东营石油工程设计院2025.json'\n", + "filename = f'data/data_宁夏能化人员.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print(len(dict2)) " @@ -1662,34 +1630,17 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "63edd636-f034-4aa6-8575-63d5cdb84adb", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:03:02.456319Z", - "iopub.status.busy": "2025-06-20T07:03:02.455985Z", - "iopub.status.idle": "2025-06-20T07:03:02.466008Z", - "shell.execute_reply": "2025-06-20T07:03:02.465278Z", - "shell.execute_reply.started": "2025-06-20T07:03:02.456291Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "平均成绩:2.8648分,男性:149人\n", - "平均成绩:3.347分,女性:96人\n", - "平均成绩:3.0537分,总体:245人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", - "filename = 'data/data_东营石油工程设计院2025.json'\n", + "filename = 'data/data_宁夏能化人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "i = 1\n", @@ -1723,32 +1674,12 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:18:09.278839Z", - "iopub.status.busy": "2025-06-20T07:18:09.278136Z", - "iopub.status.idle": "2025-06-20T07:18:09.306423Z", - "shell.execute_reply": "2025-06-20T07:18:09.305900Z", - "shell.execute_reply.started": "2025-06-20T07:18:09.278775Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0~255分人数:45人,男性:38人,女性:7人\n", - "256~332分人数:117人,男性:81人,女性:36人\n", - "333~367分人数:52人,男性:24人,女性:28人\n", - "368~500分人数:31人,男性:6人,女性:25人\n", - "245\n", - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1794,34 +1725,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "2d661ca6-6129-4da1-ac25-51d0156babb2", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:21:51.234293Z", - "iopub.status.busy": "2025-06-20T07:21:51.233818Z", - "iopub.status.idle": "2025-06-20T07:21:51.247599Z", - "shell.execute_reply": "2025-06-20T07:21:51.246811Z", - "shell.execute_reply.started": "2025-06-20T07:21:51.234246Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'合格': 1, '不合格': 0, '优秀': 0, '良好': 1}\n", - "25-29 {'不合格': 3, '合格': 9, '良好': 5}\n", - "30-34 {'合格': 7, '不合格': 3, '良好': 3, '优秀': 3}\n", - "35-39 {'合格': 8, '不合格': 0, '良好': 5, '优秀': 7}\n", - "40-44 {'优秀': 5, '合格': 8, '良好': 2, '不合格': 1}\n", - "45-49 {'合格': 3, '良好': 5, '优秀': 7, '不合格': 0}\n", - "50-54 {'合格': 0, '良好': 7, '优秀': 1, '不合格': 0}\n", - "55-80 {'合格': 0, '优秀': 2, '不合格': 0}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1861,34 +1770,12 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "fc97df37-34ff-4a02-9d26-b5d81b706e46", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:22:47.684882Z", - "iopub.status.busy": "2025-06-20T07:22:47.684089Z", - "iopub.status.idle": "2025-06-20T07:22:47.694069Z", - "shell.execute_reply": "2025-06-20T07:22:47.693102Z", - "shell.execute_reply.started": "2025-06-20T07:22:47.684812Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20-24 {'合格': 5, '不合格': 2, '优秀': 1, '良好': 0}\n", - "25-29 {'不合格': 18, '合格': 18, '良好': 4}\n", - "30-34 {'合格': 7, '不合格': 5, '良好': 3, '优秀': 0}\n", - "35-39 {'合格': 18, '不合格': 5, '良好': 4, '优秀': 2}\n", - "40-44 {'优秀': 0, '合格': 11, '良好': 5, '不合格': 3}\n", - "45-49 {'合格': 5, '良好': 3, '优秀': 2, '不合格': 2}\n", - "50-54 {'合格': 10, '良好': 5, '优秀': 1, '不合格': 2}\n", - "55-80 {'合格': 7, '优秀': 0, '不合格': 1}\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -1928,34 +1815,12 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:23:11.398803Z", - "iopub.status.busy": "2025-06-20T07:23:11.398178Z", - "iopub.status.idle": "2025-06-20T07:23:11.412257Z", - "shell.execute_reply": "2025-06-20T07:23:11.411707Z", - "shell.execute_reply.started": "2025-06-20T07:23:11.398743Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "16~24岁平均成绩:2.83分,人数:10人,男性:8人\n", - "25~29岁平均成绩:2.74分,人数:57人,男性:40人\n", - "30~34岁平均成绩:2.99分,人数:31人,男性:15人\n", - "35~39岁平均成绩:3.17分,人数:49人,男性:29人\n", - "40~44岁平均成绩:3.18分,人数:35人,男性:19人\n", - "45~49岁平均成绩:3.33分,人数:27人,男性:12人\n", - "50~54岁平均成绩:3.19分,人数:26人,男性:18人\n", - "55~69岁平均成绩:3.1分,人数:10人,男性:8人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n", "\n", @@ -1990,34 +1855,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "347703a1-501b-4800-bd29-16e94f4a6793", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:24:33.635096Z", - "iopub.status.busy": "2025-06-20T07:24:33.634402Z", - "iopub.status.idle": "2025-06-20T07:24:33.651087Z", - "shell.execute_reply": "2025-06-20T07:24:33.649880Z", - "shell.execute_reply.started": "2025-06-20T07:24:33.635035Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:2.76分,人数:8人\n", - "25~29岁平均成绩:2.65分,人数:40人\n", - "30~34岁平均成绩:2.79分,人数:15人\n", - "35~39岁平均成绩:2.94分,人数:29人\n", - "40~44岁平均成绩:2.99分,人数:19人\n", - "45~49岁平均成绩:3.06分,人数:12人\n", - "50~54岁平均成绩:3.06分,人数:18人\n", - "55~80岁平均成绩:2.86分,人数:8人\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -2052,34 +1895,12 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:25:13.064370Z", - "iopub.status.busy": "2025-06-20T07:25:13.063575Z", - "iopub.status.idle": "2025-06-20T07:25:13.078290Z", - "shell.execute_reply": "2025-06-20T07:25:13.077372Z", - "shell.execute_reply.started": "2025-06-20T07:25:13.064296Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "20~24岁平均成绩:3.1分,人数:2人\n", - "25~29岁平均成绩:2.96分,人数:17人\n", - "30~34岁平均成绩:3.18分,人数:16人\n", - "35~39岁平均成绩:3.51分,人数:20人\n", - "40~44岁平均成绩:3.41分,人数:16人\n", - "45~49岁平均成绩:3.54分,人数:15人\n", - "50~54岁平均成绩:3.5分,人数:8人\n", - "55~80岁平均成绩:4.05分,人数:2人\n" - ] - } - ], + "outputs": [], "source": [ "nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n", "\n", @@ -2112,36 +1933,12 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "ad69c45d-3f62-42df-894d-47424e759029", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:27:00.500978Z", - "iopub.status.busy": "2025-06-20T07:27:00.500308Z", - "iopub.status.idle": "2025-06-20T07:27:00.512882Z", - "shell.execute_reply": "2025-06-20T07:27:00.511833Z", - "shell.execute_reply.started": "2025-06-20T07:27:00.500920Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "BMI 3.52 245\n", - "肺活量 3.84 245\n", - "握力 2.16 245\n", - "坐位体前屈 2.64 240\n", - "纵跳 2.95 243\n", - "俯卧撑 3.56 143\n", - "一分钟仰卧起坐 4.18 89\n", - "单脚站立 2.77 245\n", - "选择反应时 3.46 245\n", - "台阶指数 2.36 231\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2166,56 +1963,12 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "dcf152e7-bbcc-47d1-9c5f-83854db35412", "metadata": { - "execution": { - "iopub.execute_input": "2025-06-20T07:27:51.081316Z", - "iopub.status.busy": "2025-06-20T07:27:51.080661Z", - "iopub.status.idle": "2025-06-20T07:27:51.092225Z", - "shell.execute_reply": "2025-06-20T07:27:51.091127Z", - "shell.execute_reply.started": "2025-06-20T07:27:51.081252Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "管道工程设计所 2.96 30\n", - "勘察与地下工程事业部 2.87 21\n", - "电力设计所 3.03 13\n", - "注水及水处理工艺设计所 2.98 11\n", - "油气工艺设计所 2.81 20\n", - "机械设备设计所 3.08 8\n", - "集成设计中心 2.78 12\n", - "经营管理部 2.44 1\n", - "技术发展中心 2.98 6\n", - "党群工作部 3.67 1\n", - "财务资产部 3.64 5\n", - "智能化研究中心 3.29 21\n", - "建筑设计所 3.33 14\n", - "档案管理中心 3.37 8\n", - "综合服务中心 3.04 8\n", - "绿色低碳技术研究中心 3.03 8\n", - "控制部 3.12 6\n", - "党委组织部(人力资源部) 3.11 1\n", - "工程监理公司 3.2 6\n", - "施工管理部 3.04 5\n", - "物资装备管理中心 3.47 4\n", - "海洋工程设计所 2.78 9\n", - "国际工程管理部 2.89 1\n", - "自控通信设计所 3.05 12\n", - "法律合规部 3.59 3\n", - "工程造价中心 3.04 7\n", - "运行管理部 3.0 1\n", - "纪检监督部 3.33 1\n", - "项目执行部 3.33 1\n", - "HSE管理部 3.11 1\n" - ] - } - ], + "outputs": [], "source": [ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", @@ -2260,7 +2013,7 @@ " score = 0\n", " n = 0\n", " for k, v in dict1.items():\n", - " if item == v['unit'] and v['sex'] == '女':\n", + " if item == v['unit'] and v['sex'] == '男':\n", " score = score + v['score']\n", " n = n +1 \n", " if n>0:\n", @@ -2327,7 +2080,7 @@ "import json\n", "\n", "items = ['BMI','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数'] \n", - "filename = 'data/data_北海炼化2024.json'\n", + "filename = 'data/data_宁夏能化人员.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -2374,9 +2127,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "6f9768ce-2ef5-4253-9fc6-49dbdcf00a19", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-29T01:27:37.201286Z", + "iopub.status.busy": "2025-06-29T01:27:37.200533Z", + "iopub.status.idle": "2025-06-29T01:27:37.211946Z", + "shell.execute_reply": "2025-06-29T01:27:37.211395Z", + "shell.execute_reply.started": "2025-06-29T01:27:37.201222Z" + } + }, "outputs": [], "source": [ "import json\n", @@ -2716,15 +2477,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "9ecd3ad8-c8af-4f3e-90e5-1618fea905a4", - "metadata": {}, + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-29T01:39:49.263673Z", + "iopub.status.busy": "2025-06-29T01:39:49.263044Z", + "iopub.status.idle": "2025-06-29T01:39:49.297534Z", + "shell.execute_reply": "2025-06-29T01:39:49.297056Z", + "shell.execute_reply.started": "2025-06-29T01:39:49.263597Z" + } + }, "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", + "filename = 'data/result_海淀区老干部大学第一期-1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "data_list = []\n", @@ -2806,7 +2575,7 @@ " list6.append('')\n", " i+=1\n", " data_list.append(list6)\n", - "filename = 'data/党建出版社测试情况表2025.xlsx'\n", + "filename = 'data/海淀区老干部大学第一期测试情况表.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "#sheet.append(title)\n", diff --git a/体测单位/南京化工.ipynb b/体测单位/南京化工.ipynb new file mode 100644 index 0000000..2e21812 --- /dev/null +++ b/体测单位/南京化工.ipynb @@ -0,0 +1,601 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04524c85-988e-4dbf-86eb-939a9db7aa28", + "metadata": {}, + "source": [ + "## 体测人员导入" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "bbba6efc-73cd-4db6-bae7-014724fee731", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-26T09:23:57.936852Z", + "iopub.status.busy": "2025-06-26T09:23:57.936142Z", + "iopub.status.idle": "2025-06-26T09:23:58.004545Z", + "shell.execute_reply": "2025-06-26T09:23:58.004103Z", + "shell.execute_reply.started": "2025-06-26T09:23:57.936786Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "92 ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/南化人员信息表.xlsx',data_only=True)\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = int(sheet.cell(n, 4).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['sex'] = sheet.cell(n, 5).value\n", + " dict1['unit'] = sheet.cell(n, 2).value \n", + " dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0]\n", + " dict1['phone'] = sheet.cell(n, 12).value \n", + " person[code] = dict1\n", + "filename = 'data/南京化工人员.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print(len(person),'ok')" + ] + }, + { + "cell_type": "markdown", + "id": "048a95aa-1691-45f6-b933-6eaf95ae1d30", + "metadata": {}, + "source": [ + "## 生成读卡系统文件" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-20T07:51:09.404359Z", + "iopub.status.busy": "2025-06-20T07:51:09.403401Z", + "iopub.status.idle": "2025-06-20T07:51:09.412040Z", + "shell.execute_reply": "2025-06-20T07:51:09.410889Z", + "shell.execute_reply.started": "2025-06-20T07:51:09.404278Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "\n", + "filename = 'data/南京化工人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "for k, v in dict1.items():\n", + " dict2 = {}\n", + " #if dict1['sex'] =='男':\n", + " # sex = 1\n", + " \n", + " dict2 = {'id':k,'name':v['name'],'gender':v['sex'],'birth':v['birth'],'unit':v['unit']}\n", + " list1.append(dict2)\n", + "json_data = json.dumps(list1,ensure_ascii=False, indent=4) \n", + "\n", + "# 将 json 数据写入文件\n", + "with open(\"data/data_南京化工人员.json\", \"w\",encoding = 'utf-8') as file:\n", + " file.write(json_data) \n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "6bcd45c2-10af-4d5f-9e0b-5cd1df4f7a7f", + "metadata": {}, + "source": [ + "## 获取人员测试成绩" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "970e171e-1360-448f-a28c-520ccb8f314a", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-27T04:18:55.832397Z", + "iopub.status.busy": "2025-06-27T04:18:55.832091Z", + "iopub.status.idle": "2025-06-27T04:18:55.841888Z", + "shell.execute_reply": "2025-06-27T04:18:55.841317Z", + "shell.execute_reply.started": "2025-06-27T04:18:55.832371Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "57\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/南京化工人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "filename = 'data/marks_20250627.csv'\n", + "re_ta = My.get_result(filename,dict1)\n", + "\n", + "\n", + "filename = 'data/result_南京化工.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": "6d381859-6d21-45d2-8313-55ebbabf8bd4", + "metadata": {}, + "source": [ + "## 生成测试得分" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-26T09:26:45.723598Z", + "iopub.status.busy": "2025-06-26T09:26:45.723143Z", + "iopub.status.idle": "2025-06-26T09:26:45.735635Z", + "shell.execute_reply": "2025-06-26T09:26:45.734794Z", + "shell.execute_reply.started": "2025-06-26T09:26:45.723567Z" + } + }, + "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_南京化工.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_南京化工.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict2,fl , ensure_ascii=False) \n", + "print('ok!') " + ] + }, + { + "cell_type": "markdown", + "id": "d034a61d-1fbd-417b-99bd-277e43ebb678", + "metadata": {}, + "source": [ + "## 导出测试人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-26T09:26:59.739745Z", + "iopub.status.busy": "2025-06-26T09:26:59.738920Z", + "iopub.status.idle": "2025-06-26T09:26:59.761164Z", + "shell.execute_reply": "2025-06-26T09:26:59.760746Z", + "shell.execute_reply.started": "2025-06-26T09:26:59.739659Z" + }, + "tags": [] + }, + "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_南京化工.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/南京化工人员.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/南京化工测试情况明细表(截至20250626).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": "markdown", + "id": "699c6a40-a6ae-4300-9646-708cb85aa5e8", + "metadata": {}, + "source": [ + "## 统计各部门测试人员情况" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "c4b71b0f-0f0c-4962-a540-611cbab51bfa", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-27T04:19:17.469888Z", + "iopub.status.busy": "2025-06-27T04:19:17.469137Z", + "iopub.status.idle": "2025-06-27T04:19:17.491232Z", + "shell.execute_reply": "2025-06-27T04:19:17.490732Z", + "shell.execute_reply.started": "2025-06-27T04:19:17.469824Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/result_南京化工.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/南京化工人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "\n", + "list1 = []\n", + "for k, v in dict2.items():\n", + " if k not in dict1.keys():\n", + " list2 = []\n", + " unit = v['unit']\n", + " list2 = [k,v['name'],v['sex'],unit]\n", + " list1.append(list2)\n", + " \n", + "\n", + "\n", + "\n", + "filename = 'data/南京化工未体测人员.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": "markdown", + "id": "3796748f-2079-46b6-a3a1-b22441880843", + "metadata": {}, + "source": [ + "## 统计各部门已测试情况" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "def3f47a-24ef-4815-b63b-2a16b79b4c15", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-17T11:02:38.842412Z", + "iopub.status.busy": "2025-06-17T11:02:38.841860Z", + "iopub.status.idle": "2025-06-17T11:02:38.879864Z", + "shell.execute_reply": "2025-06-17T11:02:38.879320Z", + "shell.execute_reply.started": "2025-06-17T11:02:38.842360Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/result_宁夏能化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/宁夏能化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "\n", + "dict3 = {}\n", + "\n", + "\n", + "title =['单位','体测人数']\n", + "list1 = []\n", + "for k,v in dict1.items():\n", + " unit = v['unit']\n", + " if unit=='管理部门':\n", + " sub_unit = dict2[k]['sub_unit']\n", + " else:\n", + " sub_unit = unit\n", + " dict3.setdefault(unit,{}) \n", + " dict3[unit].setdefault(sub_unit,{})\n", + " dict3[unit][sub_unit].setdefault('人数',0)\n", + " dict3[unit][sub_unit]['人数'] = dict3[unit][sub_unit]['人数'] + 1\n", + "\n", + "for k, v in dict3.items():\n", + " list2 = []\n", + " for k1,v1 in v.items():\n", + " list2 = [k,k1,v1['人数']]\n", + " list1.append(list2)\n", + "\n", + "filename = 'data/宁夏能化部门测试情况表.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": 65, + "id": "61dde8c3-844a-4016-8952-cb726ab5f61d", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-17T11:01:30.219475Z", + "iopub.status.busy": "2025-06-17T11:01:30.218747Z", + "iopub.status.idle": "2025-06-17T11:01:30.259871Z", + "shell.execute_reply": "2025-06-17T11:01:30.259320Z", + "shell.execute_reply.started": "2025-06-17T11:01:30.219409Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "\n", + "filename = 'data/result_宁夏能化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "filename = 'data/宁夏能化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "\n", + "dict3 = {}\n", + "\n", + "\n", + "title =['单位','体测人数']\n", + "list1 = []\n", + "for k,v in dict2.items():\n", + " unit = v['unit']\n", + " if unit=='管理部门':\n", + " sub_unit = dict2[k]['sub_unit']\n", + " else:\n", + " sub_unit = unit\n", + " dict3.setdefault(unit,{}) \n", + " dict3[unit].setdefault(sub_unit,{})\n", + " dict3[unit][sub_unit].setdefault('人数',0)\n", + " dict3[unit][sub_unit]['人数'] = dict3[unit][sub_unit]['人数'] + 1\n", + "\n", + "for k, v in dict3.items():\n", + " list2 = []\n", + " for k1,v1 in v.items():\n", + " list2 = [k,k1,v1['人数']]\n", + " list1.append(list2)\n", + "\n", + "filename = 'data/宁夏能化部门人员情况表.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": "markdown", + "id": "8d5f4103-0d1e-4711-b324-ece360f8dcd3", + "metadata": {}, + "source": [ + "## 生成报告" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "23ffd115-72a3-4f90-9e64-ffa6420df8a4", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-26T07:15:55.749748Z", + "iopub.status.busy": "2025-06-26T07:15:55.749253Z", + "iopub.status.idle": "2025-06-26T07:15:56.590649Z", + "shell.execute_reply": "2025-06-26T07:15:56.589700Z", + "shell.execute_reply.started": "2025-06-26T07:15:55.749700Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\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_南京化工.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "file_path ='./南京化工/'\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'] = v['unit']\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": "code", + "execution_count": null, + "id": "87556725-f68a-484b-827c-f6735155e940", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/体测单位/宁夏能化.ipynb b/体测单位/宁夏能化.ipynb index 028df78..abe0b45 100644 --- a/体测单位/宁夏能化.ipynb +++ b/体测单位/宁夏能化.ipynb @@ -10,12 +10,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "bbba6efc-73cd-4db6-bae7-014724fee731", "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T06:47:52.647999Z", + "iopub.status.busy": "2025-06-24T06:47:52.647468Z", + "iopub.status.idle": "2025-06-24T06:47:52.837761Z", + "shell.execute_reply": "2025-06-24T06:47:52.837173Z", + "shell.execute_reply.started": "2025-06-24T06:47:52.647952Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1698 ok\n" + ] + } + ], "source": [ "import openpyxl\n", "import json\n", @@ -48,6 +63,60 @@ "print(len(person),'ok')" ] }, + { + "cell_type": "code", + "execution_count": 36, + "id": "ddddbac1-ab71-436a-ab64-2a15600f5b1b", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:47:30.639088Z", + "iopub.status.busy": "2025-06-24T07:47:30.638546Z", + "iopub.status.idle": "2025-06-24T07:47:30.944089Z", + "shell.execute_reply": "2025-06-24T07:47:30.943556Z", + "shell.execute_reply.started": "2025-06-24T07:47:30.639038Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1953 ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "\n", + "wb = openpyxl.load_workbook('data/宁夏能化-全部名单.xlsx',data_only=True)\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "\n", + "for n in range(2, sheet.max_row+1):\n", + " code = int(sheet.cell(n, 2).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 3).value\n", + " dict1['sex'] = sheet.cell(n, 4).value\n", + " unit = sheet.cell(n, 8).value\n", + " \n", + " dict1['sub_unit'] = sheet.cell(n, 6).value\n", + " if unit == '管理部门':\n", + " dict1['unit'] = sheet.cell(n, 9).value\n", + " else:\n", + " dict1['unit'] = sheet.cell(n, 8).value\n", + " \n", + " dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n", + " person[code] = dict1\n", + "filename = 'data/宁夏能化人员all.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print(len(person),'ok')" + ] + }, { "cell_type": "markdown", "id": "048a95aa-1691-45f6-b933-6eaf95ae1d30", @@ -96,11 +165,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 37, "id": "970e171e-1360-448f-a28c-520ccb8f314a", "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:47:35.746440Z", + "iopub.status.busy": "2025-06-24T07:47:35.746188Z", + "iopub.status.idle": "2025-06-24T07:47:35.874766Z", + "shell.execute_reply": "2025-06-24T07:47:35.874285Z", + "shell.execute_reply.started": "2025-06-24T07:47:35.746417Z" + }, "tags": [] }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1699\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/宁夏能化人员all.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "filename = 'data/marks_20250619.csv'\n", + "re_ta = My.get_result(filename,dict1)\n", + "\n", + "\n", + "filename = 'data/result_宁夏能化人员all.json'\n", + "with open(filename,'w') as fl:\n", + " json.dump(re_ta, fl, ensure_ascii=False) \n", + "print(len(re_ta))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "24189bf6-d2b2-4855-a6b2-7a6e36cd79f3", + "metadata": {}, "outputs": [], "source": [ "import json\n", @@ -122,6 +232,45 @@ "print(len(re_ta))" ] }, + { + "cell_type": "code", + "execution_count": 22, + "id": "2082c096-9f36-430c-9823-f09d8b6f9b42", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:24:22.507391Z", + "iopub.status.busy": "2025-06-24T07:24:22.506635Z", + "iopub.status.idle": "2025-06-24T07:24:22.548344Z", + "shell.execute_reply": "2025-06-24T07:24:22.547831Z", + "shell.execute_reply.started": "2025-06-24T07:24:22.507322Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['2018652', '2019665', '2019160', '2019512', '3427477', '2019423', '2019494', '2019901']\n" + ] + } + ], + "source": [ + "filename = 'data/result_宁夏能化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/result_宁夏能化人员all.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl) \n", + "list1 = []\n", + "for k,v in dict2.items():\n", + " if k not in dict1.keys():\n", + " #print(k,v['name'],v['sex'],v['unit'])\n", + " #print(k,v)\n", + " list1.append(str(k))\n", + "print(list1)" + ] + }, { "cell_type": "markdown", "id": "6d381859-6d21-45d2-8313-55ebbabf8bd4", @@ -132,10 +281,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 38, "id": "0905ad6a-f7e4-43ed-ae29-c4850deb946b", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:47:41.560238Z", + "iopub.status.busy": "2025-06-24T07:47:41.559637Z", + "iopub.status.idle": "2025-06-24T07:47:41.657989Z", + "shell.execute_reply": "2025-06-24T07:47:41.657434Z", + "shell.execute_reply.started": "2025-06-24T07:47:41.560182Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok!\n" + ] + } + ], "source": [ "import json\n", "import time\n", @@ -143,7 +308,7 @@ "\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_宁夏能化人员.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl) \n", "for k, v in dict2.items():\n", @@ -166,7 +331,7 @@ " dict2[k][item_en]['score'] = My.cal_score(data1)\n", " #print(k,v[item_en]['成绩'],cal_score(data1))\n", "\n", - "filename = f'data/result_宁夏能化人员.json'\n", + "filename = f'data/result_宁夏能化人员all.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print('ok!') " @@ -182,9 +347,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890", "metadata": { + "execution": { + "iopub.execute_input": "2025-06-26T01:35:41.139581Z", + "iopub.status.busy": "2025-06-26T01:35:41.139145Z", + "iopub.status.idle": "2025-06-26T01:35:41.663585Z", + "shell.execute_reply": "2025-06-26T01:35:41.663054Z", + "shell.execute_reply.started": "2025-06-26T01:35:41.139557Z" + }, "tags": [] }, "outputs": [], @@ -195,11 +367,11 @@ "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "\n", - "filename = 'data/result_宁夏能化人员.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", - "filename = 'data/宁夏能化人员.json'\n", + "filename = 'data/宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl)\n", " \n", @@ -396,6 +568,90 @@ "wb.save(filename)" ] }, + { + "cell_type": "markdown", + "id": "970a1cc8-4fdf-478a-9f5b-b82d7d4bf762", + "metadata": {}, + "source": [ + "## 生成体测成绩明细表" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "d31020be-c9c0-404f-8e0b-f8f507385f48", + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-27T04:14:46.467739Z", + "iopub.status.busy": "2025-06-27T04:14:46.466974Z", + "iopub.status.idle": "2025-06-27T04:14:47.053693Z", + "shell.execute_reply": "2025-06-27T04:14:47.053104Z", + "shell.execute_reply.started": "2025-06-27T04:14:46.467668Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n", + "bmi = ['height','weight']\n", + "title = ['编号','姓名','性别','单位/部门','身高','体重','bmi','肺活量','得分','握力','得分','坐位体前屈','得分','纵跳','得分','俯卧撑','得分','一分钟仰卧起坐','得分','单脚站立','得分','选择反应时','得分','台阶指数','得分']\n", + "\n", + "filename = 'data/result_宁夏能化人员all.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "\n", + "list1 = []\n", + "for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(dict1[k]['name']) \n", + " list2.append(dict1[k]['sex'])\n", + " list2.append(dict1[k]['unit'])\n", + " i = 0\n", + " if 'bmi' in dict1[k].keys():\n", + " list2.append(dict1[k]['bmi']['成绩'].split(',')[0])\n", + " list2.append(dict1[k]['bmi']['成绩'].split(',')[1])\n", + " list2.append(dict1[k]['bmi']['score'])\n", + " i+=1\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " list2.append('') \n", + " \n", + " \n", + " for item in items:\n", + " if item in dict1[k].keys():\n", + " list2.append(dict1[k][item]['成绩'])\n", + " list2.append(dict1[k][item]['score']) \n", + " i+=1\n", + " elif item =='name':\n", + " list2.append(dict1[k][item])\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " if i>2:\n", + " list1.append(list2)\n", + "filename = 'data/宁夏能化体测情况明细表.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)\n", + "print('ok') " + ] + }, { "cell_type": "markdown", "id": "8d5f4103-0d1e-4711-b324-ece360f8dcd3", @@ -474,10 +730,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "id": "9ffec868-3851-42f6-8431-c5c5d3d15424", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:47:57.736323Z", + "iopub.status.busy": "2025-06-24T07:47:57.736061Z", + "iopub.status.idle": "2025-06-24T07:48:02.653903Z", + "shell.execute_reply": "2025-06-24T07:48:02.653030Z", + "shell.execute_reply.started": "2025-06-24T07:47:57.736300Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "8\n" + ] + } + ], "source": [ "import requests\n", "import json\n", @@ -487,7 +759,7 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_宁夏能化人员.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", @@ -498,7 +770,7 @@ "for k, v in dict1.items():\n", " list1 = []\n", " mydata = {}\n", - " if str(k) =='2019945':\n", + " if str(k) in ['2018652', '2019665', '2019160', '2019512', '3427477', '2019423', '2019494', '2019901']:\n", " \n", " id = str(k).rjust(4,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", @@ -551,10 +823,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "id": "59f69be9-ab27-4308-8641-927dbcfda87e", - "metadata": {}, - "outputs": [], + "metadata": { + "execution": { + "iopub.execute_input": "2025-06-24T07:48:39.717546Z", + "iopub.status.busy": "2025-06-24T07:48:39.716729Z", + "iopub.status.idle": "2025-06-24T07:48:40.238267Z", + "shell.execute_reply": "2025-06-24T07:48:40.237638Z", + "shell.execute_reply.started": "2025-06-24T07:48:39.717462Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1699\n" + ] + } + ], "source": [ "import os,sys,shutil\n", "import json\n", @@ -566,7 +854,7 @@ "old = []\n", "dict2 = {}\n", "\n", - "filename = 'data/result_宁夏能化人员.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", @@ -592,15 +880,15 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 41, "id": "896955ac-351a-4914-94a6-56e6d1ae9e6e", "metadata": { "execution": { - "iopub.execute_input": "2025-06-23T09:48:19.322071Z", - "iopub.status.busy": "2025-06-23T09:48:19.321505Z", - "iopub.status.idle": "2025-06-23T09:48:19.482488Z", - "shell.execute_reply": "2025-06-23T09:48:19.482024Z", - "shell.execute_reply.started": "2025-06-23T09:48:19.322019Z" + "iopub.execute_input": "2025-06-24T07:48:42.641359Z", + "iopub.status.busy": "2025-06-24T07:48:42.641096Z", + "iopub.status.idle": "2025-06-24T07:48:42.812702Z", + "shell.execute_reply": "2025-06-24T07:48:42.812095Z", + "shell.execute_reply.started": "2025-06-24T07:48:42.641334Z" } }, "outputs": [ @@ -621,7 +909,7 @@ "\n", "fi_path = '/home/songyi/pdf-typescript-old2/宁夏能化人员'\n", "\n", - "filename = 'data/result_宁夏能化人员.json'\n", + "filename = 'data/result_宁夏能化人员all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "fls = glob.glob(f'{fi_path}/*.pdf')\n", diff --git a/体测单位/海淀老干部大学.ipynb b/体测单位/海淀老干部大学.ipynb index c21bef8..6738ac5 100644 --- a/体测单位/海淀老干部大学.ipynb +++ b/体测单位/海淀老干部大学.ipynb @@ -10,15 +10,15 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "id": "eb9aa782-ce2c-4814-bdf6-92c7e892854d", "metadata": { "execution": { - "iopub.execute_input": "2025-03-13T02:11:09.976784Z", - "iopub.status.busy": "2025-03-13T02:11:09.976043Z", - "iopub.status.idle": "2025-03-13T02:11:09.999996Z", - "shell.execute_reply": "2025-03-13T02:11:09.999500Z", - "shell.execute_reply.started": "2025-03-13T02:11:09.976712Z" + "iopub.execute_input": "2025-06-27T07:52:20.116852Z", + "iopub.status.busy": "2025-06-27T07:52:20.116187Z", + "iopub.status.idle": "2025-06-27T07:52:20.147516Z", + "shell.execute_reply": "2025-06-27T07:52:20.146947Z", + "shell.execute_reply.started": "2025-06-27T07:52:20.116789Z" } }, "outputs": [ @@ -26,7 +26,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "49\n", + "51\n", "ok\n" ] } @@ -36,7 +36,7 @@ "import json\n", "from datetime import date\n", "\n", - "wb = openpyxl.load_workbook('data/海淀老干部局第一期.xlsx')\n", + "wb = openpyxl.load_workbook('data/海淀老干部局第二期.xlsx')\n", "sheet = wb.active\n", "# sheets = wb.sheetnames\n", "person = {}\n", @@ -47,13 +47,13 @@ " dict1 = {}\n", " dict1['name'] = sheet.cell(n, 2).value\n", " dict1['sex'] = sheet.cell(n, 3).value\n", - " dict1['unit'] = '第一期'\n", + " dict1['unit'] = '第二期'\n", " dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n", " dict1['id'] = sheet.cell(n, 5).value\n", " if sheet.cell(n,6).value is not None:\n", " dict1['phone'] = str(sheet.cell(n,6).value) \n", " person[code] = dict1\n", - "filename = 'data/海淀区老干部大学第一期.json'\n", + "filename = 'data/海淀区老干部大学第二期.json'\n", "with open(filename, 'w') as fl:\n", " json.dump(person, fl, ensure_ascii=False)\n", "print(len(person))\n", @@ -122,15 +122,15 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 6, "id": "fd005ed3-24ee-4b39-a619-6c83e64c2852", "metadata": { "execution": { - "iopub.execute_input": "2025-03-18T08:59:51.660525Z", - "iopub.status.busy": "2025-03-18T08:59:51.660023Z", - "iopub.status.idle": "2025-03-18T08:59:51.676922Z", - "shell.execute_reply": "2025-03-18T08:59:51.676147Z", - "shell.execute_reply.started": "2025-03-18T08:59:51.660475Z" + "iopub.execute_input": "2025-06-27T08:01:00.773765Z", + "iopub.status.busy": "2025-06-27T08:01:00.772994Z", + "iopub.status.idle": "2025-06-27T08:01:00.788351Z", + "shell.execute_reply": "2025-06-27T08:01:00.787439Z", + "shell.execute_reply.started": "2025-06-27T08:01:00.773693Z" } }, "outputs": [ @@ -138,7 +138,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "40\n" + "30\n" ] } ], @@ -151,11 +151,11 @@ "\n", "re_ta = {}\n", "list1 = []\n", - "filename = 'data/海淀区老干部大学第一期.json'\n", + "filename = 'data/海淀区老干部大学第二期.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "\n", - "filename = 'data/marks_20250318.csv'\n", + "filename = 'data/marks_20250627.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -190,7 +190,7 @@ " score = result[4] \n", " re_ta[user][item_name]['成绩'] = score\n", "\n", - "filename = 'data/result_海淀区老干部大学第一期.json'\n", + "filename = 'data/result_海淀区老干部大学第二期.json'\n", "with open(filename,'w') as fl:\n", " json.dump(re_ta, fl, ensure_ascii=False) \n", "print(len(re_ta))" @@ -206,15 +206,15 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 7, "id": "9481765c-92b7-4a58-b192-582bb001f167", "metadata": { "execution": { - "iopub.execute_input": "2025-03-18T08:59:58.639366Z", - "iopub.status.busy": "2025-03-18T08:59:58.638697Z", - "iopub.status.idle": "2025-03-18T08:59:58.654499Z", - "shell.execute_reply": "2025-03-18T08:59:58.653527Z", - "shell.execute_reply.started": "2025-03-18T08:59:58.639304Z" + "iopub.execute_input": "2025-06-27T08:01:04.771410Z", + "iopub.status.busy": "2025-06-27T08:01:04.770655Z", + "iopub.status.idle": "2025-06-27T08:01:04.784375Z", + "shell.execute_reply": "2025-06-27T08:01:04.783184Z", + "shell.execute_reply.started": "2025-06-27T08:01:04.771340Z" } }, "outputs": [ @@ -233,7 +233,7 @@ "\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_海淀区老干部大学第一期.json'\n", + "filename = 'data/result_海淀区老干部大学第二期.json'\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl) \n", "for k, v in dict2.items():\n", @@ -256,7 +256,7 @@ " dict2[k][item_en]['score'] = My.cal_score(data1)\n", " #print(k,v[item_en]['成绩'],cal_score(data1))\n", "\n", - "filename = f'data/result_海淀区老干部大学第一期.json'\n", + "filename = f'data/result_海淀区老干部大学第二期.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print('ok!') " @@ -272,15 +272,15 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "id": "63c81b75-9b3d-4001-a5da-32b7cf992843", "metadata": { "execution": { - "iopub.execute_input": "2025-03-11T06:54:01.231518Z", - "iopub.status.busy": "2025-03-11T06:54:01.230854Z", - "iopub.status.idle": "2025-03-11T06:54:01.260859Z", - "shell.execute_reply": "2025-03-11T06:54:01.260166Z", - "shell.execute_reply.started": "2025-03-11T06:54:01.231459Z" + "iopub.execute_input": "2025-06-29T01:24:19.165326Z", + "iopub.status.busy": "2025-06-29T01:24:19.164670Z", + "iopub.status.idle": "2025-06-29T01:24:19.203326Z", + "shell.execute_reply": "2025-06-29T01:24:19.202250Z", + "shell.execute_reply.started": "2025-06-29T01:24:19.165268Z" } }, "outputs": [ @@ -300,7 +300,7 @@ "bmi = ['height','weight']\n", "title = ['编号','姓名','性别','身高','体重','bmi','肺活量','得分','握力','得分','坐位体前屈','得分','纵跳','得分','俯卧撑','得分','一分钟仰卧起坐','得分','单脚站立','得分','选择反应时','得分','台阶指数','得分']\n", "\n", - "filename = 'data/result_海淀区老干部大学第一期.json'\n", + "filename = 'data/result_海淀区老干部大学第二期.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "\n", @@ -334,7 +334,7 @@ " list2.append('') \n", " if i>2:\n", " list1.append(list2)\n", - "filename = 'data/海淀区老干部大学第一期.xlsx'\n", + "filename = 'data/海淀区老干部大学第二期.xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -355,15 +355,15 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 13, "id": "dd8ed4fe-5014-455f-993d-64a41519de6d", "metadata": { "execution": { - "iopub.execute_input": "2025-03-18T09:00:09.951390Z", - "iopub.status.busy": "2025-03-18T09:00:09.949962Z", - "iopub.status.idle": "2025-03-18T09:00:09.977680Z", - "shell.execute_reply": "2025-03-18T09:00:09.977238Z", - "shell.execute_reply.started": "2025-03-18T09:00:09.951310Z" + "iopub.execute_input": "2025-06-27T08:18:07.185139Z", + "iopub.status.busy": "2025-06-27T08:18:07.184397Z", + "iopub.status.idle": "2025-06-27T08:18:07.209650Z", + "shell.execute_reply": "2025-06-27T08:18:07.208728Z", + "shell.execute_reply.started": "2025-06-27T08:18:07.185073Z" } }, "outputs": [ @@ -371,7 +371,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "36\n" + "27\n" ] } ], @@ -384,10 +384,10 @@ "\n", "dict1 = {}\n", "\n", - "filename = 'data/result_海淀区老干部大学第一期.json'\n", + "filename = 'data/result_海淀区老干部大学第二期.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", - "filename = 'data/海淀区老干部大学第一期.json'\n", + "filename = 'data/海淀区老干部大学第二期.json'\n", "with open(filename,'r') as fl:\n", " dict3 = json.load(fl)\n", "\n", @@ -397,7 +397,7 @@ " phone[v['phone']] = k\n", "\n", "list1 = []\n", - "filename = 'data/Survey_20250318.csv'\n", + "filename = 'data/Survey_20250627.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -453,7 +453,7 @@ " dict1[phone[item[2]]]['month'] = int(days/365*12)\n", " #print(phone[item[2]])\n", " nn+=1\n", - "filename = 'data/result_海淀区老干部大学第一期-1.json'\n", + "filename = 'data/result_海淀区老干部大学第二期-1.json'\n", "\n", "with open(filename,'w') as fl:\n", " json.dump(dict1, fl, ensure_ascii=False)\n", @@ -470,15 +470,15 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 14, "id": "b8b2fc93-9e8b-4bde-bc13-2de179de2b2d", "metadata": { "execution": { - "iopub.execute_input": "2025-03-18T09:00:27.649247Z", - "iopub.status.busy": "2025-03-18T09:00:27.648488Z", - "iopub.status.idle": "2025-03-18T09:00:49.222330Z", - "shell.execute_reply": "2025-03-18T09:00:49.221284Z", - "shell.execute_reply.started": "2025-03-18T09:00:27.649176Z" + "iopub.execute_input": "2025-06-27T08:18:23.717064Z", + "iopub.status.busy": "2025-06-27T08:18:23.716302Z", + "iopub.status.idle": "2025-06-27T08:18:40.822028Z", + "shell.execute_reply": "2025-06-27T08:18:40.821014Z", + "shell.execute_reply.started": "2025-06-27T08:18:23.716991Z" } }, "outputs": [ @@ -486,7 +486,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "40\n" + "33\n" ] } ], @@ -499,11 +499,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_海淀区老干部大学第一期-1.json'\n", + "filename = 'data/result_海淀区老干部大学第二期-1.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./海淀老年大学第一期/'\n", + "file_path ='./海淀老年大学第二期/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n",