iOS AILinkBleSDK - 蓝牙SDK
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ELEightScaleAlgorithmTool.m 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. //
  2. // ELEightScaleAlgorithmTool.m
  3. // Elink
  4. //
  5. // Created by iot_user on 2020/6/18.
  6. // Copyright © 2020 iot_iMac. All rights reserved.
  7. //
  8. #import "ELEightScaleAlgorithmTool.h"
  9. #import "ELEightScaleRecordModel.h"
  10. #import <AILinkBleSDK/ELEightScaleBleDataModel.h>
  11. #import <AILinkBleSDK/ELEightScaleSDKHeader.h>
  12. #import "HTBodyfat_SDK.h"
  13. #import <AILinkBleSDK/ELHeightAlgorithmusModel.h>
  14. #import <AILinkBleSDK/ELWeightAlgorithmusModel.h>
  15. #import <AILinkBleSDK/ELBodyIndexAlgorithmModel.h>
  16. #import <AILinkBleSDK/ELEightScaleBadyInfo.h>
  17. #import <AILinkBleSDK/ELPeripheralModel.h>
  18. #import "BhBodyCompositionAllBody50KHz.h"
  19. static NSString *ELEightScaleWeightShowString(id kgValue, ELDeviceWeightUnit weightUnit) {
  20. return [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:weightUnit bleWeightInt:[kgValue floatValue] * 10 bleWeightUnit:ELDeviceWeightUnit_KG bleWeightPoint:1];
  21. }
  22. static NSString *ELEightScaleStringFromValue(id value) {
  23. if (value == nil || value == [NSNull null]) {
  24. return @"";
  25. }
  26. if ([value isKindOfClass:[NSString class]]) {
  27. return value;
  28. }
  29. if ([value isKindOfClass:[NSArray class]]) {
  30. return [(NSArray *)value componentsJoinedByString:@","];
  31. }
  32. return [NSString stringWithFormat:@"%@", value];
  33. }
  34. @implementation ELEightScaleAlgorithmTool
  35. //新算法
  36. /// 根据秤测量的阻抗数据调用算法解析出其他体脂数据
  37. /// @param dataModel 八电极秤测量的数据
  38. /// @param sex 女性传0,男性传1
  39. /// @param height 身高,单位cm
  40. /// @param age 年龄
  41. + (ELEightScaleRecordModel *)getNewRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age {
  42. CGFloat kgWeight = [ELWeightAlgorithmusModel getKgWithWeightShowStr:dataModel.weight weightUnit:dataModel.weightUnit weightPoint:dataModel.weightPoint].floatValue;
  43. HTBodyBasicInfo *bodyBasicInfo = [[HTBodyBasicInfo alloc] initWithSex:sex height:height weight:kgWeight age:age];
  44. bodyBasicInfo.htZAllBodyImpedance = dataModel.RWholeBodyAdc;
  45. bodyBasicInfo.htZLeftLegImpedance = dataModel.leftFootAdc;
  46. bodyBasicInfo.htZRightLegImpedance = dataModel.rightFootAdc;
  47. bodyBasicInfo.htZLeftArmImpedance = dataModel.leftHandAdc;
  48. bodyBasicInfo.htZRightArmImpedance = dataModel.rightHandAdc;
  49. bodyBasicInfo.htTwoArmsImpedance = dataModel.handsAdc;
  50. bodyBasicInfo.htTwoLegsImpedance = dataModel.feetAdc;
  51. //计算体脂参数
  52. HTBodyResultAllBody *bodyResultTwoLegs = [[HTBodyResultAllBody alloc] init];
  53. HTBodyfatErrorType errorType = [bodyResultTwoLegs getBodyfatWithBasicInfo:bodyBasicInfo];
  54. NSLog(@"HTBodyfatErrorType = %lu",errorType);
  55. if(errorType != HTBodyfatErrorTypeNone){
  56. NSMutableString *errorStr = [[NSMutableString alloc]initWithString:@""];
  57. if((errorType & HTBodyfatErrorTypeAge) == HTBodyfatErrorTypeAge){
  58. [errorStr appendString:@"年龄 "];
  59. }
  60. if((errorType & HTBodyfatErrorTypeWeight) == HTBodyfatErrorTypeWeight){
  61. [errorStr appendString:@"体重 "];
  62. }
  63. if((errorType & HTBodyfatErrorTypeHeight) == HTBodyfatErrorTypeHeight){
  64. [errorStr appendString:@"身高 "];
  65. }
  66. if((errorType & HTBodyfatErrorTypeSex) == HTBodyfatErrorTypeSex){
  67. [errorStr appendString:@"性别 "];
  68. }
  69. if((errorType & HTBodyfatErrorTypeImpedance) == HTBodyfatErrorTypeImpedance){
  70. [errorStr appendString:@"阻抗 "];
  71. }
  72. if((errorType & HTBodyfatErrorTypeImpedanceLeftLeg) == HTBodyfatErrorTypeImpedanceLeftLeg){
  73. [errorStr appendString:@"左脚阻抗 "];
  74. }
  75. if((errorType & HTBodyfatErrorTypeImpedanceRightLeg) == HTBodyfatErrorTypeImpedanceRightLeg){
  76. [errorStr appendString:@"右脚阻抗 "];
  77. }
  78. if((errorType & HTBodyfatErrorTypeImpedanceLeftArm) == HTBodyfatErrorTypeImpedanceLeftArm){
  79. [errorStr appendString:@"左手阻抗 "];
  80. }
  81. if((errorType & HTBodyfatErrorTypeImpedanceRightArm) == HTBodyfatErrorTypeImpedanceRightArm){
  82. [errorStr appendString:@"右手阻抗 "];
  83. }
  84. [errorStr appendString:@"参数有误!"];
  85. NSLog(@"errorType = %@",errorStr);
  86. }
  87. ELEightScaleRecordModel *recordModel = [[ELEightScaleRecordModel alloc] init];
  88. recordModel.bmi = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBMI];
  89. recordModel.bfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatPercentage];
  90. recordModel.sfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatSubcut];
  91. recordModel.uvi = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htVFAL];
  92. recordModel.rom = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htMusclePercentage];
  93. recordModel.bmr = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBMR];
  94. recordModel.vwc = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htWaterPercentage];
  95. recordModel.bodyAge = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBodyAge];
  96. recordModel.pp = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htProteinPercentage];
  97. recordModel.adc = [NSString stringWithFormat:@"%d",dataModel.trunkAdc];//记录躯干adc
  98. recordModel.heartRate = dataModel.heartRate>0?[NSString stringWithFormat:@"%d",dataModel.heartRate]:@"";
  99. recordModel.createTime = dataModel.createTime;
  100. recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d",dataModel.algorithmID];
  101. //新算法
  102. [self new_algorithmOfHTWithDataModel:dataModel sex:sex height:height kgWeight:kgWeight age:age updateRecordModel:recordModel];
  103. return recordModel;
  104. }
  105. /// 根据秤测量的阻抗数据调用算法解析出其他体脂数据
  106. /// @param dataModel 八电极秤测量的数据
  107. /// @param sex 女性传0,男性传1
  108. /// @param height 身高,单位cm
  109. /// @param age 年龄
  110. + (ELEightScaleRecordModel *)getRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age {
  111. CGFloat kgWeight = [ELWeightAlgorithmusModel getKgWithWeightShowStr:dataModel.weight weightUnit:dataModel.weightUnit weightPoint:dataModel.weightPoint].floatValue;
  112. HTBodyBasicInfo *bodyBasicInfo = [[HTBodyBasicInfo alloc] initWithSex:sex height:height weight:kgWeight age:age];
  113. bodyBasicInfo.htZAllBodyImpedance = dataModel.RWholeBodyAdc;
  114. bodyBasicInfo.htZLeftLegImpedance = dataModel.leftFootAdc;
  115. bodyBasicInfo.htZRightLegImpedance = dataModel.rightFootAdc;
  116. bodyBasicInfo.htZLeftArmImpedance = dataModel.leftHandAdc;
  117. bodyBasicInfo.htZRightArmImpedance = dataModel.rightHandAdc;
  118. bodyBasicInfo.htTwoArmsImpedance = dataModel.handsAdc;
  119. bodyBasicInfo.htTwoLegsImpedance = dataModel.feetAdc;
  120. //计算体脂参数
  121. HTBodyResultAllBody *bodyResultTwoLegs = [[HTBodyResultAllBody alloc] init];
  122. HTBodyfatErrorType errorType = [bodyResultTwoLegs getBodyfatWithBasicInfo:bodyBasicInfo];
  123. NSLog(@"HTBodyfatErrorType = %lu",errorType);
  124. if(errorType != HTBodyfatErrorTypeNone){
  125. NSMutableString *errorStr = [[NSMutableString alloc]initWithString:@""];
  126. if((errorType & HTBodyfatErrorTypeAge) == HTBodyfatErrorTypeAge){
  127. [errorStr appendString:@"年龄 "];
  128. }
  129. if((errorType & HTBodyfatErrorTypeWeight) == HTBodyfatErrorTypeWeight){
  130. [errorStr appendString:@"体重 "];
  131. }
  132. if((errorType & HTBodyfatErrorTypeHeight) == HTBodyfatErrorTypeHeight){
  133. [errorStr appendString:@"身高 "];
  134. }
  135. if((errorType & HTBodyfatErrorTypeSex) == HTBodyfatErrorTypeSex){
  136. [errorStr appendString:@"性别 "];
  137. }
  138. if((errorType & HTBodyfatErrorTypeImpedance) == HTBodyfatErrorTypeImpedance){
  139. [errorStr appendString:@"阻抗 "];
  140. }
  141. if((errorType & HTBodyfatErrorTypeImpedanceLeftLeg) == HTBodyfatErrorTypeImpedanceLeftLeg){
  142. [errorStr appendString:@"左脚阻抗 "];
  143. }
  144. if((errorType & HTBodyfatErrorTypeImpedanceRightLeg) == HTBodyfatErrorTypeImpedanceRightLeg){
  145. [errorStr appendString:@"右脚阻抗 "];
  146. }
  147. if((errorType & HTBodyfatErrorTypeImpedanceLeftArm) == HTBodyfatErrorTypeImpedanceLeftArm){
  148. [errorStr appendString:@"左手阻抗 "];
  149. }
  150. if((errorType & HTBodyfatErrorTypeImpedanceRightArm) == HTBodyfatErrorTypeImpedanceRightArm){
  151. [errorStr appendString:@"右手阻抗 "];
  152. }
  153. [errorStr appendString:@"参数有误!"];
  154. NSLog(@"errorType = %@",errorStr);
  155. }
  156. ELEightScaleRecordModel *recordModel = [[ELEightScaleRecordModel alloc] init];
  157. recordModel.bmi = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBMI];
  158. recordModel.bfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatPercentage];
  159. recordModel.sfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatSubcut];
  160. recordModel.uvi = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htVFAL];
  161. recordModel.rom = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htMusclePercentage];
  162. recordModel.bmr = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBMR];
  163. recordModel.vwc = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htWaterPercentage];
  164. recordModel.bodyAge = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBodyAge];
  165. recordModel.pp = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htProteinPercentage];
  166. recordModel.adc = [NSString stringWithFormat:@"%d",dataModel.trunkAdc];//记录躯干adc
  167. recordModel.heartRate = dataModel.heartRate>0?[NSString stringWithFormat:@"%d",dataModel.heartRate]:@"";
  168. recordModel.createTime = dataModel.createTime;
  169. recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d",dataModel.algorithmID];
  170. //骨量
  171. if (bodyResultTwoLegs.htBoneKg>0) {
  172. NSUInteger boneMass = roundf(bodyResultTwoLegs.htBoneKg*pow(10, dataModel.weightPoint));
  173. recordModel.bm = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:boneMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  174. }else{
  175. recordModel.bm = @"";
  176. }
  177. //标准体重
  178. if (bodyResultTwoLegs.htIdealWeightKg >0) {
  179. //说明有值
  180. NSUInteger standard = roundf(bodyResultTwoLegs.htIdealWeightKg*pow(10, dataModel.weightPoint));
  181. recordModel.standardWeight = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:standard bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  182. //体重控制量
  183. CGFloat weightControl = kgWeight - bodyResultTwoLegs.htIdealWeightKg;
  184. NSUInteger weightContrlABS = roundf(fabs(weightControl*pow(10, dataModel.weightPoint)));
  185. NSString *weightContrlStr = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:weightContrlABS bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  186. if (weightControl<0) {
  187. recordModel.weightControl = [NSString stringWithFormat:@"-%@",weightContrlStr];
  188. }else{
  189. recordModel.weightControl = weightContrlStr;
  190. }
  191. recordModel.fatLevel = [NSString stringWithFormat:@"%lu",(unsigned long)[ELBodyIndexAlgorithmModel getfatLevelWithweight:kgWeight andStandardWeight:bodyResultTwoLegs.htIdealWeightKg]];
  192. }else{
  193. recordModel.standardWeight = @"";
  194. recordModel.weightControl = @"";
  195. recordModel.fatLevel = @"";
  196. }
  197. //脂肪量
  198. if (bodyResultTwoLegs.htBodyfatKg>0) {
  199. NSUInteger fatMass = roundf(bodyResultTwoLegs.htBodyfatKg*pow(10, dataModel.weightPoint));
  200. recordModel.fatMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  201. }else{
  202. recordModel.fatMass = @"";
  203. }
  204. //去脂体重
  205. if (bodyResultTwoLegs.htBodyfatFreeMass>0) {
  206. NSUInteger withoutFatW = roundf(bodyResultTwoLegs.htBodyfatFreeMass*pow(10, dataModel.weightPoint));
  207. recordModel.weightWithoutFat = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:withoutFatW bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  208. }else{
  209. recordModel.weightWithoutFat = @"";
  210. }
  211. //肌肉量
  212. if (bodyResultTwoLegs.htMuscleKg>0) {
  213. NSInteger musleMass = round(bodyResultTwoLegs.htMuscleKg*pow(10, dataModel.weightPoint));
  214. recordModel.musleMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:musleMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  215. }else{
  216. recordModel.musleMass = @"";
  217. }
  218. //蛋白量
  219. if (bodyResultTwoLegs.htProteinPercentage>0) {
  220. NSUInteger proteinMassInt = roundf((bodyResultTwoLegs.htProteinPercentage/100.0)*kgWeight* pow(10, dataModel.weightPoint));
  221. recordModel.proteinMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:proteinMassInt bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  222. }else{
  223. recordModel.proteinMass = @"";
  224. }
  225. //体脂-右手
  226. if (bodyResultTwoLegs.htBodyfatKgRightArm >0) {
  227. NSUInteger rightHand = roundf(bodyResultTwoLegs.htBodyfatKgRightArm*pow(10, dataModel.weightPoint));
  228. recordModel.fatMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  229. }else{
  230. recordModel.fatMassRightTop = @"";
  231. }
  232. //体脂-右脚
  233. if (bodyResultTwoLegs.htBodyfatKgRightLeg >0) {
  234. NSUInteger rightFoot = roundf(bodyResultTwoLegs.htBodyfatKgRightLeg*pow(10, dataModel.weightPoint));
  235. recordModel.fatMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  236. }else{
  237. recordModel.fatMassRightBottom = @"";
  238. }
  239. //体脂-左手
  240. if (bodyResultTwoLegs.htBodyfatKgLeftArm >0) {
  241. NSUInteger leftHand = roundf(bodyResultTwoLegs.htBodyfatKgLeftArm*pow(10, dataModel.weightPoint));
  242. recordModel.fatMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  243. }else{
  244. recordModel.fatMassLeftTop = @"";
  245. }
  246. //体脂-左脚
  247. if (bodyResultTwoLegs.htBodyfatKgLeftLeg >0) {
  248. NSUInteger leftFoot = roundf(bodyResultTwoLegs.htBodyfatKgLeftLeg*pow(10, dataModel.weightPoint));
  249. recordModel.fatMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  250. }else{
  251. recordModel.fatMassLeftBottom = @"";
  252. }
  253. //体脂-躯干
  254. if (bodyResultTwoLegs.htBodyfatKgTrunk >0) {
  255. NSUInteger fatMassBody = roundf(bodyResultTwoLegs.htBodyfatKgTrunk*pow(10, dataModel.weightPoint));
  256. recordModel.fatMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  257. }else{
  258. recordModel.fatMassBody = @"";
  259. }
  260. //肌肉-右手
  261. if (bodyResultTwoLegs.htMuscleKgRightArm >0) {
  262. NSUInteger rightHand = roundf(bodyResultTwoLegs.htMuscleKgRightArm*pow(10, dataModel.weightPoint));
  263. recordModel.musleMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  264. }else{
  265. recordModel.musleMassRightTop = @"";
  266. }
  267. //肌肉-右脚
  268. if (bodyResultTwoLegs.htMuscleKgRightLeg >0) {
  269. NSUInteger rightFoot = roundf(bodyResultTwoLegs.htMuscleKgRightLeg*pow(10, dataModel.weightPoint));
  270. recordModel.musleMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  271. }else{
  272. recordModel.musleMassRightBottom = @"";
  273. }
  274. //肌肉-左手
  275. if (bodyResultTwoLegs.htMuscleKgLeftArm >0) {
  276. NSUInteger leftHand = roundf(bodyResultTwoLegs.htMuscleKgLeftArm*pow(10, dataModel.weightPoint));
  277. recordModel.musleMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  278. }else{
  279. recordModel.musleMassLeftTop = @"";
  280. }
  281. //肌肉-左脚
  282. if (bodyResultTwoLegs.htMuscleKgeLeftLeg >0) {
  283. NSUInteger leftFoot = roundf(bodyResultTwoLegs.htMuscleKgeLeftLeg*pow(10, dataModel.weightPoint));
  284. recordModel.musleMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  285. }else{
  286. recordModel.musleMassLeftBottom = @"";
  287. }
  288. //肌肉-躯干
  289. if (bodyResultTwoLegs.htMuscleKgTrunk >0) {
  290. NSUInteger muscleMassBody = roundf(bodyResultTwoLegs.htMuscleKgTrunk*pow(10, dataModel.weightPoint));
  291. recordModel.musleMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:muscleMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  292. }else{
  293. recordModel.musleMassBody = @"";
  294. }
  295. //四肢肌肉指数 = 四肢肌肉量(kg)/身高的平方(m)
  296. CGFloat heightM = (height/100.0);
  297. CGFloat index = (bodyResultTwoLegs.htMuscleKgLeftArm+bodyResultTwoLegs.htMuscleKgeLeftLeg+bodyResultTwoLegs.htMuscleKgRightArm+bodyResultTwoLegs.htMuscleKgRightLeg)/(heightM*heightM);
  298. recordModel.musleMassLimbs = [NSString stringWithFormat:@"%.1f",index];
  299. return recordModel;
  300. }
  301. #pragma mark - 新算法
  302. +(void)new_algorithmOfHTWithDataModel:(ELEightScaleBleDataModel *)dataModel sex:(BhSexType)sex height:(CGFloat)height kgWeight:(CGFloat)kgWeight age:(NSInteger)age updateRecordModel:(ELEightScaleRecordModel *)recordModel {
  303. #if TARGET_IPHONE_SIMULATOR == 0
  304. //HT算法
  305. BhSexType htSex = sex;
  306. BhBodyCompositionAllBody50KHz *bodyCompositon = [[BhBodyCompositionAllBody50KHz alloc] init];
  307. bodyCompositon.bhSex = htSex;
  308. bodyCompositon.bhPeopleType = BH_PEOPLE_TYPE_NORMAL;
  309. bodyCompositon.bhHeightCm = height;
  310. bodyCompositon.bhWeightKg = kgWeight;
  311. bodyCompositon.bhAge = (int)age;
  312. bodyCompositon.bhZLeftArmEnCode = dataModel.leftHandAdc;
  313. bodyCompositon.bhZRightArmEnCode = dataModel.rightHandAdc;
  314. bodyCompositon.bhZLeftLegEnCode = dataModel.leftFootAdc;
  315. bodyCompositon.bhZRightLegEnCode = dataModel.rightFootAdc;
  316. bodyCompositon.bhZLeftBodyEnCode = dataModel.RWholeBodyAdc;
  317. BhErrorType errType = [bodyCompositon getBhBodyCompositionAllBody50KHz];
  318. NSLog(@"errType(不为0就有问题) = %zd",errType);
  319. //显示体脂参数
  320. recordModel.bmi = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhBMI];
  321. recordModel.bfr = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhBodyFatRate];
  322. recordModel.sfr = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhBodyFatSubCutRate];
  323. recordModel.uvi = [NSString stringWithFormat:@"%u",bodyCompositon.bhVFAL];
  324. recordModel.rom = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhMuscleRate];
  325. recordModel.bmr = [NSString stringWithFormat:@"%u",bodyCompositon.bhBMR];
  326. recordModel.vwc = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhWaterRate];
  327. recordModel.bodyAge = [NSString stringWithFormat:@"%u",bodyCompositon.bhBodyAge];
  328. recordModel.pp = [NSString stringWithFormat:@"%.1f",bodyCompositon.bhProteinRate];
  329. recordModel.adc = [NSString stringWithFormat:@"%d",dataModel.trunkAdc];//记录躯干adc
  330. recordModel.heartRate = dataModel.heartRate>0?[NSString stringWithFormat:@"%d",dataModel.heartRate]:@"";
  331. recordModel.createTime = dataModel.createTime;
  332. recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d",dataModel.algorithmID];
  333. //骨量
  334. if (bodyCompositon.bhBoneKg>0) {
  335. NSUInteger boneMass = roundf(bodyCompositon.bhBoneKg*pow(10, dataModel.weightPoint));
  336. recordModel.bm = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:boneMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  337. }else{
  338. recordModel.bm = @"";
  339. }
  340. //标准体重
  341. if (bodyCompositon.bhIdealWeightKg >0) {
  342. //说明有值
  343. NSUInteger standard = roundf(bodyCompositon.bhIdealWeightKg*pow(10, dataModel.weightPoint));
  344. recordModel.standardWeight = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:standard bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  345. //体重控制量
  346. CGFloat weightControl = kgWeight - bodyCompositon.bhIdealWeightKg;
  347. NSUInteger weightContrlABS = roundf(fabs(weightControl*pow(10, dataModel.weightPoint)));
  348. NSString *weightContrlStr = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:weightContrlABS bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  349. if (weightControl<0) {
  350. recordModel.weightControl = [NSString stringWithFormat:@"-%@",weightContrlStr];
  351. }else{
  352. recordModel.weightControl = weightContrlStr;
  353. }
  354. recordModel.fatLevel = [NSString stringWithFormat:@"%lu",(unsigned long)[ELBodyIndexAlgorithmModel getfatLevelWithweight:kgWeight andStandardWeight:bodyCompositon.bhIdealWeightKg]];
  355. }else{
  356. recordModel.standardWeight = @"";
  357. recordModel.weightControl = @"";
  358. recordModel.fatLevel = @"";
  359. }
  360. //脂肪量
  361. if (bodyCompositon.bhBodyFatKg>0) {
  362. NSLog(@"---和泰脂肪量:%f",bodyCompositon.bhBodyFatKg);
  363. NSUInteger fatMass = roundf(bodyCompositon.bhBodyFatKg*pow(10, dataModel.weightPoint));
  364. recordModel.fatMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  365. }else{
  366. recordModel.fatMass = @"";
  367. }
  368. //去脂体重
  369. if (bodyCompositon.bhBodyFatFreeMassKg>0) {
  370. NSUInteger withoutFatW = roundf(bodyCompositon.bhBodyFatFreeMassKg*pow(10, dataModel.weightPoint));
  371. recordModel.weightWithoutFat = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:withoutFatW bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  372. }else{
  373. recordModel.weightWithoutFat = @"";
  374. }
  375. //肌肉量
  376. if (bodyCompositon.bhMuscleKg>0) {
  377. NSLog(@"---和泰脂肪量:%f",bodyCompositon.bhMuscleKg);
  378. NSInteger musleMass = round(bodyCompositon.bhMuscleKg*pow(10, dataModel.weightPoint));
  379. recordModel.musleMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:musleMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  380. }else{
  381. recordModel.musleMass = @"";
  382. }
  383. //蛋白量
  384. if (bodyCompositon.bhProteinRate>0) {
  385. NSUInteger proteinMassInt = roundf((bodyCompositon.bhProteinRate/100.0)*kgWeight* pow(10, dataModel.weightPoint));
  386. recordModel.proteinMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:proteinMassInt bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  387. }else{
  388. recordModel.proteinMass = @"";
  389. }
  390. //体脂-右手
  391. if (bodyCompositon.bhBodyFatKgRightArm >0) {
  392. NSUInteger rightHand = roundf(bodyCompositon.bhBodyFatKgRightArm*pow(10, dataModel.weightPoint));
  393. recordModel.fatMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  394. }else{
  395. recordModel.fatMassRightTop = @"";
  396. }
  397. //体脂-右脚
  398. if (bodyCompositon.bhBodyFatKgRightLeg >0) {
  399. NSUInteger rightFoot = roundf(bodyCompositon.bhBodyFatKgRightLeg*pow(10, dataModel.weightPoint));
  400. recordModel.fatMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  401. }else{
  402. recordModel.fatMassRightBottom = @"";
  403. }
  404. //体脂-左手
  405. if (bodyCompositon.bhBodyFatKgLeftArm >0) {
  406. NSUInteger leftHand = roundf(bodyCompositon.bhBodyFatKgLeftArm*pow(10, dataModel.weightPoint));
  407. recordModel.fatMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  408. }else{
  409. recordModel.fatMassLeftTop = @"";
  410. }
  411. //体脂-左脚
  412. if (bodyCompositon.bhBodyFatKgLeftLeg >0) {
  413. NSUInteger leftFoot = roundf(bodyCompositon.bhBodyFatKgLeftLeg*pow(10, dataModel.weightPoint));
  414. recordModel.fatMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  415. }else{
  416. recordModel.fatMassLeftBottom = @"";
  417. }
  418. //体脂-躯干
  419. if (bodyCompositon.bhBodyFatKgTrunk >0) {
  420. NSUInteger fatMassBody = roundf(bodyCompositon.bhBodyFatKgTrunk*pow(10, dataModel.weightPoint));
  421. recordModel.fatMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  422. }else{
  423. recordModel.fatMassBody = @"";
  424. }
  425. //肌肉-右手
  426. if (bodyCompositon.bhMuscleKgRightArm >0) {
  427. NSUInteger rightHand = roundf(bodyCompositon.bhMuscleKgRightArm*pow(10, dataModel.weightPoint));
  428. recordModel.musleMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  429. }else{
  430. recordModel.musleMassRightTop = @"";
  431. }
  432. //肌肉-右脚
  433. if (bodyCompositon.bhMuscleKgRightLeg >0) {
  434. NSUInteger rightFoot = roundf(bodyCompositon.bhMuscleKgRightLeg*pow(10, dataModel.weightPoint));
  435. recordModel.musleMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  436. }else{
  437. recordModel.musleMassRightBottom = @"";
  438. }
  439. //肌肉-左手
  440. if (bodyCompositon.bhMuscleKgLeftArm >0) {
  441. NSUInteger leftHand = roundf(bodyCompositon.bhMuscleKgLeftArm*pow(10, dataModel.weightPoint));
  442. recordModel.musleMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  443. }else{
  444. recordModel.musleMassLeftTop = @"";
  445. }
  446. //肌肉-左脚
  447. if (bodyCompositon.bhMuscleKgLeftLeg >0) {
  448. NSUInteger leftFoot = roundf(bodyCompositon.bhMuscleKgLeftLeg*pow(10, dataModel.weightPoint));
  449. recordModel.musleMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  450. }else{
  451. recordModel.musleMassLeftBottom = @"";
  452. }
  453. //肌肉-躯干
  454. if (bodyCompositon.bhMuscleKgTrunk >0) {
  455. NSUInteger muscleMassBody = roundf(bodyCompositon.bhMuscleKgTrunk*pow(10, dataModel.weightPoint));
  456. recordModel.musleMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:muscleMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint];
  457. }else{
  458. recordModel.musleMassBody = @"";
  459. }
  460. //四肢肌肉指数 = 四肢肌肉量(kg)/身高的平方(m)
  461. CGFloat heightM = (height/100.0);
  462. CGFloat index = (bodyCompositon.bhMuscleKgLeftArm+bodyCompositon.bhMuscleKgLeftLeg+bodyCompositon.bhMuscleKgRightArm+bodyCompositon.bhMuscleKgRightLeg)/(heightM*heightM);
  463. recordModel.musleMassLimbs = [NSString stringWithFormat:@"%.1f",index];
  464. NSLog(@"八电极体脂:\n%@",recordModel);
  465. #endif
  466. }
  467. + (void)getDoubleEightRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel
  468. peripheral:(ELPeripheralModel *)peripheral
  469. withUserSex:(NSInteger)sex
  470. height:(NSInteger)height
  471. age:(NSInteger)age
  472. success:(ELEightScaleRecordSuccessBlock)success
  473. failure:(ELEightScaleRecordFailureBlock)failure {
  474. [ELEightScaleBadyInfo getDoubleEightDataWithBleDataModel:dataModel
  475. peripheral:peripheral
  476. withUserSex:sex
  477. height:height
  478. age:age
  479. success:^(NSDictionary *data) {
  480. if (success) {
  481. success([self recordModelWithServerData:data dataModel:dataModel withUserSex:sex height:height]);
  482. }
  483. } failure:failure];
  484. }
  485. + (ELEightScaleRecordModel *)recordModelWithServerData:(NSDictionary *)dataDic
  486. dataModel:(ELEightScaleBleDataModel *)dataModel
  487. withUserSex:(NSInteger)sex
  488. height:(NSInteger)height {
  489. ELEightScaleRecordModel *recordModel = [[ELEightScaleRecordModel alloc] init];
  490. ELDeviceWeightUnit weightUnit = dataModel.weightUnit;
  491. NSUInteger weightPoint = dataModel.weightPoint;
  492. CGFloat kgWeight = [ELWeightAlgorithmusModel getKgWithWeightShowStr:dataModel.weight weightUnit:weightUnit weightPoint:weightPoint].floatValue;
  493. CGFloat rightArmMuscle = [dataDic[@"muscleKgRightArm"] floatValue];
  494. CGFloat leftArmMuscle = [dataDic[@"muscleKgLeftArm"] floatValue];
  495. CGFloat rightLegMuscle = [dataDic[@"muscleKgRightLeg"] floatValue];
  496. CGFloat leftLegMuscle = [dataDic[@"muscleKgLeftLeg"] floatValue];
  497. CGFloat trunkMuscle = [dataDic[@"muscleKgTrunk"] floatValue];
  498. float muscleMass = rightArmMuscle + leftArmMuscle + rightLegMuscle + leftLegMuscle + trunkMuscle;
  499. NSString *waterStr = ELEightScaleStringFromValue(dataDic[@"waterKg"]);
  500. NSString *proteinMassStr = ELEightScaleWeightShowString(dataDic[@"proteinKg"], weightUnit);
  501. float proteinKg = [ELWeightAlgorithmusModel getKgWithWeightShowStr:proteinMassStr weightUnit:weightUnit weightPoint:weightPoint].floatValue;
  502. float numPoint = pow(10, weightPoint);
  503. float standard = [ELBodyIndexAlgorithmModel getStandardWeight:sex andheight:height];
  504. CGFloat weightControl = kgWeight - standard;
  505. NSUInteger weightContrlABS = roundf(fabs(weightControl * numPoint));
  506. NSString *weightContrlStr = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:weightUnit bleWeightInt:weightContrlABS bleWeightUnit:ELDeviceWeightUnit_KG bleWeightPoint:weightPoint];
  507. recordModel.bmi = ELEightScaleStringFromValue(dataDic[@"bMI"]);
  508. recordModel.bfr = ELEightScaleStringFromValue(dataDic[@"bodyFatRate"]);
  509. recordModel.sfr = ELEightScaleStringFromValue(dataDic[@"bodyFatSubCutRate"]);
  510. recordModel.uvi = ELEightScaleStringFromValue(dataDic[@"vFAL"]);
  511. recordModel.rom = muscleMass >= kgWeight ? @"" : [NSString stringWithFormat:@"%.1f", muscleMass / kgWeight * 100];
  512. recordModel.bmr = ELEightScaleStringFromValue(dataDic[@"bMR"]);
  513. recordModel.bm = ELEightScaleWeightShowString(dataDic[@"boneKg"], weightUnit);
  514. recordModel.vwc = [NSString stringWithFormat:@"%.1f", waterStr.floatValue / kgWeight * 100];
  515. recordModel.bodyAge = ELEightScaleStringFromValue(dataDic[@"bodyAge"]);
  516. recordModel.pp = [NSString stringWithFormat:@"%.1f", proteinKg / kgWeight * 100];
  517. recordModel.adc = [NSString stringWithFormat:@"%d", dataModel.trunkAdc];
  518. recordModel.heartRate = dataModel.heartRate > 0 ? [NSString stringWithFormat:@"%d", dataModel.heartRate] : @"";
  519. recordModel.createTime = dataModel.createTime;
  520. recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d", dataModel.algorithmID];
  521. recordModel.standardWeight = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:weightUnit bleWeightInt:standard * numPoint bleWeightUnit:ELDeviceWeightUnit_KG bleWeightPoint:weightPoint];
  522. recordModel.weightControl = weightControl < 0 ? [NSString stringWithFormat:@"-%@", weightContrlStr] : weightContrlStr;
  523. recordModel.fatMass = ELEightScaleWeightShowString(dataDic[@"bodyFatKg"], weightUnit);
  524. recordModel.weightWithoutFat = ELEightScaleWeightShowString(dataDic[@"bodyFatFreeMassKg"], weightUnit);
  525. if (muscleMass >= kgWeight) {
  526. recordModel.musleMass = @"";
  527. } else {
  528. NSString *pointFormat = [NSString stringWithFormat:@"%%.%zdf", weightPoint];
  529. float muscleMassText = [[NSString stringWithFormat:pointFormat, muscleMass] floatValue];
  530. recordModel.musleMass = ELEightScaleWeightShowString(@(muscleMassText), weightUnit);
  531. }
  532. recordModel.proteinMass = proteinMassStr;
  533. recordModel.fatLevel = [NSString stringWithFormat:@"%lu", (unsigned long)[ELBodyIndexAlgorithmModel getfatLevelWithweight:kgWeight andStandardWeight:[dataDic[@"idealWeightKg"] floatValue]]];
  534. recordModel.fatMassRightTop = ELEightScaleWeightShowString(dataDic[@"bodyFatKgRightArm"], weightUnit);
  535. recordModel.fatMassRightBottom = ELEightScaleWeightShowString(dataDic[@"bodyFatKgRightLeg"], weightUnit);
  536. recordModel.fatMassLeftTop = ELEightScaleWeightShowString(dataDic[@"bodyFatKgLeftArm"], weightUnit);
  537. recordModel.fatMassLeftBottom = ELEightScaleWeightShowString(dataDic[@"bodyFatKgLeftLeg"], weightUnit);
  538. recordModel.fatMassBody = ELEightScaleWeightShowString(dataDic[@"bodyFatKgTrunk"], weightUnit);
  539. recordModel.musleMassRightTop = ELEightScaleWeightShowString(@(rightArmMuscle), weightUnit);
  540. recordModel.musleMassRightBottom = ELEightScaleWeightShowString(@(rightLegMuscle), weightUnit);
  541. recordModel.musleMassLeftTop = ELEightScaleWeightShowString(@(leftArmMuscle), weightUnit);
  542. recordModel.musleMassLeftBottom = ELEightScaleWeightShowString(@(leftLegMuscle), weightUnit);
  543. recordModel.musleMassBody = ELEightScaleWeightShowString(@(trunkMuscle), weightUnit);
  544. CGFloat heightM = height / 100.0;
  545. CGFloat limbsIndex = (rightArmMuscle + leftArmMuscle + rightLegMuscle + leftLegMuscle) / (heightM * heightM);
  546. recordModel.musleMassLimbs = [NSString stringWithFormat:@"%.1f", limbsIndex];
  547. recordModel.fatMassRightTopRate = ELEightScaleStringFromValue(dataDic[@"bodyFatRateRightArm"]);
  548. recordModel.fatMassRightBottomRate = ELEightScaleStringFromValue(dataDic[@"bodyFatRateRightLeg"]);
  549. recordModel.fatMassLeftTopRate = ELEightScaleStringFromValue(dataDic[@"bodyFatRateLeftArm"]);
  550. recordModel.fatMassLeftBottomRate = ELEightScaleStringFromValue(dataDic[@"bodyFatRateLeftLeg"]);
  551. recordModel.fatMassBodyRate = ELEightScaleStringFromValue(dataDic[@"bodyFatRateTrunk"]);
  552. recordModel.musleMassRightTopRate = ELEightScaleStringFromValue(dataDic[@"muscleRateRightArm"]);
  553. recordModel.musleMassRightBottomRate = ELEightScaleStringFromValue(dataDic[@"muscleRateRightLeg"]);
  554. recordModel.musleMassLeftTopRate = ELEightScaleStringFromValue(dataDic[@"muscleRateLeftArm"]);
  555. recordModel.musleMassLeftBottomRate = ELEightScaleStringFromValue(dataDic[@"muscleRateLeftLeg"]);
  556. recordModel.musleMassBodyRate = ELEightScaleStringFromValue(dataDic[@"muscleRateTrunk"]);
  557. recordModel.mineralKg = ELEightScaleStringFromValue(dataDic[@"mineralKg"]);
  558. recordModel.waterKg = waterStr;
  559. recordModel.cellMassKg = ELEightScaleStringFromValue(dataDic[@"cellMassKg"]);
  560. recordModel.waterECWKg = ELEightScaleStringFromValue(dataDic[@"waterECWKg"]);
  561. recordModel.waterICWKg = ELEightScaleStringFromValue(dataDic[@"waterICWKg"]);
  562. recordModel.muscleKgCon = ELEightScaleStringFromValue(dataDic[@"muscleKgCon"]);
  563. recordModel.bodyFatKgCon = ELEightScaleStringFromValue(dataDic[@"bodyFatKgCon"]);
  564. recordModel.whr = ELEightScaleStringFromValue(dataDic[@"wHR"]);
  565. recordModel.bodyType = ELEightScaleStringFromValue(dataDic[@"bodyType"]);
  566. recordModel.obesity = ELEightScaleStringFromValue(dataDic[@"obesity"]);
  567. recordModel.bodyScore = ELEightScaleStringFromValue(dataDic[@"bodyScore"]);
  568. recordModel.dci = ELEightScaleStringFromValue(dataDic[@"dCI"]);
  569. recordModel.mineralKgStand = ELEightScaleStringFromValue(dataDic[@"mineralKgStand"]);
  570. recordModel.waterECWKgStand = ELEightScaleStringFromValue(dataDic[@"waterECWKgStand"]);
  571. recordModel.waterICWKgStand = ELEightScaleStringFromValue(dataDic[@"waterICWKgStand"]);
  572. recordModel.cellMassKgStand = ELEightScaleStringFromValue(dataDic[@"cellMassKgStand"]);
  573. recordModel.Z20KhzLeftArmDeCode = ELEightScaleStringFromValue(dataDic[@"z20KhzLeftArmDeCode"]);
  574. recordModel.Z20KhzRightArmDeCode = ELEightScaleStringFromValue(dataDic[@"z20KhzRightArmDeCode"]);
  575. recordModel.Z20KhzLeftLegDeCode = ELEightScaleStringFromValue(dataDic[@"z20KhzLeftLegDeCode"]);
  576. recordModel.Z20KhzRightLegDeCode = ELEightScaleStringFromValue(dataDic[@"z20KhzRightLegDeCode"]);
  577. recordModel.Z20KhzTrunkDeCode = ELEightScaleStringFromValue(dataDic[@"z20KhzTrunkDeCode"]);
  578. recordModel.Z100KhzLeftArmDeCode = ELEightScaleStringFromValue(dataDic[@"z100KhzLeftArmDeCode"]);
  579. recordModel.Z100KhzRightArmDeCode = ELEightScaleStringFromValue(dataDic[@"z100KhzRightArmDeCode"]);
  580. recordModel.Z100KhzLeftLegDeCode = ELEightScaleStringFromValue(dataDic[@"z100KhzLeftLegDeCode"]);
  581. recordModel.Z100KhzRightLegDeCode = ELEightScaleStringFromValue(dataDic[@"z100KhzRightLegDeCode"]);
  582. recordModel.Z100KhzTrunkDeCode = ELEightScaleStringFromValue(dataDic[@"z100KhzTrunkDeCode"]);
  583. return recordModel;
  584. }
  585. @end