SchoolPhysicalExamination/application/test/controller/Xishuju1.php

1640 lines
94 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\test\controller;
use think\Controller;
use think\Db;
use app\bj\controller\Common;
use think\Log;
use \think\Validate;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use app\test\controller\Baidufanyi;
class Xishuju1 extends Controller{
protected $return_data_all = [
// '0' => ['success',[]],
'10001'=>'关键参数缺失',
'10002'=>'操作失败',
'10003'=>'信息核实错误',
'10004'=>'未找到有效数据',
'10005'=>'参数格式错误',
'10006'=>'参数不能为空',
'10007'=>'参数错误',
'10008'=>'',
'10009'=>'',
'10010'=>'自定义信息',
'20001'=>'登录失效',
'99999'=>'网络异常,请稍后重试',
];
public function xishuju1_qd_page(){
// $cfc = Db::connect('cfc_db');
// $y_result_food = $cfc->table('linshi_usa_data')->group('data_type')->field('data_type,count(*) as num')->select();
// dump($y_result_food);
// die;
return $this->fetch();
}
public function xishuju1_action(){
$data = input();
$result = $this->wash_step1_chuli_shicai_name();
return $result;
}
public function xishuju2_action(){
// // 处理lebal
// $cfc = Db::connect('cfc_db');
// $data = $cfc->table('linshi_usa_label_list')->order('id')->select();
// $data2 = [];
// foreach ($data as $key => $value) {
// $data2[] = [
// 'name'=>$value['description'],
// 'one_id'=>999,
// 'create_time'=>date('Y-m-d H:i:s'),
// ];
// }
// $data3 = $cfc->table('app_z_national_standard_food_type_2_multilingual')->insertAll($data2);
// dump($data3);
// die;
$data = input();
$result = $this->wash_step2_chuli_shicai_name();
return $result;
}
public function xishuju3_action(){
$data = input();
$result = $this->wash_step3_chuli_shicai_name();
return $result;
}
public function wash_step1_chuli_shicai_name(){
$cfc = Db::connect('cfc_db');
$y_result_food = $cfc->table('linshi_usa_data')->where("data_type = 'sub_sample_food' AND status is null")->order('id desc')->field('id,fdc_id,data_type,food_category_id,description')->find();
if(!$y_result_food){
return $this->msg(10004);
}
$y_result_food_id = $y_result_food['id'];
unset($y_result_food['ROW_NUMBER']);
unset($y_result_food['id']);
// unset($y_result_food['publication_date']);
// unset($y_result_food['status']);
$y_result_food['description2'] = str_replace(' ', '', $y_result_food['description']);
$now_result_food = $cfc->table('linshi_usa_data_copy')->where(['data_type'=>'sub_sample_food','description2'=>$y_result_food['description2']])->find();
// dump($y_result_food);
// dump($now_result_food);
// die;
if($now_result_food){
// 启动事务
$cfc->startTrans();
try{
$cfc->table('linshi_usa_data_copy')->where(['id'=>$now_result_food['id']])->update([
'fdc_id'=>$now_result_food['fdc_id'].','.$y_result_food['fdc_id'],
]);
$cfc->table('linshi_usa_data')->where(['id'=>$y_result_food_id])->update([
'status'=>$now_result_food['id'],
]);
// 提交事务
$cfc->commit();
return $this->msg([]);
} catch (\Exception $e) {
// 回滚事务
$cfc->rollback();
return $this->msg(10002);
}
}else{
$cfc->startTrans();
try{
$new_id = $cfc->table('linshi_usa_data_copy')->insertGetId($y_result_food);
$cfc->table('linshi_usa_data')->where(['id'=>$y_result_food_id])->update([
'status'=>$new_id,
]);
// 提交事务
$cfc->commit();
return $this->msg([]);
} catch (\Exception $e) {
// 回滚事务
$cfc->rollback();
return $this->msg(10002);
}
}
}
public function wash_step2_chuli_shicai_name(){
// 选出一个食材,并处理它的营养物质,然后分别插入对应的表单
$nutritionData_map = [
'1008'=>['name'=>'Calorie','name_ch'=>'卡路里','unit'=>'KCAL','type'=>1],
'1003'=>['name'=>'Protein','name_ch'=>'蛋白质','unit'=>'G','type'=>1],
'1004'=>['name'=>'Fat','name_ch'=>'脂肪','unit'=>'G','type'=>1],
'1005'=>['name'=>'Carbohydrate','name_ch'=>'碳水化合物','unit'=>'G','type'=>1],
'1106'=>['name'=>'VitaminA','name_ch'=>'维生素A','unit'=>'UG','type'=>2],
'1165'=>['name'=>'VitaminB1','name_ch'=>'硫胺素','unit'=>'MG','type'=>2],
'1166'=>['name'=>'VitaminB2','name_ch'=>'核黄素','unit'=>'MG','type'=>2],
'1175'=>['name'=>'VitaminB6','name_ch'=>'维生素B6','unit'=>'MG','type'=>2],
'1178'=>['name'=>'VitaminB12','name_ch'=>'维生素B12','unit'=>'UG','type'=>2],
'1114'=>['name'=>'VitaminD','name_ch'=>'维生素D','unit'=>'UG','type'=>2],
'1185'=>['name'=>'VitaminK','name_ch'=>'维生素K','unit'=>'UG','type'=>2],
'1167'=>['name'=>'Niacin','name_ch'=>'烟酸','unit'=>'MG','type'=>2],
'1169'=>['name'=>'Niacin','name_ch'=>'烟酸','unit'=>'MG','type'=>2],
'1162'=>['name'=>'VitaminC','name_ch'=>'维生素C','unit'=>'MG','type'=>2],
'1109'=>['name'=>'VitaminE','name_ch'=>'维生素E','unit'=>'MG','type'=>2],
'1186'=>['name'=>'FolicAcid','name_ch'=>'叶酸','unit'=>'UG','type'=>2],
'1176'=>['name'=>'Biotin','name_ch'=>'生物素','unit'=>'UG','type'=>2],
'1170'=>['name'=>'PantothenicAcid','name_ch'=>'泛酸','unit'=>'MG','type'=>2],
'1180'=>['name'=>'TotalCholine','name_ch'=>'总胆碱','unit'=>'MG','type'=>2],
'1087'=>['name'=>'Ca','name_ch'=>'钙','unit'=>'MG','type'=>3],
'1091'=>['name'=>'Phosphorus','name_ch'=>'磷','unit'=>'MG','type'=>3],
'1092'=>['name'=>'Kalium','name_ch'=>'钾','unit'=>'MG','type'=>3],
'1090'=>['name'=>'Mg','name_ch'=>'镁','unit'=>'MG','type'=>3],
'1093'=>['name'=>'Na','name_ch'=>'钠','unit'=>'MG','type'=>3],
'1089'=>['name'=>'Fe','name_ch'=>'铁','unit'=>'MG','type'=>3],
'1095'=>['name'=>'Zn','name_ch'=>'锌','unit'=>'MG','type'=>3],
'1103'=>['name'=>'Se','name_ch'=>'硒','unit'=>'UG','type'=>3],
'1098'=>['name'=>'Cu','name_ch'=>'铜','unit'=>'MG','type'=>3],
'1101'=>['name'=>'Mn','name_ch'=>'锰','unit'=>'MG','type'=>3],
'1100'=>['name'=>'Iodine','name_ch'=>'碘','unit'=>'UG','type'=>3],
];
$nutritionData = [
"Calorie" => [],
"Protein" => [],
"Fat" => [],
"Carbohydrate" => [],
"VitaminA" => [],
"VitaminB1" => [],
"VitaminB2" => [],
"VitaminB6" => [],
"VitaminB12" => [],
"VitaminD" => [],
"VitaminK" => [],
"Niacin" => [],
"VitaminC" => [],
"VitaminE" => [],
"FolicAcid" => [],
"Biotin" => [],
"PantothenicAcid" => [],
"TotalCholine" => [],
"Ca" => [],
"Phosphorus" => [],
"Kalium" => [],
"Mg" => [],
"Na" => [],
"Fe" => [],
"Zn" => [],
"Se" => [],
"Cu" => [],
"Mn" => [],
"Iodine" => []
];
// 处理食物表数据
$cfc = Db::connect('cfc_db');
// 获取一条数据
$shiwu_name = $cfc->table('linshi_usa_data_copy')->where("status is null")->order('id')->find();
// dump($shiwu_name);
// dump(explode(',',$shiwu_name['fdc_id']));
// die;
if(!$shiwu_name){
return $this->msg(10004);
}
// 开始处理
$end_shiwu_data = [];
$end_shiwu_data['record_id'] = 251213;
$end_shiwu_data['Calorie_name'] = '卡路里';
$end_shiwu_data['Calorie_unit'] = 'kcal';
$end_shiwu_data['Calorie_val'] = '';
$end_shiwu_data['Protein_name'] = '蛋白质';
$end_shiwu_data['Protein_unit'] = 'g';
$end_shiwu_data['Protein_val'] = '';
$end_shiwu_data['Fat_name'] = '脂肪';
$end_shiwu_data['Fat_unit'] = 'g';
$end_shiwu_data['Fat_val'] = '';
$end_shiwu_data['Carbohydrate_name'] = '碳水化合物';
$end_shiwu_data['Carbohydrate_unit'] = 'g';
$end_shiwu_data['Carbohydrate_val'] = '';
$end_shiwu_data['two_id'] = $shiwu_name['food_category_id'];
$end_shiwu_data['data_type'] = $shiwu_name['data_type'];
$end_shiwu_data['food_name_en'] = $shiwu_name['description'];
// 处理营养成分表
// 加 bcadd(,,20)
// 减 bcsub(,,20)
// 乘 bcmul(,,20)
// 除 bcdiv(,,20)
// 获取一条数据
$yingyang_list = $cfc->table('linshi_usa_yingyang_guanlian')->where("fdc_id in (".$shiwu_name['fdc_id'].")")->select();
// dump(count($yingyang_list));
// die;
if(count($yingyang_list)<=0){
return $this->msg(11006,'error',['id'=>$shiwu_name['id']]);
}
// 开始处理
// 处理有值的营养成分
foreach ($yingyang_list as $key => $value) {
if(array_key_exists($value['nutrient_id'],$nutritionData_map)){
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['father_id'] = '';
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['name'] = $nutritionData_map[$value['nutrient_id']]['name'];
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['name_ch'] = $nutritionData_map[$value['nutrient_id']]['name_ch'];
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['unit'] = $nutritionData_map[$value['nutrient_id']]['unit'];
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['value'][] = $value['amount'];
$nutritionData[$nutritionData_map[$value['nutrient_id']]['name']]['type'] = $nutritionData_map[$value['nutrient_id']]['type'];
}
}
// 处理无值的营养成分
foreach ($nutritionData as $key => $value) {
if(count($value)<=0){
foreach ($nutritionData_map as $k => $v) {
if($v['name'] == $key){
$nutritionData[$key]['father_id'] = '';
$nutritionData[$key]['name'] = $v['name'];
$nutritionData[$key]['name_ch'] = $v['name_ch'];
$nutritionData[$key]['unit'] = $v['unit'];
$nutritionData[$key]['value'] = [];
$nutritionData[$key]['type'] = $v['type'];
}
}
}
}
// 处理营养成分的具体值&食材中的四大营养物质
foreach ($nutritionData as $key => $value) {
// 营养成分的具体值
$nutritionData_tmp = 0;
if(count($value['value'])<=0){
if($key == 'Calorie' || $key == 'Protein' || $key == 'Fat' || $key == 'Carbohydrate'){
return $this->msg(10006,'error',['id'=>$shiwu_name['id']]);
}
$nutritionData[$key]['value'] = '/';
}else{
foreach ($value['value'] as $k => $v) {
$nutritionData_tmp = bcadd($nutritionData_tmp,$v,20);
}
$nutritionData[$key]['value'] = bcdiv($nutritionData_tmp,count($value),20);
$nutritionData[$key]['value'] = $this->processPrecisionNumberBC($nutritionData[$key]['value']);
}
// 食材中的四大营养物质
if($key == 'Calorie'){
$end_shiwu_data['Calorie_unit'] = $value['unit'];
$end_shiwu_data['Calorie_val'] = $nutritionData[$key]['value'];
}else if($key == 'Protein'){
$end_shiwu_data['Protein_unit'] = $value['unit'];
$end_shiwu_data['Protein_val'] = $nutritionData[$key]['value'];
}else if($key == 'Fat'){
$end_shiwu_data['Fat_unit'] = $value['unit'];
$end_shiwu_data['Fat_val'] = $nutritionData[$key]['value'];
}else if($key == 'Carbohydrate'){
$end_shiwu_data['Carbohydrate_unit'] = $value['unit'];
$end_shiwu_data['Carbohydrate_val'] = $nutritionData[$key]['value'];
}
}
$end_nutritionData = [];
foreach ($nutritionData as $key => $value) {
$end_nutritionData[] = $value;
}
$cfc->startTrans();
try{
$new_id = $cfc->table('app_z_national_standard_food_type_3_multilingual')->insertGetId($end_shiwu_data);
foreach ($end_nutritionData as $key => $value) {
$end_nutritionData[$key]['father_id'] = $new_id;
}
$cfc->table('app_z_national_standard_food_type_4_multilingual')->insertAll($end_nutritionData);
$cfc->table('linshi_usa_data_copy')->where(['id'=>$shiwu_name['id']])->update([
'status'=>'success-'.$new_id,
]);
// 提交事务
$cfc->commit();
return $this->msg([]);
} catch (\Exception $e) {
// 回滚事务
$cfc->rollback();
return $this->msg(10002,'error',['id'=>$shiwu_name['id']]);
}
}
public function wash_step3_chuli_shicai_name(){
// 处理食物表数据
$cfc = Db::connect('cfc_db');
// 获取一条数据
$shicai_data = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->where("food_name = ''")->order('id')->find();
if(!$shicai_data){
return $this->msg(10004,'没了');
}
// dump($shicai_data);
// die;
$baidufanyi = new Baidufanyi;
$result = $baidufanyi->fanyi_action($shicai_data['food_name_en'], 'en', 'zh');
// dump($result);
// dump($result['data']['trans_result'][0]['dst']);
// die;
// $fanyi_result = '';
if($result['success'] == true){
$fanyi_result = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->where(['id'=>$shicai_data['id']])->update(['food_name'=>$result['data']['trans_result'][0]['dst']]);
if($fanyi_result){
return $this->msg([]);
}else{
return $this->msg(10002);
}
}else{
return $this->msg(10002,'翻译失败');
}
}
public function error_action(){
$data = input();
$code_arr = [
'10002' => 'DB_error',
'10006' => 'all_null',
'11006' => 'food_nutrition_null2',
'12002' => 'fanyi_error',
];
$cfc = Db::connect('cfc_db');
$result = $cfc->table('linshi_usa_data_copy')->where(['id'=>$data['id']])->update([
'status'=>$code_arr[$data['code']]
]);
if($result){
return $this->msg([]);
}else{
return $this->msg(10002,$data);
}
}
// 查看数据
public function look_food_data(){
// 根据您提供的营养成分表创建的数组
$nutritionArray = [
'Energy (Atwater General Factors)' => ['中文意思' => '能量(阿特沃特通用系数)', '状态' => '新!'],
'Energy (Atwater Specific Factors)' => ['中文意思' => '能量(阿特沃特定系数)', '状态' => '新!'],
'Solids' => ['中文意思' => '固形物', '状态' => '新!'],
'Nitrogen' => ['中文意思' => '氮', '状态' => '新!'],
'Protein' => ['中文意思' => '蛋白质', '状态' => '默认'],
'Total lipid (fat)' => ['中文意思' => '总脂肪', '状态' => '默认'],
'Carbohydrate, by difference' => ['中文意思' => '碳水化合物(差值法)', '状态' => '默认'],
'Fiber, crude (DO NOT USE - Archived)' => ['中文意思' => '粗纤维(已归档-请勿使用)', '状态' => '新!'],
'Ash' => ['中文意思' => '灰分', '状态' => '新!'],
'Energy' => ['中文意思' => '能量', '状态' => '默认'],
'Starch' => ['中文意思' => '淀粉', '状态' => '新!'],
'Sucrose' => ['中文意思' => '蔗糖', '状态' => '新!'],
'Glucose' => ['中文意思' => '葡萄糖', '状态' => '新!'],
'Fructose' => ['中文意思' => '果糖', '状态' => '新!'],
'Lactose' => ['中文意思' => '乳糖', '状态' => '新!'],
'Maltose' => ['中文意思' => '麦芽糖', '状态' => '新!'],
'Amylose' => ['中文意思' => '直链淀粉', '状态' => '新!'],
'Amylopectin' => ['中文意思' => '支链淀粉', '状态' => '新!'],
'Pectin' => ['中文意思' => '果胶', '状态' => '新!'],
'Alcohol, ethyl' => ['中文意思' => '乙醇', '状态' => '新!'],
'Pentosan' => ['中文意思' => '戊聚糖', '状态' => '新!'],
'Pentoses' => ['中文意思' => '戊糖', '状态' => '新!'],
'Hemicellulose' => ['中文意思' => '半纤维素', '状态' => '新!'],
'Cellulose' => ['中文意思' => '纤维素', '状态' => '新!'],
'pH' => ['中文意思' => '酸碱度', '状态' => '新!'],
'Specific Gravity' => ['中文意思' => '比重', '状态' => '新!'],
'Organic acids' => ['中文意思' => '有机酸', '状态' => '新!'],
'Acetic acid' => ['中文意思' => '乙酸', '状态' => '新!'],
'Aconitic acid' => ['中文意思' => '乌头酸', '状态' => '新!'],
'Benzoic acid' => ['中文意思' => '苯甲酸', '状态' => '新!'],
'Chelidonic acid' => ['中文意思' => '白屈菜酸', '状态' => '新!'],
'Chlorogenic acid' => ['中文意思' => '绿原酸', '状态' => '新!'],
'Cinnamic acid' => ['中文意思' => '肉桂酸', '状态' => '新!'],
'Citric acid' => ['中文意思' => '柠檬酸', '状态' => '新!'],
'Fumaric acid' => ['中文意思' => '富马酸', '状态' => '新!'],
'Galacturonic acid' => ['中文意思' => '半乳糖醛酸', '状态' => '新!'],
'Gallic acid' => ['中文意思' => '没食子酸', '状态' => '新!'],
'Glycolic acid' => ['中文意思' => '乙醇酸', '状态' => '新!'],
'Isocitric acid' => ['中文意思' => '异柠檬酸', '状态' => '新!'],
'Lactic acid' => ['中文意思' => '乳酸', '状态' => '新!'],
'Malic acid' => ['中文意思' => '苹果酸', '状态' => '新!'],
'Oxaloacetic acid' => ['中文意思' => '草酰乙酸', '状态' => '新!'],
'Oxalic acid' => ['中文意思' => '草酸', '状态' => '新!'],
'Phytic acid' => ['中文意思' => '植酸', '状态' => '新!'],
'Pyruvic acid' => ['中文意思' => '丙酮酸', '状态' => '新!'],
'Quinic acid' => ['中文意思' => '奎宁酸', '状态' => '新!'],
'Salicylic acid' => ['中文意思' => '水杨酸', '状态' => '新!'],
'Succinic acid' => ['中文意思' => '琥珀酸', '状态' => '新!'],
'Tartaric acid' => ['中文意思' => '酒石酸', '状态' => '新!'],
'Ursolic acid' => ['中文意思' => '熊果酸', '状态' => '新!'],
'Solids, non-fat' => ['中文意思' => '非脂固形物', '状态' => '新!'],
'Carbohydrate, by summation' => ['中文意思' => '碳水化合物(加和法)', '状态' => '新!'],
'Water' => ['中文意思' => '水分', '状态' => '新!'],
'Adjusted Nitrogen' => ['中文意思' => '调整氮', '状态' => '新!'],
'Adjusted Protein' => ['中文意思' => '调整蛋白质', '状态' => '新!'],
'Piperine' => ['中文意思' => '胡椒碱', '状态' => '新!'],
'Mannitol' => ['中文意思' => '甘露醇', '状态' => '新!'],
'Sorbitol' => ['中文意思' => '山梨糖醇', '状态' => '新!'],
'Caffeine' => ['中文意思' => '咖啡因', '状态' => '新!'],
'Theobromine' => ['中文意思' => '可可碱', '状态' => '新!'],
'Nitrates' => ['中文意思' => '硝酸盐', '状态' => '新!'],
'Nitrites' => ['中文意思' => '亚硝酸盐', '状态' => '新!'],
'Nitrosamine,total' => ['中文意思' => '总亚硝胺', '状态' => '新!'],
'Energy' => ['中文意思' => '能量(千焦)', '状态' => '默认'],
'Sugars, Total' => ['中文意思' => '总糖', '状态' => '新!'],
'Solids, soluble' => ['中文意思' => '可溶性固形物', '状态' => '新!'],
'Glycogen' => ['中文意思' => '糖原', '状态' => '新!'],
'Fiber, neutral detergent (DO NOT USE - Archived)' => ['中文意思' => '中性洗涤纤维(已归档-请勿使用)', '状态' => '新!'],
'Reducing sugars' => ['中文意思' => '还原糖', '状态' => '新!'],
'Beta-glucans' => ['中文意思' => 'β-葡聚糖', '状态' => '新!'],
'Oligosaccharides' => ['中文意思' => '低聚糖', '状态' => '新!'],
'Nonstarch polysaccharides' => ['中文意思' => '非淀粉多糖', '状态' => '新!'],
'Resistant starch' => ['中文意思' => '抗性淀粉', '状态' => '新!'],
'Carbohydrate, other' => ['中文意思' => '其他碳水化合物', '状态' => '新!'],
'Arabinose' => ['中文意思' => '阿拉伯糖', '状态' => '新!'],
'Xylose' => ['中文意思' => '木糖', '状态' => '新!'],
'Galactose' => ['中文意思' => '半乳糖', '状态' => '新!'],
'Raffinose' => ['中文意思' => '棉子糖', '状态' => '新!'],
'Stachyose' => ['中文意思' => '水苏糖', '状态' => '新!'],
'Xylitol' => ['中文意思' => '木糖醇', '状态' => '新!'],
'Fiber, total dietary' => ['中文意思' => '总膳食纤维', '状态' => '新!'],
'Lignin' => ['中文意思' => '木质素', '状态' => '新!'],
'Ribose' => ['中文意思' => '核糖', '状态' => '新!'],
'Fiber, soluble' => ['中文意思' => '可溶性纤维', '状态' => '新!'],
'Theophylline' => ['中文意思' => '茶碱', '状态' => '新!'],
'Fiber, insoluble' => ['中文意思' => '不溶性纤维', '状态' => '新!'],
'Total fat (NLEA)' => ['中文意思' => '总脂肪NLEA', '状态' => '新!'],
'Total sugar alcohols' => ['中文意思' => '总糖醇', '状态' => '新!'],
'Calcium, Ca' => ['中文意思' => '钙', '状态' => '默认'],
'Chlorine, Cl' => ['中文意思' => '氯', '状态' => '新!'],
'Iron, Fe' => ['中文意思' => '铁', '状态' => '默认'],
'Magnesium, Mg' => ['中文意思' => '镁', '状态' => '默认'],
'Phosphorus, P' => ['中文意思' => '磷', '状态' => '默认'],
'Potassium, K' => ['中文意思' => '钾', '状态' => '默认'],
'Sodium, Na' => ['中文意思' => '钠', '状态' => '默认'],
'Sulfur, S' => ['中文意思' => '硫', '状态' => '新!'],
'Zinc, Zn' => ['中文意思' => '锌', '状态' => '默认'],
'Chromium, Cr' => ['中文意思' => '铬', '状态' => '新!'],
'Cobalt, Co' => ['中文意思' => '钴', '状态' => '新!'],
'Copper, Cu' => ['中文意思' => '铜', '状态' => '默认'],
'Fluoride, F' => ['中文意思' => '氟化物', '状态' => '新!'],
'Iodine, I' => ['中文意思' => '碘', '状态' => '默认'],
'Manganese, Mn' => ['中文意思' => '锰', '状态' => '默认'],
'Molybdenum, Mo' => ['中文意思' => '钼', '状态' => '新!'],
'Selenium, Se' => ['中文意思' => '硒', '状态' => '默认'],
'Vitamin A, IU' => ['中文意思' => '维生素A国际单位', '状态' => '新!'],
'Retinol' => ['中文意思' => '视黄醇', '状态' => '新!'],
'Vitamin A, RAE' => ['中文意思' => '维生素A视黄醇活性当量', '状态' => '默认'],
'Carotene, beta' => ['中文意思' => 'β-胡萝卜素', '状态' => '新!'],
'Carotene, alpha' => ['中文意思' => 'α-胡萝卜素', '状态' => '新!'],
'Vitamin E (alpha-tocopherol)' => ['中文意思' => '维生素Eα-生育酚)', '状态' => '默认'],
'Vitamin D (D2 + D3), International Units' => ['中文意思' => '维生素DD2+D3国际单位', '状态' => '新!'],
'Vitamin D2 (ergocalciferol)' => ['中文意思' => '维生素D2麦角钙化醇', '状态' => '新!'],
'Vitamin D3 (cholecalciferol)' => ['中文意思' => '维生素D3胆钙化醇', '状态' => '新!'],
'25-hydroxycholecalciferol' => ['中文意思' => '25-羟基胆钙化醇', '状态' => '新!'],
'Vitamin D (D2 + D3)' => ['中文意思' => '维生素DD2+D3', '状态' => '默认'],
'25-hydroxyergocalciferol' => ['中文意思' => '25-羟基麦角钙化醇', '状态' => '新!'],
'Phytoene' => ['中文意思' => '八氢番茄红素', '状态' => '新!'],
'Phytofluene' => ['中文意思' => '六氢番茄红素', '状态' => '新!'],
'Carotene, gamma' => ['中文意思' => 'γ-胡萝卜素', '状态' => '新!'],
'Zeaxanthin' => ['中文意思' => '玉米黄质', '状态' => '新!'],
'Cryptoxanthin, beta' => ['中文意思' => 'β-隐黄质', '状态' => '新!'],
'Lutein' => ['中文意思' => '叶黄素', '状态' => '新!'],
'Lycopene' => ['中文意思' => '番茄红素', '状态' => '新!'],
'Lutein + zeaxanthin' => ['中文意思' => '叶黄素+玉米黄质', '状态' => '新!'],
'Vitamin E (label entry primarily)' => ['中文意思' => '维生素E标签主要条目', '状态' => '新!'],
'Tocopherol, beta' => ['中文意思' => 'β-生育酚', '状态' => '新!'],
'Tocopherol, gamma' => ['中文意思' => 'γ-生育酚', '状态' => '新!'],
'Tocopherol, delta' => ['中文意思' => 'δ-生育酚', '状态' => '新!'],
'Tocotrienol, alpha' => ['中文意思' => 'α-生育三烯酚', '状态' => '新!'],
'Tocotrienol, beta' => ['中文意思' => 'β-生育三烯酚', '状态' => '新!'],
'Tocotrienol, gamma' => ['中文意思' => 'γ-生育三烯酚', '状态' => '新!'],
'Tocotrienol, delta' => ['中文意思' => 'δ-生育三烯酚', '状态' => '新!'],
'Aluminum, Al' => ['中文意思' => '铝', '状态' => '新!'],
'Antimony, Sb' => ['中文意思' => '锑', '状态' => '新!'],
'Arsenic, As' => ['中文意思' => '砷', '状态' => '新!'],
'Barium, Ba' => ['中文意思' => '钡', '状态' => '新!'],
'Beryllium, Be' => ['中文意思' => '铍', '状态' => '新!'],
'Boron, B' => ['中文意思' => '硼', '状态' => '新!'],
'Bromine, Br' => ['中文意思' => '溴', '状态' => '新!'],
'Cadmium, Cd' => ['中文意思' => '镉', '状态' => '新!'],
'Gold, Au' => ['中文意思' => '金', '状态' => '新!'],
'Iron, heme' => ['中文意思' => '血红素铁', '状态' => '新!'],
'Iron, non-heme' => ['中文意思' => '非血红素铁', '状态' => '新!'],
'Lead, Pb' => ['中文意思' => '铅', '状态' => '新!'],
'Lithium, Li' => ['中文意思' => '锂', '状态' => '新!'],
'Mercury, Hg' => ['中文意思' => '汞', '状态' => '新!'],
'Nickel, Ni' => ['中文意思' => '镍', '状态' => '新!'],
'Rubidium, Rb' => ['中文意思' => '铷', '状态' => '新!'],
'Fluoride - DO NOT USE; use 313' => ['中文意思' => '氟化物请勿使用使用313', '状态' => '新!'],
'Salt, NaCl' => ['中文意思' => '食盐(氯化钠)', '状态' => '新!'],
'Silicon, Si' => ['中文意思' => '硅', '状态' => '新!'],
'Silver, Ag' => ['中文意思' => '银', '状态' => '新!'],
'Strontium, Sr' => ['中文意思' => '锶', '状态' => '新!'],
'Tin, Sn' => ['中文意思' => '锡', '状态' => '新!'],
'Titanium, Ti' => ['中文意思' => '钛', '状态' => '新!'],
'Vanadium, V' => ['中文意思' => '钒', '状态' => '新!'],
'Vitamin A, RE' => ['中文意思' => '维生素A视黄醇当量', '状态' => '新!'],
'Carotene' => ['中文意思' => '胡萝卜素', '状态' => '新!'],
'Vitamin E' => ['中文意思' => '维生素Eα-生育酚当量)', '状态' => '新!'],
'cis-beta-Carotene' => ['中文意思' => '顺式-β-胡萝卜素', '状态' => '新!'],
'cis-Lycopene' => ['中文意思' => '顺式-番茄红素', '状态' => '新!'],
'cis-Lutein/Zeaxanthin' => ['中文意思' => '顺式-叶黄素/玉米黄质', '状态' => '新!'],
'Vitamin C, total ascorbic acid' => ['中文意思' => '总抗坏血酸维生素C', '状态' => '默认'],
'Vitamin C, reduced ascorbic acid' => ['中文意思' => '还原型抗坏血酸', '状态' => '新!'],
'Vitamin C, dehydro ascorbic acid' => ['中文意思' => '脱氢抗坏血酸', '状态' => '新!'],
'Thiamin' => ['中文意思' => '硫胺素维生素B1', '状态' => '默认'],
'Riboflavin' => ['中文意思' => '核黄素维生素B2', '状态' => '默认'],
'Niacin' => ['中文意思' => '烟酸维生素B3', '状态' => '默认'],
'Niacin from tryptophan, determined' => ['中文意思' => '由色氨酸转化的烟酸(测定值)', '状态' => '新!'],
'Niacin equivalent N406 +N407' => ['中文意思' => '烟酸当量N406+N407', '状态' => '默认'],
'Pantothenic acid' => ['中文意思' => '泛酸维生素B5', '状态' => '默认'],
'Vitamin B-6, pyridoxine, alcohol form' => ['中文意思' => '维生素B6吡哆醇醇型', '状态' => '新!'],
'Vitamin B-6, pyridoxal, aldehyde form' => ['中文意思' => '维生素B6吡哆醛醛型', '状态' => '新!'],
'Vitamin B-6, pyridoxamine, amine form' => ['中文意思' => '维生素B6吡哆胺胺型', '状态' => '新!'],
'Vitamin B-6, N411 + N412 +N413' => ['中文意思' => '维生素B6N411+N412+N413', '状态' => '新!'],
'Vitamin B-6' => ['中文意思' => '维生素B6', '状态' => '默认'],
'Biotin' => ['中文意思' => '生物素维生素B7', '状态' => '默认'],
'Folate, total' => ['中文意思' => '总叶酸', '状态' => '新!'],
'Vitamin B-12' => ['中文意思' => '维生素B12', '状态' => '默认'],
'Folate, free' => ['中文意思' => '游离叶酸', '状态' => '新!'],
'Choline, total' => ['中文意思' => '总胆碱', '状态' => '默认'],
'Inositol' => ['中文意思' => '肌醇', '状态' => '新!'],
'Inositol phosphate' => ['中文意思' => '肌醇磷酸', '状态' => '新!'],
'Vitamin K (Menaquinone-4)' => ['中文意思' => '维生素K甲基萘醌-4', '状态' => '新!'],
'Vitamin K (Dihydrophylloquinone)' => ['中文意思' => '维生素K二氢叶绿醌', '状态' => '新!'],
'Vitamin K (phylloquinone)' => ['中文意思' => '维生素K叶绿醌', '状态' => '默认'],
'Folic acid' => ['中文意思' => '叶酸(合成)', '状态' => '默认'],
'Folate, food' => ['中文意思' => '食物叶酸', '状态' => '新!'],
'5-methyl tetrahydrofolate (5-MTHF)' => ['中文意思' => '5-甲基四氢叶酸5-MTHF', '状态' => '新!'],
'Folate, not 5-MTHF' => ['中文意思' => '非5-MTHF叶酸', '状态' => '新!'],
'Folate, DFE' => ['中文意思' => '叶酸(膳食叶酸当量)', '状态' => '新!'],
'10-Formyl folic acid (10HCOFA)' => ['中文意思' => '10-甲酰叶酸10HCOFA', '状态' => '新!'],
'5-Formyltetrahydrofolic acid (5-HCOH4' => ['中文意思' => '5-甲酰四氢叶酸5-HCOH4', '状态' => '新!'],
'Tetrahydrofolic acid (THF)' => ['中文意思' => '四氢叶酸THF', '状态' => '新!'],
'Choline, free' => ['中文意思' => '游离胆碱', '状态' => '新!'],
'Choline, from phosphocholine' => ['中文意思' => '来自磷酸胆碱的胆碱', '状态' => '新!'],
'Choline, from phosphotidyl choline' => ['中文意思' => '来自磷脂酰胆碱的胆碱', '状态' => '新!'],
'Choline, from glycerophosphocholine' => ['中文意思' => '来自甘油磷酸胆碱的胆碱', '状态' => '新!'],
'Betaine' => ['中文意思' => '甜菜碱', '状态' => '新!'],
'Choline, from sphingomyelin' => ['中文意思' => '来自鞘磷脂的胆碱', '状态' => '新!'],
'p-Hydroxy benzoic acid' => ['中文意思' => '对羟基苯甲酸', '状态' => '新!'],
'Caffeic acid' => ['中文意思' => '咖啡酸', '状态' => '新!'],
'p-Coumaric acid' => ['中文意思' => '对香豆酸', '状态' => '新!'],
'Ellagic acid' => ['中文意思' => '鞣花酸', '状态' => '新!'],
'Ferrulic acid' => ['中文意思' => '阿魏酸', '状态' => '新!'],
'Gentisic acid' => ['中文意思' => '龙胆酸', '状态' => '新!'],
'Tyrosol' => ['中文意思' => '酪醇', '状态' => '新!'],
'Vanillic acid' => ['中文意思' => '香草酸', '状态' => '新!'],
'Phenolic acids, total' => ['中文意思' => '总酚酸', '状态' => '新!'],
'Polyphenols, total' => ['中文意思' => '总多酚', '状态' => '新!'],
'Tryptophan' => ['中文意思' => '色氨酸', '状态' => '新!'],
'Threonine' => ['中文意思' => '苏氨酸', '状态' => '新!'],
'Isoleucine' => ['中文意思' => '异亮氨酸', '状态' => '新!'],
'Leucine' => ['中文意思' => '亮氨酸', '状态' => '新!'],
'Lysine' => ['中文意思' => '赖氨酸', '状态' => '新!'],
'Methionine' => ['中文意思' => '蛋氨酸', '状态' => '新!'],
'Cystine' => ['中文意思' => '胱氨酸', '状态' => '新!'],
'Phenylalanine' => ['中文意思' => '苯丙氨酸', '状态' => '新!'],
'Tyrosine' => ['中文意思' => '酪氨酸', '状态' => '新!'],
'Valine' => ['中文意思' => '缬氨酸', '状态' => '新!'],
'Arginine' => ['中文意思' => '精氨酸', '状态' => '新!'],
'Histidine' => ['中文意思' => '组氨酸', '状态' => '新!'],
'Alanine' => ['中文意思' => '丙氨酸', '状态' => '新!'],
'Aspartic acid' => ['中文意思' => '天冬氨酸', '状态' => '新!'],
'Glutamic acid' => ['中文意思' => '谷氨酸', '状态' => '新!'],
'Glycine' => ['中文意思' => '甘氨酸', '状态' => '新!'],
'Proline' => ['中文意思' => '脯氨酸', '状态' => '新!'],
'Serine' => ['中文意思' => '丝氨酸', '状态' => '新!'],
'Hydroxyproline' => ['中文意思' => '羟脯氨酸', '状态' => '新!'],
'Cysteine and methionine(sulfer containig AA)' => ['中文意思' => '含硫氨基酸(半胱氨酸+蛋氨酸)', '状态' => '新!'],
'Phenylalanine and tyrosine (aromatic AA)' => ['中文意思' => '芳香族氨基酸(苯丙氨酸+酪氨酸)', '状态' => '新!'],
'Asparagine' => ['中文意思' => '天冬酰胺', '状态' => '新!'],
'Cysteine' => ['中文意思' => '半胱氨酸', '状态' => '新!'],
'Glutamine' => ['中文意思' => '谷氨酰胺', '状态' => '新!'],
'Taurine' => ['中文意思' => '牛磺酸', '状态' => '新!'],
'Sugars, added' => ['中文意思' => '添加糖', '状态' => '新!'],
'Sugars, intrinsic' => ['中文意思' => '内源糖', '状态' => '新!'],
'Calcium, added' => ['中文意思' => '添加钙', '状态' => '新!'],
'Iron, added' => ['中文意思' => '添加铁', '状态' => '新!'],
'Calcium, intrinsic' => ['中文意思' => '内源钙', '状态' => '新!'],
'Iron, intrinsic' => ['中文意思' => '内源铁', '状态' => '新!'],
'Vitamin C, added' => ['中文意思' => '添加维生素C', '状态' => '新!'],
'Vitamin E, added' => ['中文意思' => '添加维生素E', '状态' => '新!'],
'Thiamin, added' => ['中文意思' => '添加硫胺素', '状态' => '新!'],
'Riboflavin, added' => ['中文意思' => '添加核黄素', '状态' => '新!'],
'Niacin, added' => ['中文意思' => '添加烟酸', '状态' => '新!'],
'Vitamin B-12, added' => ['中文意思' => '添加维生素B12', '状态' => '新!'],
'Vitamin C, intrinsic' => ['中文意思' => '内源维生素C', '状态' => '新!'],
'Vitamin E, intrinsic' => ['中文意思' => '内源维生素E', '状态' => '新!'],
'Thiamin, intrinsic' => ['中文意思' => '内源硫胺素', '状态' => '新!'],
'Riboflavin, intrinsic' => ['中文意思' => '内源核黄素', '状态' => '新!'],
'Niacin, intrinsic' => ['中文意思' => '内源烟酸', '状态' => '新!'],
'Vitamin B-12, intrinsic' => ['中文意思' => '内源维生素B12', '状态' => '新!'],
'Cholesterol' => ['中文意思' => '胆固醇', '状态' => '新!'],
'Glycerides' => ['中文意思' => '甘油酯', '状态' => '新!'],
'Phospholipids' => ['中文意思' => '磷脂', '状态' => '新!'],
'Glycolipids' => ['中文意思' => '糖脂', '状态' => '新!'],
'Fatty acids, total trans' => ['中文意思' => '总反式脂肪酸', '状态' => '新!'],
'Fatty acids, total saturated' => ['中文意思' => '总饱和脂肪酸', '状态' => '新!'],
'SFA 4:0' => ['中文意思' => '饱和脂肪酸4:0丁酸', '状态' => '新!'],
'SFA 6:0' => ['中文意思' => '饱和脂肪酸6:0己酸', '状态' => '新!'],
'SFA 8:0' => ['中文意思' => '饱和脂肪酸8:0辛酸', '状态' => '新!'],
'SFA 10:0' => ['中文意思' => '饱和脂肪酸10:0癸酸', '状态' => '新!'],
'SFA 12:0' => ['中文意思' => '饱和脂肪酸12:0月桂酸', '状态' => '新!'],
'SFA 14:0' => ['中文意思' => '饱和脂肪酸14:0肉豆蔻酸', '状态' => '新!'],
'SFA 16:0' => ['中文意思' => '饱和脂肪酸16:0棕榈酸', '状态' => '新!'],
'SFA 18:0' => ['中文意思' => '饱和脂肪酸18:0硬脂酸', '状态' => '新!'],
'SFA 20:0' => ['中文意思' => '饱和脂肪酸20:0花生酸', '状态' => '新!'],
'MUFA 18:1' => ['中文意思' => '单不饱和脂肪酸18:1油酸', '状态' => '新!'],
'PUFA 18:2' => ['中文意思' => '多不饱和脂肪酸18:2亚油酸', '状态' => '新!'],
'PUFA 18:3' => ['中文意思' => '多不饱和脂肪酸18:3亚麻酸', '状态' => '新!'],
'PUFA 20:4' => ['中文意思' => '多不饱和脂肪酸20:4花生四烯酸', '状态' => '新!'],
'PUFA 22:6 n-3 (DHA)' => ['中文意思' => '多不饱和脂肪酸22:6 n-3DHA', '状态' => '新!'],
'SFA 22:0' => ['中文意思' => '饱和脂肪酸22:0山萮酸', '状态' => '新!'],
'MUFA 14:1' => ['中文意思' => '单不饱和脂肪酸14:1肉豆蔻油酸', '状态' => '新!'],
'MUFA 16:1' => ['中文意思' => '单不饱和脂肪酸16:1棕榈油酸', '状态' => '新!'],
'PUFA 18:4' => ['中文意思' => '多不饱和脂肪酸18:4十八碳四烯酸', '状态' => '新!'],
'MUFA 20:1' => ['中文意思' => '单不饱和脂肪酸20:1二十碳一烯酸', '状态' => '新!'],
'PUFA 20:5 n-3 (EPA)' => ['中文意思' => '多不饱和脂肪酸20:5 n-3EPA', '状态' => '新!'],
'MUFA 22:1' => ['中文意思' => '单不饱和脂肪酸22:1芥酸', '状态' => '新!'],
'PUFA 22:5 n-3 (DPA)' => ['中文意思' => '多不饱和脂肪酸22:5 n-3DPA', '状态' => '新!'],
'TFA 14:1 t' => ['中文意思' => '反式脂肪酸14:1 t', '状态' => '新!'],
'Phytosterols' => ['中文意思' => '植物固醇', '状态' => '新!'],
'Ergosterol' => ['中文意思' => '麦角固醇', '状态' => '新!'],
'Stigmasterol' => ['中文意思' => '豆甾醇', '状态' => '新!'],
'Campesterol' => ['中文意思' => '菜油甾醇', '状态' => '新!'],
'Brassicasterol' => ['中文意思' => '菜籽甾醇', '状态' => '新!'],
'Beta-sitosterol' => ['中文意思' => 'β-谷甾醇', '状态' => '新!'],
'Campestanol' => ['中文意思' => '菜油甾烷醇', '状态' => '新!'],
'Unsaponifiable matter (lipids)' => ['中文意思' => '不皂化物(脂质)', '状态' => '新!'],
'Fatty acids, other than 607-615, 617-621, 624-632, 652-654, 686-689)' => ['中文意思' => '其他脂肪酸(除指定范围)', '状态' => '新!'],
'Fatty acids, total monounsaturated' => ['中文意思' => '总单不饱和脂肪酸', '状态' => '新!'],
'Fatty acids, total polyunsaturated' => ['中文意思' => '总多不饱和脂肪酸', '状态' => '新!'],
'Beta-sitostanol' => ['中文意思' => 'β-谷甾烷醇', '状态' => '新!'],
'Delta-7-avenasterol' => ['中文意思' => 'Δ7-燕麦甾醇', '状态' => '新!'],
'Delta-5-avenasterol' => ['中文意思' => 'Δ5-燕麦甾醇', '状态' => '新!'],
'Alpha-spinasterol' => ['中文意思' => 'α-菠菜甾醇', '状态' => '新!'],
'Phytosterols, other' => ['中文意思' => '其他植物固醇', '状态' => '新!'],
'SFA 15:0' => ['中文意思' => '饱和脂肪酸15:0十五酸', '状态' => '新!'],
'SFA 17:0' => ['中文意思' => '饱和脂肪酸17:0十七酸', '状态' => '新!'],
'SFA 24:0' => ['中文意思' => '饱和脂肪酸24:0木焦油酸', '状态' => '新!'],
'Wax Esters(Total Wax)' => ['中文意思' => '蜡酯(总蜡)', '状态' => '新!'],
'TFA 16:1 t' => ['中文意思' => '反式脂肪酸16:1 t', '状态' => '新!'],
'TFA 18:1 t' => ['中文意思' => '反式脂肪酸18:1 t', '状态' => '新!'],
'TFA 22:1 t' => ['中文意思' => '反式脂肪酸22:1 t', '状态' => '新!'],
'TFA 18:2 t not further defined' => ['中文意思' => '反式脂肪酸18:2 t未进一步定义', '状态' => '新!'],
'PUFA 18:2 i' => ['中文意思' => '多不饱和脂肪酸18:2 i异构体', '状态' => '新!'],
'PUFA 18:2 t,c' => ['中文意思' => '多不饱和脂肪酸18:2 t,c', '状态' => '新!'],
'PUFA 18:2 c,t' => ['中文意思' => '多不饱和脂肪酸18:2 c,t', '状态' => '新!'],
'TFA 18:2 t,t' => ['中文意思' => '反式脂肪酸18:2 t,t', '状态' => '新!'],
'PUFA 18:2 CLAs' => ['中文意思' => '多不饱和脂肪酸18:2共轭亚油酸', '状态' => '新!'],
'MUFA 24:1 c' => ['中文意思' => '单不饱和脂肪酸24:1 c神经酸', '状态' => '新!'],
'PUFA 20:2 n-6 c,c' => ['中文意思' => '多不饱和脂肪酸20:2 n-6 c,c', '状态' => '新!'],
'MUFA 16:1 c' => ['中文意思' => '单不饱和脂肪酸16:1 c顺式棕榈油酸', '状态' => '新!'],
'MUFA 18:1 c' => ['中文意思' => '单不饱和脂肪酸18:1 c顺式油酸', '状态' => '新!'],
'PUFA 18:2 n-6 c,c' => ['中文意思' => '多不饱和脂肪酸18:2 n-6 c,c亚油酸', '状态' => '新!'],
'MUFA 22:1 c' => ['中文意思' => '单不饱和脂肪酸22:1 c顺式芥酸', '状态' => '新!'],
'Fatty acids, saturated, other' => ['中文意思' => '其他饱和脂肪酸', '状态' => '新!'],
'Fatty acids, monounsat., other' => ['中文意思' => '其他单不饱和脂肪酸', '状态' => '新!'],
'Fatty acids, polyunsat., other' => ['中文意思' => '其他多不饱和脂肪酸', '状态' => '新!'],
'PUFA 18:3 n-6 c,c,c' => ['中文意思' => '多不饱和脂肪酸18:3 n-6 c,c,cγ-亚麻酸)', '状态' => '新!'],
'SFA 19:0' => ['中文意思' => '饱和脂肪酸19:0十九酸', '状态' => '新!'],
'MUFA 17:1' => ['中文意思' => '单不饱和脂肪酸17:1十七碳一烯酸', '状态' => '新!'],
'PUFA 16:2' => ['中文意思' => '多不饱和脂肪酸16:2十六碳二烯酸', '状态' => '新!'],
'PUFA 20:3' => ['中文意思' => '多不饱和脂肪酸20:3二十碳三烯酸', '状态' => '新!'],
'Fatty acids, total sat., NLEA' => ['中文意思' => '总饱和脂肪酸NLEA', '状态' => '新!'],
'Fatty acids, total monounsat., NLEA' => ['中文意思' => '总单不饱和脂肪酸NLEA', '状态' => '新!'],
'Fatty acids, total polyunsat., NLEA' => ['中文意思' => '总多不饱和脂肪酸NLEA', '状态' => '新!'],
'Fatty acids, total trans-monoenoic' => ['中文意思' => '总反式单烯酸', '状态' => '新!'],
'Fatty acids, total trans-dienoic' => ['中文意思' => '总反式二烯酸', '状态' => '新!'],
'Fatty acids, total trans-polyenoic' => ['中文意思' => '总反式多烯酸', '状态' => '新!'],
'SFA 13:0' => ['中文意思' => '饱和脂肪酸13:0十三酸', '状态' => '新!'],
'MUFA 15:1' => ['中文意思' => '单不饱和脂肪酸15:1十五碳一烯酸', '状态' => '新!'],
'PUFA 22:2' => ['中文意思' => '多不饱和脂肪酸22:2二十二碳二烯酸', '状态' => '新!'],
'SFA 11:0' => ['中文意思' => '饱和脂肪酸11:0十一酸', '状态' => '新!'],
'ORAC, Hydrophyllic' => ['中文意思' => '亲水性氧自由基吸收能力', '状态' => '新!'],
'ORAC, Lipophillic' => ['中文意思' => '亲脂性氧自由基吸收能力', '状态' => '新!'],
'ORAC, Total' => ['中文意思' => '总氧自由基吸收能力', '状态' => '新!'],
'Total Phenolics' => ['中文意思' => '总酚类化合物', '状态' => '新!'],
'Daidzein' => ['中文意思' => '大豆苷元', '状态' => '新!'],
'Genistein' => ['中文意思' => '染料木素', '状态' => '新!'],
'Glycitein' => ['中文意思' => '黄豆黄素', '状态' => '新!'],
'Isoflavones' => ['中文意思' => '异黄酮', '状态' => '新!'],
'Biochanin A' => ['中文意思' => '鹰嘴豆素A', '状态' => '新!'],
'Formononetin' => ['中文意思' => '芒柄花素', '状态' => '新!'],
'Coumestrol' => ['中文意思' => '香豆雌酚', '状态' => '新!'],
'Flavonoids, total' => ['中文意思' => '总黄酮', '状态' => '新!'],
'Anthocyanidins' => ['中文意思' => '花青素', '状态' => '新!'],
'Cyanidin' => ['中文意思' => '矢车菊素', '状态' => '新!'],
'Proanthocyanidin (dimer-A linkage)' => ['中文意思' => '原花青素A型二聚体', '状态' => '新!'],
'Proanthocyanidin monomers' => ['中文意思' => '原花青素单体', '状态' => '新!'],
'Proanthocyanidin dimers' => ['中文意思' => '原花青素二聚体', '状态' => '新!'],
'Proanthocyanidin trimers' => ['中文意思' => '原花青素三聚体', '状态' => '新!'],
'Proanthocyanidin 4-6mers' => ['中文意思' => '原花青素4-6聚体', '状态' => '新!'],
'Proanthocyanidin 7-10mers' => ['中文意思' => '原花青素7-10聚体', '状态' => '新!'],
'Proanthocyanidin polymers (>10mers)' => ['中文意思' => '原花青素聚合物(>10聚体', '状态' => '新!'],
'Delphinidin' => ['中文意思' => '飞燕草素', '状态' => '新!'],
'Malvidin' => ['中文意思' => '锦葵色素', '状态' => '新!'],
'Pelargonidin' => ['中文意思' => '天竺葵素', '状态' => '新!'],
'Peonidin' => ['中文意思' => '芍药素', '状态' => '新!'],
'Petunidin' => ['中文意思' => '矮牵牛素', '状态' => '新!'],
'Flavans, total' => ['中文意思' => '总黄烷', '状态' => '新!'],
'Catechins, total' => ['中文意思' => '总儿茶素', '状态' => '新!'],
'Catechin' => ['中文意思' => '儿茶素', '状态' => '新!'],
'Epigallocatechin' => ['中文意思' => '表没食子儿茶素', '状态' => '新!'],
'Epicatechin' => ['中文意思' => '表儿茶素', '状态' => '新!'],
'Epicatechin-3-gallate' => ['中文意思' => '表儿茶素-3-没食子酸酯', '状态' => '新!'],
'Epigallocatechin-3-gallate' => ['中文意思' => '表没食子儿茶素-3-没食子酸酯', '状态' => '新!'],
'Procyanidins, total' => ['中文意思' => '总原花青素', '状态' => '新!'],
'Theaflavins' => ['中文意思' => '茶黄素', '状态' => '新!'],
'Thearubigins' => ['中文意思' => '茶红素', '状态' => '新!'],
'Flavanones, total' => ['中文意思' => '总黄烷酮', '状态' => '新!'],
'Eriodictyol' => ['中文意思' => '圣草酚', '状态' => '新!'],
'Hesperetin' => ['中文意思' => '橙皮素', '状态' => '新!'],
'Isosakuranetin' => ['中文意思' => '异樱花素', '状态' => '新!'],
'Liquiritigenin' => ['中文意思' => '甘草素', '状态' => '新!'],
'Naringenin' => ['中文意思' => '柚皮素', '状态' => '新!'],
'Flavones, total' => ['中文意思' => '总黄酮', '状态' => '新!'],
'Apigenin' => ['中文意思' => '芹菜素', '状态' => '新!'],
'Chrysoeriol' => ['中文意思' => '金圣草黄素', '状态' => '新!'],
'Diosmetin' => ['中文意思' => '香叶木素', '状态' => '新!'],
'Luteolin' => ['中文意思' => '木犀草素', '状态' => '新!'],
'Nobiletin' => ['中文意思' => '川陈皮素', '状态' => '新!'],
'Sinensetin' => ['中文意思' => '甜橙黄酮', '状态' => '新!'],
'Tangeretin' => ['中文意思' => '橘皮素', '状态' => '新!'],
'Flavonols, total' => ['中文意思' => '总黄酮醇', '状态' => '新!'],
'Isorhamnetin' => ['中文意思' => '异鼠李素', '状态' => '新!'],
'Kaempferol' => ['中文意思' => '山奈酚', '状态' => '新!'],
'Limocitrin' => ['中文意思' => '柠檬黄酮', '状态' => '新!'],
'Myricetin' => ['中文意思' => '杨梅素', '状态' => '新!'],
'Quercetin' => ['中文意思' => '槲皮素', '状态' => '新!'],
'Theogallin' => ['中文意思' => '茶没食子素', '状态' => '新!'],
"Theaflavin -3,3' -digallate" => ['中文意思' => "茶黄素-3,3'-双没食子酸酯", '状态' => '新!'],
"Theaflavin -3' -gallate" => ['中文意思' => "茶黄素-3'-没食子酸酯", '状态' => '新!'],
'Theaflavin -3 -gallate' => ['中文意思' => '茶黄素-3-没食子酸酯', '状态' => '新!'],
'(+) -Gallo catechin' => ['中文意思' => '(+)-没食子儿茶素', '状态' => '新!'],
'(+)-Catechin 3-gallate' => ['中文意思' => '(+)-儿茶素-3-没食子酸酯', '状态' => '新!'],
'(+)-Gallocatechin 3-gallate' => ['中文意思' => '(+)-没食子儿茶素-3-没食子酸酯', '状态' => '新!'],
'Mannose' => ['中文意思' => '甘露糖', '状态' => '新!'],
'Triose' => ['中文意思' => '丙糖', '状态' => '新!'],
'Tetrose' => ['中文意思' => '丁糖', '状态' => '新!'],
'Other Saccharides' => ['中文意思' => '其他糖类', '状态' => '新!'],
'Inulin' => ['中文意思' => '菊粉', '状态' => '新!'],
'PUFA 18:3 n-3 c,c,c (ALA)' => ['中文意思' => '多不饱和脂肪酸18:3 n-3 c,c,cα-亚麻酸)', '状态' => '新!'],
'PUFA 20:3 n-3' => ['中文意思' => '多不饱和脂肪酸20:3 n-3', '状态' => '新!'],
'PUFA 20:3 n-6' => ['中文意思' => '多不饱和脂肪酸20:3 n-6', '状态' => '新!'],
'PUFA 20:4 n-3' => ['中文意思' => '多不饱和脂肪酸20:4 n-3', '状态' => '新!'],
'PUFA 20:4 n-6' => ['中文意思' => '多不饱和脂肪酸20:4 n-6花生四烯酸', '状态' => '新!'],
'PUFA 18:3i' => ['中文意思' => '多不饱和脂肪酸18:3i异构体', '状态' => '新!'],
'PUFA 21:5' => ['中文意思' => '多不饱和脂肪酸21:5二十一碳五烯酸', '状态' => '新!'],
'PUFA 22:4' => ['中文意思' => '多不饱和脂肪酸22:4二十二碳四烯酸', '状态' => '新!'],
'MUFA 18:1-11 t (18:1t n-7)' => ['中文意思' => '单不饱和脂肪酸18:1-11 t反式十八碳一烯酸n-7', '状态' => '新!'],
'MUFA 18:1-11 c (18:1c n-7)' => ['中文意思' => '单不饱和脂肪酸18:1-11 c顺式十八碳一烯酸n-7', '状态' => '新!'],
'PUFA 20:3 n-9' => ['中文意思' => '多不饱和脂肪酸20:3 n-9', '状态' => '新!'],
'Total Sugars' => ['中文意思' => '总糖', '状态' => '新!'],
'SFA 5:0' => ['中文意思' => '饱和脂肪酸5:0戊酸', '状态' => '新!'],
'SFA 7:0' => ['中文意思' => '饱和脂肪酸7:0庚酸', '状态' => '新!'],
'SFA 9:0' => ['中文意思' => '饱和脂肪酸9:0壬酸', '状态' => '新!'],
'SFA 21:0' => ['中文意思' => '饱和脂肪酸21:0二十一酸', '状态' => '新!'],
'SFA 23:0' => ['中文意思' => '饱和脂肪酸23:0二十三酸', '状态' => '新!'],
'MUFA 12:1' => ['中文意思' => '单不饱和脂肪酸12:1十二碳一烯酸', '状态' => '新!'],
'MUFA 14:1 c' => ['中文意思' => '单不饱和脂肪酸14:1 c顺式肉豆蔻油酸', '状态' => '新!'],
'MUFA 17:1 c' => ['中文意思' => '单不饱和脂肪酸17:1 c顺式十七碳一烯酸', '状态' => '新!'],
'TFA 17:1 t' => ['中文意思' => '反式脂肪酸17:1 t反式十七碳一烯酸', '状态' => '新!'],
'MUFA 20:1 c' => ['中文意思' => '单不饱和脂肪酸20:1 c顺式二十碳一烯酸', '状态' => '新!'],
'TFA 20:1 t' => ['中文意思' => '反式脂肪酸20:1 t反式二十碳一烯酸', '状态' => '新!'],
'MUFA 22:1 n-9' => ['中文意思' => '单不饱和脂肪酸22:1 n-9芥酸n-9', '状态' => '新!'],
'MUFA 22:1 n-11' => ['中文意思' => '单不饱和脂肪酸22:1 n-11芥酸n-11', '状态' => '新!'],
'PUFA 18:2 c' => ['中文意思' => '多不饱和脂肪酸18:2 c顺式', '状态' => '新!'],
'TFA 18:2 t' => ['中文意思' => '反式脂肪酸18:2 t', '状态' => '新!'],
'PUFA 18:3 c' => ['中文意思' => '多不饱和脂肪酸18:3 c顺式', '状态' => '新!'],
'TFA 18:3 t' => ['中文意思' => '反式脂肪酸18:3 t', '状态' => '新!'],
'PUFA 20:3 c' => ['中文意思' => '多不饱和脂肪酸20:3 c顺式', '状态' => '新!'],
'PUFA 22:3' => ['中文意思' => '多不饱和脂肪酸22:3二十二碳三烯酸', '状态' => '新!'],
'PUFA 20:4c' => ['中文意思' => '多不饱和脂肪酸20:4 c顺式花生四烯酸', '状态' => '新!'],
'PUFA 20:5c' => ['中文意思' => '多不饱和脂肪酸20:5 c顺式EPA', '状态' => '新!'],
'PUFA 22:5 c' => ['中文意思' => '多不饱和脂肪酸22:5 c顺式DPA', '状态' => '新!'],
'PUFA 22:6 c' => ['中文意思' => '多不饱和脂肪酸22:6 c顺式DHA', '状态' => '新!'],
'PUFA 20:2 c' => ['中文意思' => '多不饱和脂肪酸20:2 c顺式', '状态' => '新!'],
'Proximate' => ['中文意思' => '近似成分', '状态' => '新!'],
'trans-beta-Carotene' => ['中文意思' => '反式-β-胡萝卜素', '状态' => '新!'],
'trans-Lycopene' => ['中文意思' => '反式-番茄红素', '状态' => '新!'],
'Cryptoxanthin, alpha' => ['中文意思' => 'α-隐黄质', '状态' => '新!'],
'Total dietary fiber (AOAC 2011.25)' => ['中文意思' => '总膳食纤维AOAC 2011.25方法)', '状态' => '新!'],
'Insoluble dietary fiber (IDF)' => ['中文意思' => '不溶性膳食纤维', '状态' => '新!'],
'Soluble dietary fiber (SDFP+SDFS)' => ['中文意思' => '可溶性膳食纤维SDFP+SDFS', '状态' => '新!'],
'Soluble dietary fiber (SDFP)' => ['中文意思' => '可溶性膳食纤维SDFP', '状态' => '新!'],
'Soluble dietary fiber (SDFS)' => ['中文意思' => '可溶性膳食纤维SDFS', '状态' => '新!'],
'High Molecular Weight Dietary Fiber (HMWDF)' => ['中文意思' => '高分子量膳食纤维', '状态' => '新!'],
'Carbohydrates' => ['中文意思' => '碳水化合物', '状态' => '新!'],
'Other carotenoids' => ['中文意思' => '其他类胡萝卜素', '状态' => '新!'],
'Tocopherols and tocotrienols' => ['中文意思' => '生育酚和生育三烯酚', '状态' => '新!'],
'Amino acids' => ['中文意思' => '氨基酸', '状态' => '新!'],
'Minerals' => ['中文意思' => '矿物质', '状态' => '新!'],
'Lipids' => ['中文意思' => '脂质', '状态' => '新!'],
'Proximates' => ['中文意思' => '近似成分', '状态' => '新!'],
'Vitamins and Other Components' => ['中文意思' => '维生素及其他成分', '状态' => '新!'],
'Total Tocopherols' => ['中文意思' => '总生育酚', '状态' => '新!'],
'Total Tocotrienols' => ['中文意思' => '总生育三烯酚', '状态' => '新!'],
'Stigmastadiene' => ['中文意思' => '豆甾二烯', '状态' => '新!'],
'Delta-7-Stigmastenol' => ['中文意思' => 'Δ7-豆甾烯醇', '状态' => '新!'],
'Daidzin' => ['中文意思' => '大豆苷', '状态' => '新!'],
'Genistin' => ['中文意思' => '染料木苷', '状态' => '新!'],
'Glycitin' => ['中文意思' => '黄豆黄苷', '状态' => '新!'],
'Ergothioneine' => ['中文意思' => '麦角硫因', '状态' => '新!'],
'Beta-glucan' => ['中文意思' => 'β-葡聚糖', '状态' => '新!'],
'Vitamin D4' => ['中文意思' => '维生素D4', '状态' => '新!'],
'Ergosta-7-enol' => ['中文意思' => '麦角甾-7-烯醇', '状态' => '新!'],
'Ergosta-7,22-dienol' => ['中文意思' => '麦角甾-7,22-二烯醇', '状态' => '新!'],
'Ergosta-5,7-dienol' => ['中文意思' => '麦角甾-5,7-二烯醇', '状态' => '新!'],
'Verbascose' => ['中文意思' => '毛蕊花糖', '状态' => '新!'],
'Oligosaccharides' => ['中文意思' => '低聚糖', '状态' => '新!'],
'Low Molecular Weight Dietary Fiber (LMWDF)' => ['中文意思' => '低分子量膳食纤维', '状态' => '新!'],
'Vitamin E' => ['中文意思' => '维生素E', '状态' => '新!'],
'Vitamin A' => ['中文意思' => '维生素A', '状态' => '新!'],
'Glutathione' => ['中文意思' => '谷胱甘肽', '状态' => '新!'],
];
$cfc = Db::connect('cfc_db');
$result = [];
$shiwu_data= $cfc->table('linshi_usa_data_copy')->where(['id'=>126])->order('id')->find();
// dump($shiwu_data);
// dump(explode(',',$shiwu_data['fdc_id']));
// die;
$result['shiwu_data'] = $shiwu_data;
$yingyang_list = $cfc->table('linshi_usa_yingyang_guanlian')
->alias('a')
->join('linshi_usa_yingyang_list w','a.nutrient_id = w.yuanshi_id','LEFT')
->where("fdc_id in (".$shiwu_data['fdc_id'].")")
->field('a.*,w.name')
->select();
// ->count();
// dump($yingyang_list);
// die;
$yingyang_data = [];
foreach ($yingyang_list as $key => $value) {
if(array_key_exists($value['name'],$yingyang_data)){
$yingyang_data[$value['name']]['value'][] = $value['amount'];
}else{
$yingyang_data[$value['name']]['en'] = $value['name'];
$yingyang_data[$value['name']]['ch'] = $nutritionArray[$value['name']]['中文意思'];
$yingyang_data[$value['name']]['status'] = $nutritionArray[$value['name']]['状态'];
$yingyang_data[$value['name']]['value'] = [$value['amount']];
}
}
$yingyang_data2 = ['default_num'=>0,'default'=>[],'new_num'=>0,'new'=>[]];
foreach ($yingyang_data as $key => $value) {
if($value['status'] == '默认'){
$yingyang_data2['default'][] = $value;
}else{
$yingyang_data2['new'][] = $value;
}
}
$yingyang_data2['default_num'] = count($yingyang_data2['default']);
$yingyang_data2['new_num'] = count($yingyang_data2['new']);
$result['yingyang'] = $yingyang_data2;
return $this->msg($result);
}
public function next_pass_action(){
$data = input();
$cfc = Db::connect('cfc_db');
if($data['id'] == 0){
$result = $cfc->table('app_z_national_standard_food_type_3_multilingual')->where("status is null")->order('id')->find();
return $this->msg($result);
}
$cfc->startTrans();
try{
$cfc->table('app_z_national_standard_food_type_3_multilingual')->where(['id'=>$data['id']])->update([
'status'=>$data['type']
]);
$result = $cfc->table('app_z_national_standard_food_type_3_multilingual')->where("status is null")->order('id')->find();
// 提交事务
$cfc->commit();
return $this->msg($result);
} catch (\Exception $e) {
// 回滚事务
$cfc->rollback();
return $this->msg(10002);
}
}
public function pass_action(){
$data = input();
}
###########################################################################使用API进行处理的###########################################################################
###########################################################################使用API进行处理的###########################################################################
###########################################################################使用API进行处理的###########################################################################
public function new_step1_action(){
$data = input();
$page_size = 3;
// $curl_result = $this->queryUSDAFoodsRaw('Foundation',['pageSize'=>3,'pageNumber'=>1]);
$curl_result = $this->queryUSDAFoodsRaw('Foundation',['pageSize'=>$page_size,'pageNumber'=>$data['page']]);
if($curl_result === false){
return $this->msg(99999);
}
// return $this->msg($curl_result);
// 定义营养成分映射关系
$nutrientMapping = [
'Calorie' => ['Energy (Atwater General Factors)', 'Energy (Atwater Specific Factors)', 'Energy'],
'Protein' => ['Protein'],
'Fat' => ['Total lipid (fat)', 'Total fat (NLEA)'],
'Carbohydrate' => ['Carbohydrate, by difference', 'Carbohydrate, by summation', 'Carbohydrates'],
'VitaminA' => ['Vitamin A, IU', 'Vitamin A, RAE', 'Vitamin A, RE', 'Vitamin A', 'Retinol', 'Vitamin A, RAE'],
'VitaminB1' => ['Thiamin', 'Thiamin, added', 'Thiamin, intrinsic'],
'VitaminB2' => ['Riboflavin', 'Riboflavin, added', 'Riboflavin, intrinsic'],
'VitaminB6' => ['Vitamin B-6', 'Vitamin B-6, pyridoxine, alcohol form', 'Vitamin B-6, pyridoxal, aldehyde form', 'Vitamin B-6, pyridoxamine, amine form', 'Vitamin B-6, N411 + N412 +N413'],
'VitaminB12' => ['Vitamin B-12', 'Vitamin B-12, added', 'Vitamin B-12, intrinsic'],
'VitaminD' => ['Vitamin D (D2 + D3)', 'Vitamin D (D2 + D3), International Units', 'Vitamin D2 (ergocalciferol)', 'Vitamin D3 (cholecalciferol)', '25-hydroxycholecalciferol', '25-hydroxyergocalciferol', 'Vitamin D4'],
'VitaminK' => ['Vitamin K (phylloquinone)', 'Vitamin K (Menaquinone-4)', 'Vitamin K (Dihydrophylloquinone)', 'Vitamin K'],
'Niacin' => ['Niacin', 'Niacin equivalent N406 +N407', 'Niacin from tryptophan, determined', 'Niacin, added', 'Niacin, intrinsic'],
'VitaminC' => ['Vitamin C, total ascorbic acid', 'Vitamin C, reduced ascorbic acid', 'Vitamin C, dehydro ascorbic acid', 'Vitamin C, added', 'Vitamin C, intrinsic', 'Vitamin C'],
'VitaminE' => ['Vitamin E (alpha-tocopherol)', 'Vitamin E (label entry primarily)', 'Tocopherol, beta', 'Tocopherol, gamma', 'Tocopherol, delta', 'Vitamin E, added', 'Vitamin E, intrinsic', 'Vitamin E'],
'FolicAcid' => ['Folic acid', 'Folate, total', 'Folate, free', 'Folate, food', 'Folate, DFE', '5-methyl tetrahydrofolate (5-MTHF)', 'Folate, not 5-MTHF', '10-Formyl folic acid (10HCOFA)', '5-Formyltetrahydrofolic acid (5-HCOH4', 'Tetrahydrofolic acid (THF)'],
'Biotin' => ['Biotin'],
'PantothenicAcid' => ['Pantothenic acid'],
'TotalCholine' => ['Choline, total', 'Choline, free', 'Choline, from phosphocholine', 'Choline, from phosphotidyl choline', 'Choline, from glycerophosphocholine', 'Choline, from sphingomyelin'],
'Ca' => ['Calcium, Ca', 'Calcium, added', 'Calcium, intrinsic'],
'Phosphorus' => ['Phosphorus, P'],
'Kalium' => ['Potassium, K'],
'Mg' => ['Magnesium, Mg'],
'Na' => ['Sodium, Na'],
'Fe' => ['Iron, Fe', 'Iron, heme', 'Iron, non-heme', 'Iron, added', 'Iron, intrinsic'],
'Zn' => ['Zinc, Zn'],
'Se' => ['Selenium, Se'],
'Cu' => ['Copper, Cu'],
'Mn' => ['Manganese, Mn'],
'Iodine' => ['Iodine, I']
];
$v_k = [
// === 维生素 (2) ===
'Vitamin A, IU' => 2,
'Vitamin A, RAE' => 2,
'Vitamin A, RE' => 2,
'Vitamin A' => 2,
'Retinol' => 2,
'Vitamin B-6' => 2,
'Vitamin B-6, pyridoxine, alcohol form' => 2,
'Vitamin B-6, pyridoxal, aldehyde form' => 2,
'Vitamin B-6, pyridoxamine, amine form' => 2,
'Vitamin B-6, N411 + N412 +N413' => 2,
'Vitamin B-12' => 2,
'Vitamin B-12, added' => 2,
'Vitamin B-12, intrinsic' => 2,
'Vitamin C, total ascorbic acid' => 2,
'Vitamin C, reduced ascorbic acid' => 2,
'Vitamin C, dehydro ascorbic acid' => 2,
'Vitamin C, added' => 2,
'Vitamin C, intrinsic' => 2,
'Vitamin C' => 2,
'Vitamin D (D2 + D3)' => 2,
'Vitamin D (D2 + D3), International Units' => 2,
'Vitamin D2 (ergocalciferol)' => 2,
'Vitamin D3 (cholecalciferol)' => 2,
'25-hydroxycholecalciferol' => 2,
'25-hydroxyergocalciferol' => 2,
'Vitamin D4' => 2,
'Vitamin E (alpha-tocopherol)' => 2,
'Vitamin E (label entry primarily)' => 2,
'Tocopherol, beta' => 2,
'Tocopherol, gamma' => 2,
'Tocopherol, delta' => 2,
'Vitamin E, added' => 2,
'Vitamin E, intrinsic' => 2,
'Vitamin E' => 2,
'Vitamin K (phylloquinone)' => 2,
'Vitamin K (Menaquinone-4)' => 2,
'Vitamin K (Dihydrophylloquinone)' => 2,
'Vitamin K' => 2,
'Thiamin' => 2,
'Thiamin, added' => 2,
'Thiamin, intrinsic' => 2,
'Riboflavin' => 2,
'Riboflavin, added' => 2,
'Riboflavin, intrinsic' => 2,
'Niacin' => 2,
'Niacin equivalent N406 +N407' => 2,
'Niacin from tryptophan, determined' => 2,
'Niacin, added' => 2,
'Niacin, intrinsic' => 2,
'Folic acid' => 2,
'Folate, total' => 2,
'Folate, free' => 2,
'Folate, food' => 2,
'Folate, DFE' => 2,
'5-methyl tetrahydrofolate (5-MTHF)' => 2,
'Folate, not 5-MTHF' => 2,
'10-Formyl folic acid (10HCOFA)' => 2,
'5-Formyltetrahydrofolic acid (5-HCOH4' => 2,
'Tetrahydrofolic acid (THF)' => 2,
'Biotin' => 2,
'Pantothenic acid' => 2,
'Choline, total' => 2,
'Choline, free' => 2,
'Choline, from phosphocholine' => 2,
'Choline, from phosphotidyl choline' => 2,
'Choline, from glycerophosphocholine' => 2,
'Choline, from sphingomyelin' => 2,
// === 矿物质 (3) ===
'Calcium, Ca' => 3,
'Calcium, added' => 3,
'Calcium, intrinsic' => 3,
'Phosphorus, P' => 3,
'Potassium, K' => 3,
'Magnesium, Mg' => 3,
'Sodium, Na' => 3,
'Iron, Fe' => 3,
'Iron, heme' => 3,
'Iron, non-heme' => 3,
'Iron, added' => 3,
'Iron, intrinsic' => 3,
'Zinc, Zn' => 3,
'Selenium, Se' => 3,
'Copper, Cu' => 3,
'Manganese, Mn' => 3,
'Iodine, I' => 3,
// 其他矿物质
'Chlorine, Cl' => 3,
'Sulfur, S' => 3,
'Chromium, Cr' => 3,
'Cobalt, Co' => 3,
'Fluoride, F' => 3,
'Molybdenum, Mo' => 3,
'Aluminum, Al' => 3,
'Antimony, Sb' => 3,
'Arsenic, As' => 3,
'Barium, Ba' => 3,
'Beryllium, Be' => 3,
'Boron, B' => 3,
'Bromine, Br' => 3,
'Cadmium, Cd' => 3,
'Gold, Au' => 3,
'Lead, Pb' => 3,
'Lithium, Li' => 3,
'Mercury, Hg' => 3,
'Nickel, Ni' => 3,
'Rubidium, Rb' => 3,
'Silicon, Si' => 3,
'Silver, Ag' => 3,
'Strontium, Sr' => 3,
'Tin, Sn' => 3,
'Titanium, Ti' => 3,
'Vanadium, V' => 3
];
$food_data = [];
$nutrients_data = [];
$nutrients_data2 = [];
$temporary_data1 = [];
$temporary_data2 = [];
// 如果有数据,不是最后一页
if(count($curl_result['foods'])){
$temporary_data1 = [];
$temporary_data2 = [
'Calorie' => [],
'Protein' => [],
'Fat' => [],
'Carbohydrate' => [],
'VitaminA' => [],
'VitaminB1' => [],
'VitaminB2' => [],
'VitaminB6' => [],
'VitaminB12' => [],
'VitaminD' => [],
'VitaminK' => [],
'Niacin' => [],
'VitaminC' => [],
'VitaminE' => [],
'FolicAcid' => [],
'Biotin' => [],
'PantothenicAcid' => [],
'TotalCholine' => [],
'Ca' => [],
'Phosphorus' => [],
'Kalium' => [],
'Mg' => [],
'Na' => [],
'Fe' => [],
'Zn' => [],
'Se' => [],
'Cu' => [],
'Mn' => [],
'Iodine' => []
];
foreach ($curl_result['foods'] as $key => $value) {
// 处理食材数据
$temporary_data1['record_id'] = $value['fdcId'];
$temporary_data1['food_name'] = '';
$temporary_data1['Calorie_name'] = '卡路里';
$temporary_data1['Calorie_unit'] = 'kcal';
$temporary_data1['Calorie_val'] = '/';
$temporary_data1['Protein_name'] = '蛋白质';
$temporary_data1['Protein_unit'] = 'g';
$temporary_data1['Protein_val'] = '/';
$temporary_data1['Fat_name'] = '脂肪';
$temporary_data1['Fat_unit'] = 'g';
$temporary_data1['Fat_val'] = '/';
$temporary_data1['Carbohydrate_name'] = '碳水化合物';
$temporary_data1['Carbohydrate_unit'] = 'g';
$temporary_data1['Carbohydrate_val'] = '/';
$temporary_data1['two_id'] = $value['foodCategory'];
$temporary_data1['weight_unit'] = 'g';
$temporary_data1['data_type'] = $value['dataType'];
$temporary_data1['food_name_en'] = $value['description'];
$food_data[] = $temporary_data1;
// 处理营养成分数据
// 使用映射表处理数据
foreach ($value['foodNutrients'] as $k => $v) {
if(!array_key_exists('value',$v)){
continue;
}else{
$nutrientName = $v['nutrientName'];
foreach ($nutrientMapping as $category => $names) {
if (in_array($nutrientName, $names)) {
$temporary_data2[$category][$nutrientName] = [$v['value'], $v['unitName']];
break; // 找到匹配后跳出内层循环
}
}
}
}
$nutrients_data[$value['fdcId']] = $temporary_data2;
}
// 重新处理数据,最终数据
$temporary_data3 = [];
foreach ($food_data as $key => $value) {
$temporary_data3 = [];
foreach ($nutrients_data[$value['record_id']] as $k => $v) {
if($k == 'Calorie'){
if(count($v) > 0){
if(array_key_exists('Energy (Atwater General Factors)',$v)){
$food_data[$key]['Calorie_val'] = $v['Energy (Atwater General Factors)'][0];
$food_data[$key]['Calorie_unit'] = $v['Energy (Atwater General Factors)'][1];
}else if(array_key_exists('Energy (Atwater Specific Factors)',$v)){
$food_data[$key]['Calorie_val'] = $v['Energy (Atwater Specific Factors)'][0];
$food_data[$key]['Calorie_unit'] = $v['Energy (Atwater Specific Factors)'][1];
}else if(array_key_exists('Energy',$v)){
$food_data[$key]['Calorie_val'] = $v['Energy'][0];
$food_data[$key]['Calorie_unit'] = $v['Energy'][1];
}
$temporary_data3[] = [
'name'=>$k,
'value'=>$food_data[$key]['Calorie_val'],
'unit'=>$food_data[$key]['Calorie_unit'],
'type'=>1,
];
// $temporary_data3['name'] = $k;
// $temporary_data3['value'] = $food_data[$key]['Calorie_val'];
// $temporary_data3['unit'] = $food_data[$key]['Calorie_unit'];
// $temporary_data3['type'] = 1;
}else{
$food_data[$key]['Calorie_val'] = 0;
$food_data[$key]['Calorie_unit'] = 'KCAL';
$temporary_data3[] = [
'name'=>$k,
'value'=>0,
'unit'=>'KCAL',
'type'=>1,
];
}
}else if($k == 'Protein'){
if(count($v) > 0){
$food_data[$key]['Protein_val'] = $v['Protein'][0];
$food_data[$key]['Protein_unit'] = $v['Protein'][1];
$temporary_data3[] = [
'name'=>$k,
'value'=>$v['Protein'][0],
'unit'=>$v['Protein'][1],
'type'=>1,
];
}else{
$food_data[$key]['Protein_val'] = 0;
$food_data[$key]['Protein_unit'] = 'G';
$temporary_data3[] = [
'name'=>$k,
'value'=>0,
'unit'=>'G',
'type'=>1,
];
}
}else if($k == 'Fat'){
if(count($v) > 0){
if(array_key_exists('Total lipid (fat)',$v)){
$food_data[$key]['Fat_val'] = $v['Total lipid (fat)'][0];
$food_data[$key]['Fat_unit'] = $v['Total lipid (fat)'][1];
}else if(array_key_exists('Total fat (NLEA)',$v)){
$food_data[$key]['Fat_val'] = $v['Total fat (NLEA)'][0];
$food_data[$key]['Fat_unit'] = $v['Total fat (NLEA)'][1];
}
$temporary_data3[] = [
'name'=>$k,
'value'=>$food_data[$key]['Fat_val'],
'unit'=>$food_data[$key]['Fat_unit'],
'type'=>1,
];
}else{
$food_data[$key]['Fat_val'] = 0;
$food_data[$key]['Fat_unit'] = 'G';
$temporary_data3[] = [
'name'=>$k,
'value'=>0,
'unit'=>'G',
'type'=>1,
];
}
}else if($k == 'Carbohydrate'){
if(count($v) > 0){
if(array_key_exists('Carbohydrate, by difference',$v)){
$food_data[$key]['Carbohydrate_val'] = $v['Carbohydrate, by difference'][0];
$food_data[$key]['Carbohydrate_unit'] = $v['Carbohydrate, by difference'][1];
}else if(array_key_exists('Carbohydrate, by summation',$v)){
$food_data[$key]['Carbohydrate_val'] = $v['Carbohydrate, by summation'][0];
$food_data[$key]['Carbohydrate_unit'] = $v['Carbohydrate, by summation'][1];
}else if(array_key_exists('Carbohydrates',$v)){
$food_data[$key]['Carbohydrate_val'] = $v['Carbohydrates'][0];
$food_data[$key]['Carbohydrate_unit'] = $v['Carbohydrates'][1];
}
$temporary_data3[] = [
'name'=>$k,
'value'=>$food_data[$key]['Carbohydrate_val'],
'unit'=>$food_data[$key]['Carbohydrate_unit'],
'type'=>1,
];
}else{
$food_data[$key]['Carbohydrate_val'] = 0;
$food_data[$key]['Carbohydrate_unit'] = 'G';
$temporary_data3[] = [
'name'=>$k,
'value'=>0,
'unit'=>'G',
'type'=>1,
];
}
}else{
if(count($v) > 0){
foreach ($v as $kk => $vv) {
if($vv[0] != 0){
$temporary_data3[] = [
'name'=>$kk,
'value'=>$vv[0],
'unit'=>$vv[1],
'type'=>array_key_exists($kk,$v_k)?$v_k[$kk]:0,
];
}
}
}
}
}
$nutrients_data2[$value['record_id']] = $temporary_data3;
}
// return $this->msg(['food'=>$food_data,'yingyang'=>$nutrients_data2]);
// 开始插入数据库
$cfc = Db::connect('cfc_db');
$linshi_chalou = false;
$chongfu_chalou = 0;
$chongfu_chalou_arr = [];
$success_num = [];
// 过滤重复数据
foreach ($food_data as $key => $value) {
$congfu_num = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')
->where(['food_name_en' => $value['food_name_en']])
->find();
if ($congfu_num) {
unset($food_data[$key]);
$chongfu_chalou++;
}
}
// 如果没有需要插入的数据,直接返回
if (empty($food_data)) {
return $this->msg([
'now_page' => $data['page'],
'total_num' => $page_size,
'fail_num' => 0,
'chongfu_num' => $chongfu_chalou,
'success_num' => 0,
]);
}
// 启动事务
$cfc->startTrans();
try{
foreach ($food_data as $key => $value) {
$new_id = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->insertGetId($value);
foreach ($nutrients_data2[$value['record_id']] as $k => $v) {
$nutrients_data2[$value['record_id']][$k]['father_id'] = $new_id;
}
$cfc->table('app_z_national_standard_food_type_4_multilingual_copy1')->insertAll($nutrients_data2[$value['record_id']]);
$success_num[] = $value['food_name_en'];
}
// 提交事务
$cfc->commit();
} catch (\Exception $e) {
// 回滚事务
$cfc->rollback();
$error_message = $e->getMessage();
$linshi_chalou = true;
}
if($linshi_chalou == true){
foreach ($food_data as $key => $value) {
$chongfu_chalou_arr[] = ['name'=>$value['food_name_en']];
}
$cfc->table('linshi_z_chalou')->insertAll($chongfu_chalou_arr);
}
return $this->msg([
'now_page' => $data['page'],
'total_num' => $page_size,
'fail_num' => count($chongfu_chalou_arr),
'chongfu_num' => $chongfu_chalou,
'success_num' => count($success_num),
]);
}else{
return $this->msg(10006);
}
}
public function new_step2_action(){
$foodCategories = [
'Dairy and Egg Products' => 1,
'Spices and Herbs' => 2,
'Baby Foods' => 3,
'Fats and Oils' => 4,
'Poultry Products' => 5,
'Soups, Sauces, and Gravies' => 6,
'Sausages and Luncheon Meats' => 7,
'Breakfast Cereals' => 8,
'Fruits and Fruit Juices' => 9,
'Pork Products' => 10,
'Vegetables and Vegetable Products' => 11,
'Nut and Seed Products' => 12,
'Beef Products' => 13,
'Beverages' => 14,
'Finfish and Shellfish Products' => 15,
'Legumes and Legume Products' => 16,
'Lamb, Veal, and Game Products' => 17,
'Baked Products' => 18,
'Sweets' => 19,
'Cereal Grains and Pasta' => 20,
'Fast Foods' => 21,
'Meals, Entrees, and Side Dishes' => 22,
'Snacks' => 23,
'American Indian/Alaska Native Foods' => 24,
'Restaurant Foods' => 25,
'Branded Food Products Database' => 26,
'Quality Control Materials' => 27,
'Alcoholic Beverages' => 28
];
$cfc = Db::connect('cfc_db');
$congfu_num = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')
->where("status is null")
->order('id')
->find();
if(!$congfu_num){
return $this->msg(11006,'没了');
}
if(array_key_exists($congfu_num['two_id'],$foodCategories)){
$result = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->where(['id'=>$congfu_num['id']])->update(['two_id'=>$foodCategories[$congfu_num['two_id']],'status'=>'ok']);
}else{
$result = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->where(['id'=>$congfu_num['id']])->update(['two_id'=>$foodCategories[$congfu_num['two_id']],'status'=>'nothing']);
}
if($result){
return $this->msg([]);
}else{
return $this->msg(10002);
}
}
public function new_step3_action(){
$foodCategories = [
'Dairy and Egg Products' => 1,
'Spices and Herbs' => 2,
'Baby Foods' => 3,
'Fats and Oils' => 4,
'Poultry Products' => 5,
'Soups, Sauces, and Gravies' => 6,
'Sausages and Luncheon Meats' => 7,
'Breakfast Cereals' => 8,
'Fruits and Fruit Juices' => 9,
'Pork Products' => 10,
'Vegetables and Vegetable Products' => 11,
'Nut and Seed Products' => 12,
'Beef Products' => 13,
'Beverages' => 14,
'Finfish and Shellfish Products' => 15,
'Legumes and Legume Products' => 16,
'Lamb, Veal, and Game Products' => 17,
'Baked Products' => 18,
'Sweets' => 19,
'Cereal Grains and Pasta' => 20,
'Fast Foods' => 21,
'Meals, Entrees, and Side Dishes' => 22,
'Snacks' => 23,
'American Indian/Alaska Native Foods' => 24,
'Restaurant Foods' => 25,
'Branded Food Products Database' => 26,
'Quality Control Materials' => 27,
'Alcoholic Beverages' => 28
];
$cfc = Db::connect('cfc_db');
$congfu_num = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')
->where("Calorie_unit = 'kJ'")
->order('id')
->find();
if(!$congfu_num){
return $this->msg(11006,'没了');
}
// 加 bcadd(,,20)
// 减 bcsub(,,20)
// 乘 bcmul(,,20)
// 除 bcdiv(,,20)
$kcal_val = bcdiv($congfu_num['Calorie_val'],4.184,2);
$result = $cfc->table('app_z_national_standard_food_type_3_multilingual_copy1')->where(['id'=>$congfu_num['id']])->update(['Calorie_unit'=>'KCAL','Calorie_val'=>$kcal_val]);
if($result){
return $this->msg([]);
}else{
return $this->msg(10002);
}
}
/**
* 查询美国农业部食品数据库
* 支持按数据类型查询食材及其营养成分
*
* @param string $dataType 数据类型:'Foundation', 'SR Legacy', 'Survey (FNDDS)', 'Branded'
* @param array $params 查询参数
* - query: 搜索关键词(可选)
* - pageSize: 每页数量默认10
* - pageNumber: 页码默认1
* - includeNutrients: 是否包含营养成分默认true
* - nutrientIds: 指定营养成分ID数组可选
* - sortBy: 排序字段,默认'relevance'
* - sortOrder: 排序顺序,默认'desc'
* @return array 返回API数据
*/
public function queryUSDAFoodsRaw($dataType, $params = []) {
$apiKey = '4HgkqLdr0tXrufKZpgA5TB2KTcDmFuzrfFl9t0YW';
$url = "https://api.nal.usda.gov/fdc/v1/foods/search?api_key={$apiKey}";
$requestBody = [
'dataType' => [$dataType],
'pageSize' => $params['pageSize'] ?? 10,
'pageNumber' => $params['pageNumber'] ?? 1
];
if (!empty($params['query'])) {
$requestBody['query'] = $params['query'];
}
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($requestBody),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
]);
$response = curl_exec($ch);
curl_close($ch);
return $response ? json_decode($response, true) : false;
}
###################################################################################################################
###################################################################################################################
###################################################################################################################
public function ceshiyong(){
}
public function msg($data,$str='',$result = []){
if(is_array($data)){
if($str != ''){
return json(['code'=>0,'msg'=>$str,'data'=>$data]);
}else{
return json(['code'=>0,'msg'=>'操作成功','data'=>$data]);
}
}else{
if($str != ''){
return json(['code'=>$data,'msg'=>$str,'data'=>$result]);
}
return json(['code'=>$data,'msg'=>$this->return_data_all[$data],'data'=>$result]);
}
}
// 使用纯BC函数的版本最精确
public function processPrecisionNumberBC($numberStr) {
// 1. 去除数字末尾的0
$processed = rtrim($numberStr, '0');
if ($processed === '' || $processed === '.') {
return '0';
}
$processed = rtrim($processed, '.');
// 2. 判断小数点后的位数
$dotPosition = strpos($processed, '.');
if ($dotPosition === false) {
return $processed;
}
$decimalLength = strlen($processed) - $dotPosition - 1;
// 3. 如果小数点长度不超过5位直接返回
if ($decimalLength <= 5) {
return $processed;
}
// 4. 使用BC函数处理
$decimalPart = substr($processed, $dotPosition + 1);
// 找到第一个非零字符的位置
$firstNonZeroPos = -1;
for ($i = 0; $i < strlen($decimalPart); $i++) {
if ($decimalPart[$i] !== '0') {
$firstNonZeroPos = $i;
break;
}
}
if ($firstNonZeroPos === -1) {
return $processed;
}
// 计算需要保留的小数位数
$keepDecimalPlaces = $firstNonZeroPos + 1;
// 使用BC函数进行截断
$number = $processed;
$multiplier = bcpow('10', $keepDecimalPlaces);
// 方法:乘以倍数,取整数部分(截断),再除以倍数
$scaled = bcmul($number, $multiplier, 20);
// 取整数部分(直接截断小数部分)
$integerPart = bcdiv($scaled, '1', 0);
// 得到截断后的结果
$result = bcdiv($integerPart, $multiplier, $keepDecimalPlaces);
// 去除末尾0
$result = rtrim($result, '0');
if (substr($result, -1) === '.') {
$result = rtrim($result, '.');
}
return $result === '' ? '0' : $result;
}
}