This commit is contained in:
512song committed 2024-11-26 09:31:20 +08:00
1 parent f382b9af15
commit 752e3f388e
2 files changed
+252 -110

No files matched your search

+15 -6
View File
@@ -1,5 +1,17 @@
def cal_score(data1):
#data = {'name':'张三','sex':'M','age':37,'item':'StepExperiment','result':46}
import sys,os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import json
import time
filename = 'data/体质检测标准 (1).json'
with open(filename,'r') as fl:
dict1 = json.load(fl)
filename = 'data/体质检测标准_BMI.json'
with open(filename,'r') as fl:
dict4 = json.load(fl)
def cal_score(data1):
person = dict1['person']
criteria = dict1['criteria']
if data1['age'] >59:
@@ -28,8 +40,7 @@ def cal_score(data1):
score = 5
return(score)
def cal_bmi(data1):
# data = {'name':'张三','sex':'M','age':37,'item':'HeightWeight','result':'177.7,97.0'}
def cal_bmi(data1):
person = dict4['person']
criteria = dict4['criteria']
if data1['age'] > 59:
@@ -38,9 +49,7 @@ def cal_bmi(data1):
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]: