From f382b9af15d7de529f9071125546b7f8b788196a Mon Sep 17 00:00:00 2001 From: 512song Date: Sat, 23 Nov 2024 18:53:00 +0800 Subject: [PATCH] 20241123 --- item.json | 173 +++++++++++++++++++++++++++++++++++++++- 体测单位/my_module.py | 60 ++++++++++++++ 体测单位/北海炼化.ipynb | 26 +++--- 3 files changed, 241 insertions(+), 18 deletions(-) create mode 100644 体测单位/my_module.py diff --git a/item.json b/item.json index 7dc6ab9..b8f0047 100644 --- a/item.json +++ b/item.json @@ -1 +1,172 @@ -{"1": {"name": "肺活量", "unit": "毫升", "divisor": 1}, "2": {"name": "握力", "unit": "千克", "divisor": 1000}, "3": {"name": "坐位体前屈", "unit": "厘米", "divisor": 10}, "4": {"name": "纵跳", "unit": "厘米", "divisor": 10}, "5": {"name": "俯卧撑", "unit": "次", "divisor": 1}, "6": {"name": "单脚站立", "unit": "秒", "divisor": 1000}, "7": {"name": "选择反应时", "unit": "秒", "divisor": 1000}, "8": {"name": "台阶指数", "unit": "分", "divisor": 10}, "9": {"name": "一分钟仰卧起坐", "unit": "次", "divisor": 1}, "10": {"name": "身高", "unit": "厘米", "divisor": 10}, "11": {"name": "体重", "unit": "千克", "divisor": 1000}, "12": {"name": "立定跳远", "unit": "厘米", "divisor": 10}, "13": {"name": "网球掷远", "unit": "米", "divisor": 1000}, "14": {"name": "双脚连续跳", "unit": "秒", "divisor": 1000}, "15": {"name": "10米折返跑", "unit": "秒", "divisor": 1000}, "16": {"name": "走平衡木", "unit": "秒", "divisor": 1000}, "17": {"name": "50米跑", "unit": "秒", "divisor": 1000}, "18": {"name": "一分钟跳绳", "unit": "次", "divisor": 1}, "19": {"name": "50米*8往返跑", "unit": "秒", "divisor": 1000}, "20": {"name": "高压", "unit": "mmHg", "divisor": 1}, "21": {"name": "低压", "unit": "mmHg", "divisor": 1}, "22": {"name": "心率", "unit": "次", "divisor": 1}, "23": {"name": "长跑", "unit": "秒", "divisor": 1000}, "24": {"name": "引体向上", "unit": "次", "divisor": 1}, "27": {"name": "实心球", "unit": "米", "divisor": 1000}, "28": {"name": "篮球运球", "unit": "秒", "divisor": 1000}, "29": {"name": "足球运球", "unit": "秒", "divisor": 1000}, "30": {"name": "足球垫球", "unit": "次", "divisor": 1}, "31": {"name": "排球垫球", "unit": "次", "divisor": 1}, "32": {"name": "25米×2往返跑", "unit": "秒", "divisor": 1000}, "33": {"name": "左右眼视力", "unit": "分", "divisor": 10}, "34": {"name": "测试", "unit": "毫升", "divisor": 1}, "37": {"name": "跪卧撑", "unit": "次", "divisor": 1}, "38": {"name": "功率车", "unit": "毫升/千克/分钟", "divisor": 10}} \ No newline at end of file +{ + "lung": { + "name": "肺活量", + "unit": "毫升", + "divisor": 1 + }, + "grip": { + "name": "握力", + "unit": "千克", + "divisor": 1000 + }, + "flexion": { + "name": "坐位体前屈", + "unit": "厘米", + "divisor": 10 + }, + "jump": { + "name": "纵跳", + "unit": "厘米", + "divisor": 10 + }, + "pushup": { + "name": "俯卧撑", + "unit": "次", + "divisor": 1 + }, + "balance": { + "name": "单脚站立", + "unit": "秒", + "divisor": 1000 + }, + "reaction": { + "name": "选择反应时", + "unit": "秒", + "divisor": 1000 + }, + "step": { + "name": "台阶指数", + "unit": "分", + "divisor": 10 + }, + "situp": { + "name": "一分钟仰卧起坐", + "unit": "次", + "divisor": 1 + }, + "height": { + "name": "身高", + "unit": "厘米", + "divisor": 10 + }, + "weight": { + "name": "体重", + "unit": "千克", + "divisor": 1000 + }, + "12": { + "name": "立定跳远", + "unit": "厘米", + "divisor": 10 + }, + "13": { + "name": "网球掷远", + "unit": "米", + "divisor": 1000 + }, + "14": { + "name": "双脚连续跳", + "unit": "秒", + "divisor": 1000 + }, + "15": { + "name": "10米折返跑", + "unit": "秒", + "divisor": 1000 + }, + "16": { + "name": "走平衡木", + "unit": "秒", + "divisor": 1000 + }, + "17": { + "name": "50米跑", + "unit": "秒", + "divisor": 1000 + }, + "18": { + "name": "一分钟跳绳", + "unit": "次", + "divisor": 1 + }, + "19": { + "name": "50米*8往返跑", + "unit": "秒", + "divisor": 1000 + }, + "20": { + "name": "高压", + "unit": "mmHg", + "divisor": 1 + }, + "21": { + "name": "低压", + "unit": "mmHg", + "divisor": 1 + }, + "22": { + "name": "心率", + "unit": "次", + "divisor": 1 + }, + "23": { + "name": "长跑", + "unit": "秒", + "divisor": 1000 + }, + "24": { + "name": "引体向上", + "unit": "次", + "divisor": 1 + }, + "27": { + "name": "实心球", + "unit": "米", + "divisor": 1000 + }, + "28": { + "name": "篮球运球", + "unit": "秒", + "divisor": 1000 + }, + "29": { + "name": "足球运球", + "unit": "秒", + "divisor": 1000 + }, + "30": { + "name": "足球垫球", + "unit": "次", + "divisor": 1 + }, + "31": { + "name": "排球垫球", + "unit": "次", + "divisor": 1 + }, + "32": { + "name": "25米×2往返跑", + "unit": "秒", + "divisor": 1000 + }, + "33": { + "name": "左右眼视力", + "unit": "分", + "divisor": 10 + }, + "34": { + "name": "测试", + "unit": "毫升", + "divisor": 1 + }, + "37": { + "name": "跪卧撑", + "unit": "次", + "divisor": 1 + }, + "38": { + "name": "功率车", + "unit": "毫升/千克/分钟", + "divisor": 10 + } +} \ No newline at end of file diff --git a/体测单位/my_module.py b/体测单位/my_module.py new file mode 100644 index 0000000..c7519a6 --- /dev/null +++ b/体测单位/my_module.py @@ -0,0 +1,60 @@ +def cal_score(data1): + #data = {'name':'张三','sex':'M','age':37,'item':'StepExperiment','result':46} + person = dict1['person'] + criteria = dict1['criteria'] + if data1['age'] >59: + data1['age'] = 59 + if data1['age'] <20: + data1['age'] = 20 + info = data1['sex']+str(data1['age']) + bz = person[info] + mx = criteria[bz][data1['item']] + result = data1['result'] + if data1['item'] == 'reaction': + for bz1 in mx: + if result > bz1: + #print(bz1) + score = mx.index(bz1,0) + break + else: + score = 5 + else: + for bz1 in mx: + if result < bz1: + #print(bz1) + score = mx.index(bz1,0) + break + else: + score = 5 + return(score) + +def cal_bmi(data1): + # data = {'name':'张三','sex':'M','age':37,'item':'HeightWeight','result':'177.7,97.0'} + person = dict4['person'] + criteria = dict4['criteria'] + if data1['age'] > 59: + data1['age'] = 59 + if data1['age'] <20: + data1['age'] = 20 + info = data1['sex']+str(data1['age']) + bz = person[info] + #print(bz) + result = data1['result'] + #print(data1['code'],result) + height = int(float(result.split(',')[0])) + weight = float(result.split(',')[1]) + if str(height) not in criteria[bz]: + score = 1 + else: + mx = criteria[bz][str(height)] + if weight < mx[0]: + score = 1 + elif weight < mx[1]: + score = 3 + elif weight < mx[2]: + score = 5 + elif weight <= mx[3]: + score = 3 + elif weight > mx[3]: + score = 1 + return score \ No newline at end of file diff --git a/体测单位/北海炼化.ipynb b/体测单位/北海炼化.ipynb index 5197995..bf91a36 100644 --- a/体测单位/北海炼化.ipynb +++ b/体测单位/北海炼化.ipynb @@ -2227,15 +2227,15 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 9, "id": "202dcc9d-1f36-43c4-ad8d-8ee8c9db90ce", "metadata": { "execution": { - "iopub.execute_input": "2024-11-21T07:01:27.546392Z", - "iopub.status.busy": "2024-11-21T07:01:27.545774Z", - "iopub.status.idle": "2024-11-21T07:01:27.560036Z", - "shell.execute_reply": "2024-11-21T07:01:27.559152Z", - "shell.execute_reply.started": "2024-11-21T07:01:27.546333Z" + "iopub.execute_input": "2024-11-23T10:36:27.159751Z", + "iopub.status.busy": "2024-11-23T10:36:27.159001Z", + "iopub.status.idle": "2024-11-23T10:36:27.181532Z", + "shell.execute_reply": "2024-11-23T10:36:27.181062Z", + "shell.execute_reply.started": "2024-11-23T10:36:27.159680Z" } }, "outputs": [ @@ -2243,8 +2243,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "6\n", - "6\n" + "159\n", + "159\n" ] } ], @@ -2267,7 +2267,7 @@ "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "\n", - "filename = 'data/marks_20241121.csv'\n", + "filename = 'data/marks_20241123.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -2286,14 +2286,6 @@ " re_ta[user]['rq'] = result[5].replace('/','-')\n", " #re_ta[user]['sub_unit'] = dict1[user]['sub_unit'] \n", " re_ta[user].setdefault(item_name,{})\n", - " #if item_name =='bmi':\n", - " # height = result[4].split(',')[0]\n", - " # weight = result[4].split(',')[1]\n", - " # re_ta[user]['height']['成绩'] = height\n", - " # re_ta[user]['weight']['成绩'] = weight\n", - " # re_ta[user]['bmi']['成绩'] = result[4]\n", - " #else:\n", - " # re_ta[user][item_name]['成绩'] = result[4]\n", " re_ta[user][item_name]['成绩'] = result[4]\n", "print(len(re_ta))\n", "filename = 'data/result_北海炼化人员2024.json'\n",