1934 lines
92 KiB
PHP
1934 lines
92 KiB
PHP
<?php
|
||
|
||
namespace app\testapp\controller;
|
||
|
||
use think\Db;
|
||
use app\testapp\controller\Calculatebody;
|
||
use app\testapp\controller\Cardparts;
|
||
|
||
class Card extends Base{
|
||
|
||
protected $color = ['#FF5656','#FFAB00','#5AD06D','#6492F6','#3967D6'];
|
||
protected $card_use_db_name = [
|
||
'1'=>'app_card_body_data_copy1',
|
||
'2'=>'app_user_data_copy1',
|
||
'3'=>'pc_bmistand_copy1',
|
||
'4'=>'pc_heightstand_copy1',
|
||
'5'=>'pc_weightstand_copy1',
|
||
'6'=>'pc_childrenprescription_copy1',
|
||
'7'=>'pc_childprescriptionbyage_copy1',
|
||
'8'=>'pc_heightstand_copy1',
|
||
'9'=>'pc_weightstand_copy1',
|
||
'10'=>'pc_bmistand_copy1',
|
||
'11'=>'app_account_number_copy1',
|
||
'12'=>'ws_height',
|
||
];
|
||
protected $age_limit = 16;
|
||
protected $unit_symbol = ['score'=>'分','height'=>'CM','weight'=>'公斤','bmi'=>'','fat_r'=>'%','fat_w'=>'kg','muscle'=>'%','muscleval'=>'kg','water'=>'kg','bone'=>'kg','protein'=>'%','proteinval'=>'kg','kcal'=>'kcal','visceral'=>'','sfr'=>'%',];
|
||
protected $unit_name = ['score'=>'身体得分','height'=>'身高','weight'=>'体重','bmi'=>'BMI','fat_r'=>'脂肪率','fat_w'=>'脂肪量','muscle'=>'肌肉率','muscleval'=>'肌肉量','water'=>'水分','bone'=>'骨重','protein'=>'蛋白率','proteinval'=>'蛋白量','kcal'=>'基础代谢','visceral'=>'内脏指数','sfr'=>'皮下脂肪','body_level'=>'肥胖等级','body_type'=>'身体类型'];
|
||
protected $bhw_list = [
|
||
'bmi'=>[
|
||
['min_val'=>'0','max_val'=>'','text'=>'消瘦','color'=>'#FDDA6B'],
|
||
['min_val'=>'','max_val'=>'','text'=>'正常','color'=>'#59D06A'],
|
||
['min_val'=>'','max_val'=>'','text'=>'偏重','color'=>'#FDAA02'],
|
||
['min_val'=>'','max_val'=>'50','text'=>'肥胖','color'=>'#FB5755'],
|
||
],
|
||
'height'=>[
|
||
['min_val'=>'0','max_val'=>'','text'=>'矮','color'=>'#FD5759'],
|
||
['min_val'=>'','max_val'=>'','text'=>'偏矮','color'=>'#FAAD01'],
|
||
['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#5BD068'],
|
||
['min_val'=>'','max_val'=>'','text'=>'偏高','color'=>'#6793F4'],
|
||
['min_val'=>'','max_val'=>'','text'=>'高','color'=>'#3D67D3'],
|
||
],
|
||
'weight'=>[
|
||
['min_val'=>'0','max_val'=>'','text'=>'低','color'=>'#F8595D'],
|
||
['min_val'=>'','max_val'=>'','text'=>'偏低','color'=>'#FFAF04'],
|
||
['min_val'=>'','max_val'=>'','text'=>'标准','color'=>'#59D168'],
|
||
['min_val'=>'','max_val'=>'','text'=>'偏高','color'=>'#FFAF04'],
|
||
['min_val'=>'','max_val'=>'','text'=>'高','color'=>'#F8595D'],
|
||
]
|
||
];
|
||
protected $standard_color = [
|
||
'fat_r'=>['偏低'=>'#FCDB67','标准'=>'#58D268','偏高'=>'#FCAA00','高'=>'#FD5752'],
|
||
'fat_w'=>['偏低'=>'#FCDB67','标准'=>'#58D268','偏高'=>'#FCAA00','高'=>'#FD5752'],
|
||
'muscle'=>['不足'=>'#FFDA68','标准'=>'#59CD6F','优'=>'#3C64D4'],
|
||
'muscleval'=>['不足'=>'#FFDA68','标准'=>'#59CD6F','优'=>'#3C64D4'],
|
||
'water'=>['不足'=>'#FED966','标准'=>'#58CF6B','优'=>'#3A68D7'],
|
||
'proteinval'=>['不足'=>'#FED966','标准'=>'#58CF6B','优'=>'#3A68D7'],
|
||
'bone'=>['不足'=>'#FED966','标准'=>'#58CF6B','优'=>'#3A68D7'],
|
||
'protein'=>['不足'=>'#FED966','标准'=>'#58CF6B','优'=>'#3A68D7'],
|
||
'kcal'=>['偏低'=>'#FF5656','优'=>'#3A68D4'],
|
||
'visceral'=>['标准'=>'#55CF6C','警惕'=>'#FEAC00','危险'=>'#FB5A52'],
|
||
'sfr'=>['不足'=>'#FCDB68','标准'=>'#59D16F','偏高'=>'#FEAB03'],
|
||
];
|
||
protected $result_end_data_mould = [
|
||
'name'=>'',
|
||
'value'=>'',
|
||
'unit'=>'',
|
||
'standard'=>'',
|
||
'color'=>'',
|
||
'list'=>[]
|
||
];
|
||
// 曲线参数
|
||
protected $card_body_curve_arr = ['height','weight','bmi','fat_r'];
|
||
protected $card_body_curve_arr2 = ['身高','体重','BMI','脂肪率',];
|
||
protected $card_body_curve_arr3 = ['#f7b03e','#fb7b92','#ff9f40','#3fcba7',];
|
||
|
||
protected $card_body_level = [
|
||
'height'=>['value'=>1,'list'=>['矮'=>2,'偏矮'=>3,'标准'=>4,'偏高'=>5,'高'=>5]],
|
||
'weight'=>['value'=>3,'list'=>['低'=>1,'偏低'=>1,'标准'=>2,'偏高'=>3,'高'=>3]],
|
||
'bmi'=>['value'=>2,'list'=>['消瘦'=>1,'正常'=>2,'偏重'=>3,'肥胖'=>4]],
|
||
];
|
||
protected $unit_data = [
|
||
'height'=>['cm','inch','ft-in'],
|
||
'weight'=>['kg','斤','st:lb','lb'],
|
||
];
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
|
||
|
||
// 详细卡片信息
|
||
// $data = ['id'=>'2']
|
||
public function card_data_detailed($data=['aud_id'=>'144']){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!array_key_exists('aud_id', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
// $return_data;
|
||
$return_data = $this->get_user_body_data($data);
|
||
|
||
return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
// 曲线页面-曲线接口
|
||
public function card_curve_chart($data = ['aud_id'=>'144','s_time'=>'2025-01-29','e_time'=>'2025-04-29','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||
// try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!array_key_exists('aud_id', $data) || !array_key_exists('s_time', $data) || !array_key_exists('e_time', $data) || !array_key_exists('token', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
// unset($data['token']);
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['s_time'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['e_time'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
$return_data = $this->curve_chart_action($data);
|
||
// 成功
|
||
$this->record_api_log($data, null, $return_data);
|
||
return $return_data;
|
||
// } catch (\Exception $e) {
|
||
// // 捕获异常
|
||
// $logContent["flie"] = $e->getFile();
|
||
// $logContent["line"] = $e->getLine();
|
||
// $logContent['all_content'] = "异常信息:\n";
|
||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
// $this->record_api_log($data, $logContent, null);
|
||
// return $this->msg(99999);
|
||
// }
|
||
|
||
}
|
||
|
||
// 手动记录
|
||
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
||
// public function card_manual_recording($data = ['aud_id'=>'37','time'=>'2024-10-12','height'=>'144.7,cm','weight'=>'36.8,kg','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||
public function card_manual_recording($data = ['aud_id'=>'38','time'=>'2024-10-12','height'=>'88.5','weight'=>'10','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}else{
|
||
$data['time'] = date('Y-m-d H:i:s');
|
||
}
|
||
if(!array_key_exists('aud_id', $data) || !array_key_exists('time', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('token', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
unset($data['token']);
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['time'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
$temporary_data = $this->convertHeightAndWeight($data['height'],$data['weight']);
|
||
if($temporary_data['height_in_cm'] == false){
|
||
return $this->msg(10005,'身高单位错误');
|
||
}
|
||
if($temporary_data['weight_in_kg'] == false){
|
||
return $this->msg(10005,'体重单位错误');
|
||
}
|
||
$data['height'] = $temporary_data['height_in_cm'];
|
||
$data['weight'] = $temporary_data['weight_in_kg'];
|
||
// if(!$this->verify_data_is_ok($data['height'],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// $data['height'] = explode(',',$data['height']);
|
||
// if(count($data['height']) < 2){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['height'][0],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!in_array($data['height'][1],$this->unit_data['height'])){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// $data['weight'] = explode(',',$data['weight']);
|
||
// if(count($data['height']) < 2){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['weight'][0],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!in_array($data['weight'][1],$this->unit_data['weight'])){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// $data['head_data'] = '48';
|
||
|
||
$data['acd_id'] = '2';
|
||
$return_data = $this->set_user_body_data($data,'by_hand_means');
|
||
// 成功
|
||
$this->record_api_log($data, null, $return_data);
|
||
return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
// 设备记录
|
||
// $data = ['id'=>'2','time'=>'1991-04-20 10:10:10','height'=>'15.1','weight'=>'75.1']
|
||
// public function card_manual_recording_device($data = ['aud_id'=>'37','height'=>'169.60,inch','weight'=>'52.45,lb','adc'=>'520.3','token'=>'591b70e0d80b5fa6d77e6e1384453ab9']){
|
||
public function card_manual_recording_device($data = ['aud_id'=>'37','height'=>'169.60斤','weight'=>'52.45斤','adc'=>'520.3','token'=>'591b70e0d80b5fa6d77e6e1384453ab9']){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}else{
|
||
$data['time'] = date('Y-m-d H:i:s');
|
||
}
|
||
if(!array_key_exists('aud_id', $data) || !array_key_exists('height', $data) || !array_key_exists('weight', $data) || !array_key_exists('adc', $data) || !array_key_exists('token', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['adc'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
$temporary_data = $this->convertHeightAndWeight($data['height'],$data['weight']);
|
||
if($temporary_data['height_in_cm'] == false){
|
||
return $this->msg(10005,'身高单位错误');
|
||
}
|
||
if($temporary_data['weight_in_kg'] == false){
|
||
return $this->msg(10005,'体重单位错误');
|
||
}
|
||
$data['height'] = $temporary_data['height_in_cm'];
|
||
$data['weight'] = $temporary_data['weight_in_kg'];
|
||
|
||
// if(!$this->verify_data_is_ok($data['height'],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// $data['height'] = explode(',',$data['height']);
|
||
// if(count($data['height']) < 2){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['height'][0],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!in_array($data['height'][1],$this->unit_data['height'])){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// $data['weight'] = explode(',',$data['weight']);
|
||
// if(count($data['height']) < 2){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!$this->verify_data_is_ok($data['weight'][0],'num')){
|
||
// return $this->msg(10005);
|
||
// }
|
||
// if(!in_array($data['weight'][1],$this->unit_data['weight'])){
|
||
// return $this->msg(10005);
|
||
// }
|
||
|
||
$data['time'] = date('Y-m-d H:i:s');
|
||
$data['acd_id'] = '2';
|
||
$return_data = $this->set_user_body_data($data,'by_device');
|
||
// 成功
|
||
$this->record_api_log($data, null, $return_data);
|
||
return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
// 修改初始体重/目标体重{"aud_id":"3967","time":"","weight":"124","type":1,"aan_id":"3475"}
|
||
public function card_modify_weight($data = ['aud_id'=>'3967','weight'=>'124','type'=>1,'time'=>'','token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!is_array($data)){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!array_key_exists('aud_id', $data) || !array_key_exists('weight', $data) || !array_key_exists('type', $data) || !array_key_exists('time', $data) || !array_key_exists('token', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
unset($data['token']);
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['weight'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['type'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if($data['type'] != 1){
|
||
if(!$this->verify_data_is_ok($data['time'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
}
|
||
|
||
$return_data = $this->modify_weight_action($data);
|
||
// 成功
|
||
$this->record_api_log($data, null, $return_data);
|
||
return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
// 身高预测
|
||
public function card_height_prediction($data = ['dadHeight'=>'199','momHeight'=>'160','birthday'=>'2014-07-24','sex'=>'1',]){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!is_array($data)){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!array_key_exists('dadHeight', $data) || !array_key_exists('momHeight', $data) || !array_key_exists('birthday', $data) || !array_key_exists('sex', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
unset($data['token']);
|
||
if(!$this->verify_data_is_ok($data['birthday'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['dadHeight'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['momHeight'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['sex'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
|
||
// 直接开始业务,请求外部接口start
|
||
$url = 'https://ybapi.pcxbc.com/api/child/predictheight';
|
||
$temporary_parameter = [
|
||
'dadHeight'=>$data['dadHeight'],
|
||
'momHeight'=>$data['momHeight'],
|
||
'birthday'=>$data['birthday'],
|
||
'sex'=>$data['sex'],
|
||
];
|
||
$request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
||
// 直接开始业务,请求外部接口end
|
||
$this->record_api_log($data, null, $request_result);
|
||
return json($request_result);
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
}
|
||
|
||
// BMI测评
|
||
public function card_bmi_evaluation($cbe_data = ['height'=>'177','weight'=>'177','birthday'=>'2024-10-03','sex'=>'1','token'=>'caadd1be045a65f30b92aa805f1de54a'],$type = false){
|
||
// try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0 && $type == false){
|
||
$cbe_data = input('post.');
|
||
}
|
||
if(!is_array($cbe_data)){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!array_key_exists('height', $cbe_data) || !array_key_exists('token', $cbe_data) || !array_key_exists('weight', $cbe_data) || !array_key_exists('birthday', $cbe_data) || !array_key_exists('sex', $cbe_data)){
|
||
return $this->msg(10001);
|
||
}
|
||
$token = $cbe_data['token'];
|
||
unset($cbe_data['token']);
|
||
if(!$this->verify_data_is_ok($cbe_data['birthday'],'datetime')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($cbe_data['height'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($cbe_data['weight'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($cbe_data['sex'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
|
||
// 直接开始业务,请求外部接口start
|
||
$url = 'http://ybdevice.pcxbc.com/api/result/calcbmi';
|
||
$temporary_parameter = [
|
||
'height'=>$cbe_data['height'],
|
||
'weight'=>$cbe_data['weight'],
|
||
'birthday'=>$cbe_data['birthday'],
|
||
'sex'=>$cbe_data['sex'],
|
||
];
|
||
$request_result = $this->postRequest($url,$temporary_parameter,array('Content-Type:application/json','Origin:http://ybdevice.pcxbc.com'));
|
||
// 直接开始业务,请求外部接口end
|
||
|
||
|
||
// 处理进度点
|
||
$request_result =$this->bmi_evaluation_action($request_result);
|
||
|
||
$language_str = Db::table($this->card_use_db_name['11'])->where(['token'=>$token])->field('language')->find();
|
||
$language_data = new Language();
|
||
if(!$language_str['language']){
|
||
$language_str['language'] = 'zh-Hans';
|
||
}
|
||
$request_result = $language_data->handling_languages_from_multiple_countries($language_str['language'], $request_result->getData()['data']);
|
||
// $this->record_api_log($cbe_data, null, $request_result);
|
||
return $this->msg($request_result);
|
||
// } catch (\Exception $e) {
|
||
// // 捕获异常
|
||
// $logContent["flie"] = $e->getFile();
|
||
// $logContent["line"] = $e->getLine();
|
||
// $logContent['all_content'] = "异常信息:\n";
|
||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
// $this->record_api_log($cbe_data, $logContent, null);
|
||
// return $this->msg(99999);
|
||
// }
|
||
}
|
||
public function incremental_comparison($data = ['aud_id'=>'87','token'=>'caadd1be045a65f30b92aa805f1de54a']){
|
||
// try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!is_array($data)){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!array_key_exists('aud_id', $data) || !array_key_exists('token', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['aud_id'],'intnum')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||
return $this->msg(10005);
|
||
}
|
||
$request_result = $this->incremental_comparison_action($data);
|
||
// $this->record_api_log($cbe_data, null, $request_result);
|
||
return $this->msg($request_result);
|
||
// } catch (\Exception $e) {
|
||
// // 捕获异常
|
||
// $logContent["flie"] = $e->getFile();
|
||
// $logContent["line"] = $e->getLine();
|
||
// $logContent['all_content'] = "异常信息:\n";
|
||
// $logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
// $logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
// $logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
// $logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
// $logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
// $this->record_api_log($cbe_data, $logContent, null);
|
||
// return $this->msg(99999);
|
||
// }
|
||
}
|
||
|
||
|
||
################################################################业务接口################################################################
|
||
################################################################业务接口################################################################
|
||
|
||
################################################card_data_detailed
|
||
// 用户身体数据卡片获取
|
||
public function get_user_body_data($data){
|
||
$result = Db::query("
|
||
select
|
||
Top 1
|
||
acbd.id,
|
||
acbd.acd_id,
|
||
acbd.record_type,
|
||
acbd.create_time,
|
||
acbd.last_update_time,
|
||
acbd.score,
|
||
acbd.fat_r,
|
||
acbd.fat_w,
|
||
acbd.muscle,
|
||
acbd.muscleval,
|
||
acbd.water,
|
||
acbd.proteinval,
|
||
acbd.bone,
|
||
acbd.protein,
|
||
acbd.kcal,
|
||
acbd.visceral,
|
||
acbd.sfr,
|
||
acbd.body_level,
|
||
acbd.aud_id,
|
||
acbd.record_time,
|
||
acbd.body_type,
|
||
acbd.age,
|
||
acbd.is_del,
|
||
acbd.height,
|
||
acbd.height_val,
|
||
acbd.weight,
|
||
acbd.weight_val,
|
||
acbd.bmi,
|
||
acbd.body_age,
|
||
acbd.head_circumference,
|
||
aud.birthday,aud.gender,aud.target_weight,aud.initial_weight,aud.initial_date,aud.aan_id
|
||
from ".$this->card_use_db_name['1']." as acbd
|
||
left join ".$this->card_use_db_name['2']." as aud on acbd.aud_id=aud.id
|
||
where acbd.is_del=0 and acbd.aud_id='".$data['aud_id']."'
|
||
order by acbd.record_time desc
|
||
");
|
||
|
||
if(count($result) <= 0){
|
||
$result_return = [
|
||
"score_name"=>"",
|
||
"score_value"=>"",
|
||
"score_unit"=>"",
|
||
"body_type_name"=>"",
|
||
"body_type_value"=>"",
|
||
"body_type_unit"=>"",
|
||
"record_time"=>"",
|
||
'top_list'=>[
|
||
[
|
||
"name"=>"体重",
|
||
"value"=>"0",
|
||
"unit"=>"公斤",
|
||
"standard"=>"",
|
||
"color"=>"",
|
||
"list"=>[],
|
||
"key_name"=>"weight",
|
||
"desc"=>"反映和衡量一个人健康状况的重要标志之一",
|
||
"offset"=>"0",
|
||
"standard_val"=>"",
|
||
"difference_val"=>"",
|
||
],
|
||
[
|
||
"name"=>"身高",
|
||
"value"=>"0",
|
||
"unit"=>"CM",
|
||
"standard"=>"",
|
||
"color"=>"",
|
||
"list"=>[],
|
||
"key_name"=>"height",
|
||
"desc"=>"人体纵向部分的长度,源于人体的纵向生长,受遗传因素的影响较大",
|
||
"offset"=>"0",
|
||
"standard_val"=>"",
|
||
"difference_val"=>"",
|
||
],
|
||
[
|
||
"name"=>"BMI",
|
||
"value"=>"0",
|
||
"unit"=>"公斤",
|
||
"standard"=>"",
|
||
"color"=>"",
|
||
"list"=>[],
|
||
"key_name"=>"bmi",
|
||
"desc"=>"BMI是身体质量指数,是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准。",
|
||
"offset"=>"0",
|
||
"standard_val"=>"",
|
||
"difference_val"=>"",
|
||
],
|
||
],
|
||
'bottom_list' => [],
|
||
'cplist'=>[
|
||
'nutritionlist'=>[],
|
||
'sportlist'=>[],
|
||
'sleeplist'=>[],
|
||
'moodlist'=>[],
|
||
],
|
||
'literature'=>[],
|
||
'target_current'=>[
|
||
'target_weight'=>'0',
|
||
'initial_weight'=>'0',
|
||
'cumulative_weight'=>'0',
|
||
'cumulative_day'=>'0'
|
||
],
|
||
];
|
||
$language_data = new Language();
|
||
$result_return = $language_data->handling_languages_from_multiple_countries('zh-Hans', $result_return);
|
||
return $this->msg($result_return);
|
||
}else{
|
||
|
||
// 存储头围数据
|
||
$head_circumference = $result[0]['head_circumference']?json_decode($result[0]['head_circumference'],true):false;
|
||
unset($result[0]['head_circumference']);
|
||
|
||
// 处理返回数据
|
||
$result_end = $this->processing_return_data_new($result[0]);
|
||
|
||
|
||
$cardparts = new Cardparts;
|
||
$result_end['gender'] = $result[0]['gender'];
|
||
$result_end['record_time'] = $result[0]['record_time'];
|
||
|
||
$result_end['score'] = $result_end['score'];
|
||
$result_end['body_type'] = $result_end['body_type'];
|
||
$result_end = $cardparts->conversion_interval($result_end);
|
||
$result_end['cplist'] = $this->grow_up_recommendation([
|
||
'birthday'=>$result[0]['birthday'],
|
||
'body'=>[
|
||
'height'=>$result[0]['height'],
|
||
'weight'=>$result[0]['weight'],
|
||
'bmi'=>$result[0]['bmi']
|
||
],
|
||
]);
|
||
|
||
// 只有含有阻抗的记录才有数据参考
|
||
// if($result[0]['record_type'] == 'by_device_adc'){
|
||
// if(count($result_end['cplist']['nutritionlist']) <= 0){
|
||
// $result_end['literature'] = [];
|
||
// }else{
|
||
$result_end['literature'] = [
|
||
'《中华人民共和国卫生行业标准WS/T 423-2022》',
|
||
'《中华人民共和国卫生行业标准WS/T 612-2018》',
|
||
'《中华人民共和国卫生行业标准WS/T 586-2018》',
|
||
'《WHO 5~19岁身高/体重判定标准》',
|
||
];
|
||
// }
|
||
// }else{
|
||
// $result_end['literature'] = [];
|
||
// }
|
||
|
||
// 加入曲线板块底部的减肥计划数据start
|
||
$result_end['target_current'] = $this->base_target_initial_cumulative_weight([
|
||
'weight'=>$result[0]['weight']>0?$result[0]['weight']:0,
|
||
'target_weight'=>$result[0]['target_weight']>0?$result[0]['target_weight']:0,
|
||
'initial_weight'=>$result[0]['initial_weight']>0?$result[0]['initial_weight']:0,
|
||
'initial_date'=>$result[0]['initial_date']!=null?$result[0]['initial_date']:0,
|
||
]);
|
||
// dump($result_end);
|
||
if(count($result_end['top_list'][2]['list']) <= 0){
|
||
// 这是16岁以上人群
|
||
$data = [
|
||
'height'=>$result[0]['height_val'],
|
||
'weight'=>$result[0]['weight_val'],
|
||
'birthday'=>$result[0]['birthday'],
|
||
'sex'=>$result[0]['gender']
|
||
];
|
||
|
||
$temporary_arr_bmi_list = $this->card_bmi_evaluation($data,true);
|
||
// dump($temporary_arr_bmi_list);
|
||
$temporary_arr_bmi_list = $temporary_arr_bmi_list->getData();
|
||
// dump($temporary_arr_bmi_list);
|
||
// die;
|
||
if($temporary_arr_bmi_list['code'] == 0){
|
||
$result_end['top_list'][2]['standard'] = $temporary_arr_bmi_list['data']['bmilevel'];
|
||
$result_end['top_list'][2]['color'] = $temporary_arr_bmi_list['data']['bmilevelcolor'];
|
||
$result_end['top_list'][2]['list'] = $temporary_arr_bmi_list['data']['bmilevellist'];
|
||
$result_end['top_list'][2]['offset'] = $temporary_arr_bmi_list['data']['offset'];
|
||
}
|
||
// dump($result_end);
|
||
// die;
|
||
}
|
||
|
||
// 加入曲线板块底部的减肥计划数据end
|
||
// 添加头围数据(如果有的话)start
|
||
if($head_circumference !== false && $this->calculate_age($result[0]['birthday']) < 3){
|
||
|
||
if($head_circumference['level'] == '异常' || $head_circumference['value'] == 0){
|
||
$offset = 0;
|
||
}else{
|
||
$offset = $cardparts->calculate_landing_point($head_circumference['list2'],$head_circumference['value'],$head_circumference['level']);
|
||
}
|
||
$touwei_array = [
|
||
'name'=>'头围',
|
||
'value'=>$head_circumference['value'],
|
||
'unit'=>'CM',
|
||
'standard'=>$head_circumference['level'],
|
||
'color'=>'',
|
||
'list'=>$head_circumference['list2'],
|
||
'key_name'=>'head_circumference',
|
||
'desc'=>'头围是指绕头部一周的最大长度,头围的大小与脑的发育密切相关',
|
||
'offset'=>$offset
|
||
];
|
||
$touwei_data = $this->touwei_temporary_use($result[0]['birthday'],$result[0]['gender']);
|
||
if(count($touwei_data)){
|
||
$touwei_array['standard_val'] = $touwei_data['middle'];
|
||
$touwei_array['difference_val'] = bcsub($touwei_array['value'],$touwei_data['middle'],2);
|
||
}else{
|
||
$touwei_array['standard_val'] = '';
|
||
$touwei_array['difference_val'] = '';
|
||
}
|
||
array_push($result_end['top_list'],$touwei_array);
|
||
|
||
}
|
||
// 添加头围数据(如果有的话)end
|
||
|
||
// 这段业务处理可以删除,是做的临时的,假的start
|
||
|
||
$biaozhun_val = $this->body_temporary_use($result[0]['birthday'],$result[0]['gender']);
|
||
// dump($biaozhun_val);
|
||
// $biaozhun_val_weight = 50;
|
||
// $biaozhun_val_height = 170;
|
||
// $biaozhun_val_bmi = 22;
|
||
foreach ($result_end['top_list'] as $key => $value) {
|
||
if($value['key_name'] == 'weight'){
|
||
if($biaozhun_val['weight'] == ''){
|
||
$result_end['top_list'][$key]['standard_val'] = '';
|
||
$result_end['top_list'][$key]['difference_val'] = '';
|
||
}else{
|
||
$result_end['top_list'][$key]['standard_val'] = $biaozhun_val['weight'];
|
||
$result_end['top_list'][$key]['difference_val'] = bcsub($value['value'],$biaozhun_val['weight'],2);
|
||
}
|
||
}else if($value['key_name'] == 'height'){
|
||
if($biaozhun_val['height'] == ''){
|
||
$result_end['top_list'][$key]['standard_val'] = '';
|
||
$result_end['top_list'][$key]['difference_val'] = '';
|
||
}else{
|
||
$result_end['top_list'][$key]['standard_val'] = $biaozhun_val['height'];
|
||
$result_end['top_list'][$key]['difference_val'] = bcsub($value['value'],$biaozhun_val['height'],2);
|
||
}
|
||
}else if($value['key_name'] == 'bmi'){
|
||
if($biaozhun_val['bmi'] == ''){
|
||
$result_end['top_list'][$key]['standard_val'] = '';
|
||
$result_end['top_list'][$key]['difference_val'] = '';
|
||
}else{
|
||
$result_end['top_list'][$key]['standard_val'] = $biaozhun_val['bmi'];
|
||
$result_end['top_list'][$key]['difference_val'] = bcsub($value['value'],$biaozhun_val['bmi'],2);
|
||
}
|
||
}
|
||
|
||
}
|
||
// 这段业务处理可以删除,是做的临时的,假的end
|
||
// dump($result);
|
||
$language_str = Db::table($this->card_use_db_name['11'])->where(['id'=>$result[0]['aan_id']])->field('language')->find();
|
||
$language_data = new Language();
|
||
if(!$language_str['language']){
|
||
$language_str['language'] = 'zh-Hans';
|
||
}
|
||
$result_end = $language_data->handling_languages_from_multiple_countries($language_str['language'], $result_end);
|
||
return $this->msg($result_end);
|
||
}
|
||
}
|
||
// 返回数据处理
|
||
public function processing_return_data_new($data){
|
||
$result_end_data = [];
|
||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
||
$gender_val = $data['gender'];
|
||
foreach ($data as $key => $value) {
|
||
if($key != 'aud_id' && $key != 'id' && $key != 'create_time' && $key != 'last_update_time' && $key != 'acd_id' && $key != 'ROW_NUMBER' && $key != 'record_time' && $key != 'gender' && $key != 'birthday'){
|
||
// 设置单个数据格式
|
||
$result_end_data[$key] = $this->result_end_data_mould;
|
||
// 该项名
|
||
if(array_key_exists($key, $this->unit_name)){
|
||
$result_end_data[$key]['name'] = $this->unit_name[$key];
|
||
}
|
||
// 该项单位
|
||
if(array_key_exists($key, $this->unit_symbol)){
|
||
$result_end_data[$key]['unit'] = $this->unit_symbol[$key];
|
||
}
|
||
|
||
$result_end_data[$key]['value'] = explode(',',$value)[0];
|
||
|
||
if(strpos($value, ',')){
|
||
$result_end_data[$key]['standard'] = explode(',',$value)[1];
|
||
}
|
||
if(array_key_exists($key, $this->standard_color)){
|
||
if($result_end_data[$key]['standard'] != '异常' && $result_end_data[$key]['standard'] != ''){
|
||
$result_end_data[$key]['color'] = $this->standard_color[$key][$result_end_data[$key]['standard']];
|
||
}
|
||
}
|
||
// 如果小于16岁(儿童)
|
||
if($data['age'] < $this->age_limit){
|
||
if(array_key_exists($key, $this->bhw_list)){
|
||
$result_end_data[$key]['list'] = $this->bhw_list[$key];
|
||
if($key == 'bmi'){
|
||
$bhw_date = Db::table($this->card_use_db_name['3'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
if($bhw_date){
|
||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z2sd'];
|
||
}
|
||
}else if($key == 'height'){
|
||
$bhw_date = Db::table($this->card_use_db_name['4'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
if($bhw_date){
|
||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||
$result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$result_end_data[$key]['list'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||
$result_end_data[$key]['list'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||
}
|
||
}else if($key == 'weight'){
|
||
$bhw_date = Db::table($this->card_use_db_name['5'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
if($bhw_date){
|
||
$result_end_data[$key]['list'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||
$result_end_data[$key]['list'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||
$result_end_data[$key]['list'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$result_end_data[$key]['list'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$result_end_data[$key]['list'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$result_end_data[$key]['list'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||
$result_end_data[$key]['list'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return $result_end_data;
|
||
}
|
||
|
||
public function grow_up_recommendation($data){
|
||
// card_body_level
|
||
// die;
|
||
// $result = [
|
||
// ['name'=>'营养','key'=>'nutrition','content'=>''],
|
||
// ['name'=>'睡眠','key'=>'sleep','content'=>''],
|
||
// ['name'=>'运动','key'=>'motion','content'=>''],
|
||
// ['name'=>'情绪','key'=>'emotion','content'=>'']
|
||
// ];
|
||
$result = [
|
||
'nutritionlist'=>[],//营养
|
||
'sportlist'=>[],//运动
|
||
'sleeplist'=>[],//睡眠
|
||
'moodlist'=>[],//情绪
|
||
];
|
||
|
||
$temporary_arr = [];
|
||
foreach ($data['body'] as $key => $value) {
|
||
if(explode(',',$value)[1] == '无'){
|
||
$result = [
|
||
'nutritionlist'=>[],//营养
|
||
'sportlist'=>[],//运动
|
||
'sleeplist'=>[],//睡眠
|
||
'moodlist'=>[],//情绪
|
||
];
|
||
return $result;
|
||
}
|
||
$temporary_arr[$key] = $this->card_body_level[$key]['list'][explode(',',$value)[1]];
|
||
}
|
||
$min_value = min($temporary_arr);
|
||
$min_key = array_search($min_value,$temporary_arr);
|
||
$type_num = $this->card_body_level[$min_key]['value'];
|
||
$temporary_arr2 = Db::table($this->card_use_db_name['6'])->where(['Type'=>$type_num,'Level'=>$min_value,'IsDeleted'=>0])->field('Nutrition,Sport')->find();
|
||
// dump($temporary_arr2);
|
||
array_push($result['nutritionlist'],$temporary_arr2['Nutrition']);
|
||
array_push($result['sportlist'],$temporary_arr2['Sport']);
|
||
// $result['nutritionlist'] = $temporary_arr2['Nutrition'];
|
||
// $result['sportlist'] = $temporary_arr2['Sport'];
|
||
|
||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
||
$temporary_arr2 = Db::table($this->card_use_db_name['7'])->where(['IsDeleted'=>0])->field('MinAge,MaxAge,Type,Content')->select();
|
||
$default_sleep = '';
|
||
$default_emotion = '';
|
||
foreach ($temporary_arr2 as $key => $value) {
|
||
if($value['MinAge'] == -1 && $value['Type'] == 2){
|
||
$default_sleep = $value['Content'];
|
||
}
|
||
if($value['MinAge'] == -1 && $value['Type'] == 3){
|
||
$default_emotion = $value['Content'];
|
||
}
|
||
if($month_num>=$value['MinAge'] && $month_num<=$value['MaxAge']){
|
||
if($value['Type'] == 1){
|
||
array_push($result['sportlist'],$value['Content']);
|
||
// $result['sportlist'] = $result['sportlist'].$value['Content'];
|
||
}else if($value['Type'] == 2){
|
||
array_push($result['sleeplist'],$value['Content']);
|
||
// $result['sleeplist'] = $result['sleeplist'].$value['Content'];
|
||
}else if($value['Type'] == 3){
|
||
array_push($result['moodlist'],$value['Content']);
|
||
// $result['moodlist'] = $result['moodlist'].$value['Content'];
|
||
}
|
||
}
|
||
}
|
||
|
||
$result['sleeplist'] = count($result['sleeplist']) <= 0?array_push($result['sportlist'],$default_sleep):$result['sleeplist'];
|
||
$result['moodlist'] = count($result['moodlist']) <= 0?array_push($result['moodlist'],$default_sleep):$result['moodlist'];
|
||
|
||
return $result;
|
||
}
|
||
|
||
########################################################card_curve_chart
|
||
|
||
// 曲线图动作函数
|
||
public function curve_chart_action($data){
|
||
|
||
$card_body_curve_arr = implode(',',$this->card_body_curve_arr);
|
||
|
||
$data['s_time'] = $data['s_time'].' 00:00:00';
|
||
$data['e_time'] = $data['e_time'].' 23:59:59';
|
||
|
||
$user_data_list = Db::table($this->card_use_db_name['1'])
|
||
->where(['aud_id'=>$data['aud_id'],'is_del'=> 0])
|
||
->whereTime('record_time', 'between', [$data['s_time'], $data['e_time']])
|
||
->field("record_type,record_time,REPLACE(CONVERT(varchar(10), record_time, 23), '-', '-') AS b_time,$card_body_curve_arr")
|
||
// ->field("record_time,REPLACE(CONVERT(varchar(10), record_time, 23), '-', '/') AS b_time,$card_body_curve_arr")
|
||
->order('record_time desc')
|
||
->select();
|
||
|
||
// 下面业务逻辑是取每天的,最近后一次记录成绩
|
||
$data_arr = [];
|
||
$record_arr1 = [];
|
||
$record_arr2 = [];
|
||
// 如果有数据
|
||
if(count($user_data_list)>0){
|
||
// 循环数据
|
||
foreach ($user_data_list as $key => $value) {
|
||
// 如果数据中的时间不存在临时数组中
|
||
if(!in_array($value['b_time'],$record_arr1)){
|
||
array_push($record_arr1,$value['b_time']);
|
||
foreach ($this->card_body_curve_arr as $k => $v) {
|
||
$user_data_list[$key][$v] = explode(',',$user_data_list[$key][$v])[0];
|
||
}
|
||
array_push($record_arr2,$user_data_list[$key]);
|
||
}
|
||
}
|
||
|
||
foreach ($this->card_body_curve_arr as $key => $value) {
|
||
$temporary_arr = [];
|
||
$temporary_arr['title'] = $this->card_body_curve_arr2[$key];
|
||
$temporary_arr['key'] = $value;
|
||
$temporary_arr['line']['categories'] = [];
|
||
$temporary_arr['line']['series'][0]['color'] = $this->card_body_curve_arr3[$key];
|
||
$temporary_arr['line']['series'][0]['data'] = [];
|
||
foreach ($record_arr2 as $k => $v) {
|
||
if($value == 'fat_r'){
|
||
if($v['record_type'] == 'by_device_adc'){
|
||
array_push($temporary_arr['line']['categories'],$record_arr2[$k]['b_time']);
|
||
array_push($temporary_arr['line']['series'][0]['data'],$record_arr2[$k][$value]);
|
||
}
|
||
}else{
|
||
array_push($temporary_arr['line']['categories'],$record_arr2[$k]['b_time']);
|
||
array_push($temporary_arr['line']['series'][0]['data'],$record_arr2[$k][$value]);
|
||
}
|
||
}
|
||
array_push($data_arr,$temporary_arr);
|
||
}
|
||
}
|
||
// dump($data);
|
||
$language_data = new Language();
|
||
$user_language = Db::table($this->card_use_db_name['11'])
|
||
->where(['token'=>$data['token'],'is_del'=>0])
|
||
->field('language')
|
||
->find();
|
||
if(!$user_language['language']){
|
||
$user_language['language'] = 'zh-Hans';
|
||
}
|
||
$result_end = $language_data->handling_languages_from_multiple_countries($user_language['language'], $data_arr);
|
||
return $this->msg($result_end);
|
||
}
|
||
|
||
################################################card_manual_recording
|
||
// 用户身体数据卡片记录
|
||
public function set_user_body_data($data,$type){
|
||
// 加 bcadd(,,20)
|
||
// 减 bcsub(,,20)
|
||
// 乘 bcmul(,,20)
|
||
// 除 bcdiv(,,20)
|
||
// // 这里开始转换不同单位的身高体重为cm跟kg(start)
|
||
// if($data['height'][1] == 'kg'){
|
||
// $data['height'] = $data['height'][0];
|
||
// }else if($data['height'][1] == '斤'){
|
||
// // 斤数除以2就是公斤
|
||
// $data['height'] = bcdiv($data['height'][0],2,2);
|
||
// }else if($data['height'][1] == 'st:lb'){
|
||
// $data['height'] = $data['height'][0];
|
||
// }else if($data['height'][1] == 'lb'){
|
||
// $data['height'] = $data['height'][0];
|
||
// }
|
||
// // 这里开始转换不同单位的身高体重为cm跟kg(end)
|
||
// $adc_type = $type;
|
||
// $data['type'] = 1;
|
||
|
||
// 判断头围数据是否存在是否合理
|
||
if(array_key_exists('head_data', $data)){
|
||
if(!$this->verify_data_is_ok($data['head_data'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
$data['head_circumference'] = $data['head_data'];
|
||
}else{
|
||
$data['head_circumference'] = 0;
|
||
}
|
||
// 查询用户信息
|
||
$user_data = Db::table($this->card_use_db_name['2'])->where(['id'=>$data['aud_id']])->field('birthday,gender,target_weight,initial_weight,initial_date')->find();
|
||
|
||
if(!$user_data){
|
||
return $this->msg(10003);
|
||
}
|
||
// 如果最初体重设置为null
|
||
if($user_data['initial_date'] == null){
|
||
Db::table($this->card_use_db_name['2'])->where(['id'=>$data['aud_id']])->update(['initial_weight'=>$data['weight'],'initial_date'=>$data['time']]);
|
||
$target_current = $this->base_target_initial_cumulative_weight([
|
||
'weight'=>$data['weight'],
|
||
'target_weight'=>$user_data['target_weight'],
|
||
'initial_weight'=>$data['weight'],
|
||
'initial_date'=>$data['time'],
|
||
]);
|
||
}else{
|
||
$target_current = $this->base_target_initial_cumulative_weight([
|
||
'weight'=>$data['weight'],
|
||
'target_weight'=>$user_data['target_weight'],
|
||
'initial_weight'=>$user_data['initial_weight'],
|
||
'initial_date'=>$user_data['initial_date'],
|
||
]);
|
||
}
|
||
// 设置身高、体重、年龄、性别、阶段称谓、头围、生日、阻抗
|
||
$result_data['height'] = $data['height'];
|
||
$result_data['weight'] = $data['weight'];
|
||
$result_data['age'] = $this->calculate_age($user_data['birthday']);
|
||
$result_data['gender'] = $user_data['gender'];
|
||
$result_data['head_circumference'] = $data['head_circumference'];
|
||
$result_data['birthday'] = $user_data['birthday'];
|
||
if(array_key_exists('adc', $data)){
|
||
if($data['adc'] > 0){
|
||
$result_data['adc'] = $data['adc'];
|
||
$type = "by_device_adc";
|
||
}else{
|
||
$result_data['adc'] = 550;
|
||
$type = "by_device";
|
||
}
|
||
}
|
||
$calculate_body_formula = new Calculatebody();
|
||
|
||
// 计算身体数据
|
||
$get_body_value = $calculate_body_formula->calculate_body_data_result($result_data);
|
||
|
||
if($get_body_value === false){
|
||
return $this->msg(10005);
|
||
}
|
||
|
||
// 如果年纪小于三岁,处理头围数据star
|
||
$standardlist = [];
|
||
if($result_data['age'] < 3){
|
||
if(array_key_exists('standardlist',$get_body_value)){
|
||
$standardlist = $get_body_value['standardlist'];
|
||
foreach ($standardlist as $key => $value) {
|
||
if($value['name'] == 'head' && count($value['list'] ) > 0){
|
||
$standardlist = $value;
|
||
}
|
||
}
|
||
$standardlist['list2'] = [];
|
||
foreach ($standardlist['list'] as $key => $value) {
|
||
array_push($standardlist['list2'],[
|
||
'min_val'=>$value['minvalue'],
|
||
'max_val'=>$value['maxvalue'],
|
||
'text'=>$value['text'],
|
||
'color'=>$value['color']
|
||
]);
|
||
}
|
||
unset($standardlist['list']);
|
||
unset($get_body_value['standardlist']);
|
||
}
|
||
}else{
|
||
if(array_key_exists('standardlist',$get_body_value)){
|
||
unset($get_body_value['standardlist']);
|
||
}
|
||
}
|
||
// 如果年纪小于三岁,处理头围数据end
|
||
$get_body_value['gender'] = $user_data['gender'];
|
||
$get_body_value['birthday'] = $user_data['birthday'];
|
||
// 添加身高、体重、bmi、头围(如果有)的标尺标准
|
||
$get_body_value = $this->hwb_standard($get_body_value);
|
||
$set_data = [
|
||
'acd_id'=>$data['acd_id'],
|
||
'aud_id'=>$data['aud_id'],
|
||
'record_time'=>array_key_exists('time', $data)?$data['time']:date('Y-m-d H:i:s'),
|
||
'create_time'=>date('Y-m-d H:i:s'),
|
||
'last_update_time'=>date('Y-m-d H:i:s'),
|
||
'age'=>$get_body_value['age'],
|
||
'height'=>$get_body_value['身高2'],
|
||
'height_val'=>$get_body_value['身高'],
|
||
'weight'=>$get_body_value['体重2'],
|
||
'weight_val'=>$get_body_value['体重'],
|
||
'bmi'=>$get_body_value['BMI2'],
|
||
'bmi_val'=>$get_body_value['BMI'],
|
||
'score'=>$get_body_value['身体得分'],
|
||
'fat_r'=> implode(',',$get_body_value['脂肪率']),
|
||
'fat_w'=>implode(',',$get_body_value['脂肪量']),
|
||
'muscle'=>implode(',',$get_body_value['肌肉率']),
|
||
'muscleval'=>implode(',',$get_body_value['肌肉量']),
|
||
'water'=>implode(',',$get_body_value['水分']),
|
||
'proteinval'=>implode(',',$get_body_value['蛋白量']),
|
||
'bone'=>implode(',',$get_body_value['骨重']),
|
||
'protein'=>implode(',',$get_body_value['蛋白率']),
|
||
'kcal'=>implode(',',$get_body_value['基础代谢']),
|
||
'visceral'=>implode(',',$get_body_value['内脏指数']),
|
||
'sfr'=>implode(',',$get_body_value['皮下脂肪']),
|
||
'body_level'=>$get_body_value['肥胖等级'],
|
||
'body_type'=>$get_body_value['身体类型'],
|
||
'body_age'=>$get_body_value['身体年龄'],
|
||
'record_type' => $type,
|
||
'head_circumference' => $result_data['age'] < 3?json_encode($standardlist):"",
|
||
];
|
||
if(strlen($set_data['record_time']) <= 12){
|
||
// 时间日期转换,把'Y-m-d'转换成'Y-m-d H:i:s'格式
|
||
$set_data['record_time'] = $this->addCurrentTimeToDateString($set_data['record_time']);
|
||
}
|
||
// 启动事务
|
||
Db::startTrans();
|
||
try{
|
||
$set_user_data = Db::table($this->card_use_db_name['1'])->insert($set_data);
|
||
$update_arr = [
|
||
'height'=>$get_body_value['身高'],
|
||
'weight'=>$get_body_value['体重']
|
||
];
|
||
if($data['head_circumference']>0){
|
||
$update_arr['head_data'] = $data['head_circumference'];
|
||
}
|
||
$update_user_data = Db::table($this->card_use_db_name['2'])->where(['id'=>$data['aud_id']])->update($update_arr);
|
||
// 提交事务
|
||
Db::commit();
|
||
return $this->msg([
|
||
'acd_id'=>2,
|
||
'height'=>$get_body_value['身高'].',CM',
|
||
'weight'=>$get_body_value['体重'].',公斤',
|
||
'bmi'=>$get_body_value['BMI'],
|
||
// 'user_set_height'=>$get_body_value['身高'],
|
||
// 'user_set_weight'=>$get_body_value['体重'],
|
||
'target_current'=>$target_current,
|
||
]);
|
||
} catch (\Exception $e) {
|
||
// 回滚事务
|
||
Db::rollback();
|
||
return $this->msg(10002);
|
||
}
|
||
}
|
||
|
||
// 添加身高体重bmi的标准
|
||
public function hwb_standard($data){
|
||
$linshi_data = [];
|
||
$month_num = $this->calculateAgeInMonthsWithPrecision($data['birthday']);
|
||
$gender_val = $data['gender'];
|
||
if($data['age'] < $this->age_limit){
|
||
foreach ($data as $key => $value) {
|
||
if($key =='身高'){
|
||
$linshi_data['身高'] = $this->bhw_list['height'];
|
||
$bhw_date = Db::table($this->card_use_db_name['8'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
|
||
if($bhw_date){
|
||
$linshi_data['身高'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||
$linshi_data['身高'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||
$linshi_data['身高'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['身高'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['身高'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['身高'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['身高'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$linshi_data['身高'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||
$linshi_data['身高'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||
}
|
||
|
||
}else if($key =='体重'){
|
||
$linshi_data['体重'] = $this->bhw_list['weight'];
|
||
$bhw_date = Db::table($this->card_use_db_name['9'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
if($bhw_date){
|
||
$linshi_data['体重'][0]['max_val'] = $bhw_date[0]['f2sd'];
|
||
$linshi_data['体重'][1]['min_val'] = $bhw_date[0]['f2sd'];
|
||
$linshi_data['体重'][1]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['体重'][2]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['体重'][2]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['体重'][3]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['体重'][3]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$linshi_data['体重'][4]['min_val'] = $bhw_date[0]['z2sd'];
|
||
$linshi_data['体重'][4]['max_val'] = $bhw_date[0]['z3sd'];
|
||
}
|
||
}else if($key =='BMI'){
|
||
$linshi_data['BMI'] = $this->bhw_list['bmi'];
|
||
$bhw_date = Db::table($this->card_use_db_name['10'])->where("Month <= $month_num and Sex = '$gender_val'")->order('Month desc')->limit(1)->select();
|
||
if($bhw_date){
|
||
$linshi_data['BMI'][0]['max_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['BMI'][1]['min_val'] = $bhw_date[0]['f1sd'];
|
||
$linshi_data['BMI'][1]['max_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['BMI'][2]['min_val'] = $bhw_date[0]['z1sd'];
|
||
$linshi_data['BMI'][2]['max_val'] = $bhw_date[0]['z2sd'];
|
||
$linshi_data['BMI'][3]['min_val'] = $bhw_date[0]['z2sd'];
|
||
}
|
||
}
|
||
}
|
||
foreach ($linshi_data as $key => $value) {
|
||
foreach ($value as $k => $v) {
|
||
if($data[$key] >= $v['min_val'] && $data[$key] < $v['max_val']){
|
||
// 如果落在区间内
|
||
$data[$key.'2'] = $data[$key].','.$v['text'].','.$v['color'];
|
||
break;
|
||
}
|
||
}
|
||
// 如果$key.'2'没有被设置
|
||
if(!array_key_exists($key.'2', $data)){
|
||
if($data[$key] < $value[0]['min_val']){
|
||
// 如果小于最小值
|
||
$data[$key.'2'] = $data[$key].','.$value[0]['text'].','.$value[0]['color'];
|
||
}else if($data[$key] >= $value[count($value)-1]['max_val']){
|
||
// 如果大于最大值
|
||
$data[$key.'2'] = $data[$key].','.$value[count($value)-1]['text'].','.$value[count($value)-1]['color'];
|
||
}
|
||
}
|
||
}
|
||
// die;
|
||
}else{
|
||
$data['身高2'] = $data['身高'].',无,无';
|
||
$data['体重2'] = $data['体重'].',无,无';
|
||
$data['BMI2'] = $data['BMI'].',无,无';
|
||
}
|
||
return $data;
|
||
}
|
||
|
||
|
||
################################################card_modify_weight
|
||
public function modify_weight_action($data){
|
||
// $data['aud_id'] = 26;
|
||
// $data['weight'] = 60;
|
||
|
||
$result = Db::query("
|
||
select
|
||
TOP 1
|
||
acbd.weight_val as weight,
|
||
aud.target_weight,
|
||
aud.initial_weight,
|
||
aud.initial_date
|
||
from ".$this->card_use_db_name['1']." as acbd
|
||
left join ".$this->card_use_db_name['2']." as aud on acbd.aud_id = aud.id
|
||
where acbd.aud_id = ".$data['aud_id']."
|
||
order by acbd.record_time desc
|
||
");
|
||
|
||
if($data['type'] == 1){
|
||
// 修改目标体重
|
||
$bhw_date = ['target_weight'=>$data['weight']];
|
||
}else if($data['type'] == 2){
|
||
// 修改原始体重
|
||
$bhw_date = ['initial_weight'=>$data['weight'],'initial_date' => $data['time']];
|
||
}else{
|
||
return $this->msg(10005);
|
||
}
|
||
$result_update = Db::table($this->card_use_db_name['2'])->where(['id'=>$data['aud_id']])->update($bhw_date);
|
||
// $result_update = true;
|
||
if($result_update){
|
||
$target_current = $this->base_target_initial_cumulative_weight([
|
||
'weight'=>count($result) <= 0?0:$result[0]['weight'],
|
||
'target_weight'=>$data['type'] == 1?$data['weight']:(count($result) <= 0?0:$result[0]['target_weight']),
|
||
'initial_weight'=>$data['type'] == 1?(count($result) <= 0?0:$result[0]['initial_weight']):$data['weight'],
|
||
'initial_date'=>$data['type'] == 1?(count($result) <= 0?'':$result[0]['initial_date']):$data['time'],
|
||
]);
|
||
|
||
return $this->msg($target_current);
|
||
}else{
|
||
return $this->msg(10002);
|
||
}
|
||
|
||
}
|
||
|
||
################################################card_bmi_evaluation
|
||
public function bmi_evaluation_action($data){
|
||
// 加 bcadd(,,20)
|
||
// 减 bcsub(,,20)
|
||
// 乘 bcmul(,,20)
|
||
// 除 bcdiv(,,20)
|
||
if(!array_key_exists('code',$data) || !array_key_exists('data',$data)){
|
||
return $this->msg(99999,'网络异常,请稍后重试1');
|
||
}
|
||
if($data['code'] != 0){
|
||
return $this->msg(99999,'网络异常,请稍后重试2');
|
||
}
|
||
if(!is_array($data['data'])){
|
||
return $this->msg(99999,'网络异常,请稍后重试3');
|
||
}
|
||
if(!array_key_exists('bmi',$data['data']) || !array_key_exists('bmilevel',$data['data']) || !array_key_exists('bmilevelcolor',$data['data']) || !array_key_exists('bmilevellist',$data['data'])){
|
||
return $this->msg(99999,'网络异常,请稍后重试4');
|
||
}
|
||
if(!is_array($data['data']['bmilevellist'])){
|
||
return $this->msg(99999,'网络异常,请稍后重试5');
|
||
}
|
||
$num = 0;
|
||
$subsection_val = 0;
|
||
$temporary_subsection_val = null;
|
||
foreach ($data['data']['bmilevellist'] as $key => $value) {
|
||
if(!array_key_exists('maxvalue',$value) || !array_key_exists('minvalue',$value)){
|
||
return $this->msg(99999,'网络异常,请稍后重试6');
|
||
}
|
||
// 判断是否可以进行比较,规则是否正确
|
||
if(is_numeric($value['maxvalue']) && is_numeric($value['minvalue'])){
|
||
if($data['data']['bmi'] >= $value['minvalue'] && $data['data']['bmi'] < $value['maxvalue']){
|
||
// 在落点内
|
||
$subsection_val = bcsub($value['maxvalue'],$value['minvalue'],1);//获取最大最小值差
|
||
$temporary_subsection_val = bcsub($data['data']['bmi'],$value['minvalue'],1);//获取当前值与最小值差
|
||
$temporary_subsection_val = bcdiv($temporary_subsection_val,$subsection_val,1);//获取当前值与最小值差与最大最小值差之比
|
||
$subsection_val = bcdiv(100,count($data['data']['bmilevellist']),1);//每段应该的百分比
|
||
$temporary_subsection_val = bcmul($subsection_val,$temporary_subsection_val,1);//获取当前值与最小值差与最大最小值差之比与总段数之比
|
||
$temporary_subsection_val = bcadd($temporary_subsection_val,bcmul($subsection_val,$num,1),1);
|
||
}else{
|
||
$num = $num + 1;
|
||
}
|
||
}
|
||
}
|
||
|
||
if($temporary_subsection_val === null){
|
||
if($data['data']['bmi'] >= $data['data']['bmilevellist'][count($data['data']['bmilevellist'])-1]['maxvalue']){
|
||
$temporary_subsection_val = 100;
|
||
}else{
|
||
return $this->msg(99999,'网络异常,请稍后重试7');
|
||
}
|
||
}
|
||
$data['data']['offset'] = $temporary_subsection_val;
|
||
$data = $data['data'];
|
||
// 处理key名称一致start
|
||
foreach ($data['bmilevellist'] as $key => $value) {
|
||
$data['bmilevellist'][$key]['max_val'] = $value['maxvalue'];
|
||
$data['bmilevellist'][$key]['min_val'] = $value['minvalue'];
|
||
unset($data['bmilevellist'][$key]['minvalue']);
|
||
unset($data['bmilevellist'][$key]['maxvalue']);
|
||
}
|
||
// 处理key名称一致end
|
||
return $this->msg($data);
|
||
}
|
||
################################################incremental_comparison
|
||
public function incremental_comparison_action($data){
|
||
// 加 bcadd(,,20)
|
||
// 减 bcsub(,,20)
|
||
// 乘 bcmul(,,20)
|
||
// 除 bcdiv(,,20)
|
||
// protected $card_use_db_name = [
|
||
// '1'=>'app_card_body_data_copy1',
|
||
// '2'=>'app_user_data_copy1',
|
||
// '3'=>'pc_bmistand_copy1',
|
||
// '4'=>'pc_heightstand_copy1',
|
||
// '5'=>'pc_weightstand_copy1',
|
||
// '6'=>'pc_childrenprescription_copy1',
|
||
// '7'=>'pc_childprescriptionbyage_copy1',
|
||
// '8'=>'pc_heightstand_copy1',
|
||
// '9'=>'pc_weightstand_copy1',
|
||
// '10'=>'pc_bmistand_copy1',
|
||
// '11'=>'app_account_number_copy1',
|
||
// ];
|
||
|
||
|
||
|
||
|
||
$return_data = [];
|
||
$user_last_data = Db::table($this->card_use_db_name['1'])
|
||
->alias('a')
|
||
->join(''.$this->card_use_db_name['2'].' b','a.aud_id = b.id','LEFT')
|
||
->where('a.aud_id',$data['aud_id'])
|
||
->order('record_time desc')
|
||
->field('a.record_time as record_time,a.height_val,b.gender,b.nickname,b.gender,b.birthday')
|
||
->find();
|
||
|
||
// 设置基础数据
|
||
$return_data['nickname'] = $user_last_data['nickname'];
|
||
$return_data['gender'] = $user_last_data['gender'] == 1 ? '男' : '女';
|
||
$return_data['birthday'] = $user_last_data['birthday'];
|
||
$return_data['age'] = $this->calculateAge($user_last_data['birthday']);
|
||
// dump($return_data);
|
||
// die;
|
||
$return_data['age_year'] = $return_data['age']['age_year'];
|
||
$return_data['age_year_unit'] = $return_data['age']['age_year_unit'];
|
||
$return_data['age_months'] = $return_data['age']['age_months'];
|
||
$return_data['age_months_unit'] = $return_data['age']['age_months_unit'];
|
||
$return_data['height'] = $user_last_data['height_val'];
|
||
unset($return_data['age']);
|
||
|
||
|
||
|
||
$half_year = Db::table($this->card_use_db_name['1'])
|
||
->where(['aud_id'=>$data['aud_id']])
|
||
->whereTime('record_time', '>=', '-6 month')
|
||
->order('record_time desc')
|
||
->field('id,record_time,height_val')
|
||
->select();
|
||
|
||
$one_year = Db::table($this->card_use_db_name['1'])
|
||
->where(['aud_id'=>$data['aud_id']])
|
||
->whereTime('record_time', '>=', '-12 month')
|
||
->order('record_time desc')
|
||
->field('id,record_time,height_val')
|
||
->select();
|
||
|
||
$month_age = $this->calculateAgeInMonthsWithPrecision($user_last_data['birthday']);
|
||
|
||
$height_standard = Db::table($this->card_use_db_name['12'])
|
||
->where(['gender'=>$user_last_data['gender'],'age'=>['<=',$month_age]])
|
||
->order('age desc')
|
||
->find();
|
||
// dump($height_standard);
|
||
// 处理身体级别
|
||
$true_altitude_list = [
|
||
[
|
||
'maxvalue' => $height_standard['f1sd'],
|
||
'minvalue' => 0,
|
||
'text' => '矮',
|
||
'color' => '#ff5656',
|
||
'level' => 4
|
||
],
|
||
[
|
||
'maxvalue' => $height_standard['middle'],
|
||
'minvalue' => $height_standard['f1sd'],
|
||
'text' => '偏矮',
|
||
'color' => '#ffab00',
|
||
'level' => 2
|
||
],
|
||
[
|
||
'maxvalue' => $height_standard['z1sd'],
|
||
'minvalue' => $height_standard['middle'],
|
||
'text' => '标准',
|
||
'color' => '#5ad06d',
|
||
'level' => 1
|
||
],
|
||
[
|
||
'maxvalue' => $height_standard['z2sd'],
|
||
'minvalue' => $height_standard['z1sd'],
|
||
'text' => '偏高',
|
||
'color' => '#6492f6',
|
||
'level' => 3
|
||
],
|
||
[
|
||
'maxvalue' => 99999,
|
||
'minvalue' => $height_standard['z2sd'],
|
||
'text' => '高',
|
||
'color' => '#3967d6',
|
||
'level' => 5
|
||
]
|
||
];
|
||
$return_data['heightlevel'] = 1;
|
||
foreach ($true_altitude_list as $key => $value) {
|
||
// dump($return_data['height']);
|
||
// dump($value);
|
||
if($return_data['height'] >= $value['minvalue'] && $return_data['height'] < $value['maxvalue']){
|
||
// dump($value);
|
||
$return_data['heightlevel'] = $value['level'];
|
||
}
|
||
}
|
||
// die;
|
||
// 处理半年信息
|
||
if(count($half_year) >= 2){
|
||
$return_data['halfyearheight'] = bcsub($half_year[0]['height_val'],$half_year[count($half_year)-1]['height_val'],2);
|
||
}else{
|
||
$return_data['halfyearheight'] = 0;
|
||
}
|
||
// $height_standard_half = Db::table($this->card_use_db_name['12'])
|
||
// ->where(['gender'=>$user_last_data['gender'],'age'=>['<=',($month_age-6)<=0?0:$month_age-6]])
|
||
// ->order('age desc')
|
||
// ->find();
|
||
$height_standard_half = $this->count_increment_val($return_data,'half_year');
|
||
// dump($height_standard_half);
|
||
// die;
|
||
$halfyearstandlist = [
|
||
[
|
||
'val' => 0,
|
||
'text' => '偏低',
|
||
'color' => '#ffda69',
|
||
'level' => 2
|
||
],
|
||
[
|
||
'val' => $height_standard_half,
|
||
'text' => '正常',
|
||
'color' => '#5ad06d',
|
||
'level' => 1
|
||
]
|
||
];
|
||
|
||
for ($i=count($halfyearstandlist)-1; $i >=0 ; $i--) {
|
||
if($return_data['halfyearheight'] >= $halfyearstandlist[$i]['val']){
|
||
$return_data['halfyearheightlevel'] = $halfyearstandlist[$i]['level'];
|
||
break;
|
||
}
|
||
}
|
||
$return_data['halfyearstandheight'] = $halfyearstandlist[1]['val'];
|
||
// 处理一年信息
|
||
if(count($one_year) >= 2){
|
||
$return_data['yearheight'] = bcsub($one_year[0]['height_val'],$one_year[count($one_year)-1]['height_val'],2);
|
||
}else{
|
||
$return_data['yearheight'] = 0;
|
||
}
|
||
// $height_standard_year = Db::table($this->card_use_db_name['12'])
|
||
// ->where(['gender'=>$user_last_data['gender'],'age'=>['<=',($month_age-12)<=0?0:$month_age-12]])
|
||
// ->order('age desc')
|
||
// ->find();
|
||
$height_standard_half = $this->count_increment_val($return_data,'one_year');
|
||
$yearstandlist = [
|
||
[
|
||
'val' => 0,
|
||
'text' => '偏低',
|
||
'color' => '#ffda69',
|
||
'level' => 2
|
||
],
|
||
[
|
||
'val' => $height_standard_half,
|
||
'text' => '正常',
|
||
'color' => '#5ad06d',
|
||
'level' => 1
|
||
]
|
||
];
|
||
for ($i=count($yearstandlist)-1; $i >=0 ; $i--) {
|
||
if($return_data['yearheight'] >= $yearstandlist[$i]['val']){
|
||
$return_data['yearheightlevel'] = $yearstandlist[$i]['level'];
|
||
break;
|
||
}
|
||
}
|
||
$return_data['yearstandheight'] = $yearstandlist[1]['val'];
|
||
|
||
$return_data['f3sd'] = $height_standard['f3sd'];
|
||
$return_data['f2sd'] = $height_standard['f2sd'];
|
||
$return_data['f1sd'] = $height_standard['f1sd'];
|
||
$return_data['median'] = $height_standard['middle'];
|
||
$return_data['z1sd'] = $height_standard['z1sd'];
|
||
$return_data['z2sd'] = $height_standard['z2sd'];
|
||
$return_data['z3sd'] = $height_standard['z3sd'];
|
||
$return_data['list'] = $true_altitude_list;
|
||
$return_data['halfyearstandlist'] = $halfyearstandlist;
|
||
$return_data['yearstandlist'] = $yearstandlist;
|
||
// dump($return_data);
|
||
// die;
|
||
$language_data = new Language();
|
||
$zh_language = Db::table($this->card_use_db_name['11'])
|
||
->where(['token'=>$data['token'],'is_del'=>0])
|
||
->field('id,language')
|
||
->find();
|
||
if(!$zh_language['language']){
|
||
$zh_language['language'] = 'zh-Hans';
|
||
}
|
||
$result_end = $language_data->handling_languages_from_multiple_countries($zh_language['language'], $return_data);
|
||
return $result_end;
|
||
|
||
}
|
||
|
||
|
||
|
||
################################################################其他接口################################################################
|
||
################################################################其他接口################################################################
|
||
|
||
public function count_increment_val($user,$type){
|
||
// 加 bcadd(,,20)
|
||
// 减 bcsub(,,20)
|
||
// 乘 bcmul(,,20)
|
||
// 除 bcdiv(,,20)
|
||
// [
|
||
// 'min_age' => 0,
|
||
// 'max_age' => 1,
|
||
// 'boy_val' => '26.1',
|
||
// 'girl_val' => '25.3',
|
||
// ],
|
||
$height_add_list = [
|
||
[
|
||
'min_age' => 0,
|
||
'max_age' => 1,
|
||
'boy_val' => '26.1',
|
||
'girl_val' => '25.3',
|
||
],
|
||
[
|
||
'min_age' => 1,
|
||
'max_age' => 2,
|
||
'boy_val' => '12.0',
|
||
'girl_val' => '12.2',
|
||
],
|
||
[
|
||
'min_age' => 2,
|
||
'max_age' => 3,
|
||
'boy_val' => '8.3',
|
||
'girl_val' => '8.4',
|
||
],
|
||
[
|
||
'min_age' => 3,
|
||
'max_age' => 4,
|
||
'boy_val' => '7.3',
|
||
'girl_val' => '7.5',
|
||
],
|
||
[
|
||
'min_age' => 4,
|
||
'max_age' => 5,
|
||
'boy_val' => '7.2',
|
||
'girl_val' => '7.1',
|
||
],
|
||
[
|
||
'min_age' => 5,
|
||
'max_age' => 6,
|
||
'boy_val' => '6.4',
|
||
'girl_val' => '6.4',
|
||
],
|
||
[
|
||
'min_age' => 6,
|
||
'max_age' => 7,
|
||
'boy_val' => '7.8',
|
||
'girl_val' => '7.5',
|
||
],
|
||
[
|
||
'min_age' => 7,
|
||
'max_age' => 8,
|
||
'boy_val' => '5.2',
|
||
'girl_val' => '5.2',
|
||
],
|
||
[
|
||
'min_age' => 8,
|
||
'max_age' => 9,
|
||
'boy_val' => '5.1',
|
||
'girl_val' => '5.6',
|
||
],
|
||
[
|
||
'min_age' => 9,
|
||
'max_age' => 10,
|
||
'boy_val' => '5.0',
|
||
'girl_val' => '6.3',
|
||
],
|
||
[
|
||
'min_age' => 10,
|
||
'max_age' => 11,
|
||
'boy_val' => '6.8',
|
||
'girl_val' => '6.2',
|
||
],
|
||
[
|
||
'min_age' => 11,
|
||
'max_age' => 12,
|
||
'boy_val' => '6.2',
|
||
'girl_val' => '5.0',
|
||
],
|
||
[
|
||
'min_age' => 12,
|
||
'max_age' => 13,
|
||
'boy_val' => '8.0',
|
||
'girl_val' => '3.7',
|
||
],
|
||
[
|
||
'min_age' => 13,
|
||
'max_age' => 14,
|
||
'boy_val' => '5.4',
|
||
'girl_val' => '1.7',
|
||
],
|
||
[
|
||
'min_age' => 14,
|
||
'max_age' => 15,
|
||
'boy_val' => '4.6',
|
||
'girl_val' => '0.7',
|
||
],
|
||
[
|
||
'min_age' => 15,
|
||
'max_age' => 16,
|
||
'boy_val' => '1.6',
|
||
'girl_val' => '0.4',
|
||
],
|
||
[
|
||
'min_age' => 16,
|
||
'max_age' => 17,
|
||
'boy_val' => '0.8',
|
||
'girl_val' => '0.3',
|
||
],
|
||
[
|
||
'min_age' => 17,
|
||
'max_age' => 18,
|
||
'boy_val' => '0.0',
|
||
'girl_val' => '0.8',
|
||
],
|
||
];
|
||
|
||
$temporary_arr1 = [];
|
||
$temporary_arr0 = [];
|
||
$gender = $user['gender'] == '男'?'boy_val':'girl_val';
|
||
for ($i=0; $i < count($height_add_list); $i++) {
|
||
if($user['age_year'] >= $height_add_list[$i]['min_age'] && $user['age_year'] < $height_add_list[$i]['max_age']){
|
||
$temporary_arr1 = $height_add_list[$i];
|
||
if($i > 0){
|
||
$temporary_arr0 = $height_add_list[$i-1];
|
||
}
|
||
}
|
||
}
|
||
|
||
$monthly = bcdiv($temporary_arr1[$gender],12,20);
|
||
if($type == 'half_year'){
|
||
if($user['age_months'] >= 6){
|
||
$return_data = bcmul($monthly,6,2);
|
||
return $return_data;
|
||
}else{
|
||
if(count($temporary_arr0) > 0){
|
||
$return_data = bcmul($monthly,$user['age_months'],20);
|
||
$return_data = bcadd($return_data,bcmul(bcdiv($temporary_arr0[$gender],12,20),bcsub(6,$user['age_months'],20),20),2);
|
||
return $return_data;
|
||
}else{
|
||
$return_data = bcmul($monthly,6,2);
|
||
return $return_data;
|
||
}
|
||
}
|
||
}else{
|
||
if($user['age_months'] < 12){
|
||
if(count($temporary_arr0) > 0){
|
||
$return_data = bcmul($monthly,$user['age_months'],20);
|
||
$return_data = bcadd($return_data,bcmul(bcdiv($temporary_arr0[$gender],12,20),bcsub(12,$user['age_months'],20),20),2);
|
||
return $return_data;
|
||
}else{
|
||
$return_data = bcmul($monthly,12,2);
|
||
return $return_data;
|
||
}
|
||
}else{
|
||
$return_data = bcmul($monthly,12,2);
|
||
return $return_data;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
public function body_temporary_use($age,$gender){
|
||
$return_data = [
|
||
'height'=>'',
|
||
'weight'=>'',
|
||
'bmi'=>'',
|
||
];
|
||
if(!in_array($gender,['1','2'])){
|
||
return $return_data;
|
||
}
|
||
$age_m = $this->calculateAgeInMonthsWithPrecision($age);
|
||
if($age_m < 228){//月龄小于19岁
|
||
// dump($age_m);
|
||
// $height_date = Db::table('ws_height')->where("age <= $age_m and gender = '$gender'")->order('age desc')->limit(1)->field('middle')->select();
|
||
$height_date = Db::query("select * from ws_height where age <= $age_m and gender = '$gender' order by age desc");
|
||
// $weight_date = Db::table('ws_weight')->where("age <= $month_num and Sex = '$gender'")->order('age desc')->limit(1)->field('middle')->select();
|
||
$weight_date = Db::query("select * from ws_weight where age <= $age_m and gender = '$gender' order by age desc");
|
||
// $bmi_date = Db::table('ws_bmi')->where("age <= $month_num and Sex = '$gender'")->order('age desc')->limit(1)->field('middle')->select();
|
||
$bmi_date = Db::query("select * from ws_bmi where age <= $age_m and gender = '$gender' order by age desc");
|
||
$return_data = array(
|
||
'height' => $height_date[0]['middle'],
|
||
'weight' => $weight_date[0]['middle'],
|
||
'bmi' => $bmi_date[0]['middle'],
|
||
);
|
||
}else{
|
||
$bmi_data = [
|
||
'1' => [ // 男性
|
||
[
|
||
'age' => ['min' => 216, 'max' => 299], // 18-24岁(216-299月龄)
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.5', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.5', 'max_val' => '20.4', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '20.5', 'max_val' => '23.9', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '24.0', 'max_val' => '27.9', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '28.0', 'max_val' => '31.9', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '32.0', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 300, 'max' => 419], // 25-34岁(300-419月龄)
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.5', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.5', 'max_val' => '20.9', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '21.0', 'max_val' => '24.4', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '24.5', 'max_val' => '28.4', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '28.5', 'max_val' => '32.4', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '32.5', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 420, 'max' => 539], // 35-44岁(420-539月龄)
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.5', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.5', 'max_val' => '21.4', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '21.5', 'max_val' => '25.0', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '25.1', 'max_val' => '29.0', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '29.1', 'max_val' => '33.0', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '33.1', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 540, 'max' => 719], // 45-59岁(540-719月龄)
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.5', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.5', 'max_val' => '21.9', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '22.0', 'max_val' => '25.5', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '25.6', 'max_val' => '29.5', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '29.6', 'max_val' => '33.5', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '33.6', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 720, 'max' => '99999'], // ≥60岁(720+月龄)
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.5', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.5', 'max_val' => '22.4', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '22.5', 'max_val' => '26.0', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '26.1', 'max_val' => '29.0', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '29.1', 'max_val' => '33.0', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '33.1', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
]
|
||
],
|
||
'2' => [ // 女性
|
||
[
|
||
'age' => ['min' => 216, 'max' => 299], // 18-24岁
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.0', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.0', 'max_val' => '19.9', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '20.0', 'max_val' => '22.9', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '23.0', 'max_val' => '26.9', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '27.0', 'max_val' => '30.9', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '31.0', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 300, 'max' => 419], // 25-34岁
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.0', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.0', 'max_val' => '20.4', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '20.5', 'max_val' => '23.4', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '23.5', 'max_val' => '27.4', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '27.5', 'max_val' => '31.4', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '31.5', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 420, 'max' => 539], // 35-44岁
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.0', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.0', 'max_val' => '20.9', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '21.0', 'max_val' => '24.0', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '24.1', 'max_val' => '28.0', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '28.1', 'max_val' => '32.0', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '32.1', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 540, 'max' => 719], // 45-59岁
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.0', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.0', 'max_val' => '21.4', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '21.5', 'max_val' => '24.5', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '24.6', 'max_val' => '28.5', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '28.6', 'max_val' => '32.5', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '32.6', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
],
|
||
[
|
||
'age' => ['min' => 720, 'max' => 99999], // ≥60岁
|
||
'list'=>[
|
||
['min_val' => '0', 'max_val' => '18.0', 'text' => '低体重', 'color' => '#8BC8FB'],
|
||
['min_val' => '18.0', 'max_val' => '21.9', 'text' => '偏瘦', 'color' => '#B4E3FD'],
|
||
['min_val' => '22.0', 'max_val' => '25.0', 'text' => '正常', 'color' => '#6CD86F'],
|
||
['min_val' => '25.1', 'max_val' => '28.0', 'text' => '超重', 'color' => '#FFD166'],
|
||
['min_val' => '28.1', 'max_val' => '32.0', 'text' => '肥胖', 'color' => '#FF9A5A'],
|
||
['min_val' => '32.1', 'max_val' => '99999', 'text' => '重度肥胖', 'color' => '#FF6B6B']
|
||
]
|
||
]
|
||
]
|
||
];
|
||
|
||
foreach ($bmi_data[$gender] as $group) {
|
||
if ($age_m >= $group['age']['min'] && $age_m <= $group['age']['max']) {
|
||
$return_data['bmi'] = bcdiv(bcadd($group['list'][2]['min_val'],$group['list'][2]['max_val'],20),2,1);
|
||
}
|
||
}
|
||
|
||
}
|
||
return $return_data;
|
||
}
|
||
public function touwei_temporary_use($age,$gender){
|
||
$return_data = [
|
||
|
||
];
|
||
if(!in_array($gender,['1','2'])){
|
||
return $return_data;
|
||
}
|
||
|
||
$age_m = $this->calculateAgeInMonthsWithPrecision($age);
|
||
|
||
if($age_m <= 36){
|
||
// $touwei_date = Db::table('ws_touwei')->where("age <= $age_m and gender = '$gender'")->order('age desc')->limit(1)->field('middle')->fetchSql(true)->select();
|
||
$touwei_date = Db::query("select * from ws_touwei where age <= $age_m and gender = '$gender' order by age desc");
|
||
$return_data = $touwei_date[0];
|
||
}
|
||
return $return_data;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |