xkrs_ms/stdiet-ui/src/utils/healthyData.js
2021-06-27 23:45:08 +08:00

1105 lines
39 KiB
JavaScript
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.

export const titleArray = [
"基础信息",
"减脂经历评估",
"食品安全评估",
"饮食结构评估",
"生活习惯评估",
"运动习惯评估",
"睡眠质量评估",
"既往病史/用药史评估",
"体检报告"
];
export const titleNumArray = [
"一、",
"二、",
"三、",
"四、",
"五、",
"六、",
"七、",
"八、",
"九、",
"十、",
"十一、",
"十二、",
"十三、"
];
export const condimentArray = [
{ name: "鸡精", value: "1" },
{ name: "耗油", value: "2" },
{ name: "生抽", value: "3" },
{ name: "老抽", value: "4" },
{ name: "香油", value: "5" },
{ name: "浓汤宝", value: "6" },
{ name: "鸡粉", value: "7" },
{ name: "花椒", value: "8" },
{ name: "辣椒油", value: "9" },
{ name: "黄酒", value: "10" },
{ name: "料酒", value: "11" }
];
export const cookingStyleArray = [
{ name: "煎", value: "1" },
{ name: "烤", value: "2" },
{ name: "炸", value: "3" },
{ name: "卤", value: "4" },
{ name: "腌", value: "5" },
{ name: "腊", value: "6" },
{ name: "煲", value: "7" },
{ name: "炒", value: "8" },
{ name: "蒸", value: "9" },
{ name: "刺身", value: "10" },
{ name: "水煮", value: "11" }
];
export const washVegetablesStyleArray = [
{ name: "先切后洗", value: "1" },
{ name: "先洗后切", value: "2" },
{ name: "切后浸泡", value: "3" }
];
export const breakfastTypeArray = [
{ name: "不吃", value: "1" },
{ name: "偶尔吃", value: "2" },
{ name: "每天吃", value: "3" }
];
export const lunchTypeArray = [
{ name: "外卖", value: "1" },
{ name: "自带餐", value: "2" },
{ name: "快餐", value: "3" },
{ name: "餐厅", value: "4" }
];
export const dinnerArray = [
{ name: "餐馆吃", value: "1" },
{ name: "在家吃", value: "2" },
{ name: "丰盛", value: "3" },
{ name: "清淡", value: "4" }
];
export const dietHotAndColdArray = [
{ name: "偏冷食", value: "1" },
{ name: "偏热食", value: "2" },
{ name: "正常", value: "3" }
];
export const dietFlavorArray = [
{ name: "偏油", value: "1" },
{ name: "偏咸", value: "2" },
{ name: "偏辣", value: "3" },
{ name: "偏甜", value: "4" },
{ name: "偏酸", value: "5" },
{ name: "清淡", value: "6" }
];
export const vegetablesRateTypeArray = [
{ name: "每天吃", value: "1" },
{ name: "经常吃", value: "2" },
{ name: "偶尔吃", value: "3" },
{ name: "从不吃", value: "4" }
];
export const fruitsTimeArray = [
{ name: "餐前", value: "1" },
{ name: "餐后", value: "2" },
{ name: "餐间", value: "3" }
];
export const fruitsRateArray = [
{ name: "每天吃", value: "1" },
{ name: "经常吃", value: "2" },
{ name: "偶尔吃", value: "3" },
{ name: "从不吃", value: "4" }
];
export const eatFruitsArray = [
{ name: "梨", value: "梨" },
{ name: "苹果", value: "苹果" },
{ name: "香蕉", value: "香蕉" },
{ name: "榴莲", value: "榴莲" },
{ name: "橙子", value: "橙子" },
{ name: "西瓜", value: "西瓜" },
{ name: "桃子", value: "桃子" },
{ name: "葡萄", value: "葡萄" },
{ name: "李子", value: "李子" },
{ name: "哈密瓜", value: "哈密瓜"},
{ name: "香瓜", value: "香瓜" },
{ name: "荔枝", value: "荔枝" },
{ name: "杨梅", value: "杨梅" },
{ name: "菠萝", value: "菠萝" },
{ name: "草莓", value: "草莓" },
{ name: "龙眼", value: "龙眼" },
];
export const eatingSpeedArray = [
{ name: "很快", value: "1" },
{ name: "偏快", value: "2" },
{ name: "正常", value: "3" },
{ name: "偏慢", value: "4" },
{ name: "很慢", value: "5" }
];
export const snacksArray = [
{ name: "面包", value: "1" },
{ name: "蛋糕", value: "2" },
{ name: "饼干", value: "3" },
{ name: "冰淇淋", value: "4" },
{ name: "糖果", value: "5" },
{ name: "巧克力", value: "6" },
{ name: "方便面", value: "7" },
{ name: "薯条", value: "8" },
{ name: "肉干", value: "9" },
{ name: "坚果", value: "10" },
{ name: "饮料", value: "11" },
{ name: "果脯", value: "12" },
{ name: "牛奶", value: "13" }
];
export const waterTypeArray = [
{ name: "冰水", value: "1" },
{ name: "温水", value: "2" },
{ name: "常温水", value: "3" }
];
export const waterHabitArray = [
{ name: "均匀地喝", value: "1" },
{ name: "餐前多喝", value: "2" },
{ name: "餐后多喝", value: "3" },
{ name: "餐间多喝", value: "4" },
{ name: "随时喝", value: "5" }
];
export const drinkWineFlagArray = [
{ name: "经常饮酒", value: "1" },
{ name: "不饮酒", value: "2" },
{ name: "偶尔", value: "3" }
];
export const drinkWineClassifyArray = [
{ name: "白酒", value: "1" },
{ name: "红酒", value: "2" },
{ name: "啤酒", value: "3" }
];
export const workTypeArray = [
{ name: "工作时间长", value: "1" },
{ name: "久坐", value: "2" },
{ name: "久站", value: "3" },
{ name: "走动多", value: "4" },
{ name: "强度大", value: "5" },
{ name: "用电脑多", value: "6" },
{ name: "体力工作多", value: "7" }
];
export const defecationTimeArray = [
{ name: "上午", value: "1" },
{ name: "中午", value: "2" },
{ name: "晚上", value: "3" }
];
export const aerobicMotionClassifyArray = [
{ name: "跳绳", value: "1" },
{ name: "跑步", value: "2" },
{ name: "游泳", value: "3" }
];
export const anaerobicMotionClassifyArray = [
{ name: "撸铁", value: "1" },
{ name: "俯卧撑", value: "2" }
];
export const anaerobicAerobicMotionClassifyArray = [
{ name: "拳击", value: "1" },
{ name: "瑜伽", value: "2" }
];
export const motionFieldArray = [
{ name: "居家", value: "1" },
{ name: "健身房", value: "2" },
{ name: "户外", value: "3" },
{ name: "瑜伽馆", value: "4" }
];
export const sleepQualityArray = [
{ name: "好", value: "1" },
{ name: "一般", value: "2" },
{ name: "入睡难", value: "3" },
{ name: "失眠", value: "4" },
{ name: "易醒", value: "5" },
{ name: "多梦", value: "6" }
];
export const familyIllnessHistoryArray = [
{ name: "高血压病", value: "1" },
{ name: "脑卒中", value: "2" },
{ name: "冠心病", value: "3" },
{ name: "外周血管病", value: "4" },
{ name: "心力衰竭", value: "5" },
{ name: "糖尿病", value: "6" },
{ name: "肥胖症", value: "7" },
{ name: "慢性肾脏疾病", value: "8" },
{ name: "骨质疏松", value: "9" },
{ name: "痛风", value: "10" },
{ name: "精神疾病", value: "11" },
{ name: "恶性肿瘤", value: "12" },
{ name: "慢性阻塞性肺病", value: "13" },
{ name: "风湿性免疫性疾病", value: "14" }
];
export const operationHistoryArray = [
{ name: "头颅(含脑)", value: "1" },
{ name: "眼", value: "2" },
{ name: "耳鼻咽喉", value: "3" },
{ name: "颌面部及口腔", value: "4" },
{ name: "颈部或甲状腺", value: "5" },
{ name: "胸部(含肺部)", value: "6" },
{ name: "心脏(含心脏介入)", value: "7" },
{ name: "外周血管", value: "8" },
{ name: "胃肠", value: "9" },
{ name: "肝胆", value: "10" },
{ name: "肾脏", value: "11" },
{ name: "脊柱", value: "12" },
{ name: "四肢及关节", value: "13" },
{ name: "前列腺", value: "14" },
{ name: "妇科", value: "15" },
{ name: "乳腺", value: "16" },
{ name: "膀胱", value: "17" }
];
export const longEatDrugClassifyArray = [
{ name: "降压药", value: "1" },
{ name: "降糖药", value: "2" },
{ name: "降尿酸药", value: "3" },
{ name: "抗心律失常药", value: "4" },
{ name: "缓解哮喘药物", value: "5" },
{ name: "抗压郁药物", value: "6" },
{ name: "雌激素类药物", value: "7" },
{ name: "利尿剂", value: "8" },
{ name: "中草药", value: "9" },
{ name: "避孕药", value: "10" },
{ name: "强的松类药物", value: "11" },
{ name: "镇静剂或安眠药", value: "12" },
{ name: "调值药(降脂药)", value: "13" },
{ name: "解热镇痛药(如布洛芬等)", value: "14" }
];
export const allergenArray = [
{ name: "青霉素", value: "1" },
{ name: "磺胺类", value: "2" },
{ name: "链霉素", value: "3" },
{ name: "头孢类", value: "4" },
{ name: "鸡蛋", value: "5" },
{ name: "牛奶", value: "6" },
{ name: "海鲜", value: "7" },
{ name: "花粉或尘螨", value: "8" },
{ name: "粉尘", value: "9" },
{ name: "洗洁剂", value: "10" },
{ name: "化妆品", value: "11" }
];
export const makeFoodTypeArray = [
{ name: "居家做饭", value: "1" },
{ name: "外卖食堂", value: "2" },
{ name: "居家和外食", value: "3" },
{ name: "国外饮食", value: "4" },
{ name: "运动饮食", value: "5" }
];
export const yesNoDict = { 0: "否", 1: "是" };
export const sexDict = { 0: "男", 1: "女" };
export const positionDict = { 0: "南方", 1: "北方" };
export const makeFoodTypeDict = { 0: "自己做", 1: "外面吃" };
export const makeFoodTasteDict = { 0: "清淡", 1: "重口味" };
export const walkDict = { 0: "久坐多", 1: "走动多" };
export const cookingStyleRateArray = ["煎", "炸", "卤", "腌", "腊", "煲"];
export const cookingStyleRateUnitArray = cookingStyleRateArray.map(() => "次");
export const drinksNumArray = [
"老火汤",
"咖啡",
"浓茶",
"奶茶",
"冷饮",
"碳酸饮料",
"甜饮料",
"鲜榨果汁"
];
export const drinksNumUnitArray = drinksNumArray.map(() => "次");
export const drinkWineAmountArray = ["白酒", "啤酒", "红酒"];
export const drinkWineAmountUnitArray = ["两", "瓶", "毫升"];
export const smokeRateArray = ["每天抽烟", "烟龄", "已戒烟"];
export const smokeRateUnitArray = ["次", "年", "年"];
//并发症
export const syndromeNameArray = [
{ name: "腰痛", value: "1" },
{ name: "四肢酸痛", value: "2" },
{ name: "手足蚁感", value: "3" },
{ name: "麻木", value: "4" },
{ name: "皮肤瘙痒", value: "5" },
{ name: "性欲减退", value: "6" },
{ name: "男性勃起功能障碍", value: "7" },
{ name: "视力下降", value: "8" }
];
//月经颜色
export const menstrualColorArray = [
{ name: "鲜红色", value: "1" },
{ name: "褐色", value: "2" },
{ name: "暗黑色", value: "3" }
];
//月经形状
export const menstrualCharacterArray = [
{ name: "带血块", value: "1" },
{ name: "豆腐渣", value: "2" },
{ name: "正常", value: "3" }
];
//痛经形状
export const menstrualNatureArray = [
{ name: "无", value: "0" },
{ name: "生理性(原发性)", value: "1" },
{ name: "病理性(继发性,如子宫内膜炎)", value: "2" }
];
//痛经类型
export const menstrualTypeArray = [
{ name: "无", value: "0" },
{ name: "气滞血瘀型", value: "1" },
{ name: "寒湿凝滞型", value: "2" },
{ name: "气血两虚型", value: "3" },
{ name: "湿热瘀结型", value: "4" }
];
//痛经类型特点说明
export const menstrualTypeIntroduceArray = [
{ name: "气滞血瘀型", value: "经血排出不顺畅、颜色深有血块,血块排出后疼痛就减少" },
{ name: "寒湿凝滞型", value: "小腹冷痛、热敷或者喝热汤后有缓解,怕冷手脚冰凉,经量少,颜色深有血块,便溏" },
{ name: "气血两虚型", value: "小腹隐痛、月经稀少、颜色淡、脸色黄白没力气,吃不下还便溏" },
{ name: "湿热瘀结型", value: "湿热瘀结型,特点是经期疼痛、经血深红粘稠,腰部胀痛,或者有低热,小便黄,便秘" }
];
//需要将数组转成字符串的属性名称,包含对象数组、字符串数组
export const arrayName = [
"condiment",
"cookingStyle",
"cookingStyleRate",
"washVegetablesStyle",
"lunchType",
"dinner",
"dietFlavor",
"snacks",
"waterType",
"waterHabit",
"drinksNum",
"drinkWineClassify",
"drinkWineAmount",
"smokeRate",
"workType",
"defecationTime",
"aerobicMotionClassify",
"anaerobicMotionClassify",
"anaerobicAerobicMotionClassify",
"motionField",
"sleepQuality",
"physicalSignsId",
"moistureDate",
"bloodData",
"familyIllnessHistory",
"operationHistory",
"longEatDrugClassify",
"allergen",
"medicalReport",
"medicalReportName"
];
//需要将数字下标转成中文含义的属性名
export const needAttrName = [
"condiment",
"cookingStyle",
"washVegetablesStyle",
"breakfastType",
"lunchType",
"dinner",
"dietFlavor",
"vegetablesRateType",
"dietHotAndCold",
"fruitsTime",
"fruitsRate",
"eatingSpeed",
"snacks",
"waterType",
"waterHabit",
"drinkWineFlag",
"drinkWineClassify",
"workType",
"defecationTime",
"aerobicMotionClassify",
"anaerobicMotionClassify",
"anaerobicAerobicMotionClassify",
"motionField",
"sleepQuality",
"familyIllnessHistory",
"operationHistory",
"longEatDrugClassify",
"allergen"
];
export const needCombineName = [
"cookingStyleRate",
"drinksNum",
"drinkWineAmount",
"smokeRate"
];
export const yesNoName = [
"constipation",
"staylate",
"motion",
"night",
"weakness",
"rebound",
"crux",
"stayupLateFlag",
"nearOperationFlag",
"longEatDrugFlag",
"allergyFlag",
"smokeFlag",
"secondSmoke",
"sleepDrugFlag"
];
export const dictName = [
"sex",
"position",
"makeFoodType",
"makeFoodTaste",
"walk"
];
export const newLineName = ["bloodData", "moistureDate"];
export const bloodDataArray = [
{ value: "1", name: "1.体质虚弱,免疫力差" },
{ value: "2", name: "2.畏寒肢冷,自汗,头晕耳鸣" },
{ value: "3", name: "3.心悸气短,神疲乏力,气短懒言" },
{ value: "4", name: "4.失眠多梦,健忘,精神恍惚" },
{ value: "5", name: "5.面色淡白或萎黄,皮肤干燥,毛发枯萎" },
{ value: "6", name: "6.女性月经量少,延期或闭经" },
{ value: "7", name: "7.唇甲色淡,舌淡脉虚" }
];
export const moistureDateArray = [
{ value: "1", name: "1.头发爱出油,头一天刚洗头第二天就油油的" },
{ value: "2", name: "2.面部油亮" },
{ value: "3", name: "3.睡觉流口水" },
{ value: "4", name: "4.排便粘稠且多便" },
{ value: "5", name: "5.小肚子大" },
{ value: "6", name: "6.耳内湿" },
{ value: "7", name: "7.头重脚轻" },
{ value: "8", name: "8.头晕没精神,特别疲劳" },
{ value: "9", name: "9.经常感觉很累很困,怎么都睡不够" }
];
const moduleObj = {
condimentArray,
cookingStyleArray,
washVegetablesStyleArray,
breakfastTypeArray,
lunchTypeArray,
dinnerArray,
dietHotAndColdArray,
dietFlavorArray,
vegetablesRateTypeArray,
fruitsTimeArray,
fruitsRateArray,
eatingSpeedArray,
snacksArray,
waterTypeArray,
waterHabitArray,
drinkWineFlagArray,
drinkWineClassifyArray,
workTypeArray,
defecationTimeArray,
aerobicMotionClassifyArray,
anaerobicMotionClassifyArray,
anaerobicAerobicMotionClassifyArray,
motionFieldArray,
sleepQualityArray,
familyIllnessHistoryArray,
operationHistoryArray,
longEatDrugClassifyArray,
allergenArray,
makeFoodTypeArray,
//
cookingStyleRateArray,
cookingStyleRateUnitArray,
drinksNumArray,
drinksNumUnitArray,
drinkWineAmountArray,
drinkWineAmountUnitArray,
smokeRateArray,
smokeRateUnitArray,
//
yesNoDict,
sexDict,
positionDict,
makeFoodTypeDict,
makeFoodTasteDict,
walkDict,
//
bloodDataArray,
moistureDateArray
};
//healthyExtend扩展信息中需要将对象转为json字符串或字符串转json的字段
export const needJSONFieldName = [
"eatFruitsMessage",
"longEatDrugMessage",
"bloodSugarMessage",
"bloodPressureMessage",
"anxietyStateMessage",
"depressedStateMessage",
"menstruationMessage"
];
//健康信息处理,将数组转为字符串
export function dealHealthy(customerHealthy) {
customerHealthy.bmi = (
customerHealthy.weight /
2 /
(customerHealthy.tall / 100) /
(customerHealthy.tall / 100)
).toFixed(1);
customerHealthy.basicBMR = (
(10 * customerHealthy.weight) / 2 +
6.25 * customerHealthy.tall -
5 * customerHealthy.age -
customerHealthy.sex * 161
).toFixed(1);
customerHealthy.notSportHeat = (customerHealthy.basicBMR * 1.3).toFixed(1);
customerHealthy.basicBMR += "千卡";
customerHealthy.notSportHeat += "千卡";
const lowRecProtein = customerHealthy.tall - 105;
customerHealthy.recProtein = `${(lowRecProtein * 0.8).toFixed(1)} - ${(
lowRecProtein * 1.5
).toFixed(1)}`;
needAttrName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = (String(customerHealthy[name]) || "")
.split(",")
.map(val => {
const tarObj = moduleObj[`${name}Array`].find(
obj => obj.value === val
);
if (tarObj) {
return tarObj.name;
}
return "";
})
.join("");
}
});
needCombineName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = (String(customerHealthy[name]) || "")
.split(",")
.map((val, idx) => {
return `${moduleObj[`${name}Array`][idx]}${val}${
moduleObj[`${name}UnitArray`][idx]
}`;
})
.join("");
}
});
newLineName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = (String(customerHealthy[name]) || "")
.split(",")
.map(val => {
const tarObj = moduleObj[`${name}Array`].find(
obj => obj.value === val
);
if (tarObj) {
return tarObj.name;
}
return "";
})
.join("</br>");
}
});
yesNoName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = yesNoDict[customerHealthy[name]];
}
});
dictName.forEach(name => {
if (customerHealthy.hasOwnProperty(name)) {
customerHealthy[name] = moduleObj[`${name}Dict`][customerHealthy[name]];
}
});
if (customerHealthy.hasOwnProperty("physicalSignsId")) {
const signs = customerHealthy.otherPhysicalSigns
? [customerHealthy.otherPhysicalSigns]
: [];
(customerHealthy.signList || []).forEach(obj => {
signs.push(obj.name);
});
customerHealthy.physicalSigns = signs.join(",");
}
if (customerHealthy.hasOwnProperty("otherLongEatDrugClassify")) {
customerHealthy.longEatDrugClassify += customerHealthy.otherLongEatDrugClassify
? `${customerHealthy.otherLongEatDrugClassify}`
: "";
}
if (customerHealthy.hasOwnProperty("washVegetablesStyle")) {
customerHealthy.washVegetablesStyle += customerHealthy.otherWashVegetablesStyle
? `${customerHealthy.otherWashVegetablesStyle}`
: "";
}
if (customerHealthy.hasOwnProperty("snacks")) {
customerHealthy.snacks += customerHealthy.otherSnacks
? `${customerHealthy.otherSnacks}`
: "";
}
if (customerHealthy.hasOwnProperty("healthProductsWeekRate")) {
customerHealthy.healthProductsWeekRate =
customerHealthy.healthProductsDayRate +
"次/天," +
customerHealthy.healthProductsWeekRate +
"次/周";
}
if (customerHealthy.hasOwnProperty("drinkWineClassify")) {
customerHealthy.drinkWineClassify += customerHealthy.otherWineClassify
? `${customerHealthy.otherWineClassify}`
: "";
}
if (customerHealthy.hasOwnProperty("otherMotionClassify")) {
let motionStr = customerHealthy.aerobicMotionClassify
? `${customerHealthy.aerobicMotionClassify}`
: "";
motionStr += customerHealthy.anaerobicMotionClassify
? `${customerHealthy.anaerobicMotionClassify}`
: "";
motionStr += customerHealthy.anaerobicAerobicMotionClassify
? `${customerHealthy.anaerobicAerobicMotionClassify}`
: "";
motionStr += customerHealthy.otherMotionClassify
? `${customerHealthy.otherMotionClassify}`
: "";
customerHealthy.motion = motionStr;
}
if (customerHealthy.hasOwnProperty("motionField")) {
customerHealthy.motionField += customerHealthy.otherMotionField
? `${customerHealthy.otherMotionField}`
: "";
}
if (customerHealthy.hasOwnProperty("otherOperationHistory")) {
customerHealthy.operationHistory += customerHealthy.otherOperationHistory
? `${customerHealthy.otherOperationHistory}`
: "";
}
if (customerHealthy.hasOwnProperty("medicalReport")) {
const urls = customerHealthy.medicalReport.split(",");
customerHealthy.medicalReport_one = urls[0];
customerHealthy.medicalReport_two = urls[1];
customerHealthy.medicalReport_three = urls[2];
}
if (customerHealthy.hasOwnProperty("defecationNum")) {
customerHealthy.defecationNum += "次/天";
}
if (customerHealthy.hasOwnProperty("motionDuration")) {
customerHealthy.motionDuration += "分钟";
}
if (customerHealthy.hasOwnProperty("tall")) {
customerHealthy.tall += "cm";
}
if (customerHealthy.hasOwnProperty("weight")) {
customerHealthy.weight += "斤";
}
if (customerHealthy.hasOwnProperty("vegetableRate")) {
customerHealthy.vegetableRate += "成";
}
if (customerHealthy.hasOwnProperty("stayupLateWeekNum")) {
customerHealthy.stayupLateWeekNum += "次/周";
}
if (customerHealthy.hasOwnProperty("riceFull")) {
customerHealthy.riceFull += "成";
}
if (customerHealthy.hasOwnProperty("connectTime")) {
customerHealthy.connectTime += "点";
}
if (customerHealthy.hasOwnProperty("sleepTime")) {
customerHealthy.sleepTime += "点";
}
if (customerHealthy.hasOwnProperty("getupTime")) {
customerHealthy.getupTime += "点";
}
if (customerHealthy.hasOwnProperty("signList")) {
customerHealthy.signStr = (customerHealthy.signList || [])
.map(obj => obj.name)
.join("");
}
return customerHealthy;
}
export const extendHealthyTitle = {"0":"减脂","5":"降血压","6":"降血糖","3": "备孕营养", "1": "月经不调", "2": "多囊调理", "11":"心脑血管调理"};
export const projectName = {"0":"减脂","5":"高血压","6":"高血糖","3": "备孕营养", "1":"月经不调", "2":"多囊卵巢综合症"};
//需要填写慢病调查问卷的项目
export const extendHealthyIndex = [5, 6, 1, 2];
//跳过减脂经历问卷的项目
export const notExperienceIndex = [3,1,2];
export function getTitleKey(projectId){
return extendHealthyTitle[projectId+""] != null ? extendHealthyTitle[projectId+""] : extendHealthyTitle["0"];
}
export function getTitle(projectId, index , flag){
if(extendHealthyIndex.includes(projectId)){
//跳过了减脂经历
if(notExperienceIndex.includes(projectId)){
if(index > 1){
return titleNumArray[index-1] + titleArray[index];
}else{
return titleNumArray[index]+titleArray[index];
}
}else{
if(index == 1){
return titleNumArray[index]+getTitleKey(projectId)+"经历评估";
}else if(index == 8 && flag != 1){
return titleNumArray[index+1] + titleArray[index];
}else{
return titleNumArray[index]+titleArray[index];
}
}
}else{
//跳过了减脂经历
if(notExperienceIndex.includes(projectId) && index > 1){
return titleNumArray[index-1] + titleArray[index];
}else{
return titleNumArray[index]+titleArray[index];
}
}
}
//获取展示时,根据项目不同返回不同标题
export function getTitleShowArray(projectId){
let keyName = getTitleKey(projectId);
let array = [
[keyName+"经历", keyName+"遇到的困难", keyName+"是否反弹"],
["是否意识到生活习惯是"+keyName+"关键", "", ""],
];
return array;
}
/**
* 新增、查询展示时用于json与json字符串互相转换
* @param {*} healthyExtend 健康扩展数据
* @param {*} jsonFlag true json字符串转JSON false json对象转json字符串
*/
export function dealHealthyExtendJson(healthyExtend, jsonFlag){
//处理healthyExtend扩展数据
needJSONFieldName.forEach(function (item, index) {
healthyExtend[item] = healthyExtend[item] != null ? (jsonFlag ? JSON.parse(healthyExtend[item]) : JSON.stringify(healthyExtend[item])) : null;
});
return healthyExtend;
}
export const extendedYesNoAttrName = [
//焦虑
{"targetAttrName": "easyAnxiousFlag", "healthyAttrName": "anxietyStateMessage,easyAnxiousFlag"},
{"targetAttrName": "upsetRecently", "healthyAttrName": "anxietyStateMessage,upsetRecently"},
{"targetAttrName": "nervousOnSpecialOccasionsFlag", "healthyAttrName": "anxietyStateMessage,nervousOnSpecialOccasionsFlag"},
{"targetAttrName": "terrifiedFlag", "healthyAttrName": "anxietyStateMessage,terrifiedFlag"},
//抑郁
{"targetAttrName": "listlessRecentlyFlag", "healthyAttrName": "depressedStateMessage,listlessRecentlyFlag"},
{"targetAttrName": "cryRecentlyFlag", "healthyAttrName": "depressedStateMessage,cryRecentlyFlag"},
{"targetAttrName": "wakeUpEarlyRecentlyFlag", "healthyAttrName": "depressedStateMessage,wakeUpEarlyRecentlyFlag"},
{"targetAttrName": "noFunLiving", "healthyAttrName": "depressedStateMessage,noFunLiving"},
//高血糖
{"targetAttrName": "measureBloodSugarFlag", "healthyAttrName": "bloodSugarMessage,measureBloodSugarFlag"},
{"targetAttrName": "lowBloodSugarFlag", "healthyAttrName": "bloodSugarMessage,lowBloodSugarFlag"},
{"targetAttrName": "complicationFlag", "healthyAttrName": "bloodSugarMessage,complicationFlag"},
{"targetAttrName": "inferiorSymptom", "healthyAttrName": "bloodSugarMessage,inferiorSymptomFlag"},
{"targetAttrName": "weightChangeFlag", "healthyAttrName": "bloodSugarMessage,weightChangeFlag"},
{"targetAttrName": "amenorrhoeaFlag", "healthyAttrName": "menstruationMessage,amenorrhoeaFlag"},
{"targetAttrName": "medicationFlag", "healthyAttrName": "menstruationMessage,medicationFlag"},
{"targetAttrName": "familyPlann", "healthyAttrName": "menstruationMessage,familyPlann"},
{"targetAttrName": "sameRoomBleed", "healthyAttrName": "menstruationMessage,sameRoomBleed"},
{"targetAttrName": "ovulationBleed", "healthyAttrName": "menstruationMessage,ovulationBleed"},
{"targetAttrName": "insulinResistanceFlag", "healthyAttrName": "menstruationMessage,insulinResistanceFlag"}
]
//单选的value转成对应name
export function getStringBySigleValue(array, value){
if(value == undefined || value == null){
return "";
}
let val = "";
array.forEach((item,index) => {
if(item.value == value){
val = item.name;
}
})
return val;
}
//多选的value转成对应name
export function getStringByMuchValue(array, valueArray){
if(valueArray == undefined || valueArray == null || valueArray.length == 0){
return "";
}
let val = [];
array.forEach((item,index) => {
if(valueArray.includes(item.value)){
val.push(item.name);
}
})
return val.join(",");
}
export function dealHealthyExtend(detailHealthy){
//将0、1处理成是、否
extendedYesNoAttrName.forEach((item,index) => {
let array = item.healthyAttrName.split(",");
detailHealthy[item.targetAttrName] = (array.length > 1 ? detailHealthy.healthyExtend[array[0]][array[1]] : detailHealthy.healthyExtend[array[0]]) == 1 ? '是' : '否';
})
//常吃水果以及份量
let eatFruitsMessage = "";
if(detailHealthy.healthyExtend.eatFruitsMessage != null && detailHealthy.healthyExtend.eatFruitsMessage.length > 0){
detailHealthy.healthyExtend.eatFruitsMessage.forEach((item,index) => {
eatFruitsMessage += (eatFruitsMessage == "" ? "" : ", ") + item.name + "/" + item.num;
});
}
//高血糖
detailHealthy.healthyExtend.eatFruitsMessage = eatFruitsMessage;
detailHealthy.mealBloodSugar = "餐前血糖:"+(detailHealthy.healthyExtend.bloodSugarMessage.beforeMealBloodSugar == null ? "" : (detailHealthy.healthyExtend.bloodSugarMessage.beforeMealBloodSugar+"mmol/L"))+", "
+"餐后两小时血糖:"+(detailHealthy.healthyExtend.bloodSugarMessage.afterMealBloodSugar == null ? "" : (detailHealthy.healthyExtend.bloodSugarMessage.afterMealBloodSugar+"mmol/L"))
+",糖化血红蛋白:"+(detailHealthy.healthyExtend.bloodSugarMessage.sugarHemoglobin == null ? "" : (detailHealthy.healthyExtend.bloodSugarMessage.sugarHemoglobin+"mmol/L"))
detailHealthy.measureBloodSugarTime = detailHealthy.healthyExtend.bloodSugarMessage.measureBloodSugarTime;
detailHealthy.nearBloodSugar = detailHealthy.healthyExtend.bloodSugarMessage.nearBloodSugar;
detailHealthy.lowBloodSugarFlag = detailHealthy.lowBloodSugarFlag + ", 出现时间:"+nullToString(detailHealthy.healthyExtend.bloodSugarMessage.lowBloodSugarTime);
detailHealthy.complication = detailHealthy.healthyExtend.bloodSugarMessage.complication;
detailHealthy.inferiorSymptom = detailHealthy.inferiorSymptom +", 具体症状:"+getStringByMuchValue( syndromeNameArray, detailHealthy.healthyExtend.bloodSugarMessage.inferiorSymptom);
detailHealthy.weightChangeFlag = detailHealthy.weightChangeFlag + ",具体变化情况:"+detailHealthy.healthyExtend.bloodSugarMessage.weightChangeDescribe;
//高血压
detailHealthy.mealBloodPressure = "餐前血压:"+(detailHealthy.healthyExtend.bloodPressureMessage.beforeMealBloodPressure == null ? "" : (detailHealthy.healthyExtend.bloodPressureMessage.beforeMealBloodPressure+"mmHg"))+", "
+"餐后两小时血压:"+(detailHealthy.healthyExtend.bloodPressureMessage.afterMealBloodPressure == null ? "" : (detailHealthy.healthyExtend.bloodPressureMessage.afterMealBloodPressure+"mmHg"));
detailHealthy.measureBloodPressureFlag = detailHealthy.healthyExtend.bloodPressureMessage.measureBloodPressureFlag == 1 ? "是" : "否";
detailHealthy.measureBloodPressureTime = detailHealthy.healthyExtend.bloodPressureMessage.measureBloodPressureTime;
detailHealthy.nearBloodPressure = detailHealthy.healthyExtend.bloodPressureMessage.nearBloodPressure;
detailHealthy.lowBloodPressureFlag = (detailHealthy.healthyExtend.bloodPressureMessage.lowBloodPressureFlag == 1 ? "是" : "否") + ", 出现时间:"+nullToString(detailHealthy.healthyExtend.bloodPressureMessage.lowBloodPressureTime);
detailHealthy.pressureComplicationFlag = detailHealthy.healthyExtend.bloodPressureMessage.complicationFlag == 1 ? "是" : "否";
detailHealthy.pressureComplication = detailHealthy.healthyExtend.bloodPressureMessage.complication;
detailHealthy.pressureInferiorSymptom = (detailHealthy.healthyExtend.bloodPressureMessage.inferiorSymptomFlag == 1 ? "是" : "否") + ", 具体症状:"+getStringByMuchValue(syndromeNameArray,detailHealthy.healthyExtend.bloodPressureMessage.inferiorSymptom);
detailHealthy.pressureWeightChangeFlag = detailHealthy.healthyExtend.bloodPressureMessage.weightChangeFlag == 1 ? "是" : "否";
//月经不调、多囊
detailHealthy.menstrualCycle = "生理周期:" + nullToString(detailHealthy.healthyExtend.menstruationMessage.menstrualCycle) + ",生理天数:" + nullToString(detailHealthy.healthyExtend.menstruationMessage.menstrualDays);
detailHealthy.menstrualForecast = detailHealthy.healthyExtend.menstruationMessage.menstrualForecast;
detailHealthy.menstrualDelayDays = detailHealthy.healthyExtend.menstruationMessage.menstrualDelayDays;
detailHealthy.menstrualAdvanceDays = detailHealthy.healthyExtend.menstruationMessage.menstrualAdvanceDays;
detailHealthy.amenorrhoeaDays = detailHealthy.amenorrhoeaFlag + ",痛经时长:" + nullToString(detailHealthy.healthyExtend.menstruationMessage.amenorrhoeaDays);
detailHealthy.menstrualColor = getStringBySigleValue(menstrualColorArray, detailHealthy.healthyExtend.menstruationMessage.menstrualColor);
detailHealthy.menstrualColor += (detailHealthy.menstrualColor != "" ? "" : "") + nullToString(detailHealthy.healthyExtend.menstruationMessage.otherMenstrualColor);
detailHealthy.menstrualColor = removeEnd(detailHealthy.menstrualColor);
detailHealthy.menstrualCharacter = getStringBySigleValue(menstrualCharacterArray, detailHealthy.healthyExtend.menstruationMessage.menstrualCharacter);
detailHealthy.menstrualCharacter += (detailHealthy.menstrualCharacter != "" ? "" : "") + nullToString(detailHealthy.healthyExtend.menstruationMessage.otherMenstrualCharacter);
detailHealthy.menstrualCharacter = removeEnd(detailHealthy.menstrualCharacter);
detailHealthy.menstrualNature = getStringBySigleValue(menstrualNatureArray, detailHealthy.healthyExtend.menstruationMessage.menstrualNature);
detailHealthy.menstrualType = getStringBySigleValue(menstrualTypeArray, detailHealthy.healthyExtend.menstruationMessage.menstrualType);
detailHealthy.medication = detailHealthy.medicationFlag + ",具体药物:" + nullToString(detailHealthy.healthyExtend.menstruationMessage.medication);
detailHealthy.otherDescriptions = detailHealthy.healthyExtend.menstruationMessage.otherDescriptions;
}
export function nullToString(val){
return (val == undefined || val == null) ? "" : val;
}
export function removeEnd(val){
if(val == undefined || val == null){
return "";
}
let lastChar = val.substr(val.length-1, 1);
if(lastChar == "," || lastChar == ""){
return val.substring(0, val.length-1);
}
return val;
}
// 健康评估标题
export const healthyTitleData = [
[
["创建时间", "客户姓名", "手机号"],
["调理项目", "性别", "年龄"],
["身高(厘米)", "体重(斤)", "腰围(厘米)"],
["臀围(厘米)", "地域", "BMI"],
],
[
["减脂经历", "减脂遇到的困难", "减脂是否反弹"],
["是否意识到生活习惯是减脂关键", "", ""],
],
[
["调味品种", "烹调方式", "烹调频次"],
["洗菜方式", "", ""],
],
[
["早餐习惯", "早餐吃的食物", "午餐习惯"],
["晚餐习惯", "正餐中素菜占比", "最常吃的肉类"],
["晚餐时间", "每周吃夜宵次数", "夜宵通常吃的食物"],
["食物的冷热偏好", "食物的口味偏好", "平均每周吃生蔬菜几次"],
["每周吃生蔬菜的频次类型", "平均每天吃水果次数", "吃水果的时间段"],
["平时吃水果的频次", "经常吃的水果以及份量","一餐吃几碗饭"],
["吃几成饱","吃饭速度", "饮食特点"],
["常吃的零食","有无服用营养保健品", "营养保健品品牌名"],
["营养保健品产品名","服用营养保健品频次", "忌口过敏食物"],
],
[
["每天的饮水量", "喜欢喝什么水", "喝水习惯"],
["常喝的饮品的每周频次", "是否喝酒", "喝酒种类"],
["对应酒的量", "是否抽烟", "抽烟频次和烟龄"],
["是否经常抽二手烟", "工作行业", "工作性质"],
["排便次数", "排便时间段", "排便的形状"],
["排便的气味", "排便的速度", "排便的颜色"],
],
[
["每周运动次数", "每次运动的时长", "每天运动的时间"],
["运动", "运动场地", ""],
],
[
["睡觉时间", "睡眠质量", "是否有辅助入睡药物"],
["辅助睡眠类药物名称", "是否经常熬夜", "熬夜频次"],
],
[
["病史体征", "湿气数据", "气血数据"],
["家族疾病史", "手术史", "近期是否做过手术"],
["手术恢复情况", "是否长期服用药物", "长期服用的药物"],
["是否出现过过敏症状", "过敏症状", "过敏源"],
],
[["体检报告(1)", "体检报告(2)", "体检报告(3)"]],
[
["餐前餐后血糖", "是否有规律测血糖", "测量血糖时间"],
["近期血糖水平", "是否有低血糖反应", "是否有出现并发症"],
["并发症情况", "存在症状", "近三个月体重是否有变化"],
],
[
["餐前餐后血压", "是否有规律测血压", "测量血压时间"],
["近期血压水平", "是否有低血压反应", "是否有出现并发症"],
["并发症情况", "存在症状", "近三个月体重是否有变化"]
],
[
["你认为你是一个容易焦虑或紧张的人吗","最近一段时间,你是否比平时更感到焦虑或忐忑不安","是否有一些特殊场合或情景更容易使得你紧张、焦虑"],
["你曾经有过惊恐发作吗.即突然发生的强烈不适感或心慌、眩晕、感到憋气或呼吸困难等症状","",""]
],
[
["过去几周(或几个月)是否感觉到无精打采、伤感、或对生活的乐趣减少","除了不开心之外,是否比平时更加悲观或想哭","经常有早醒吗(事实上不需那么早醒来)"],
["近来是否经常想到活着没有意思","",""]
],
[
["月经周期、天数", "月经预估量", "月经推迟时长"],
["月经提前时长", "是否闭经、闭经时长", "月经颜色"],
["月经形状","痛经情况","痛经类型"],
["用药情况","是否有生育计划","是否同房出血"],
["是否排卵期出血","是否出现胰岛素抵抗","其他补充"]
]
]
// 健康评估属性
export const healthyValueData = [
[
["createTime", "name", "phone"],
["conditioningProject", "sex", "age"],
["tall", "weight", "healthyExtend,waist"],
["healthyExtend,hipline", "position", "bmi"],
],
[
["experience", "difficulty", "rebound"],
["crux", "", ""],
],
[
["condiment", "cookingStyle", "cookingStyleRate"],
["washVegetablesStyle", "", ""],
],
[
["breakfastType", "breakfastFood", "lunchType"],
["dinner", "vegetableRate", "commonMeat"],
["dinnerTime", "supperNum", "supperFood"],
["dietHotAndCold", "dietFlavor", "vegetablesNum"],
["vegetablesRateType", "fruitsNum", "fruitsTime"],
["fruitsRate", "healthyExtend,eatFruitsMessage", "riceNum"],
[ "riceFull","eatingSpeed", "makeFoodType"],
["snacks","healthProductsFlag", "healthProductsBrand"],
["healthProductsName","healthProductsWeekRate", "dishesIngredient"],
],
[
["waterNum", "waterType", "waterHabit"],
["drinksNum", "drinkWineFlag", "drinkWineClassify"],
["drinkWineAmount", "smokeFlag", "smokeRate"],
["secondSmoke", "workIndustry", "workType"],
["defecationNum", "defecationTime", "defecationShape"],
["defecationSmell", "defecationSpeed", "defecationColor"],
],
[
["motionNum", "motionDuration", "motionTime"],
["motion", "motionField", ""],
],
[
["sleepTime", "sleepQuality", "sleepDrugFlag"],
["sleepDrug", "stayupLateFlag", "stayupLateWeekNum"],
],
[
["physicalSigns", "moistureDate", "bloodData"],
["familyIllnessHistory", "operationHistory", "nearOperationFlag"],
["recoveryeSituation", "longEatDrugFlag", "longEatDrugClassify"],
["allergyFlag", "allergySituation", "allergen"],
],
[["medicalReport_one", "medicalReport_two", "medicalReport_three"]],
[
["mealBloodSugar", "measureBloodSugarFlag", "measureBloodSugarTime"],
["nearBloodSugar", "lowBloodSugarFlag", "complicationFlag"],
["complication", "inferiorSymptom", "weightChangeFlag"]
],
[
["mealBloodPressure", "measureBloodPressureFlag", "measureBloodPressureTime"],
["nearBloodPressure", "lowBloodPressureFlag", "pressureComplicationFlag"],
["pressureComplication", "pressureInferiorSymptom", "pressureWeightChangeFlag"],
],
[
["easyAnxiousFlag","upsetRecently","nervousOnSpecialOccasionsFlag"],
["terrifiedFlag","",""]
],
[
["listlessRecentlyFlag","cryRecentlyFlag","wakeUpEarlyRecentlyFlag"],
["noFunLiving","",""]
],
[
["menstrualCycle", "menstrualForecast", "menstrualDelayDays"],
["menstrualAdvanceDays", "amenorrhoeaDays", "menstrualColor"],
["menstrualCharacter","menstrualNature","menstrualType"],
["medication","familyPlann","sameRoomBleed"],
["ovulationBleed","insulinResistanceFlag","otherDescriptions"]
]
]